Skip to main content
Version: Next

Resource Collection

pub resource Collection {

pub var ownedNFTs: {UInt64: NFT}
}

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

Implemented Interfaces:

  • Provider
  • Receiver
  • CollectionPublic

Functions

withdraw()

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()

fun deposit(token: NFT)

getIDs()

fun getIDs(): [UInt64]

borrowNFT()

fun borrowNFT(id: UInt64): &NFT