git.delta.rocks / unique-network / refs/commits / 46e50c0ee944

difftreelog

Fix playgrounds extracData method

Max Andreev2022-12-14parent: #c8f3a18.patch.diff
in: master

1 file changed

modifiedtests/src/util/playgrounds/unique.tsdiffbeforeafterboth
322 return obj;322 return obj;
323 }323 }
324
325 private static toHuman(data: any) {
326 return data && data.toHuman ? data.toHuman() : `${data}`;
327 }
324328
325 private static extractData(data: any, type: any): any {329 private static extractData(data: any, type: any): any {
326 if(!type) return data.toHuman();330 if(!type) return this.toHuman(data);
327 if (['u16', 'u32'].indexOf(type.type) > -1) return data.toNumber();331 if (['u16', 'u32'].indexOf(type.type) > -1) return data.toNumber();
328 if (['u64', 'u128', 'u256'].indexOf(type.type) > -1) return data.toBigInt();332 if (['u64', 'u128', 'u256'].indexOf(type.type) > -1) return data.toBigInt();
329 if(type.hasOwnProperty('sub')) return this.extractSub(data, type.sub);333 if(type.hasOwnProperty('sub')) return this.extractSub(data, type.sub);
330 return data.toHuman();334 return this.toHuman(data);
331 }335 }
332336
333 public static extractEvents(events: {event: any, phase: any}[]): IEvent[] {337 public static extractEvents(events: {event: any, phase: any}[]): IEvent[] {