0

I am trying to get transactions done by each wallet by using Etherscan API. However, I am getting Promise { <pending> }.

Can someone please tell how to solve this issue?

Here is my code:

const ethapi = require('etherscan-api').init(process.env.ETHAPI)



    async function getAddress(Address) {
        let tx = await ethapi.account.txlist(Address, 1, 'latest', 1,10, 'asc')
    
        return tx
    }
1

getTransactionFromAddress() works as intended, but you need to wait for the async function to resolve when you are logging the result. You can do this with:

getTransactionFromAddress('0x88a7EF2F047F8b07c6C917a6FD1A13438E9d8424').then((res) => {
  console.log(res);
  // do whatever you want with the response
})
2
  • Yes, it worked! Thank you so much! – Itsjonie Feb 24 at 2:51
  • Wait this not the right comment anymore? it is not working I am getting an errro with "." before then – Itsjonie May 9 at 9:53

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.