Given the transaction hash 0x7da7a1645278c94434bdc8f54eae8f8f6bf8d1a730d84af38ffcc05ded24492f

I would like to understand the input data better.

To do this, I attempted loading the ABI of the verified smart contract listed on Polygonscan here 0xf715beb51ec8f63317d66f491e37e7bb048fcc2d

This is obtained via the getABI endpoint provided.

I then use that ABI to decode the input data from the eth_getTransactionByHash endpoint, using abi-decoder.

Unfortunately, each attempt at decoding has returned undefined . I have tried different inputs and ABIs, but feel I might not be understanding this concept completely. Your thoughts would be greatly appreciated!


let resp = await axios.get(`https://api.polygonscan.com/api?module=proxy&action=eth_getTransactionByHash&txhash=${tx_hash}&apikey=${this.apiKey}`);

if (resp != null && resp.statusText == 'OK'){
    const contract_address = resp.data.result.to;
    let abi_res = await axios.get(`https://api.polygonscan.com/api?module=contract&action=getabi&address=${contract_address}&apikey=${this.apiKey}`);
   if (abi_res != null){
     if(abi_res.statusText == 'OK'){
        var abi = abi_res.data.result
        const abiArray = JSON.parse(abi);
        // console.log(abiDecoder.getABIs());
        // console.log(resp.data.result.input);
        const decodedMethod = abiDecoder.decodeMethod(resp.data.result.input);
      } else{console.log(abi.statusText)}

Link on PolygonScan

  • It seems to be an abi-decoder limitation with some ABIEncoderV2 types.
    – Ismael
    Jan 8, 2022 at 6:00

1 Answer 1


You can decode the transaction data of a transaction by using a library like Ethers.

First, get the ABI from PolygonScan:

const contract_address = "0xf715beb51ec8f63317d66f491e37e7bb048fcc2d";

const abi_res = await axios.get(

const abi = JSON.parse(abi_res.data.result);

Then fetch the transaction data. You could use the PolygonScan API here, but a more solid approach is using Ethers with a public RPC url.

const  provider  =  new  providers.JsonRpcProvider("https://polygon-rpc.com");

const transaction = await provider.getTransaction(

And then, using Ethers and the ABI, we can decode the data:

const inter = new utils.Interface(abi);

const decoded = inter.parseTransaction({
  data: transaction.data,
  value: 0,


In this case, it seems to be a matchOrders with 6 arguments.

  "args": [
  "name": "matchOrders",
  "signature": "matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes),bytes,bytes,(address,uint256)[],address)",
  "sighash": "0xbbbfa60c",
  "value": { "type": "BigNumber", "hex": "0x00" }

Check out the codesandbox.

You can use online tools for decoding transaction data like this, or this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.