Explorer

Get Chains

Learn how to retrieve supported blockchain networks using the Okto SDK.

The getChains function retrieves a list of all blockchain networks supported by Okto. This includes information about each chain's configuration, network details, and supported features.

Example

import { useOkto } from '@okto_web3/react-native-sdk';
import { getChains } from '@okto_web3/react-native-sdk'; 
import { View, Text, Pressable } from 'react-native';
 
function ChainsList() {
    const oktoClient = useOkto();
 
    async function fetchChains() {
        try {
            const chains = await getChains(oktoClient); 
            console.log('Supported chains:', chains);
        } catch (error) {
            console.error('Error fetching chains:', error);
        }
    }
 
    return (
        <View>
            <Pressable onPress={fetchChains}>
                <Text>Fetch Supported Chains</Text>
            </Pressable>
        </View>
    );
}

Method Overview

MethodDescription
async getChainsGet all supported blockchain networks

Get Chains

async getChains(oktoClient: OktoClient) retrieves the list of all blockchain networks supported by Okto.

Parameters

ParameterTypeDescription
oktoClientOktoClientInstance of OktoClient obtained from useOkto hook

Response

Success Response

Field NameTypeDescription
chainsPromise<GetSupportedNetworksResponseData[]>Array of supported blockchain networks

Note

For error handling: