[SOLVED] Using the cursor function

Could someone please help me to update this code, so that I can use the cursor function and return all the nft’s and their metadata in this contract?

Thank you so much!

const Moralis = require(“moralis”).default;
const { EvmChain } = require("@moralisweb3/common-evm-utils");

const runApp = async () => {
await Moralis.start({
apiKey: ‘YOUR_API_KEY’,
// …and any other configuration
});

const address = “0x86599B800E23036D761f43D7516092447295659f”;

const chain = EvmChain.ETHEREUM;

const response = await Moralis.EvmApi.nft.getContractNFTs({
address,
chain,
});

console.log(response.toJSON());
}

runApp();

You can look at this code:

const address = ‘0x186FFAb1C0f3e67041dCa656a32B2E89Eb2FD3d0’;
const chain = EvmChain.BSC_TESTNET;
const limit = 5;
let cursor = null;

do {
const response: any = await Moralis.EvmApi.transaction.getWalletTransactionsVerbose({
address,
chain,
limit,
cursor
});
console.log(response);

cursor = response.pagination.cursor;
console.log(cursor);

}
while (cursor != “” && cursor != null);

1 Like

Thanks so much for your assistance!