Skip to content

Commit

Permalink
Merge pull request #101 from Flowtyio/bug/borrow-nft
Browse files Browse the repository at this point in the history
fix borrowNFT method
  • Loading branch information
joshuahannan authored Aug 26, 2024
2 parents 1aa4297 + bca449a commit f22b358
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions contracts/NFTStorefrontV2.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -299,10 +299,12 @@ access(all) contract NFTStorefrontV2 {
/// it will return nil.
///
access(all) fun borrowNFT(): &{NonFungibleToken.NFT}? {
let ref = self.nftProviderCapability.borrow()!.borrowNFT(self.details.nftID)
if ref.isInstance(self.details.nftType) && ref?.id == self.details.nftID {
return ref as &{NonFungibleToken.NFT}?
}
if let ref = self.nftProviderCapability.borrow()!.borrowNFT(self.details.nftID) {
if ref.isInstance(self.details.nftType) && ref.id == self.details.nftID {
return ref
}
}

return nil
}

Expand Down

0 comments on commit f22b358

Please sign in to comment.