From d5013b88105e248e0588d37eedf8f58cc9de2ba3 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 Date: Mon, 21 May 2018 14:11:08 -0400 Subject: [PATCH] Strip hex prefix for bytes inputs (#1811) --- common/libs/contracts/ABIFunction.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/libs/contracts/ABIFunction.ts b/common/libs/contracts/ABIFunction.ts index 54502edd..3240e652 100644 --- a/common/libs/contracts/ABIFunction.ts +++ b/common/libs/contracts/ABIFunction.ts @@ -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; };