Last active
February 27, 2022 06:29
-
-
Save harry830622/c1b9355811b4a7c1ee74526a6a807a16 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
transaction { | |
prepare(acct: AuthAccount) { | |
// First, check to see if a moment collection already exists | |
if acct.borrow<&TopShot.Collection>(from: /storage/MomentCollection) == nil { | |
// create a new TopShot Collection | |
let collection <- TopShot.createEmptyCollection() as! @TopShot.Collection | |
// Put the new Collection in storage | |
acct.save(<-collection, to: /storage/MomentCollection) | |
// create a public capability for the collection | |
acct.link<&{TopShot.MomentCollectionPublic}>(/public/MomentCollection, target: /storage/MomentCollection) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment