git.delta.rocks / unique-network / refs/commits / 520f20e8866c

difftreelog

tests(util): generalize extractEvents

Fahrrader2022-10-14parent: #88cc507.patch.diff
in: master

1 file changed

modifiedtests/src/util/playgrounds/unique.tsdiffbeforeafterboth
282 return data.toHuman();282 return data.toHuman();
283 }283 }
284284
285 public static extractEvents(records: ITransactionResult): IEvent[] {285 public static extractEvents(events: {event: any, phase: any}[]): IEvent[] {
286 const parsedEvents: IEvent[] = [];286 const parsedEvents: IEvent[] = [];
287287
288 records.result.events.forEach((record) => {288 events.forEach((record) => {
289 const {event, phase} = record;289 const {event, phase} = record;
290 const types = (event as any).typeDef;290 const types = event.typeDef;
291291
292 const eventData: IEvent = {292 const eventData: IEvent = {
293 section: event.section.toString(),293 section: event.section.toString(),
505 let events: IEvent[] = [];505 let events: IEvent[] = [];
506 try {506 try {
507 result = await this.signTransaction(sender, this.constructApiCall(extrinsic, params), options, extrinsic) as ITransactionResult;507 result = await this.signTransaction(sender, this.constructApiCall(extrinsic, params), options, extrinsic) as ITransactionResult;
508 events = this.eventHelper.extractEvents(result);508 events = this.eventHelper.extractEvents(result.result.events);
509 }509 }
510 catch(e) {510 catch(e) {
511 if(!(e as object).hasOwnProperty('status')) throw e;511 if(!(e as object).hasOwnProperty('status')) throw e;