ensure data is filled

pull/3094/head
yann300 7 years ago
parent 96d1e1c4dd
commit 04ddb14f1b
  1. 1
      remix-lib/src/execution/txFormat.js
  2. 4
      remix-lib/src/execution/txListener.js

@ -243,6 +243,7 @@ module.exports = {
outputTypes.push(fnabi.outputs[i].type)
}
if (!response.length) response = new Uint8Array(32 * fnabi.outputs.length) // ensuring the data is at least filled by 0 cause `AbiCoder` throws if there's not engouh data
// decode data
var abiCoder = new ethers.utils.AbiCoder()
var decodedObj = abiCoder.decode(outputTypes, response)

@ -325,12 +325,14 @@ class TxListener {
_decodeInputParams (data, abi) {
data = ethJSUtil.toBuffer('0x' + data)
if (!data.length) data = new Uint8Array(32 * abi.inputs.length) // ensuring the data is at least filled by 0 cause `AbiCoder` throws if there's not engouh data
var inputTypes = []
for (var i = 0; i < abi.inputs.length; i++) {
inputTypes.push(abi.inputs[i].type)
}
var abiCoder = new ethers.utils.AbiCoder()
var decoded = abiCoder.decode(inputTypes, data)
var decoded = abiCoder.decode(inputTypes, data)
var ret = {}
for (var k in abi.inputs) {
ret[abi.inputs[k].type + ' ' + abi.inputs[k].name] = decoded[k]

Loading…
Cancel
Save