Consensys / abi-decoder

Nodejs and Javascript library for decoding data params and events from ethereum transactions
GNU General Public License v3.0
633 stars 218 forks source link

How to decode the contract function name and parameters from a Polygon transaction? #93

Open imkane opened 1 year ago

imkane commented 1 year ago

Using this transaction: https://polygonscan.com/tx/0x1b4165c1093936b74803666c75edd720fbd1713b5f77160e3a726299fb04078d

I thought I could simply decode the Input Data to figure out the function name and parameters, so I can call that function directly from Nodejs.

However, it's just returning undefined :thinking:

const inputData = "0x4ae301550000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b400000000000000000000000000000000000000000000000000000000000000034254430000000000000000000000000000000000000000000000000000000000";

const decodedData = abiDecoder.decodeMethod(inputData);
console.log(decodedData);

Am I using this package incorrectly? Is there any other way to figure out the contract function name and parameters for this transaction?