TransactionSEALED

╱╱~$░○○◇!█^■◇▒^%~█▒░□$▒●▓░■◇&▒@&▒!╱●$^╲●○□@○●╳◇╱%◇●◆▓▪▒@▫◇@?◇░╲%

Transaction ID

Timestamp

Jul 03, 2025, 05:53:45 AM UTC
8mo ago

Block Height

118,400,589

Computation

0

Execution Fee

0.00001874 FLOW

Transaction Summary

Contract Call

Called NonFungibleToken, ViewResolver, MetadataViews

Script Arguments

Copy:
0contractAddressAddress
1contractNameString
aiSportsMinter
2recipientAddress
3withdrawIDUInt64
3185

Cadence Script

1/// This transaction is for transferring an aiSports NFT from one account to another
2import NonFungibleToken from 0x1d7e57aa55817448
3import ViewResolver from 0x1d7e57aa55817448
4import MetadataViews from 0x1d7e57aa55817448
5
6transaction(contractAddress: Address, contractName: String, recipient: Address, withdrawID: UInt64) {
7
8    /// Reference to the withdrawer's collection
9    let withdrawRef: auth(NonFungibleToken.Withdraw) &{NonFungibleToken.Collection}
10
11    /// Reference of the collection to deposit the NFT to
12    let receiverRef: &{NonFungibleToken.Receiver}
13
14    prepare(signer: auth(BorrowValue) &Account) {
15
16        // borrow the NFT contract as ViewResolver reference
17        let viewResolver = getAccount(contractAddress).contracts.borrow<&{ViewResolver}>(name: contractName)
18            ?? panic("Could not borrow ViewResolver of given name from address")
19
20        // resolve the NFT collection data from the NFT contract
21        let collectionData = viewResolver.resolveContractView(resourceType: nil, viewType: Type<MetadataViews.NFTCollectionData>()) as! MetadataViews.NFTCollectionData?
22            ?? panic("ViewResolver does not resolve NFTCollectionData view")
23
24        // borrow a reference to the signer's NFT collection
25        self.withdrawRef = signer.storage.borrow<auth(NonFungibleToken.Withdraw) &{NonFungibleToken.Collection}>(
26                from: collectionData.storagePath
27            ) ?? panic("Account does not store an object at the specified path")
28
29
30        let recipient = getAccount(recipient)
31
32        /* the code below currently does not work (flow issue), change back after flow update
33
34        // get the recipients public account object & borrow a public reference to the receivers collection
35        let receiverCap = recipient.capabilities.get<&{NonFungibleToken.Receiver}>(collectionData.publicPath)
36        
37        self.receiverRef = receiverCap.borrow()
38            ?? panic("Could not borrow reference to the recipient's receiver") 
39        */
40
41        //the code below is being used as a workaround - replace once fix is created
42        let receiverCap = recipient.capabilities.get<&AnyResource>(collectionData.publicPath).borrow() as! &{NonFungibleToken.Receiver}?
43        self.receiverRef = receiverCap!
44
45    }
46
47    execute {
48
49        let nft <- self.withdrawRef.withdraw(withdrawID: withdrawID)
50        self.receiverRef.deposit(token: <-nft)
51
52    }
53
54    post {
55        !self.withdrawRef.getIDs().contains(withdrawID): "Original owner should not have the NFT anymore"
56    }
57}