Skip to content

Commit

Permalink
nft_tokens return empty array if there are no tokens not error (#798)
Browse files Browse the repository at this point in the history
Co-authored-by: austinabell <[email protected]>
  • Loading branch information
kay404 and austinabell authored Apr 28, 2022
1 parent cbff5e7 commit a7e15f3
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## [Unreleased]

### Fixes
- near-contract-standards: `nft_tokens` in enumeration standard no longer panics when there are no tokens [PR 798](https://github.com/near/near-sdk-rs/pull/798)
- Optimized `nth` operation for `UnorderedMap` iterator and implemented `IntoIterator` for it. [PR 801](https://github.com/near/near-sdk-rs/pull/801)
- This optimizes the `skip` operation, which is common with pagination

Expand Down
Binary file modified examples/non-fungible-token/res/non_fungible_token.wasm
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ impl NonFungibleTokenEnumeration for NonFungibleToken {
// https://nomicon.io/Standards/NonFungibleToken/Enumeration.html#interface
let start_index: u128 = from_index.map(From::from).unwrap_or_default();
require!(
(self.owner_by_id.len() as u128) > start_index,
(self.owner_by_id.len() as u128) >= start_index,
"Out of bounds, please use a smaller from_index."
);
let limit = limit.map(|v| v as usize).unwrap_or(usize::MAX);
Expand Down

0 comments on commit a7e15f3

Please sign in to comment.