Explorer
Get Tokens
Learn how to retrieve supported tokens using the Okto SDK.
The getTokens
function fetches the list of supported tokens from the backend.
Example
import { useOkto } from '@okto_web3/react-native-sdk';
import { getTokens } from '@okto_web3/react-native-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 (
<Pressable onPress={fetchTokens}>
<Text>Fetch Supported Tokens</Text>
</Pressable>
);
}
Method Overview
Method | Description |
---|---|
async getTokens | Get list of supported tokens |
Get Tokens
async getTokens(oktoClient: OktoClient)
retrieves the list of supported tokens.
Parameters
Parameter | Type | Description |
---|---|---|
oktoClient | OktoClient | Instance of OktoClient obtained from useOkto hook |
Response
Success Response
Field Name | Type | Description |
---|---|---|
tokens | Promise<Token[]> | Array of supported tokens |
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