> ## 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, fetching data, and preparing transactions for deposits and withdrawals.

## Initialization

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

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

## Deposits

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

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

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

## Withdrawals

<CardGroup cols={2}>
  <Card title="prepareWithdrawalAuthorization" icon="shield-check" href="/v0.4.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.4.2/intro/products/earn/developers/api/prepareWithdrawal">
    Prepare transaction data through the unified withdrawal wrapper.
  </Card>

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

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

## Display Helpers

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

## Function Quick Reference

| Function                            | Description                                            |
| ----------------------------------- | ------------------------------------------------------ |
| `initAmplifySDK`                    | Initialize SDK with API key and options                |
| `fetchSupportedAssets`              | Get supported tokens for a yield type                  |
| `prepareDepositAuthorization`       | Determine optimal authorization method                 |
| `prepareDeposit`                    | Prepare deposit with auto-detected method              |
| `prepareDepositTxData`              | Prepare standard deposit transaction                   |
| `prepareDepositWithPermitTxData`    | Prepare permit-based deposit transaction               |
| `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        |
| `findVaultByConfig`                 | Discover vault address by asset, yield type, and chain |
| `getMinimumMint`                    | Calculate expected vault shares for a deposit          |
| `getVaultAPY`                       | Fetch latest vault APY                                 |
| `getVaultTVL`                       | Fetch vault 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 {
  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({
  // ...
});
if (isWithdrawApprovalAuth(withdrawAuth)) {
  // withdrawAuth.txData is available
} else if (isWithdrawAlreadyApprovedAuth(withdrawAuth)) {
  // withdrawAuth.allowance is available
}
```

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