Collections
A collection refers to a personal set of officially licensed NBA highlight plays that have been purchased, traded, and owned as non-fungible tokens (NFTs) by a specific user. Each collection is unique and can include plays from different sets, editions, and subeditions.
Examples
📄️ Collection IDs
This is the script to get a list of all the moments’ ids an account owns. Just change the argument to getAccount to whatever account you want and as long as they have a published Collection receiver, you can see the moments they own.
📄️ Collection Metadata Field
This script gets the metadata associated with a moment in a collection by looking up its playID and then searching for that play’s metadata in the TopShot contract. It returns the value for the specified metadata field.
📄️ Collection Metadata
This script gets the metadata associated with a moment in a collection by looking up its playID and then searching for that play’s metadata in the TopShot contract.
📄️ Collection Moment PlayID
This script gets the playID associated with a moment in a collection by getting a reference to the moment and then looking up its playID.
📄️ Collection Moment SerialNum
This script gets the serial number of a moment by borrowing a reference to the moment and returning its serial number.
📄️ Collection Moment Series
This script gets the series associated with a moment in a collection by getting a reference to the moment and then looking up its series.
📄️ Collection Moment SetID
This script gets the setID associated with a moment in a collection by getting a reference to the moment and then looking up its setID.
📄️ Collection Moment SetName
This script gets the set name associated with a moment in a collection by getting a reference to the moment and then looking up its name.
📄️ Collection Moment isLocked
This script determines if a moment is locked
📄️ Collection SetPlays are Owned
This script checks whether for each SetID/PlayID combo, they own a moment matching that SetPlay.
📄️ ID in Collection
This script returns true if a moment with the specified ID exists in a user’s collection.
📄️ Locked NFTs length
This script determines how many NFTs are locked in the Top Shot Locking contract.