From where we can verify that transaction has took place with the help of hash on ethereum

Can anyone help me in this.

https://docs.moralis.io/moralis-dapp/web3-api/native#gettransaction-new maybe this?

Yes, this is helpful, but can we get multiple transactions in one table so we can verify other also.

If the transactions are synced to a table, you can use the confirmed property which will be true or false.

/* import moralis */

const Moralis = require(“moralis/node”);

/* Moralis init code */

const serverUrl = “…r”;

const appId = “…”;

const masterKey = “…”;

Moralis.start({ serverUrl, appId, masterKey });

const options = {

chain: "eth",

transaction_hash:

  "0x188232a3639f5a10ff097178519cb017f49bb3430fba10b29b21eb8e343b98f7",

};

const transaction = Moralis.Web3API.native.getTransaction(options);

what else is needed in this ?

TypeError: Cannot read properties of undefined (reading ‘page_size’)

this error I am getting

You need to add await or

await Moralis.Web3API.native.getTransaction(options);

Where are you trying to use page_size? That doesn’t exist with the getTransactions API.

1 Like

const Moralis = require(“moralis/node”);

const serverUrl = “…”;

const appId = “.”;

const masterKey = “…”;

Moralis.start({ serverUrl, appId, masterKey });

const tran = async () => {

const options = {

chain: "eth",

transaction_hash:

  "0x188232a3639f5a10ff097178519cb017f49bb3430fba10b29b21eb8e343b98f7",

};

const transaction = await Moralis.Web3API.native.getTransaction(options);

console.log(transaction);

}

tran();

after running this code I am getting;-
if (!result.page_size || !result.total || result.page === undefined) return options;
^

TypeError: Cannot read properties of undefined (reading ‘page_size’)

Ok the result code is from something else you’re doing, it’s not related to what you’re trying to do with getTransaction. You can remove or comment it out.

can you please elaborate what to do ?

You can just comment out the if (!result.page_size || !result.total || result.page === undefined) return options;. Why do you have this code in there? Where did you get it from?

You can post your whole file, and read this on how to post code.

It is auto generated when i did npm i moralis, this line code is in moralisweb3api.js node modules folder

I see, I thought this was from your own code. Also please keep to the one thread as this issue is related to using getTransaction with node.

What you can do as a workaround is make an HTTP request to the REST API instead to get the transaction info.

You can see how to use it here under GET /transaction/{transaction_hash}.

Also if you want to keep using the SDK, to get around this error, in the file node_modules\moralis\lib\node\MoralisWeb3Api.js

change

if (!result.page_size || !result.total || result.page === undefined) return options;

to

if (!result?.page_size || !result?.total || result?.page === undefined) return options;

Also your tx hash of 0x188232a3639f5a10ff097178519cb017f49bb3430fba10b29b21eb8e343b98f7 doesn’t seem to be valid for Ethereum. Here it is on Etherscan.

1 Like

Thanks for helping out