diff --git a/remix-lib/src/execution/txFormat.js b/remix-lib/src/execution/txFormat.js index 83883012a5..9796c02049 100644 --- a/remix-lib/src/execution/txFormat.js +++ b/remix-lib/src/execution/txFormat.js @@ -365,7 +365,8 @@ module.exports = { var outputTypes = [] for (i = 0; i < fnabi.outputs.length; i++) { - outputTypes.push(fnabi.outputs[i].type) + var type = fnabi.outputs[i].type + outputTypes.push(type === 'tuple' ? helper.makeFullTupleTypeDefinition(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 diff --git a/remix-lib/src/execution/txHelper.js b/remix-lib/src/execution/txHelper.js index 41478fabd9..5a93f66c9b 100644 --- a/remix-lib/src/execution/txHelper.js +++ b/remix-lib/src/execution/txHelper.js @@ -2,12 +2,21 @@ var ethers = require('ethers') module.exports = { + makeFullTupleTypeDefinition: function (typeDef) { + var innerTypes = [] + if (typeDef && typeDef.type === 'tuple' && typeDef.components) { + typeDef.components.map((innerType) => innerTypes.push(innerType.type)) + return 'tuple(' + innerTypes.join(',') + ')' + } + return typeDef.type + }, + encodeParams: function (funABI, args) { var types = [] if (funABI.inputs && funABI.inputs.length) { for (var i = 0; i < funABI.inputs.length; i++) { var type = funABI.inputs[i].type - types.push(type) + types.push(type === 'tuple' ? this.makeFullTupleTypeDefinition(funABI.inputs[i]) : type) if (args.length < types.length) { args.push('') } diff --git a/remix-lib/src/execution/txListener.js b/remix-lib/src/execution/txListener.js index 84c83ecc80..ede2cd7b0e 100644 --- a/remix-lib/src/execution/txListener.js +++ b/remix-lib/src/execution/txListener.js @@ -329,7 +329,8 @@ class TxListener { var inputTypes = [] for (var i = 0; i < abi.inputs.length; i++) { - inputTypes.push(abi.inputs[i].type) + var type = abi.inputs[i].type + inputTypes.push(type === 'tuple' ? txHelper.makeFullTupleTypeDefinition(abi.inputs[i]) : type) } var abiCoder = new ethers.utils.AbiCoder() var decoded = abiCoder.decode(inputTypes, data)