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

# findVaultByConfig

> Discover an account address by asset, yield type, and chain

Looks up an account configuration by asset address, yield type, and chain ID. Use this to discover the `vaultAddress` needed by [`getVaultAPY`](./getVaultAPY) and [`getVaultTVL`](./getVaultTVL).

## Import

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

## Usage

```ts theme={null}
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                           |

```ts theme={null}
interface FindVaultByConfigParams {
  assetAddress: Address
  yieldType: YieldType
  chainId: number
}
```

## Return Type

Returns the matching `AmplifyVault`, or `null` if no account matches.

```ts theme={null}
type FindVaultByConfigReturn = AmplifyVault | null
```

```ts theme={null}
interface AmplifyVault {
  id: string;
  name: string;              // Pass as vaultName to transaction functions
  chainId: number;
  yieldType: YieldType;
  inDeprecation: boolean;
  vault: {
    boringVaultAddress: Address;  // Pass as vaultAddress to display helpers
    tellerAddress: Address;
    accountantAddress: Address;
    managerAddress: Address;
    rolesAuthorityAddress: Address;
    baseTokenAddress: Address;
    baseTokenStandIn?: Address;
    communityCodeDepositorAddress?: Address;
    withdrawQueueAddress?: Address;
  };
  enterpriseConfig?: { predicatePolicyId: string | null };
  sla?: VaultSLA;
  supportedAssets: VaultSupportedAsset[];
}
```

The key fields are `vault.boringVaultAddress` (pass as `vaultAddress` to display helpers) and `name` (pass as `vaultName` to transaction functions).

## Example: Account Discovery → APY Display

```ts theme={null}
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

```tsx theme={null}
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 `null` (not an error) when no account matches the given parameters. Always check the return value before accessing account properties.

## Related

* [getVaultAPY](./getVaultAPY) - Fetch account APY (requires account address)
* [getVaultTVL](./getVaultTVL) - Fetch account TVL (requires account address)
* [getSupportedAssets](/v0.5.2/intro/products/earn/developers/api/getSupportedAssets) - Discover supported tokens and chains
