git.delta.rocks / unique-network / refs/commits / 032022202689

difftreelog

feat use mixins for sudo/scheduler helpers

Daniel Shiposha2022-09-23parent: #f13330a.patch.diff
in: master

5 files changed

modifiedtests/src/eth/util/playgrounds/types.tsdiffbeforeafterboth
1import {EthUniqueHelper} from './unique.dev';
2
1export interface ContractImports {3export interface ContractImports {
2 solPath: string;4 solPath: string;
14 args: { [key: string]: string }16 args: { [key: string]: string }
15};17};
18
19export type EthUniqueHelperConstructor = new (...args: any[]) => EthUniqueHelper;
1620
modifiedtests/src/eth/util/playgrounds/unique.dev.tsdiffbeforeafterboth
1818
19import {DevUniqueHelper} from '../../../util/playgrounds/unique.dev';19import {DevUniqueHelper} from '../../../util/playgrounds/unique.dev';
2020
21import {ContractImports, CompiledContract, NormalizedEvent} from './types';21import {ContractImports, CompiledContract, NormalizedEvent, EthUniqueHelperConstructor} from './types';
2222
23// Native contracts ABI23// Native contracts ABI
24import collectionHelpersAbi from '../../collectionHelpersAbi.json';24import collectionHelpersAbi from '../../collectionHelpersAbi.json';
modifiedtests/src/util/playgrounds/types.tsdiffbeforeafterboth
2// SPDX-License-Identifier: Apache-2.02// SPDX-License-Identifier: Apache-2.0
33
4import {IKeyringPair} from '@polkadot/types/types';4import {IKeyringPair} from '@polkadot/types/types';
5import {UniqueHelper} from './unique';
56
6export interface IEvent {7export interface IEvent {
7 section: string;8 section: string;
modifiedtests/src/util/playgrounds/unique.dev.tsdiffbeforeafterboth
11import {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';
1415
15export class SilentLogger {16export class SilentLogger {
16 log(_msg: any, _level: any): void { }17 log(_msg: any, _level: any): void { }
496497
497 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 });
503504
504 this.events.push(...newEvents);505 this.events.push(...newEvents);
505 });506 })) as any;
506 }507 }
507508
508 stopCapture() {509 stopCapture() {
modifiedtests/src/util/playgrounds/unique.tsdiffbeforeafterboth
2439}2439}
24402440
2441class SchedulerGroup extends HelperGroup<UniqueHelper> {2441class SchedulerGroup extends HelperGroup<UniqueHelper> {
2442 constructor(helper: UniqueHelper) {
2443 super(helper);
2444 }
2445
2442 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 }
2968
2969 getSudo() {
2970 return new UniqueCollectionBase(this.collectionId, this.helper.getSudo());
2971 }
2972}2971}
29732972
29742973