Use ethereumjs-abi for encoding the constructor

pull/1/head
Alex Beregszaszi 9 years ago
parent 0dc3efde05
commit 23821153c3
  1. 10
      src/universal-dapp.js

@ -291,8 +291,14 @@ UniversalDApp.prototype.getInstanceInterface = function (contract, address, $tar
$createInterface.append(this.getCallButton({
abi: funABI,
encode: function (args) {
var obj = web3contract.new;
return obj.getData.apply(obj, args);
var types = [];
for (var i = 0; i < funABI.inputs.length; i++) {
types.push(funABI.inputs[i].type);
}
// NOTE: the caller will concatenate the bytecode and this
// it could be done here too for consistency
return ethJSABI.rawEncode(types, args).toString('hex');
},
contractName: contract.name,
bytecode: contract.bytecode,

Loading…
Cancel
Save