|
|
|
@ -47,14 +47,19 @@ module.exports = { |
|
|
|
|
*/ |
|
|
|
|
buildData: function (contractName, contract, contracts, isConstructor, funAbi, params, udapp, callback, callbackStep) { |
|
|
|
|
var funArgs = '' |
|
|
|
|
var data = '' |
|
|
|
|
var dataHex = '' |
|
|
|
|
|
|
|
|
|
if (params.indexOf('0x') === 0) { |
|
|
|
|
dataHex = params.replace('0x', '') |
|
|
|
|
data = Buffer.from(dataHex, 'hex') |
|
|
|
|
} else { |
|
|
|
|
try { |
|
|
|
|
funArgs = $.parseJSON('[' + params + ']') |
|
|
|
|
} catch (e) { |
|
|
|
|
callback('Error encoding arguments: ' + e) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
var data = '' |
|
|
|
|
var dataHex = '' |
|
|
|
|
if (!isConstructor || funArgs.length > 0) { |
|
|
|
|
try { |
|
|
|
|
data = helper.encodeParams(funAbi, funArgs) |
|
|
|
@ -70,6 +75,7 @@ module.exports = { |
|
|
|
|
if (data.slice(0, 2) === '0x') { |
|
|
|
|
dataHex = data.slice(2) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
var contractBytecode |
|
|
|
|
if (isConstructor) { |
|
|
|
|
contractBytecode = contract.evm.bytecode.object |
|
|
|
|