Explorer

Get Portfolio NFTs

Learn how to retrieve a user's NFT holdings using the Okto SDK.

The getPortfolioNFT function retrieves all NFTs owned by the user across supported chains.

Example

import { useOkto } from '@okto_web3/react-native-sdk';
import { getPortfolioNFT } from '@okto_web3/react-native-sdk'; 
import { View, Text, Pressable } from 'react-native';
 
function NFTPortfolio() {
    const oktoClient = useOkto();
 
    async function fetchNFTs() {
        try {
            const nfts = await getPortfolioNFT(oktoClient); 
            console.log('NFT holdings:', nfts);
        } catch (error) {
            console.error('Error fetching NFTs:', error);
        }
    }
 
    return (
        <View>
            <Pressable onPress={fetchNFTs}>
                <Text>Fetch NFT Holdings</Text>
            </Pressable>
        </View>
    );
}


Note

This function is currently not supported for the following chains:

  • Base Sepolia
  • HyperEVM

Method Overview

MethodDescription
async getPortfolioNFTGet user's NFT holdings

Get Portfolio NFT

async getPortfolioNFT(oktoClient: OktoClient) retrieves the user's NFT portfolio data.

Parameters

ParameterTypeDescription
oktoClientOktoClientInstance of OktoClient obtained from useOkto hook

Response

Success Response

Field NameTypeDescription
nftsPromise<NFTData[]>Array of user's NFT holdings

Note

For error handling: