Module near_contract_standards::non_fungible_token[][src]

Expand description

Non-fungible tokens as described in by the spec.

Modules

The core non-fungible token standard. This can be though of as the base standard, with the others being extension standards.

Common implementation of the core non-fungible token standard. Trait for the NFT enumeration standard. This provides useful view-only methods returning token supply, tokens by owner, etc.

Metadata traits and implementation according to the NFT enumeration standard. This covers both the contract metadata and the individual token metadata.

Macros

Non-fungible token approval management allows for an escrow system where multiple approvals per token exist.

The core methods for a basic non-fungible token. Extension standards may be added in addition to this macro.

Non-fungible enumeration adds the extension standard offering several view-only methods to get token supply, tokens per owner, etc.

Structs

Implementation of the non-fungible token standard. Allows to include NEP-171 compatible token to any contract. There are next traits that any contract may implement: - NonFungibleTokenCore – interface with nft_transfer methods. NonFungibleToken provides methods for it. - NonFungibleTokenApproval – interface with nft_approve methods. NonFungibleToken provides methods for it. - NonFungibleTokenEnumeration – interface for getting lists of tokens. NonFungibleToken provides methods for it. - NonFungibleTokenMetadata – return metadata for the token in NEP-177, up to contract to implement.

In this implementation, the Token struct takes two extensions standards (metadata and approval) as optional fields, as they are frequently used in modern NFTs.

Functions

Type Definitions

Note that token IDs for NFTs are strings on NEAR. It’s still fine to use autoincrementing numbers as unique IDs if desired, but they should be stringified. This is to make IDs more future-proof as chain-agnostic conventions and standards arise, and allows for more flexibility with considerations like bridging NFTs across chains, etc.