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)}
2 Likes

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