1

Per the BigMapAbstraction Taquito API docs, there isn't a way to fetch all the values in that map.

Is the suggested way to fetch all of values in the map by doing batch queries on it then? Or what's the recommended way to fetch these values?

1

You have 2 solutions for this problem:

  • Use an indexer to get the values contained in the big map;
  • Use an off-chain view to paginate the values if they can be accessed sequentially

Off-chain example:

Code with tests: https://smartpy.io/ide?cid=QmNeBqAbS4yotpDpdv7SPb7G3a3aHZpEoeKyzHnGuMHtcT&k=cb7d23e3d4856e707cba

Explorer: https://tzcomet.io/#/explorer%3Fexplorer-input%3DKT18qKjbKKAex6ubRvWnqCYjzHFgAqwCiwxs

enter image description here enter image description here

Always use big_map over map when you will have many items. Otherwise, your contract will get gas locked easily.

0

The recommended way is to use an indexer API to fetch all the active key/value bindings in the big map. Querying the values one by one using their associated keys may be fine if you have a few entries but is going to be extremely slow when your big map starts to grow.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.