-
I am looking for a way to do: const func = "myFunction";
const args = [10, 20];
const data = myContract.interface.encodeFunctionData(func, args);
const [sameFunc, sameArgs] = somehow.decodeTheData(data); There is no transaction yet: just the data. I guess it basically would be like decoding an array of types that has the first 4 bytes identifying the function as the first item, plus the params that it takes. I have no idea if there is a direct way, or in case of doing it manually how to get back to the function name from the 4 bytes id. Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
You probably want: Let me know if that doesn’t work for you. :) |
Beta Was this translation helpful? Give feedback.
-
Yup! That's exactly the function that I was missing! |
Beta Was this translation helpful? Give feedback.
You probably want:
contract.interface.parseTransaction({ data })
.Let me know if that doesn’t work for you. :)