diff --git a/CHANGELOG.md b/CHANGELOG.md index f27064558..853c11ac3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog ## [unreleased] +- fix(standards): Fix NFT impl macros to not import `HashMap` and `near_sdk::json_types::U128`. [PR 571](https://github.com/near/near-sdk-rs/pull/571). - Add drain iterator for `near_sdk::store::UnorderedMap`. [PR 613](https://github.com/near/near-sdk-rs/pull/613). - Will remove all values and iterate over owned values that were removed - Fix codegen for methods inside a `#[near_bindgen]` to allow using `mut self` which will generate the same code as `self` and will not persist state. [PR 616](https://github.com/near/near-sdk-rs/pull/616). diff --git a/examples/non-fungible-token/nft/src/lib.rs b/examples/non-fungible-token/nft/src/lib.rs index 527843351..c5892ac3d 100644 --- a/examples/non-fungible-token/nft/src/lib.rs +++ b/examples/non-fungible-token/nft/src/lib.rs @@ -115,6 +115,7 @@ impl NonFungibleTokenMetadataProvider for Contract { mod tests { use near_sdk::test_utils::{accounts, VMContextBuilder}; use near_sdk::testing_env; + use std::collections::HashMap; use super::*; diff --git a/examples/status-message-collections/src/lib.rs b/examples/status-message-collections/src/lib.rs index 8d4dd017d..91f6be5d2 100644 --- a/examples/status-message-collections/src/lib.rs +++ b/examples/status-message-collections/src/lib.rs @@ -44,7 +44,6 @@ mod tests { use super::*; use near_sdk::test_utils::VMContextBuilder; use near_sdk::{testing_env, VMContext}; - use std::convert::TryInto; fn get_context(is_view: bool) -> VMContext { VMContextBuilder::new() diff --git a/near-contract-standards/src/non_fungible_token/macros.rs b/near-contract-standards/src/non_fungible_token/macros.rs index 3227dfcf6..c6a37a794 100644 --- a/near-contract-standards/src/non_fungible_token/macros.rs +++ b/near-contract-standards/src/non_fungible_token/macros.rs @@ -3,7 +3,6 @@ #[macro_export] macro_rules! impl_non_fungible_token_core { ($contract: ident, $token: ident) => { - use std::collections::HashMap; use $crate::non_fungible_token::core::NonFungibleTokenCore; use $crate::non_fungible_token::core::NonFungibleTokenResolver; @@ -45,7 +44,7 @@ macro_rules! impl_non_fungible_token_core { previous_owner_id: AccountId, receiver_id: AccountId, token_id: TokenId, - approved_account_ids: Option>, + approved_account_ids: Option>, ) -> bool { self.$token.nft_resolve_transfer( previous_owner_id, @@ -104,27 +103,30 @@ macro_rules! impl_non_fungible_token_approval { #[macro_export] macro_rules! impl_non_fungible_token_enumeration { ($contract: ident, $token: ident) => { - use near_sdk::json_types::U128; use $crate::non_fungible_token::enumeration::NonFungibleTokenEnumeration; #[near_bindgen] impl NonFungibleTokenEnumeration for $contract { - fn nft_total_supply(&self) -> U128 { + fn nft_total_supply(&self) -> near_sdk::json_types::U128 { self.$token.nft_total_supply() } - fn nft_tokens(&self, from_index: Option, limit: Option) -> Vec { + fn nft_tokens( + &self, + from_index: Option, + limit: Option, + ) -> Vec { self.$token.nft_tokens(from_index, limit) } - fn nft_supply_for_owner(&self, account_id: AccountId) -> U128 { + fn nft_supply_for_owner(&self, account_id: AccountId) -> near_sdk::json_types::U128 { self.$token.nft_supply_for_owner(account_id) } fn nft_tokens_for_owner( &self, account_id: AccountId, - from_index: Option, + from_index: Option, limit: Option, ) -> Vec { self.$token.nft_tokens_for_owner(account_id, from_index, limit)