Unable to get a list of transaction from ethereum address

I tried pasting this code in JS console under Moralis Dashboard but it’s returning me an empty array. What am I doing wrong?

const userAddress = "0x9D387Ab7FF693c1c26c59c3a912678b58368e9e5".toLowerCase();
await Parse.Cloud.run("watchEthAddress", {address: userAddress});

const fromQuery = new Parse.Query('EthTransactions');
fromQuery.equalTo("from_address", userAddress);
const results = await fromQuery.find();

Hey @TheStars

  1. You need to use logger.info() instead of console.log():
const logger = Moralis.Cloud.getLogger();
  1. .find() in queries needs {useMasterKey:true}, but it depends in a class permissions. If it’s public you don’t have to use it.

Let me know how it will work for you :man_mechanic:

Thanks for your prompt response. I’m currently following this tutorial and pasting the same code in my JS Console but it doesn’t seem to be returning the data. Tried adding {useMasterKey: true} but it still returning me an empty array.

Edit: I’m able to get transactions from address 0x19f494583c7c933be7b0ee58104ddafac1e8adfa but I’m getting no transactions from a random address that I’m getting from etherscan. Not sure what’s wrong

Can you use return instead of logging it(just for test)? Also, you need to JSON.stringify objects to display them in the logger.

I tried. It doesn’t explain why I’m only able to view history of only 1 address and not random addresses taken from etherscan. This is the error I get when trying to view transaction history of new addresses

I found the issue. Turns out, it’s not an error with Moralis but rather the issue with the code. I shouldn’t have try to compare the “from_address” in the code. It’s returning all the transaction from my side now. Thanks for helping me out tho, appreciate it. @Yomoo

It sometimes happens that we are looking for a mistake in the wrong place :sweat_smile:

Great job @TheStars ! Keep up the awesome work :muscle: :man_mechanic:

Yup hahaha. I do realize that Moralis tutorial on youtube gets outdated really fast. I’m thinking of writing a tutorial for this to document my progress and journey in learning how to use Moralis and hopefully be able to help anyone who experience the same issue as me in the future :heartbeat:

1 Like

That would be awesome! Eagerly waiting for this ! :smiley:

1 Like