Skip to content

Commit

Permalink
use capabilities borrow
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuahannan committed Apr 15, 2024
1 parent a0d5ecc commit 39036ac
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
12 changes: 6 additions & 6 deletions lib/go/templates/internal/assets/assets.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions transactions/generic_transfer_with_address.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@ transaction(to: Address, id: UInt64, contractAddress: Address, contractName: Str
let recipient = getAccount(to)

// borrow a public reference to the receivers collection
let receiverCap = recipient.capabilities.get<&{NonFungibleToken.Receiver}>(self.collectionData.publicPath)
?? panic("Could not get the recipient's Receiver Capability")

let receiverRef = receiverCap.borrow()
let receiverRef = recipient.capabilities.borrow<&{NonFungibleToken.Receiver}>(self.collectionData.publicPath)
?? panic("Could not borrow reference to the recipient's receiver")

// Deposit the NFT to the receiver
Expand Down
5 changes: 1 addition & 4 deletions transactions/generic_transfer_with_paths.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@ transaction(to: Address, id: UInt64, senderPathIdentifier: String, receiverPathI
let recipient = getAccount(to)

// borrow a public reference to the receivers collection
let receiverCap = recipient.capabilities.get<&{NonFungibleToken.Receiver}>(publicPath)
?? panic("Could not get the recipient's Receiver Capability")

let receiverRef = receiverCap.borrow()
let receiverRef = recipient.capabilities.borrow<&{NonFungibleToken.Receiver}>(publicPath)
?? panic("Could not borrow reference to the recipient's receiver")

// Deposit the NFT to the receiver
Expand Down

0 comments on commit 39036ac

Please sign in to comment.