difftreelog
feat use mixins for sudo/scheduler helpers
in: master
5 files changed
tests/src/eth/util/playgrounds/types.tsdiffbeforeafterboth1import {EthUniqueHelper} from './unique.dev';21export interface ContractImports {3export interface ContractImports {2 solPath: string;4 solPath: string;14 args: { [key: string]: string }16 args: { [key: string]: string }15};17};1819export type EthUniqueHelperConstructor = new (...args: any[]) => EthUniqueHelper;1620tests/src/eth/util/playgrounds/unique.dev.tsdiffbeforeafterboth181819import {DevUniqueHelper} from '../../../util/playgrounds/unique.dev';19import {DevUniqueHelper} from '../../../util/playgrounds/unique.dev';202021import {ContractImports, CompiledContract, NormalizedEvent} from './types';21import {ContractImports, CompiledContract, NormalizedEvent, EthUniqueHelperConstructor} from './types';222223// Native contracts ABI23// Native contracts ABI24import collectionHelpersAbi from '../../collectionHelpersAbi.json';24import collectionHelpersAbi from '../../collectionHelpersAbi.json';tests/src/util/playgrounds/types.tsdiffbeforeafterboth2// SPDX-License-Identifier: Apache-2.02// SPDX-License-Identifier: Apache-2.0334import {IKeyringPair} from '@polkadot/types/types';4import {IKeyringPair} from '@polkadot/types/types';5import {UniqueHelper} from './unique';566export interface IEvent {7export interface IEvent {7 section: string;8 section: string;tests/src/util/playgrounds/unique.dev.tsdiffbeforeafterboth11import {ICrossAccountId} from './types';11import {ICrossAccountId} from './types';12import {FrameSystemEventRecord} from '@polkadot/types/lookup';12import {FrameSystemEventRecord} from '@polkadot/types/lookup';13import {VoidFn} from '@polkadot/api/types';13import {VoidFn} from '@polkadot/api/types';14import {FrameSystemEventRecord} from '@polkadot/types/lookup';141515export class SilentLogger {16export class SilentLogger {16 log(_msg: any, _level: any): void { }17 log(_msg: any, _level: any): void { }496497497 async startCapture() {498 async startCapture() {498 this.stopCapture();499 this.stopCapture();499 this.unsubscribe = await this.helper.getApi().query.system.events(eventRecords => {500 this.unsubscribe = (await this.helper.getApi().query.system.events((eventRecords: FrameSystemEventRecord[]) => {500 const newEvents = eventRecords.filter(r => {501 const newEvents = eventRecords.filter(r => {501 return r.event.section == this.eventSection && r.event.method == this.eventMethod;502 return r.event.section == this.eventSection && r.event.method == this.eventMethod;502 });503 });503504504 this.events.push(...newEvents);505 this.events.push(...newEvents);505 });506 })) as any;506 }507 }507508508 stopCapture() {509 stopCapture() {tests/src/util/playgrounds/unique.tsdiffbeforeafterboth2439}2439}244024402441class SchedulerGroup extends HelperGroup<UniqueHelper> {2441class SchedulerGroup extends HelperGroup<UniqueHelper> {2442 constructor(helper: UniqueHelper) {2443 super(helper);2444 }24452442 async cancelScheduled(signer: TSigner, scheduledId: string) {2446 async cancelScheduled(signer: TSigner, scheduledId: string) {2443 return this.helper.executeExtrinsic(2447 return this.helper.executeExtrinsic(2966 return new UniqueBaseCollection(this.collectionId, this.helper.getSudo<T>());2969 return new UniqueBaseCollection(this.collectionId, this.helper.getSudo<T>());2967 }2970 }29682969 getSudo() {2970 return new UniqueCollectionBase(this.collectionId, this.helper.getSudo());2971 }2972}2971}2973297229742973