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
--- a/tests/src/eth/util/playgrounds/types.ts
+++ b/tests/src/eth/util/playgrounds/types.ts
@@ -1,3 +1,5 @@
+import {EthUniqueHelper} from './unique.dev';
+
 export interface ContractImports {
   solPath: string;
   fsPath: string;
@@ -13,3 +15,5 @@
   event: string,
   args: { [key: string]: string }
 };
+
+export type EthUniqueHelperConstructor = new (...args: any[]) => EthUniqueHelper;
modifiedtests/src/eth/util/playgrounds/unique.dev.tsdiffbeforeafterboth
--- a/tests/src/eth/util/playgrounds/unique.dev.ts
+++ b/tests/src/eth/util/playgrounds/unique.dev.ts
@@ -18,7 +18,7 @@
 
 import {DevUniqueHelper} from '../../../util/playgrounds/unique.dev';
 
-import {ContractImports, CompiledContract, NormalizedEvent} from './types';
+import {ContractImports, CompiledContract, NormalizedEvent, EthUniqueHelperConstructor} from './types';
 
 // Native contracts ABI
 import collectionHelpersAbi from '../../collectionHelpersAbi.json';
@@ -340,7 +340,6 @@
     return '0x' + address.substring(address.length - 40);
   }
 }
-
 export type EthUniqueHelperConstructor = new (...args: any[]) => EthUniqueHelper;
 
 export class EthUniqueHelper extends DevUniqueHelper {
modifiedtests/src/util/playgrounds/types.tsdiffbeforeafterboth
--- a/tests/src/util/playgrounds/types.ts
+++ b/tests/src/util/playgrounds/types.ts
@@ -2,6 +2,7 @@
 // SPDX-License-Identifier: Apache-2.0
 
 import {IKeyringPair} from '@polkadot/types/types';
+import {UniqueHelper} from './unique';
 
 export interface IEvent {
   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
--- a/tests/src/util/playgrounds/unique.ts
+++ b/tests/src/util/playgrounds/unique.ts
@@ -2439,6 +2439,10 @@
 }
 
 class SchedulerGroup extends HelperGroup<UniqueHelper> {
+  constructor(helper: UniqueHelper) {
+    super(helper);
+  }
+
   async cancelScheduled(signer: TSigner, scheduledId: string) {
     return this.helper.executeExtrinsic(
       signer,
@@ -2828,7 +2832,6 @@
       expectSuccess?: boolean,
     ): Promise<ITransactionResult> {
       const call = this.constructApiCall(extrinsic, params);
-
       return super.executeExtrinsic(
         sender,
         'api.tx.sudo.sudo',
@@ -2964,10 +2967,6 @@
 
   getSudo<T extends UniqueHelper>() {
     return new UniqueBaseCollection(this.collectionId, this.helper.getSudo<T>());
-  }
-
-  getSudo() {
-    return new UniqueCollectionBase(this.collectionId, this.helper.getSudo());
   }
 }