Merge pull request #1000 from eswarasai/master

Initial commit to allow hex encoded transaction param
pull/1/head
yann300 7 years ago committed by GitHub
commit 6c628a532c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  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.indexOf('0x') === 0) {
dataHex = params.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