Skip to content

Instantly share code, notes, and snippets.

@bjartek
Created December 8, 2023 22:42
Show Gist options
  • Save bjartek/6916b40ba4226bc931749b5facf82cd4 to your computer and use it in GitHub Desktop.
Save bjartek/6916b40ba4226bc931749b5facf82cd4 to your computer and use it in GitHub Desktop.
import "NonFungibleToken"
import "BasicNFT"
transaction(receiver:Address) {
let minter :&BasicNFT.Minter
let collection : &{NonFungibleToken.Receiver}
prepare(signer: auth(BorrowValue) &Account) {
self.minter = signer.storage.borrow<&Capability<&BasicNFT.Minter>>(
from: BasicNFT.minterPath
)?.borrow()! ?? panic("your minter priviledges has been revoked")
let cd = BasicNFT.getCollectionData()
self.collection = getAccount(receiver).capabilities.borrow<&{NonFungibleToken.Receiver}>(
cd.publicPath
) ?? panic("Could not get receiver reference to the NFT Collection")
}
execute {
self.minter.mintNFT(metadata: {"Foo": "Bar"}, receiver:self.collection)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment