Skip to main content

Contract Interface NonFungibleToken


_10
pub 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


_10
pub 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

More...


Provider


_10
pub resource interface Provider {
_10
}

Interface to mediate withdraws from the Collection

More...


Receiver


_10
pub resource interface Receiver {
_10
}

Interface to mediate deposits to the Collection

More...


CollectionPublic


_10
pub resource interface CollectionPublic {
_10
}

Interface that an account would commonly publish for their collection

More...


Structs & Resources

NFT


_10
pub 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

More...


Collection


_10
pub resource Collection {
_10
_10
pub var ownedNFTs: {UInt64: NFT}
_10
}

Requirement for the concrete resource type to be declared in the implementing contract

More...


Functions

createEmptyCollection()


_10
fun 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


_10
pub event ContractInitialized()

Event that emitted when the NFT contract is initialized


Withdraw


_10
pub 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


_10
pub 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.