1

My job is to get all the method name from the token contract transactions from the beginning and to display the new transactions in realtime.

1) Get all events

For the moment I can display the "Transfer" events in realtime with:

const targetContract = new ethers.Contract(
    "0x30062EaBec018aC86430134E2c4Ff27e963Eda13",
    [
        "event Transfer(address indexed from, address indexed to, uint amount)",
    ],
    ACCOUNT
); 
targetContract.on("Transfer", (from, to, amount, event) => {
    console.log(event); 
});

Otherwise when I try to recover the logs with INFURA:

INFURA.getLogs("0x30062EaBec018aC86430134E2c4Ff27e963Eda13").then((data) => {     console.log(data); }); 

I don't understand what it shows me... It shows me a lot of information while there are not many events...

So for now I need to get all the events in realtime (and not just "Transfer") and to be able to get all the old ones. Like "Add Liquidity", "Max Tx" and other custom events

2) Get method name

I'm trying to decode method name from a TX.data but as I can see, with ethers.js or Infura it's not possible (or I missed something)

console.log(ethers.utils.defaultAbiCoder.decode(     
[ "address user", "address rootToken", "bytes depositData"  ],     
ethers.utils.hexDataSlice(data, 4) )); 

I tried this but I need to provide the corrects arguments...

So well... if I can't decode without arguments my other choice it's to know if it's possible to just get the method name.

Then I searched a transaction in a shitty coin and I found this: https://etherscan.io/tx/0x9056f12256f1194d84d5f192087d20cd7fa8284b537e0476096eda08fde3394d

But when I'm using etherscan.io/api I don't have anything about the data (and not the method name) https://api.etherscan.io/api?module=proxy&action=eth_getTransactionReceipt&txhash=0x9056f12256f1194d84d5f192087d20cd7fa8284b537e0476096eda08fde3394d&apikey=

In summary: I would just like to get the name of the methods and to be able to make a display like etherscan.io, like this:

enter image description here

Thank you!

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.