I found many tools to encode parameters online, but besides web3 and thus Etherscan, none of them supports tuples/struct. And my problem is I’m unable to find the correct syntax.

So obviously :

[['0xe750ad66de350f8110e305fb78ec6a9f594445e3', '0xe750ad66de350f8110e305fb78ec6a9f594445e3', 120000000000, 120000000000, 9609897722, 21141030548170097311423986196179119918205185312506968352714471828911136365707, 0x415565b0000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee00000000000000000000000000000000000000000000000009346106f8b94959000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000, 5263421676475549035, '0x0000000000000000000000000000000000000000', 0]]

isn’t the correct syntax. But then where’s my mistake ? The struct is declared here https://etherscan.io/address/0x5A66a1bE5de85e770d2A7AaC6d1d30e39D4f6609#code#F25#L30.

  • Look for the abi encoder Oct 26, 2021 at 20:09
  • @MadeInDreams problem is it takes the same syntax as Etherscan. Hence I stick back to problem 1 where I’m unable to find the syntax in order to get EtherScan to accept my tuple… Oct 26, 2021 at 20:27
  • So you want to encode a tuple to send it to Etherscan?? I mean you would get the data much faster by getting it on the chain not from etherscan. Oct 26, 2021 at 20:29
  • @MadeInDreams I need the hash of that struct ('0xe750ad66de350f8110e305fb78ec6a9f594445e3', '0xe750ad66de350f8110e305fb78ec6a9f594445e3', 120000000000, 120000000000, 9609897722, 21141030548170097311423986196179119918205185312506968352714471828911136365707, 0x415565b0000000000000000000000000eeeeeeeeeeeeee, 5263421676475549035, '0x0000000000000000000000000000000000000000', 0) which is the result returned by getMetaTransactionHash with the struct passed to it as parameters. Etherscan both encode and execute that view function. but I’m unable to find the syntax in order to get it recognized. Oct 26, 2021 at 20:33

2 Answers 2


The syntax for a single function looking for a tuple or custom data type like so:

struct animal {
  uint256 id;
  string name;

function doStuff(myCustomStruct animal) public{

Would look at such:

[1, "tiger"]

In etherscan.

To compare, when you go to confirm your transaction, you can compare the output of what you get from cast

cast abi-encode "doStuff((uint256,string))" "(1,tiger)"

Heres is what you can do.

With ethers you can encode a call like this.

const orderTuple = [
const signature = orderJson.signature     
const iface = new ethers.utils.Interface(JSON.stringify(FILL_ORDER_ABI));
 const sig = "fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes),uint256,bytes)";

const data = iface.encodeFunctionData(sig,[orderTuple,fillAmount,signature])

This is an example that encode a call ready to be sent.

You can probably use it as an example to encode your data call and see the output.

  • What libraries are you using to do this ? Oct 26, 2021 at 22:53
  • docs.ethers.io/v5 Oct 26, 2021 at 23:56
  • Yet another library where compilation through ɴᴘᴍ fails… Couldn’t just you find my typo mistake in my question ? Oct 27, 2021 at 0:26

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.