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
To enable these chains for your application, please configure them in the Okto Dashboard.
Not available on
Example
import { useOkto } from '@okto_web3/react-sdk';
import { getNftCollections } from '@okto_web3/react-sdk';
function NFTCollectionsList() {
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 (
<button onClick={fetchCollections}>
Fetch NFT Collections
</button>
);
}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
Method Overview
| Method | Description |
|---|---|
async getNftCollections | Get NFT collections for the user |
Get NFT Collections
async getNftCollections(oktoClient: OktoClient) retrieves the list of NFT collections associated with the user.
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
oktoClient | OktoClient | Instance of OktoClient obtained from useOkto hook | Yes |
Response
Success Response
| Field Name | Type | Description |
|---|---|---|
collections | Promise<NFTCollection[]> | Array of NFT collections |