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

# API Reference

> Complete function reference for the Amplify SDK

The Amplify SDK provides functions for initializing the SDK, discovering accounts, and preparing transactions for deposits and withdrawals.

<Warning>
  **Breaking change in v0.5.0**: All transaction functions now identify accounts
  by `vaultName` instead of `yieldType`. Use `getVaultsByConfig()` to discover
  account names first. See the [migration
  guide](/v0.5.2/intro/products/earn/developers/changelog#migration-guide).
</Warning>

## Initialization

<CardGroup cols={2}>
  <Card title="initAmplifySDK" icon="play" href="/v0.5.2/intro/products/earn/developers/api/initAmplifySDK">
    Initialize the SDK with your API key before using any other functions.
  </Card>

  <Card title="getSupportedAssets" icon="database" href="/v0.5.2/intro/products/earn/developers/api/getSupportedAssets">
    Fetch supported tokens and account configurations for a yield type.
  </Card>
</CardGroup>

## Account Discovery

<CardGroup cols={2}>
  <Card title="getVaultsByConfig" icon="magnifying-glass" href="/v0.5.2/intro/products/earn/developers/api/getVaultsByConfig">
    Discover accounts by yield type, chain, and asset. Returns `vault.name` for
    use in transaction functions.
  </Card>

  <Card title="findVaultByConfig" icon="crosshairs" href="/v0.5.2/intro/products/earn/developers/api/display/findVaultByConfig">
    Find a single account by asset address, yield type, and chain.
  </Card>
</CardGroup>

## Deposits

<CardGroup cols={2}>
  <Card title="Deposit Workflow" icon="route" href="/v0.5.2/intro/products/earn/developers/api/deposit-workflow">
    The unified deposit API with `prepareDepositAuthorization` and
    `prepareDeposit`.
  </Card>

  <Card title="prepareDepositTxData" icon="code" href="/v0.5.2/intro/products/earn/developers/api/prepareDepositTxData">
    Prepare transaction data for a standard deposit after approval.
  </Card>

  <Card title="prepareDepositWithPermitTxData" icon="signature" href="/v0.5.2/intro/products/earn/developers/api/prepareDepositWithPermitTxData">
    Prepare transaction data for a permit-based deposit (single transaction).
  </Card>

  <Card title="prepareDepositPermitSignature" icon="pen-nib" href="/v0.5.2/intro/products/earn/developers/api/prepareDepositPermitSignature">
    Build EIP-712 typed data for signing a permit deposit directly.
  </Card>
</CardGroup>

## Withdrawals

<CardGroup cols={2}>
  <Card title="prepareWithdrawalAuthorization" icon="shield-check" href="/v0.5.2/intro/products/earn/developers/api/prepareWithdrawalAuthorization">
    Check approval requirements and prepare withdrawal authorization.
  </Card>

  <Card title="prepareWithdrawal" icon="arrow-up-from-bracket" href="/v0.5.2/intro/products/earn/developers/api/prepareWithdrawal">
    Prepare transaction data through the unified withdrawal wrapper.
  </Card>

  <Card title="prepareWithdrawOrderTxData" icon="list-checks" href="/v0.5.2/intro/products/earn/developers/api/prepareWithdrawOrderTxData">
    Build low-level WithdrawQueue order transaction data.
  </Card>

  <Card title="prepareApproveWithdrawOrderTxData" icon="check" href="/v0.5.2/intro/products/earn/developers/api/prepareApproveWithdrawOrderTxData">
    Build low-level approval transaction data for account shares.
  </Card>
</CardGroup>

## Display Helpers

<CardGroup cols={2}>
  <Card title="Display Helpers" icon="chart-line" href="/v0.5.2/intro/products/earn/developers/api/display/index">
    UI helper functions for showing account APY, TVL, fees, share calculations,
    and withdrawal history.
  </Card>
</CardGroup>

## Function Quick Reference

| Function                            | Description                                         |
| ----------------------------------- | --------------------------------------------------- |
| `initAmplifySDK`                    | Initialize SDK with API key and options             |
| `waitForCacheReady`                 | Wait for the account cache to be populated          |
| `isCacheReady`                      | Check if the account cache is ready                 |
| `getVaults`                         | Fetch accounts with optional filters                |
| `getSupportedAssets`                | Get supported tokens for a yield type               |
| `getVaultsByConfig`                 | Discover accounts by yield type, chain, and asset   |
| `findVaultByConfig`                 | Find a single account by asset + yield type + chain |
| `getWithdrawSupportedAssets`        | Get all assets grouped by available accounts        |
| `prepareDepositAuthorization`       | Determine optimal authorization method              |
| `prepareDeposit`                    | Prepare deposit with auto-detected method           |
| `prepareDepositTxData`              | Prepare standard deposit transaction                |
| `prepareDepositWithPermitTxData`    | Prepare permit-based deposit transaction            |
| `prepareDepositPermitSignature`     | Build EIP-712 permit typed data for signing         |
| `prepareWithdrawalAuthorization`    | Determine if withdrawal approval is required        |
| `prepareWithdrawal`                 | Prepare withdrawal execution transaction            |
| `prepareWithdrawOrderTxData`        | Prepare low-level WithdrawQueue submission          |
| `prepareApproveWithdrawOrderTxData` | Prepare low-level withdraw approval transaction     |
| `prepareCancelWithdrawOrderTxData`  | Prepare withdrawal order cancellation               |
| `getMinimumMint`                    | Calculate expected account shares for a deposit     |
| `getVaultAPY`                       | Fetch latest account APY                            |
| `getVaultTVL`                       | Fetch account total value locked                    |
| `getWithdrawalFee`                  | Calculate withdrawal fees                           |
| `getWithdrawalRequests`             | Fetch user's withdrawal requests                    |
| `getMinimumWithdrawalOrderSize`     | Get minimum withdrawal order size                   |

## Type Guards

The SDK exports type guards for handling discriminated union results:

```ts theme={null}
import {
  prepareDepositAuthorization,
  prepareWithdrawalAuthorization,
  isPermitAuth,
  isApprovalAuth,
  isAlreadyApprovedAuth,
  isWithdrawApprovalAuth,
  isWithdrawAlreadyApprovedAuth,
} from '@paxoslabs/amplify-sdk'

const auth = await prepareDepositAuthorization(params)

if (isPermitAuth(auth)) {
  // auth.permitData is available
} else if (isApprovalAuth(auth)) {
  // auth.txData is available
} else if (isAlreadyApprovedAuth(auth)) {
  // auth.allowance is available
}

const withdrawAuth = await prepareWithdrawalAuthorization(params)
if (isWithdrawApprovalAuth(withdrawAuth)) {
  // withdrawAuth.txData is available
} else if (isWithdrawAlreadyApprovedAuth(withdrawAuth)) {
  // withdrawAuth.allowance is available
}
```

See [DepositAuthMethod](/v0.5.2/intro/products/earn/developers/types/DepositAuthMethod) for full type documentation.

## Account Discovery Pattern

Starting in v0.5.0, transaction functions require a `vaultName` instead of `yieldType`. The recommended pattern is:

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

// Step 1: Discover the vault
const [vault] = await getVaultsByConfig({
  yieldType: YieldType.CORE,
  chainId: 1,
  depositAssetAddress: USDC_ADDRESS,
})

// Step 2: Use vault.name in all transaction calls
const auth = await prepareDepositAuthorization({
  vaultName: vault.name,
  depositAsset: USDC_ADDRESS,
  depositAmount: '1000',
  to: userAddress,
  chainId: 1,
})
```
