check if response exists

pull/1227/head
aniket-engg 4 years ago committed by Aniket
parent f0ca81d7f5
commit bf09e80270
  1. 4
      libs/remix-lib/src/execution/txFormat.ts

@ -357,14 +357,12 @@ export function decodeResponse (response, fnabi) {
if (fnabi.outputs && fnabi.outputs.length > 0) {
try {
let i
const outputTypes = []
for (i = 0; i < fnabi.outputs.length; i++) {
const type = fnabi.outputs[i].type
outputTypes.push(type.indexOf('tuple') === 0 ? makeFullTypeDefinition(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
if (!response || !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
const abiCoder = new ethers.utils.AbiCoder()
const decodedObj = abiCoder.decode(outputTypes, response)

Loading…
Cancel
Save