Explorer
Get NFT Collections
Learn how to retrieve NFT collections using the Okto SDK.
The getNFTCollections
function retrieves information about supported NFT collections.
Example
import { useOkto } from '@okto_web3/react-native-sdk';
import { getNFTCollections } from '@okto_web3/react-native-sdk';
import { View, Text, Pressable } from 'react-native';
function NFTCollections() {
const oktoClient = useOkto();
async function fetchCollections() {
try {
const collections = await getNFTCollections(oktoClient);
console.log('NFT collections:', collections);
} catch (error) {
console.error('Error fetching collections:', error);
}
}
return (
<View>
<Pressable onPress={fetchCollections}>
<Text>Fetch NFT Collections</Text>
</Pressable>
</View>
);
}
Note
This function is currently not supported for the following chains:
- Base Sepolia
- HyperEVM
Method Overview
Method | Description |
---|---|
async getNFTCollections | Get supported NFT collections |
Get NFT Collections
async getNFTCollections(oktoClient: OktoClient)
retrieves the list of supported NFT collections.
Parameters
Parameter | Type | Description |
---|---|---|
oktoClient | OktoClient | Instance of OktoClient obtained from useOkto hook |
Response
Success Response
Field Name | Type | Description |
---|---|---|
collections | Promise<NFTCollection[]> | Array of NFT collections |
Note
For error handling:
- Use the error code to debug issues. Check out the SDK errors and warnings documentation
- For help, navigate to the troubleshooting guide to contact support