Moralis.Web3.getTransactions() pagination

Hi all,
This is not an Technical issue, more like some support required.
I’m trying to paginate through transactions using web3.

Moralis.Web3.getTransactions({ chain: ‘bsc’, address: ‘address here’, pageNum: 1 }) .then(function (transactions) {

I’ve tried page, pageNum, offset but none of them are working and I keep getting only page 1.

Thanks in advance!

Hi,
We have a new version of Moralis SDK now that has a different syntax for where this function is found https://docs.moralis.io/moralis-server/web3-sdk/account#gettransactions
The new syntax: const transactions = await Moralis.Web3API.account.getTransactions(options);
You’ll also have to update Moralis server if is an older version.

Hi @cryptokid,

thank you for coming back at this! I’ve updated the server and adjusted the command as stated with Web3API.account.
However I still can’t iterate over pages? It’s also not mentioned in the document only:
chain
address
order
from_block
to_block

I’ve used an example address which has
{“result”:{“total”:280080,“page”:0,“page_size”:500,“result”:[…]}}

I was able to do this:

x = await Moralis.Web3API.account.getTransactions({chain: 'eth', 'address': '0x2170ed0880ac9a755fd29b2688956bd959f933f8', offset:'500'})
{total: 5879, page: 1, page_size: 500, result: Array(500)}
1 Like

there we go, I didn’t try offset this time as I found a pageNum setter in moralisweb3-demo’s GitHub :blush:
thanks it works now :slight_smile:

1 Like