TransactionSEALED
●&%╱▒▪╳╱◆╲█*▒▒?▒?▓╱▫□■@^▓◇@╱~█░○○@*?□╳█╳%■%◇╱▓&~░╱▫□&░$▪▓▫$^@▒$▪
Transaction ID
Execution Fee
0.00002224 FLOWTransaction Summary
Contract Call
Called NonFungibleToken, HybridCustody, ViewResolver +1 more
Script Arguments
Copy:
0contractAddressAddress
1contractNameString
Ordinal
2ownerAddress
3recipientAddress
4withdrawIDUInt64
1334
Cadence Script
1import NonFungibleToken from 0x1d7e57aa55817448
2// import HybridCustody from 0xd8a7e05a7ac670c0
3import ViewResolver from 0x1d7e57aa55817448
4import MetadataViews from 0x1d7e57aa55817448
5
6transaction(contractAddress: Address, contractName: String, owner: Address, recipient: Address, withdrawID: UInt64) {
7 // Reference to the withdrawer's collection
8 let withdrawRef: auth(NonFungibleToken.Withdraw) &{NonFungibleToken.Collection}
9
10 // Reference of the collection to deposit the NFT to
11 let receiverRef: &{NonFungibleToken.Receiver, ViewResolver.ResolverCollection}
12
13 prepare(signer: auth(BorrowValue) &Account) {
14 if owner != signer.address {
15 // // TODO: implement c1.0 txn for hybrid custody
16 // let nftCollectionProviderPrivatePath = PrivatePath(identifier: "OrdinalsCollectionProviderForFlowverseNFT")!
17 // let manager = signer.borrow<&HybridCustody.Manager>(from: HybridCustody.ManagerStoragePath)
18 // ?? panic("Missing or mis-typed HybridCustody Manager")
19 // let child = manager.borrowAccount(addr: owner) ?? panic("no child account with that address")
20 // let flowverseProviderCap = child.getCapability(path: nftCollectionProviderPrivatePath, type: Type<&{NonFungibleToken.Provider, NonFungibleToken.CollectionPublic}>())
21 // if flowverseProviderCap != nil && (flowverseProviderCap! as! Capability<&{NonFungibleToken.Provider, NonFungibleToken.CollectionPublic}>).borrow() != nil {
22 // let cap = flowverseProviderCap! as! Capability<&{NonFungibleToken.Provider, NonFungibleToken.CollectionPublic}>
23 // self.provider = cap.borrow()
24 // } else {
25 // panic("No provider capability found for child account")
26 // }
27 panic("Hybrid custody not implemented yet")
28 } else {
29 // borrow the NFT contract as ViewResolver reference
30 let viewResolver = getAccount(contractAddress).contracts.borrow<&{ViewResolver}>(name: contractName)
31 ?? panic("Could not borrow ViewResolver of given name from address")
32
33 // resolve the NFT collection data from the NFT contract
34 let collectionData = viewResolver.resolveContractView(resourceType: nil, viewType: Type<MetadataViews.NFTCollectionData>()) as! MetadataViews.NFTCollectionData?
35 ?? panic("ViewResolver does not resolve NFTCollectionData view")
36
37 // borrow a reference to the signer's NFT collection
38 self.withdrawRef = signer.storage.borrow<auth(NonFungibleToken.Withdraw) &{NonFungibleToken.Collection}>(
39 from: collectionData.storagePath
40 ) ?? panic("Account does not store an object at the specified path")
41
42 // get the recipients public account object
43 let recipient = getAccount(recipient)
44
45 // borrow a public reference to the receivers collection
46 // let receiverCap = recipient.capabilities.get<&{NonFungibleToken.Receiver, ViewResolver.ResolverCollection}>(collectionData.publicPath)
47 // ?? panic("Could not get the recipient's Receiver Capability")
48
49 // self.receiverRef = receiverCap.borrow()
50 // ?? panic("Could not borrow reference to the recipient's receiver")
51
52 self.receiverRef = recipient.capabilities.borrow<&{NonFungibleToken.Receiver, ViewResolver.ResolverCollection}>(collectionData.publicPath)
53 ?? panic("Could not borrow reference to the recipient's receiver")
54 }
55 }
56
57 execute {
58 let nft <- self.withdrawRef.withdraw(withdrawID: withdrawID)
59 self.receiverRef.deposit(token: <-nft)
60 }
61
62 post {
63 !self.withdrawRef.getIDs().contains(withdrawID): "Original owner should not have the NFT anymore"
64 self.receiverRef.getIDs().contains(withdrawID): "The receiver should now own the NFT"
65 }
66}