Documentation Index
Fetch the complete documentation index at: https://developers.paxoslabs.com/llms.txt
Use this file to discover all available pages before exploring further.
Retrieves the list of tokens supported for deposits into a specific yield strategy.
Import
import { fetchSupportedAssets } from "@paxoslabs/amplify-sdk";
Usage
const assets = await fetchSupportedAssets({
yieldType: YieldType.CORE,
chainId: 1, // optional, defaults to mainnet
});
Parameters
| Parameter | Type | Required | Description |
|---|
yieldType | YieldType | Yes | Yield strategy type (CORE, TREASURY, or FRONTIER) |
chainId | number | No | Blockchain network ID (defaults to 1 for mainnet) |
interface FetchSupportedAssetsParams {
/** Yield strategy type */
yieldType: YieldType;
/** Blockchain network ID (optional, defaults to mainnet) */
chainId?: number;
}
Return Type
Type Definition
Example Response
interface SupportedAsset {
/** Token contract address */
address: `0x${string}`;
/** Token symbol (e.g., "USDC") */
symbol: string;
/** Token decimals (e.g., 6 for USDC) */
decimals: number;
/** Whether token supports EIP-2612 permit */
supportsPermit: boolean;
}
type FetchSupportedAssetsResult = SupportedAsset[];
[
{
address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
symbol: "USDC",
decimals: 6,
supportsPermit: true,
},
{
address: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
symbol: "USDT",
decimals: 6,
supportsPermit: false,
},
]
Examples
Basic
With React Query
Asset Selector
import { fetchSupportedAssets, YieldType } from "@paxoslabs/amplify-sdk";
// Fetch assets for Core yield strategy
const coreAssets = await fetchSupportedAssets({
yieldType: YieldType.CORE,
});
console.log(`Found ${coreAssets.length} supported assets`);
coreAssets.forEach(asset => {
console.log(`${asset.symbol}: ${asset.address}`);
});
import { useQuery } from "@tanstack/react-query";
import { fetchSupportedAssets, YieldType } from "@paxoslabs/amplify-sdk";
function useAssets(yieldType: YieldType) {
return useQuery({
queryKey: ["assets", yieldType],
queryFn: () => fetchSupportedAssets({ yieldType }),
staleTime: 5 * 60 * 1000, // 5 minutes
});
}
// In component
const { data: assets, isLoading } = useAssets(YieldType.CORE);
import { useState } from "react";
import { useQuery } from "@tanstack/react-query";
import { fetchSupportedAssets, YieldType } from "@paxoslabs/amplify-sdk";
function AssetSelector({ onSelect }: { onSelect: (address: string) => void }) {
const { data: assets } = useQuery({
queryKey: ["assets", YieldType.CORE],
queryFn: () => fetchSupportedAssets({ yieldType: YieldType.CORE }),
});
return (
<select onChange={(e) => onSelect(e.target.value)}>
<option value="">Select asset</option>
{assets?.map((asset) => (
<option key={asset.address} value={asset.address}>
{asset.symbol}
</option>
))}
</select>
);
}
Checking Permit Support
Use the supportsPermit field to determine the optimal deposit flow:
const assets = await fetchSupportedAssets({ yieldType: YieldType.CORE });
const asset = assets.find(a => a.symbol === "USDC");
if (asset?.supportsPermit) {
// Can use gasless permit flow
console.log("USDC supports permit signatures");
} else {
// Must use approval flow
console.log("USDC requires standard approval");
}
Error Handling
| Error Code | Description | Resolution |
|---|
SDK_NOT_INITIALIZED | SDK not initialized | Call initAmplifySDK() first |
INVALID_YIELD_TYPE | Unknown yield type | Use YieldType.CORE, TREASURY, or FRONTIER |
NETWORK_ERROR | API request failed | Check network connection, retry |
import { fetchSupportedAssets, YieldType, APIError } from "@paxoslabs/amplify-sdk";
try {
const assets = await fetchSupportedAssets({ yieldType: YieldType.CORE });
} catch (error) {
if (error instanceof APIError) {
console.error(`API Error: ${error.code} - ${error.message}`);
}
}