What's the best way to fetch FA2 (NFT) owners? #1246
|
Hi. |
Answered by
claudebarde
Dec 7, 2021
Replies: 1 comment
|
In general, FA2 contracts have a bigmap (sometimes called |
0 replies
Answer selected by
Dreitser
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In general, FA2 contracts have a bigmap (sometimes called
ledgerorbalances) whose keys are the users’ addresses together with a token id if that’s relevant to the use case.You can get the storage of the contract with
await contract.storage()and check if the user’s address is a key of the bigmap, for example,await storage.ledger.get(USER_ADDRESS). If there is no matching key, the promise returnsundefined, otherwise, it returns the associated value.