Strip hex prefix for bytes inputs (#1811)

This commit is contained in:
HenryNguyen5 2018-05-21 14:11:08 -04:00 committed by Daniel Ternyak
parent 5c01fb12c7
commit 352473ac9f
No known key found for this signature in database
GPG Key ID: DF212D2DC5D0E245

View File

@ -1,5 +1,5 @@
import abi from 'ethereumjs-abi'; import abi from 'ethereumjs-abi';
import { toChecksumAddress, addHexPrefix } from 'ethereumjs-util'; import { toChecksumAddress, addHexPrefix, stripHexPrefix } from 'ethereumjs-util';
import BN from 'bn.js'; import BN from 'bn.js';
import { import {
FuncParams, FuncParams,
@ -97,7 +97,7 @@ export default class AbiFunction {
private parsePreEncodedValue = (type: string, value: any) => { private parsePreEncodedValue = (type: string, value: any) => {
if (type === 'bytes') { if (type === 'bytes') {
return Buffer.from(value, 'hex'); return Buffer.from(stripHexPrefix(value), 'hex');
} }
return BN.isBN(value) ? value.toString() : value; return BN.isBN(value) ? value.toString() : value;
}; };