Explorer

Get Tokens

Learn how to retrieve token information using the Okto SDK.

The getTokens function fetches the list of supported tokens from the backend.

Available on

Ethereum
Ethereum
Polygon
Polygon
Avalanche
Avalanche
Arbitrum
Arbitrum
BSC
BSC
Fantom
Fantom
Linea
Linea
Metis
Metis
Optimism
Optimism
Base
Base
Base Sepolia
Base Sepolia
HyperEVM Testnet
HyperEVM Testnet
Polygon Amoy
Polygon Amoy

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 { getTokens } from '@okto_web3/react-sdk'; 
 
function TokensList() {
    const oktoClient = useOkto();
 
    async function fetchTokens() {
        try {
            const tokens = await getTokens(oktoClient); 
            console.log('Supported tokens:', tokens);
        } catch (error) {
            console.error('Error fetching tokens:', error);
        }
    }
 
    return (
        <button onClick={fetchTokens}>
            Fetch Supported Tokens
        </button>
    );
}

Note

For error handling:

Method Overview

MethodDescription
async getTokensGet supported token information

Get Tokens

async getTokens(oktoClient: OktoClient) retrieves information about all supported tokens.

Parameters

ParameterTypeDescriptionRequired
oktoClientOktoClientInstance of OktoClient obtained from useOkto hookYes

Response

Success Response

Field NameTypeDescription
tokensPromise<Token[]>Array of supported tokens

On this page