Explorer

Get NFT Collections

Learn how to retrieve NFT collections using the Okto SDK.

The getNftCollections function retrieves NFT collection details for the authenticated user from the backend.

Available on

Ethereum
Ethereum
Polygon
Polygon
Solana
Solana
Aptos
Aptos
Avalanche
Avalanche
Arbitrum
Arbitrum
BSC
BSC
Fantom
Fantom
Linea
Linea
Metis
Metis
Optimism
Optimism
Base
Base
Polygon Amoy
Polygon Amoy

To enable these chains for your application, please configure them in the Okto Dashboard.

Not available on

Base Sepolia
Base Sepolia
HyperEVM Testnet
HyperEVM Testnet

Example

using System;
using System.Threading.Tasks;
using UnityEngine;
 
//This is an independent script which calls GetNftPotfolio() Api
namespace OktoSDK
{
    public class NFT : MonoBehaviour
    {
 
        public async Task<List<UserNFTBalance>> GetNftCollections(OktoClient oc)
        {
            try
            {
                var response = await BffClientRepository.GetPortfolioNft();
                return response;
            }
            catch (Exception error)
            {
                CustomLogger.Log(error.Message);
                throw new Exception(error.Message);
            }
        }
    }
}

Note

For error handling:

Method Overview

MethodDescription
async GetNftCollectionsGet NFT collections for the user

Get NFT Collections

async GetNftCollections(oktoClient: OktoClient) retrieves the list of NFT collections associated with the user.

Parameters

ParameterTypeDescriptionRequired
oktoClientOktoClientInstance of OktoClient obtained from OktoClient.csYes

Response

Success Response

Field NameTypeDescription
collectionsTask<List<NFTBalance>>List of NFT collections