diff --git a/specs/Standards/MultiToken/Enumeration.md b/specs/Standards/MultiToken/Enumeration.md index f9cb51329..032f882c8 100644 --- a/specs/Standards/MultiToken/Enumeration.md +++ b/specs/Standards/MultiToken/Enumeration.md @@ -1,4 +1,5 @@ -# Multi Token Enumeration +# Multi Token Enumeration([NEP-246](https://github.com/near/NEPs/discussions/246)) + Version `1.0.0` @@ -15,22 +16,15 @@ While some Multi Token contracts may forego this extension to save [storage] cos Prior art: - [ERC-721]'s enumeration extension -- [NEP-181]'s enumeration extension +- [Non Fungible Token Standard's](../NonFungibleToken/Enumeration.md) enumeration extension ## Interface The contract must implement the following view methods: -```ts // Metadata field is optional if metadata extension is implemented. Includes the base token metadata id and the token_metadata object, that represents the token specific metadata. -type MTToken { - id: string - metadata?: { - base_metadata_id: string - token_metadata: MTTokenMetadata - } -} +```ts // Get a list of all tokens // // Arguments: @@ -42,7 +36,7 @@ type MTToken { function mt_tokens( from_index: string|null, // default: "0" limit: number|null, // default: unlimited (could fail due to gas limit) -): MTToken[] {} +): Token[] {} // Get list of all tokens owned by a given account // @@ -57,7 +51,7 @@ function mt_tokens_for_owner( account_id: string, from_index: string|null, // default: 0 limit: number|null, // default: unlimited (could fail due to gas limit) -): MTToken[] {} +): Token[] {} ``` The contract must implement the following view methods if using metadata extension: diff --git a/specs/Standards/MultiToken/Metadata.md b/specs/Standards/MultiToken/Metadata.md index 98db20a21..55b6f8d2c 100644 --- a/specs/Standards/MultiToken/Metadata.md +++ b/specs/Standards/MultiToken/Metadata.md @@ -1,4 +1,5 @@ -# Multi Token Metadata +# Multi Token Metadata([NEP-246](https://github.com/near/NEPs/discussions/246)) + Version `1.0.0` @@ -80,8 +81,7 @@ A new attribute MUST be added to each `Token` struct: ```diff type Token = { id: string, - amount: string, -+ metadata: MTTokenMetadata, ++ token_metadata?: MTTokenMetadata, + base_metadata_id: string, } ``` @@ -126,7 +126,7 @@ For `MTAllTokenMetadata`: ### No incurred cost for core NFT behavior -Contracts should be implemented in a way to avoid extra gas fees for serialization & deserialization of metadata for calls to `mt_*` methods other than `mt_*metadata*` or `mt_token`. See `near-contract-standards` [implementation using `LazyOption`](https://github.com/near/near-sdk-rs/blob/c2771af7fdfe01a4e8414046752ee16fb0d29d39/examples/fungible-token/ft/src/lib.rs#L71) as a reference example. +Contracts should be implemented in a way to avoid extra gas fees for serialization & deserialization of metadata for calls to `mt_*` methods other than `mt_metadata*` or `mt_tokens`. See `near-contract-standards` [implementation using `LazyOption`](https://github.com/near/near-sdk-rs/blob/c2771af7fdfe01a4e8414046752ee16fb0d29d39/examples/fungible-token/ft/src/lib.rs#L71) as a reference example. ## Drawbacks