I am currently writing tests for a contract and for one of those tests, I would like to get the number of entries in a bigmap
field of the contract's storage. I am using JavaScript with Taquito and Truffle for these tests.
1 Answer
This is not something you will be able to achieve with Taquito (at least not for now, that will change in the future) and you have to use an indexer API. I recommend Better Call Dev API, you can easily get the number of keys with a fetch call to api.better-call.dev/v1/bigmap/${network}/${big_map_id}/keys
(the big map ID should be available in Taquito by calling the toString
method on the big map abstraction object).