-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathmint.cdc
28 lines (21 loc) · 1.08 KB
/
mint.cdc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import TatumMultiNFT from 0x4f09d8d43e4967b7
transaction(recipient: Address, url: String, type: String) {
// local variable for storing the minter reference
let minter: &TatumMultiNFT.NFTMinter
prepare(signer: AuthAccount) {
// borrow a reference to the NFTMinter resource in storage
self.minter = signer.borrow<&TatumMultiNFT.NFTMinter>(from: TatumMultiNFT.MinterStoragePath)
?? panic("Could not borrow a reference to the NFT minter")
}
execute {
// get the public account object for the recipient
let recipientAccount = getAccount(recipient)
// borrow the recipient's public NFT collection reference
let receiver = recipientAccount
.getCapability(TatumMultiNFT.CollectionPublicPath)
.borrow<&{TatumMultiNFT.TatumMultiNftCollectionPublic}>()
?? panic("Could not get receiver reference to the NFT Collection")
// mint the NFT and deposit it to the recipient's collection
self.minter.mintNFT(recipient: receiver, type: type, url: url, address: recipient)
}
}