Skip to main content

Collection NFT Length

Get the size of an account's AllDay collection.

Parameters:

  • address: The Flow Address of the account whose moment data needs to be read

Returns Int - An int representing the accounts NFT AllDay collection size.

import NonFungibleToken from 0xNONFUNGIBLETOKENADDRESS
import AllDay from 0xALLDAYADDRES

pub fun main(address: Address): Int {
let account = getAccount(address)

let collectionRef = account.getCapability(AllDay.CollectionPublicPath)
.borrow<&{NonFungibleToken.CollectionPublic}>()
?? panic("Could not borrow capability from public collection")

return collectionRef.getIDs().length
}