> ## 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.

# getVaultsByConfig

> Discover accounts by filtering on yield type, chain, and asset addresses

Returns an array of `AmplifyVault` objects matching the provided filter criteria. All parameters are optional — omitting all filters returns every account accessible with your API key.

Use `getVaultsByConfig()` as the primary way to discover account names before calling transaction functions.

## Import

```ts theme={null}
import { getVaultsByConfig, YieldType } from '@paxoslabs/amplify-sdk'
```

## Usage

```ts theme={null}
// Get all CORE vaults on Ethereum
const vaults = await getVaultsByConfig({
  yieldType: YieldType.CORE,
  chainId: 1,
})

// Use the vault name in transaction calls
const [vault] = vaults
console.log(vault.name) // e.g. "amplify-core-eth-usdc"
```

## Parameters

All parameters are optional. Results are filtered client-side from the account cache and scoped to your organization by API key.

| Parameter                | Type        | Description                                                        |
| ------------------------ | ----------- | ------------------------------------------------------------------ |
| `yieldType`              | `YieldType` | Filter by yield strategy (`"CORE"`, `"TREASURY"`, or `"FRONTIER"`) |
| `chainId`                | `number`    | Filter by blockchain network ID                                    |
| `depositAssetAddress`    | `Address`   | Filter by deposit token address (`baseTokenAddress`)               |
| `withdrawAssetAddress`   | `Address`   | Filter by withdrawal asset address                                 |
| `settlementAssetAddress` | `Address`   | Filter by settlement asset address                                 |

```ts theme={null}
interface GetVaultsByConfigParams {
  yieldType?: YieldType
  chainId?: number
  depositAssetAddress?: Address
  withdrawAssetAddress?: Address
  settlementAssetAddress?: Address
}
```

## Return Type

```ts theme={null}
Promise<AmplifyVault[]>
```

Each `AmplifyVault` object includes:

```ts theme={null}
interface AmplifyVault {
  id: string
  name: string // Use this as vaultName in transaction functions
  chainId: number
  yieldType: YieldType
  inDeprecation: boolean
  vault: VaultContracts // Contract addresses
  enterpriseConfig?: EnterpriseConfig // KYT compliance settings
  sla?: VaultSLA
  supportedAssets: VaultSupportedAsset[]
}

interface VaultSupportedAsset {
  address: Address // `0x${string}`
  symbol: string
  name: string
  decimals: number
  coinGeckoTokenId?: string
  depositable?: boolean
  withdrawable?: boolean
}
```

## Examples

<Tabs>
  <Tab title="Get specific account">
    ```ts theme={null}
    import {
      getVaultsByConfig,
      prepareDepositTxData,
      YieldType,
    } from "@paxoslabs/amplify-sdk";

    const USDC = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";

    // Find the CORE USDC vault on Ethereum
    const [vault] = await getVaultsByConfig({
      yieldType: YieldType.CORE,
      chainId: 1,
      depositAssetAddress: USDC,
    });

    if (!vault) {
      throw new Error("Vault not found");
    }

    // vault.name is now safe to use in transaction calls
    const txData = await prepareDepositTxData({
      vaultName: vault.name,
      depositAsset: USDC,
      depositAmount: "1000",
      to: userAddress,
      chainId: 1,
    });
    ```
  </Tab>

  <Tab title="List all accounts">
    ```ts theme={null}
    import { getVaultsByConfig } from "@paxoslabs/amplify-sdk";

    // All vaults for your organization
    const allVaults = await getVaultsByConfig();

    for (const vault of allVaults) {
      console.log(`${vault.name} — ${vault.yieldType} on chain ${vault.chainId}`);
    }
    ```
  </Tab>

  <Tab title="React hook">
    ```tsx theme={null}
    import { useQuery } from "@tanstack/react-query";
    import { getVaultsByConfig, YieldType } from "@paxoslabs/amplify-sdk";

    function useVaults(yieldType?: YieldType, chainId?: number) {
      return useQuery({
        queryKey: ["vaults", yieldType, chainId],
        queryFn: () => getVaultsByConfig({ yieldType, chainId }),
      });
    }

    function VaultSelector() {
      const { data: vaults, isLoading } = useVaults(YieldType.CORE, 1);

      if (isLoading) return <p>Loading vaults...</p>;

      return (
        <select>
          {vaults?.map((vault) => (
            <option key={vault.id} value={vault.name}>
              {vault.name} ({vault.supportedAssets.map((a) => a.symbol).join(", ")})
            </option>
          ))}
        </select>
      );
    }
    ```
  </Tab>

  <Tab title="Multi-chain accounts">
    ```ts theme={null}
    import { getVaultsByConfig, YieldType } from "@paxoslabs/amplify-sdk";

    // Get CORE vaults across all chains
    const coreVaults = await getVaultsByConfig({
      yieldType: YieldType.CORE,
    });

    for (const vault of coreVaults) {
      console.log(`Chain ${vault.chainId}: ${vault.name}`);
    }

    // Get all vaults on HyperEVM (chainId 999)
    const hyperVaults = await getVaultsByConfig({ chainId: 999 });
    ```
  </Tab>
</Tabs>

## Relationship to Other Discovery Functions

| Function              | Use Case                                                                        |
| --------------------- | ------------------------------------------------------------------------------- |
| `getVaultsByConfig()` | **Primary account discovery** — returns multiple accounts with flexible filters |
| `findVaultByConfig()` | Single account lookup by asset address + yield type + chain                     |
| `getVaults()`         | Raw account list with `VaultFilterOptions` (equivalent to `getVaultsByConfig`)  |

<Info>
  `getVaultsByConfig()` and `getVaults()` share the same underlying cache.
  Results are automatically scoped to your organization by the API key used in
  `initAmplifySDK()`.
</Info>

## Cache Behavior

`getVaultsByConfig()` uses the account cache:

* On first call, fetches from the Amplify API and populates the cache
* Subsequent calls within the TTL (10 minutes) return cached data
* Expired cache is automatically refreshed on access
* Call `waitForCacheReady()` at startup to ensure the cache is pre-populated

## Error Handling

| Error                           | Description                      | Resolution                                                          |
| ------------------------------- | -------------------------------- | ------------------------------------------------------------------- |
| `"SDK not initialized"`         | Called before `initAmplifySDK()` | Initialize the SDK first                                            |
| `"Invalid yieldType"`           | Unknown yield type value         | Use `YieldType.CORE`, `YieldType.TREASURY`, or `YieldType.FRONTIER` |
| `"Invalid chainId"`             | Non-positive integer chain ID    | Provide a valid chain ID                                            |
| `"Invalid depositAssetAddress"` | Malformed address                | Provide a valid checksummed Ethereum address                        |

## Related

* [findVaultByConfig](/v0.5.2/intro/products/earn/developers/api/display/findVaultByConfig) - Single account lookup
* [getSupportedAssets](/v0.5.2/intro/products/earn/developers/api/getSupportedAssets) - Deposit token metadata
* [Account Discovery Concepts](/v0.5.2/intro/products/earn/developers/getting-started/concepts) - How accounts are identified
