From 516845542805038334d510a348cc607bfc5eb84f Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Tue, 26 Apr 2016 16:49:37 +0100 Subject: [PATCH] Use ethereumjs-abi for encoding requests --- src/universal-dapp.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/universal-dapp.js b/src/universal-dapp.js index f3104aa9b9..abe758379c 100644 --- a/src/universal-dapp.js +++ b/src/universal-dapp.js @@ -274,8 +274,12 @@ UniversalDApp.prototype.getInstanceInterface = function (contract, address, $tar $instance.append(self.getCallButton({ abi: funABI, encode: function (args) { - var obj = web3contract.at('0x00')[funABI.name]; - return obj.getData.apply(obj, args); + var types = []; + for (var i = 0; i < funABI.inputs.length; i++) { + types.push(funABI.inputs[i].type); + } + + return Buffer.concat([ ethJSABI.methodID(funABI.name, types), ethJSABI.rawEncode(types, args) ]).toString('hex'); }, address: address }));