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
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
--- 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
--- a/tests/src/util/playgrounds/unique.dev.ts
+++ b/tests/src/util/playgrounds/unique.dev.ts
@@ -11,6 +11,7 @@
 import {ICrossAccountId} from './types';
 import {FrameSystemEventRecord} from '@polkadot/types/lookup';
 import {VoidFn} from '@polkadot/api/types';
+import {FrameSystemEventRecord} from '@polkadot/types/lookup';
 
 export class SilentLogger {
   log(_msg: any, _level: any): void { }
@@ -496,13 +497,13 @@
 
   async startCapture() {
     this.stopCapture();
-    this.unsubscribe = await this.helper.getApi().query.system.events(eventRecords => {
+    this.unsubscribe = (await this.helper.getApi().query.system.events((eventRecords: FrameSystemEventRecord[]) => {
       const newEvents = eventRecords.filter(r => {
         return r.event.section == this.eventSection && r.event.method == this.eventMethod;
       });
 
       this.events.push(...newEvents);
-    });
+    })) as any;
   }
 
   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());
   }
 }