Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nft_tokens return empty array if there are no tokens not error #798

Merged
merged 4 commits into from
Apr 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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