Contract Interface NonFungibleToken
_10pub contract interface NonFungibleToken {_10_10 pub var totalSupply: UInt64_10}
The main NFT contract interface. Other NFT contracts will import and implement this interface
Interfaces​
INFT
​
_10pub resource interface INFT {_10_10 pub let id: UInt64_10}
Interface that the NFTs have to conform to The metadata views methods are included here temporarily because enforcing the metadata interfaces in the standard would break many contracts in an upgrade. Those breaking changes are being saved for the stable cadence milestone
Provider
​
_10pub resource interface Provider {_10}
Interface to mediate withdraws from the Collection
Receiver
​
_10pub resource interface Receiver {_10}
Interface to mediate deposits to the Collection
CollectionPublic
​
_10pub resource interface CollectionPublic {_10}
Interface that an account would commonly publish for their collection
Structs & Resources​
NFT
​
_10pub resource NFT {_10_10 pub let id: UInt64_10}
Requirement that all conforming NFT smart contracts have to define a resource called NFT that conforms to INFT
Collection
​
_10pub resource Collection {_10_10 pub var ownedNFTs: {UInt64: NFT}_10}
Requirement for the concrete resource type to be declared in the implementing contract
Functions​
createEmptyCollection()
​
_10fun createEmptyCollection(): Collection
Creates an empty Collection and returns it to the caller so that they can own NFTs
Returns: A new Collection resource
Events​
ContractInitialized
​
_10pub event ContractInitialized()
Event that emitted when the NFT contract is initialized
Withdraw
​
_10pub event Withdraw(id: UInt64, from: Address?)
Event that is emitted when a token is withdrawn, indicating the owner of the collection that it was withdrawn from.
If the collection is not in an account's storage, from
will be nil
.
Deposit
​
_10pub event Deposit(id: UInt64, to: Address?)
Event that emitted when a token is deposited to a collection.
It indicates the owner of the collection that it was deposited to.