Skip to main content
Version: Next

Resource 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

Implemented Interfaces:

  • Provider
  • Receiver
  • CollectionPublic

Functions

withdraw()


_10
fun withdraw(withdrawID: UInt64): NFT

Removes an NFT from the collection and moves it to the caller

Parameters:

  • withdrawID : The ID of the NFT that will be withdrawn

Returns: The resource containing the desired NFT


deposit()


_10
fun deposit(token: NFT)


getIDs()


_10
fun getIDs(): [UInt64]


borrowNFT()


_10
fun borrowNFT(id: UInt64): &NFT