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.
Looks up a vault configuration by asset address, yield type, and chain ID. Use this to discover the vaultAddress needed by getVaultAPY and getVaultTVL.
Import
import { findVaultByConfig } from "@paxoslabs/amplify-sdk";
Usage
const vault = await findVaultByConfig({
assetAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
yieldType: YieldType.CORE,
chainId: 1,
});
if (vault) {
console.log(vault.vault.boringVaultAddress); // Vault contract address
}
Parameters
| Parameter | Type | Required | Description |
|---|
assetAddress | Address | Yes | Token contract address (e.g., USDC) |
yieldType | YieldType | Yes | Yield strategy (CORE, TREASURY, FRONTIER) |
chainId | number | Yes | Blockchain network ID |
interface FindVaultByConfigParams {
assetAddress: Address;
yieldType: YieldType;
chainId: number;
}
Return Type
Returns the matching AmplifyVault, or undefined if no vault matches.
type FindVaultByConfigReturn = AmplifyVault | undefined
interface AmplifyVault {
id: string;
name: string;
chainId: number;
yieldType: YieldType;
vault: {
boringVaultAddress: Address;
tellerAddress: Address;
accountantAddress: Address;
managerAddress: Address;
rolesAuthorityAddress: Address;
baseTokenAddress: Address;
baseTokenStandIn?: Address;
withdrawQueueAddress?: Address;
};
supportedAssets: {
address: Address;
symbol: string;
name: string;
decimals: number;
coinGeckoTokenId?: string;
}[];
}
The key field is vault.boringVaultAddress — pass this as the vaultAddress parameter to getVaultAPY and getVaultTVL.
Example: Vault Discovery → APY Display
import {
findVaultByConfig,
getVaultAPY,
getVaultTVL,
YieldType,
} from "@paxoslabs/amplify-sdk";
const vault = await findVaultByConfig({
assetAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
yieldType: YieldType.CORE,
chainId: 1,
});
if (vault) {
const vaultAddress = vault.vault.boringVaultAddress;
const apyResult = await getVaultAPY({ vaultAddress, chainId: 1 });
console.log(apyResult.apyFormatted); // "4.50%"
const tvlResult = await getVaultTVL({ vaultAddress, chainId: 1 });
console.log(`$${Number(tvlResult.tvl).toLocaleString()} ${tvlResult.tvlAsset}`);
}
Example: React Component
import { useQuery } from "@tanstack/react-query";
import {
findVaultByConfig,
getVaultAPY,
YieldType,
} from "@paxoslabs/amplify-sdk";
function VaultAPY({ assetAddress, chainId }: { assetAddress: `0x${string}`; chainId: number }) {
const { data, isLoading } = useQuery({
queryKey: ["vaultAPY", assetAddress, chainId],
queryFn: async () => {
const vault = await findVaultByConfig({
assetAddress,
yieldType: YieldType.CORE,
chainId,
});
if (!vault) return null;
return getVaultAPY({
vaultAddress: vault.vault.boringVaultAddress,
chainId,
});
},
});
if (isLoading) return <span>Loading...</span>;
return <span>{data?.apyFormatted ?? "N/A"}</span>;
}
Error Handling
| Error Message Pattern | Description | Resolution |
|---|
"SDK not initialized" | SDK not initialized | Call initAmplifySDK() first |
Returns undefined (not an error) when no vault matches the given parameters. Always check the return value before accessing vault properties.