Last active
February 27, 2022 06:29
-
-
Save harry830622/f2b36628b3e416a30c66ea90e499208d 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(metadata: {String: String}) { | |
// Local variable for the topshot Admin object | |
let adminRef: &TopShot.Admin | |
let currPlayID: UInt32 | |
prepare(acct: AuthAccount) { | |
// borrow a reference to the admin resource | |
self.currPlayID = TopShot.nextPlayID; | |
self.adminRef = acct.borrow<&TopShot.Admin>(from: /storage/TopShotAdmin) | |
?? panic("No admin resource in storage") | |
} | |
execute { | |
// Create a play with the specified metadata | |
self.adminRef.createPlay(metadata: metadata) | |
} | |
post { | |
TopShot.getPlayMetaData(playID: self.currPlayID) != nil: | |
"playID doesnt exist" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment