Skip to content

Instantly share code, notes, and snippets.

@polluterofminds
Created February 26, 2021 18:04
Show Gist options
  • Save polluterofminds/35f6b46abe8ad59237e491b280d30665 to your computer and use it in GitHub Desktop.
Save polluterofminds/35f6b46abe8ad59237e491b280d30665 to your computer and use it in GitHub Desktop.
PinataParty Minting Transaction
import PinataPartyContract from 0xf8d6e0586b0a20c7
transaction {
let receiverRef: &{PinataPartyContract.NFTReceiver}
let minterRef: &PinataPartyContract.NFTMinter
prepare(acct: AuthAccount) {
self.receiverRef = acct.getCapability<&{PinataPartyContract.NFTReceiver}>(/public/NFTReceiver)
.borrow()
?? panic("Could not borrow receiver reference")
self.minterRef = acct.borrow<&PinataPartyContract.NFTMinter>(from: /storage/NFTMinter)
?? panic("could not borrow minter reference")
}
execute {
let metadata : {String : String} = {
"name": "The Big Swing",
"swing_velocity": "29",
"swing_angle": "45",
"rating": "5",
"uri": "ipfs://QmRZdc3mAMXpv6Akz9Ekp1y4vDSjazTx2dCQRkxVy1yUj6"
}
let newNFT <- self.minterRef.mintNFT()
self.receiverRef.deposit(token: <-newNFT, metadata: metadata)
log("NFT Minted and deposited to Account 2's Collection")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment