Skip to content

Instantly share code, notes, and snippets.

@harry830622
Last active February 27, 2022 06:29
Show Gist options
  • Save harry830622/f2b36628b3e416a30c66ea90e499208d to your computer and use it in GitHub Desktop.
Save harry830622/f2b36628b3e416a30c66ea90e499208d to your computer and use it in GitHub Desktop.
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