I have tried many ways to retrieve the nfts metadata staked in contract
using useNFTBalances function retrieves only users nfts metadata and not nfts stoked in contract.
I don’t know how to retrieve the data using getTokenIdMetadata, or using NFTTokenIds will be inefficient because I don’t want to run on all nfts but specific ones
so I will be happy to get a workaround to achieve it?
(a code will be much appreciated)
Can you give an example of what you need?
I would like to show the nft image + name of the stacked one in contract. (in kangaroos earning meverse)
now we can see I can bring the same data from user twice, but I want only to show the staked one from this specific user.
in the smart contract I am registering the nft tokenId per user
I don’t understand yet.
What api functions do you use now? What is the output now and what is the output that you would want to get.
I am using useNFTBalances the output is the cards shown on the image, by tokenId
I would like to right number of cards and the nfts metadata staked on the contract
how do you identify what is taken on the contract?
you may need to sync an event if there isn’t some other way to get that list from the smart contract
I don’t know what you mean by right number for cards
maybe this helps you:
for this case, I have staked 1 nft so I would like to see 1 card.
the function you gave me is to render all the nfts metadata.
I am looking for a function like useNFTBalances but for address like contract not only users
what happens when you stake an NFT? how can you identify that staked NFT?
is that NFT still in your wallet, or was transferred to the contract?
it is transferred to the contract
and I can identify it yes, I have its tokenId
maybe the smart contract has a function that can return the list of ids that an address added to stake
if you know the token id, you can call a function in the smart contract to get more info about it, you can list all the tokens/NFTs that the smart contract has
I wrote the smart contract, and yes I am retrieving the list of the stacked nfts from the smart contract.
I am retrieving an array containing the tokenId and the staked timestamp
now how can I continue?
you could retrieve more info from the smart contract, you can still modify it, like the address that did the stake for every token id
yes, I can retrieve it then what?
The you can call that function to get all the info that is needed
with what moralis function?
It will be lovely
I am on it 2 days already – too much for a function
it is still not clear for me what you need, maybe that helps
I am already using these functions
I only need the images of nfts staked on the contract
not sure what you mean by that
if you know the contract address and token id, then you can get the metadata with getTokenIdMetadata:
thank you, I will work with it
the function getTokenIdMetadata is working, however I don’t succeed to call it in a proper way.
can you guide me through the implementation ?
it is more a react guidance