I am trying to decode the input field of this transaction as below,
const decodedInput = abiDecoder.decodeMethod(transaction.input);
but decodedInput returns undefined
despite the my ABI having the entry for swap (as below - taken from the contract's ABI in Etherscan)!
{
inputs: [
{
components: [
{
internalType: 'address',
name: 'tokenAddress',
type: 'address',
},
{
internalType: 'uint256',
name: 'amountIn',
type: 'uint256',
},
{
internalType: 'address',
name: 'receiver',
type: 'address',
},
{
internalType: 'bytes',
name: 'permit',
type: 'bytes',
},
],
internalType: 'struct OdosRouter.inputToken[]',
name: 'inputs',
type: 'tuple[]',
},
{
components: [
{
internalType: 'address',
name: 'tokenAddress',
type: 'address',
},
{
internalType: 'uint256',
name: 'relativeValue',
type: 'uint256',
},
{
internalType: 'address',
name: 'receiver',
type: 'address',
},
],
internalType: 'struct OdosRouter.outputToken[]',
name: 'outputs',
type: 'tuple[]',
},
{
internalType: 'uint256',
name: 'valueOutQuote',
type: 'uint256',
},
{
internalType: 'uint256',
name: 'valueOutMin',
type: 'uint256',
},
{
internalType: 'address',
name: 'executor',
type: 'address',
},
{
internalType: 'bytes',
name: 'pathDefinition',
type: 'bytes',
},
],
name: 'swap',
outputs: [
{
internalType: 'uint256[]',
name: 'amountsOut',
type: 'uint256[]',
},
{
internalType: 'uint256',
name: 'gasLeft',
type: 'uint256',
},
],
stateMutability: 'payable',
type: 'function',
}
I've check out related links, Abi-decoder returns undefined & myContract.getPastEvents returns undefined event, but they are quite different from my problem.
abi-decoder
hasn't been updated for several years. I'd suggest to look for alternatives like ethersjs or web3.js.