abiDecoder to get parameters


what’s the best way to get all the parameters of a tx by having only the abi of the contract and the tx.hash?
Can I use web3.eth.abi.decodeParameters? If yes how can I set it to work with any smartcontract?
Thanks for help

Hi @damland -

you can use web3.eth.abi.decodeParameters , but you need to get the transaction data first and strip off the function selector. You’ll definitely need to know which function is being called because you need to specify the type of each parameter - you should be able to calculate the function selectors from the ABI and use the inputs for the function to get the types to pass to decodeParameters.
You could also try using a library for this - I found this one, but it looks like there are a few other options that may help you decode parameters.