Web3BB

    • Register
    • Login
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    web3js NFT get all token ids from address

    Web3JS
    1
    1
    1741
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • W
      web3master last edited by web3master

      Example of how to get all NFT tokens IDs owned by a specific wallet address.

      let toAddr = '0xAddress';
      let incomingTokenTransferEvents = await MyContract.getPastEvents('Transfer', { filter: {'to': toAddr}, fromBlock: 0, toBlock: 'latest'})
      incomingTokenTransferEvents.forEach( (event) => console.log(event.returnValues.tokenId));
      
      1 Reply Last reply Reply Quote 0
      • First post
        Last post