I've come across a use-case to need to pass a struct into a Solidity function. I know this can be done via tuples. However, I need to sign and send this transaction from my
node.js back-end using Infura as a provider.
Currently, I use
encodeABI() from web3.js to encode the function call. However, in this case where it has a struct as a parameter using
encodeABI() doesn't properly do it, and I'm assuming it's because
encodeABI() only supports V1 of AbiEncoder.
Is there any functions in web3.js or ethers.js etc. that do what
encodeABI() does, but using the V2 of AbiEncoder?
I would just pass a flattened struct to get around this problem but I run into the infamous
stack to deep error, since the struct has 10 values, and I can't separate the function into many functions since the only code is forming the struct inside the function.
EDIT: I realized I could just pass the values in arrays to solve the flattening problem. However, I'm still curious on how to properly encode the data.
Thanks for any help or suggestions!