Skip to content

Commit

Permalink
fix example nft transfer
Browse files Browse the repository at this point in the history
  • Loading branch information
nialexsan committed Oct 3, 2024
1 parent 09bd5d9 commit 4fc6eb9
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions cadence/transactions/transfer_examplenft.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
import "ViewResolver"
import "MetadataViews"
import "NonFungibleToken"
import "ExampleNFT"

transaction(contractAddress: Address, contractName: String, recipient: Address, withdrawID: UInt64) {
transaction(recipient: Address, withdrawID: UInt64) {

/// Reference to the withdrawer's collection
let withdrawRef: auth(NonFungibleToken.Withdraw) &{NonFungibleToken.Collection}
Expand All @@ -15,11 +16,11 @@ transaction(contractAddress: Address, contractName: String, recipient: Address,
prepare(signer: auth(BorrowValue) &Account) {

// borrow the NFT contract as ViewResolver reference
let viewResolver = getAccount(contractAddress).contracts.borrow<&{ViewResolver}>(name: contractName)
?? panic("Could not borrow ViewResolver of given name from address")
// let viewResolver = getAccount(contractAddress).contracts.borrow<&{ViewResolver}>(name: contractName)
// ?? panic("Could not borrow ViewResolver of given name from address")
// resolve the NFT collection data from the NFT contract
let collectionData = viewResolver.resolveContractView(resourceType: nil, viewType: Type<MetadataViews.NFTCollectionData>()) as! MetadataViews.NFTCollectionData?
let collectionData = ExampleNFT.resolveContractView(resourceType: nil, viewType: Type<MetadataViews.NFTCollectionData>()) as! MetadataViews.NFTCollectionData?
?? panic("ViewResolver does not resolve NFTCollectionData view")

// borrow a reference to the signer's NFT collection
Expand Down

0 comments on commit 4fc6eb9

Please sign in to comment.