Previous owned NFTs by a wallet address

Hi @here I am just going to integrate the moralis SDK within my nft-marketplace All I need to confirm that ia there any APIs exist or any mechanism which support the previous NFTs owned by a specific wallet address (User) by Moralis.
My use-cases are:

  1. I want to get all of the NFTs which are currently owned by a wallet address.
  2. I want to get all of the NFTs which are previously owned by a wallet address.
    I need a help for this by the moralis community.

Thanks in advance.

Hey man docs are your freind:

  1. getNFTS will do the trick

Get all NFTs from the current user or address. Supports both ERC721 and ERC1155. Returns an object with the number of NFT objects and the array of NFT objects (asynchronous).

const userEthNFTs = await Moralis.Web3API.account.getNFTs();

Get the NFT transfers. Returns an object with the number of NFT transfers and the array of NFT transfers (asynchronous).

const options = { chain: "bsc", address: "0x...", limit: "10" };
const transfersNFT = await Moralis.Web3API.account.getNFTTransfers(options);

pass in the current user adress and from there you can do a filter on the received object everything with a from_adress as the current user was an nft they previously owned

I hope this helps


Thats good. One more thing do I really need to syncup with the moralis databse and how I can do this. As you above mentioned the APIs I need to configure them on my backend. Also

  1. Is those APIs will also return the price for which NFT sold ?

If yes I think there would be a need to create a database table on moralis so that after this I can sync up those transactions to my product database.

The price of the nft will not be returned from what I know. You can also use the api directly if you want from your server.