I am trying to pull normal transactions done by a wallet by using etherscan API.

However, I am getting Promise { <pending> }.

Can someone please tell how to solve this?

Here is my code:

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

async function getTransactionFromAddress(contractAddress) {
    let txlist = await ethapi.account.txlist(contractAddress, 1, 'latest', 1,10, 'asc')

    return txlist


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) => {
  // do whatever you want with the response
  • Yes, it worked! Thank you so much! – Itsjonie Feb 24 at 2:51

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.