From 4fc6eb9e811a00cc0a1acdbf6e2114a3964e5efc Mon Sep 17 00:00:00 2001 From: Alex Ni <12097569+nialexsan@users.noreply.github.com> Date: Thu, 3 Oct 2024 11:09:15 -0400 Subject: [PATCH] fix example nft transfer --- cadence/transactions/transfer_examplenft.cdc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cadence/transactions/transfer_examplenft.cdc b/cadence/transactions/transfer_examplenft.cdc index 2588cad..abf7d80 100644 --- a/cadence/transactions/transfer_examplenft.cdc +++ b/cadence/transactions/transfer_examplenft.cdc @@ -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} @@ -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()) as! MetadataViews.NFTCollectionData? + let collectionData = ExampleNFT.resolveContractView(resourceType: nil, viewType: Type()) as! MetadataViews.NFTCollectionData? ?? panic("ViewResolver does not resolve NFTCollectionData view") // borrow a reference to the signer's NFT collection