Skip to content

Commit e8ee7e6

Browse files
committed
add test script
1 parent e3dc73e commit e8ee7e6

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import NFTProviderAggregator from "NFTProviderAggregator"
2+
import NonFungibleToken from "NonFungibleToken"
3+
4+
// Tries to borrow an NFT by ID from the Aggregator resource stored in `address`.
5+
// Returns the NFT's Type identifier if found, nil otherwise.
6+
7+
access(all) fun main(address: Address, nftID: UInt64): &{NonFungibleToken.NFT}? {
8+
let account = getAuthAccount<auth(BorrowValue) &Account>(address)
9+
10+
let aggregator = account.storage.borrow<&NFTProviderAggregator.Aggregator>(
11+
from: NFTProviderAggregator.AggregatorStoragePath
12+
) ?? panic("Aggregator resource not found at ".concat(NFTProviderAggregator.AggregatorStoragePath.toString()))
13+
14+
let nft = aggregator.borrowNFT(id: nftID)
15+
return nft
16+
}

0 commit comments

Comments
 (0)