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

MethodDescription
async getNFTCollectionsGet supported NFT collections

Get NFT Collections

async getNFTCollections(oktoClient: OktoClient) retrieves the list of supported NFT collections.

Parameters

ParameterTypeDescription
oktoClientOktoClientInstance of OktoClient obtained from useOkto hook

Response

Success Response

Field NameTypeDescription
collectionsPromise<NFTCollection[]>Array of NFT collections

Note

For error handling: