What's the best way to fetch FA2 (NFT) owners? #1246
-
|
Hi. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
In general, FA2 contracts have a bigmap (sometimes called |
Beta Was this translation helpful? Give feedback.
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.