difftreelog
tests(util): generalize extractEvents
in: master
1 file changed
tests/src/util/playgrounds/unique.tsdiffbeforeafterboth282 return data.toHuman();282 return data.toHuman();283 }283 }284284285 public static extractEvents(records: ITransactionResult): IEvent[] {285 public static extractEvents(events: {event: any, phase: any}[]): IEvent[] {286 const parsedEvents: IEvent[] = [];286 const parsedEvents: IEvent[] = [];287287288 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;291291292 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;