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 54f3adb86e
commit d5013b8810

View File

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