Skip to content

Commit

Permalink
Debug tx
Browse files Browse the repository at this point in the history
  • Loading branch information
lealobanov committed Dec 11, 2024
1 parent a66e64e commit def0ba0
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions cadence/transactions/mint_nft.cdc
Original file line number Diff line number Diff line change
@@ -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.")
}
}

0 comments on commit def0ba0

Please sign in to comment.