diff --git a/cadence/transactions/mint_nft.cdc b/cadence/transactions/mint_nft.cdc index b945169..bbf487e 100644 --- a/cadence/transactions/mint_nft.cdc +++ b/cadence/transactions/mint_nft.cdc @@ -1,31 +1,35 @@ import "NonFungibleToken" import "Recipe" +import "ExampleNFT" transaction { - let minter: &Recipe + let minter: &ExampleNFT.NFTMinter let receiver: &{NonFungibleToken.CollectionPublic} prepare(signer: auth(Storage, Capabilities) &Account) { - // Borrow the Recipe contract as a reference - self.minter = signer.capabilities.storage.borrow<&Recipe>( + // Borrow the ExampleNFT.NFTMinter reference + self.minter = signer.storage.borrow<&ExampleNFT.NFTMinter>( from: Recipe.ExampleNFTMinterPath - ) ?? panic("Could not borrow a reference to the Recipe contract") + ) ?? panic("Could not borrow a reference to the ExampleNFT NFTMinter") // Borrow the signer's NFT collection reference - self.receiver = signer.capabilities.storage.borrow<&{NonFungibleToken.CollectionPublic}>( - from: Recipe.CollectionPublicPath + self.receiver = signer.storage.borrow<&{NonFungibleToken.CollectionPublic}>( + from: /storage/exampleNFTCollection ) ?? panic("Could not borrow a reference to the signer's NFT collection") } execute { - // Call mintNFT from the Recipe contract - self.minter.mintNFT( - recipient: self.receiver, + // Call the mintNFT function from the ExampleNFT.NFTMinter + let newNFT <- self.minter.mintNFT( name: "Hardcoded NFT Name", description: "This is a hardcoded description of the NFT.", - thumbnail: "https://example.com/hardcoded-thumbnail.png" + thumbnail: "https://example.com/hardcoded-thumbnail.png", + royalties: [] ) + // Deposit the minted NFT into the recipient's collection + self.receiver.deposit(token: <-newNFT) + log("Minted and deposited an NFT into the signer's collection.") } } \ No newline at end of file