Initial commit to allow hex encoded transaction param

pull/1/head
Eswara Sai 7 years ago
parent 247bac875e
commit 4730ca995f
  1. 10
      src/app/execution/txFormat.js

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

Loading…
Cancel
Save