git.delta.rocks / unique-network / refs/commits / f7b374443f5e

difftreelog

Fix playgrounds extracData method

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

1 file changed

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