@@ -360,7 +360,7 @@ transaction(
360
360
withdrawID: UInt64 // ID of the NFT to withdraw
361
361
) {
362
362
363
- let providerRef: &{NonFungibleToken.Provider}
363
+ let providerRef: auth(NonFungibleToken.Withdraw) &{NonFungibleToken.Provider}
364
364
365
365
prepare(signer: auth(BorrowValue) &Account) {
366
366
// Get a reference to the signer's HybridCustody.Manager from storage
@@ -377,7 +377,7 @@ transaction(
377
377
let controllerID = account.getControllerIDForType(
378
378
type: collectionType,
379
379
forPath: storagePath
380
- ) ?? panic("Could not find Capability controller ID for collection type ".concat(type .identifier)
380
+ ) ?? panic("Could not find Capability controller ID for collection type ".concat(collectionType .identifier)
381
381
.concat(" at path ").concat(storagePath.toString()))
382
382
383
383
// Get a reference to the child NFT Provider and assign to the transaction scope variable
@@ -388,7 +388,8 @@ transaction(
388
388
389
389
// We'll need to cast the Capability - this is possible thanks to CapabilityFactory, though we'll rely on the relevant
390
390
// Factory having been configured for this Type or it won't be castable
391
- self.providerRef = cap as! Capability<auth(NonFungibleToken.Withdraw) &{NonFungibleToken.Provider}>
391
+ let providerCap = cap as! Capability<auth(NonFungibleToken.Withdraw) &{NonFungibleToken.Provider}>
392
+ self.providerRef = providerCap.borrow() ?? panic("Provider capability is invalid - cannot borrow reference")
392
393
}
393
394
394
395
execute {
@@ -400,6 +401,9 @@ transaction(
400
401
// ...
401
402
}
402
403
}
404
+
405
+
406
+
403
407
```
404
408
405
409
At the end of this transaction, you withdrew an NFT from the specified account using an NFT ` Provider ` Capability. A
0 commit comments