Pass raw data for contract event decoding (#2851)

This commit is contained in:
Jaco Greeff
2020-11-14 16:42:47 +01:00
committed by GitHub
parent 7afc696da3
commit 82873c44f8
+2 -1
View File
@@ -12,6 +12,7 @@ import BN from 'bn.js';
import { map } from 'rxjs/operators';
import { SubmittableResult } from '@polkadot/api';
import { ApiBase } from '@polkadot/api/base';
import { Bytes } from '@polkadot/types';
import { assert, bnToBn, isFunction, isUndefined, logger, stringCamelCase } from '@polkadot/util';
import { Abi } from '../Abi';
@@ -119,7 +120,7 @@ export class Contract<ApiType extends ApiTypes> extends Base<ApiType> {
records
.map(({ event: { data: [, data] } }): DecodedEvent | null => {
try {
return this.abi.decodeEvent(data.toU8a());
return this.abi.decodeEvent(data as Bytes);
} catch (error) {
l.error(`Unable to decode contract event: ${(error as Error).message}`);