git.delta.rocks / unique-network / refs/commits / 0e54e4ffee5d

difftreelog

feat add create account to moonbeam helper

Daniel Shiposha2022-10-11parent: #f5e3860.patch.diff
in: master

1 file changed

modifiedtests/src/util/playgrounds/unique.dev.tsdiffbeforeafterboth
8import {IKeyringPair} from '@polkadot/types/types';8import {IKeyringPair} from '@polkadot/types/types';
9import {EventRecord} from '@polkadot/types/interfaces';9import {EventRecord} from '@polkadot/types/interfaces';
10import {ICrossAccountId} from './types';10import {ICrossAccountId} from './types';
11import {FrameSystemEventRecord} from '@polkadot/types/lookup';
1112
12export class SilentLogger {13export class SilentLogger {
13 log(_msg: any, _level: any): void { }14 log(_msg: any, _level: any): void { }
289class MoonbeamAccountGroup {290class MoonbeamAccountGroup {
290 helper: MoonbeamHelper;291 helper: MoonbeamHelper;
291292
293 keyring: Keyring;
292 _alithAccount: IKeyringPair;294 _alithAccount: IKeyringPair;
293 _baltatharAccount: IKeyringPair;295 _baltatharAccount: IKeyringPair;
294 _dorothyAccount: IKeyringPair;296 _dorothyAccount: IKeyringPair;
295297
296 constructor(helper: MoonbeamHelper) {298 constructor(helper: MoonbeamHelper) {
297 this.helper = helper;299 this.helper = helper;
298300
299 const keyring = new Keyring({type: 'ethereum'});301 this.keyring = new Keyring({type: 'ethereum'});
300 const alithPrivateKey = '0x5fb92d6e98884f76de468fa3f6278f8807c48bebc13595d45af5bdc4da702133';302 const alithPrivateKey = '0x5fb92d6e98884f76de468fa3f6278f8807c48bebc13595d45af5bdc4da702133';
301 const baltatharPrivateKey = '0x8075991ce870b93a8870eca0c0f91913d12f47948ca0fd25b49c6fa7cdbeee8b';303 const baltatharPrivateKey = '0x8075991ce870b93a8870eca0c0f91913d12f47948ca0fd25b49c6fa7cdbeee8b';
302 const dorothyPrivateKey = '0x39539ab1876910bbf3a223d84a29e28f1cb4e2e456503e7e91ed39b2e7223d68';304 const dorothyPrivateKey = '0x39539ab1876910bbf3a223d84a29e28f1cb4e2e456503e7e91ed39b2e7223d68';
303305
304 this._alithAccount = keyring.addFromUri(alithPrivateKey, undefined, 'ethereum');306 this._alithAccount = this.keyring.addFromUri(alithPrivateKey, undefined, 'ethereum');
305 this._baltatharAccount = keyring.addFromUri(baltatharPrivateKey, undefined, 'ethereum');307 this._baltatharAccount = this.keyring.addFromUri(baltatharPrivateKey, undefined, 'ethereum');
306 this._dorothyAccount = keyring.addFromUri(dorothyPrivateKey, undefined, 'ethereum');308 this._dorothyAccount = this.keyring.addFromUri(dorothyPrivateKey, undefined, 'ethereum');
307 }309 }
308310
309 alithAccount() {311 alithAccount() {
318 return this._dorothyAccount;320 return this._dorothyAccount;
319 }321 }
322
323 create() {
324 return this.keyring.addFromUri(mnemonicGenerate());
325 }
320}326}
321327
322class WaitGroup {328class WaitGroup {
383 console.log(`[Block #${blockNumber}] Waiting for event \`${eventIdStr}\` (${waitLimitStr})`);389 console.log(`[Block #${blockNumber}] Waiting for event \`${eventIdStr}\` (${waitLimitStr})`);
384 390
385 const apiAt = await this.helper.getApi().at(blockHash);391 const apiAt = await this.helper.getApi().at(blockHash);
386 const eventRecords = await apiAt.query.system.events();392 const eventRecords = (await apiAt.query.system.events()) as any;
387 393
388 const neededEvent = eventRecords.find(r => {394 const neededEvent = eventRecords.toArray().find((r: FrameSystemEventRecord) => {
389 return r.event.section == eventSection && r.event.method == eventMethod;395 return r.event.section == eventSection && r.event.method == eventMethod;
390 });396 });
391 397