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

# Changelog

> Release history and migration guides for the Amplify SDK

All notable changes to the Amplify SDK are documented here. This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Latest Release

<Update label="Docs" description="2026-04-01">
  ### Direct Contract Integration — KYT Accounts

  * **KYT-only deposit documentation** — The Direct Contract deposits guide now documents the `DistributorCodeDepositorV1` (KYT) contract exclusively. Both `deposit()` and `depositWithPermit()` include the required `_attestation` tuple parameter with empty/zero default values. Contact the Paxos Labs team to implement a compliance policy.
  * **KYT callout on Direct Contract overview** — Added a warning banner to the Direct Contract overview page about the KYT account requirement.

  ### Documentation Fixes

  * **Permit deposit `txData` shape corrected** — Code examples in the Deposit Workflow, Deposits Guide (Privy, Wagmi, and Viem tabs), and Quickstart now use the flat `txData` structure (`txData.abi`, `txData.functionName`, `txData.args`) introduced in v0.5.2. Previously these examples incorrectly referenced the pre-v0.5.2 nested shape (`txData.data.abi`).
  * **BigInt serialization fix for Privy permit signing** — Replaced `JSON.stringify(auth.permitData)` with the SDK's `toEthSignTypedDataV4()` helper in the Deposits Guide (Privy tab) and Quickstart. `JSON.stringify` throws a `TypeError` on BigInt values in `permitData.message`.
  * **`getRateInQuoteSafe` ABI corrected** — The Accountant ABI in the Direct Contract Deposits and Withdrawals guides now includes the required `quote: address` input parameter. The previous ABI had an empty `inputs` array, which would produce the wrong function selector on-chain.
  * **`VaultContracts` field name corrected** — Renamed `distributorCodeDepositorAddress` to `communityCodeDepositorAddress` in the Types reference to match the SDK's actual `VaultContracts` interface.
  * **`AmplifyVault` type updated** — Added missing `inDeprecation: boolean` and `enterpriseConfig?: EnterpriseConfig` fields to the `AmplifyVault` interface in the Types reference, `getVaultsByConfig`, `findVaultByConfig`, and AI Reference docs.
  * **`getWithdrawalFee()` parameters corrected** — Fixed parameter names (`withdrawAssetAddress` → `assetAddress`, `withdrawAmount` → `amount`) and added missing required parameters (`offerAsset`, `wantAsset`, `receiver`) in the AI Reference. Return type corrected from `string` to `bigint`.
  * **`getMinimumWithdrawalOrderSize()` parameter corrected** — Fixed parameter name (`withdrawAssetAddress` → `assetAddress`) in the AI Reference. Return type corrected from `string` to `bigint` with additional `shareDecimals: number` field.
</Update>

<Update label="0.5.2" description="2026-03-27">
  ### New Features

  * **KYT deposit routing** — Deposits automatically route to the KYT-enabled `DistributorCodeDepositorV1` contract when an account has `enterpriseConfig.predicatePolicyId` set. The SDK returns a discriminated union (`StandardDepositTxData | KytDepositTxData`) with a `depositType` field so consumers can distinguish between standard and KYT deposits. Type guards `isKytDeposit()` and `isStandardDeposit()` are exported for narrowing.
  * **Account deprecation warnings** — Accounts with `inDeprecation: true` now trigger a warning via the SDK logger when `prepareDepositTxData()` or `prepareDepositWithPermitTxData()` is called. The `AmplifyVault` type exposes the new `inDeprecation: boolean` field.
  * **Enterprise config on accounts** — `AmplifyVault.enterpriseConfig` carries `predicatePolicyId` from the GraphQL schema, enabling client-side KYT policy awareness.

  ### Improvements

  * **Flattened permit deposit return** — `prepareDepositWithPermitTxData()` now returns a flat object (`{ depositType, abi, address, functionName, args, chainId }`) matching the shape of `prepareDepositTxData()`. Previously the ABI and args were nested under a `.data` property. This makes both functions directly spreadable into viem's `writeContract`.

  ### Migration from v0.5.1

  Upgrade is **non-breaking** for standard deposits. If you use `prepareDepositWithPermitTxData()` directly, update property access:

  ```ts theme={null}
  // Before (v0.5.1)
  await writeContract({
    address: txData.address,
    abi: txData.data.abi,
    functionName: txData.data.functionName,
    args: txData.data.args,
  })

  // After (v0.5.2)
  await writeContract({
    address: txData.address,
    abi: txData.abi,
    functionName: txData.functionName,
    args: txData.args,
  })
  ```

  If you use the unified `prepareDeposit()` workflow, no changes are needed — it handles the new shape internally.
</Update>

<Update label="0.5.1" description="2026-03-23">
  ### New Features

  * **Base mainnet** — Base (`chainId` **8453**) is included in the SDK’s built-in chain map, so `getVaultsByConfig()`, deposit and withdrawal preparation, and on-chain reads resolve a proper `viem` `Chain` for Base without extra configuration. Pass `chainId: 8453` anywhere you already pass Ethereum or HyperEVM IDs.
  * **Cross-chain chain resolution** — When the wallet’s chain differs from the vault’s chain (for example, multi-chain or bridged-asset flows), chain utilities can resolve the correct built-in chain config for the user’s `chainId` as well as the vault’s.

  Upgrade from v0.5.0 is non-breaking for application code; install `@paxoslabs/amplify-sdk@0.5.1` (or latest patch) to pick up Base support.
</Update>

<Update label="0.5.0" description="2026-03-18">
  ### Breaking Changes

  <Warning>
    This release contains breaking changes. All transaction and display helper
    functions now identify accounts by `vaultName` instead of `yieldType`. Review
    the migration steps below before upgrading.
  </Warning>

  | Change                                      | Before (v0.4.2)                    | After (v0.5.0)                     |
  | ------------------------------------------- | ---------------------------------- | ---------------------------------- |
  | Account identifier in transaction functions | `yieldType: YieldType`             | `vaultName: string`                |
  | Account identifier in display helpers       | `yieldType: YieldType`             | `vaultName: string`                |
  | Account discovery                           | Implicit (SDK resolved internally) | Explicit via `getVaultsByConfig()` |
  | Withdrawal asset discovery                  | Not available                      | `getWithdrawSupportedAssets()`     |
  | Account fetching                            | `fetchVaults()`                    | `getVaults()`                      |
  | Asset fetching                              | `fetchSupportedAssets()`           | `getSupportedAssets()`             |

  **Affected functions** — the `yieldType` parameter has been replaced by `vaultName` in all of the following:

  | Category   | Functions                                                                                                                                                                      |
  | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
  | Deposit    | `prepareDepositAuthorization`, `prepareDeposit`, `prepareDepositTxData`, `prepareDepositPermitSignature`, `prepareDepositWithPermitTxData`, `prepareApproveDepositTokenTxData` |
  | Withdrawal | `prepareWithdrawalAuthorization`, `prepareWithdrawal`, `prepareWithdrawOrderTxData`, `prepareApproveWithdrawOrderTxData`, `prepareCancelWithdrawOrderTxData`                   |
  | Display    | `getMinimumMint`, `getWithdrawalFee`, `getMinimumWithdrawalOrderSize`                                                                                                          |

  ### New Features

  * **`getVaults()`** — Renamed from `fetchVaults()`. Same cache-first behavior, new name for consistency.
  * **`getSupportedAssets()`** — Renamed from `fetchSupportedAssets()`. Same cache-first behavior, new name for consistency.
  * **`getVaultsByConfig()`** — Multi-filter account discovery. Filter by `yieldType`, `chainId`, `depositAssetAddress`, `withdrawAssetAddress`, and `settlementAssetAddress`.
  * **`getWithdrawSupportedAssets()`** — Fetch all supported withdrawal assets grouped by token with their available accounts.
  * **`vaultName` parameter on display helpers** — `getVaultAPY`, `getVaultTVL`, and `getWithdrawalRequests` now accept `vaultName` as an alternative to `vaultAddress`.
  * **Cache management** — Fully documented: `initializeCache()`, `getCache()`, `refreshVaultCache()`, `isCacheReady()`, `waitForCacheReady()`.

  ### Migration Guide

  #### Why this change?

  In v0.4.2, `yieldType` served as the account identifier. This worked when each yield type mapped to a single account per chain, but broke down as multiple accounts with the same yield type launched on the same chain. The `vaultName` identifier is unique per account and future-proof.

  The new pattern is: **discover → then transact**.

  ```ts theme={null}
  // 1. Discover (once, at app startup or on chain/asset change)
  const [vault] = await getVaultsByConfig({
    yieldType: YieldType.CORE,
    chainId: 1,
    depositAssetAddress: USDC,
  })

  // 2. Transact (using the vault's name)
  await prepareDeposit({
    vaultName: vault.name,
    depositAsset: USDC,
    depositAmount: '1000',
    to: userAddress,
    chainId: 1,
  })
  ```

  <Accordion title="Step 1 — Add account discovery">
    Add a call to `getVaultsByConfig()` wherever you previously passed `yieldType` directly to a transaction function. Cache the result for the session.

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

    // Before — no discovery step needed
    // After  — discover the vault first
    const [vault] = await getVaultsByConfig({
      yieldType: YieldType.CORE,
      chainId: 1,
      depositAssetAddress: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
    })

    // vault.name is used in all subsequent calls
    ```
  </Accordion>

  <Accordion title="Step 2 — Update deposit calls">
    Replace `yieldType` with `vaultName` in every deposit function call.

    ```ts theme={null}
    // Before (v0.4.2)
    await prepareDepositTxData({
      yieldType: YieldType.CORE,
      depositAsset: '0x...',
      depositAmount: '1000',
      to: userAddress,
      chainId: 1,
    })

    // After (v0.5.0)
    await prepareDepositTxData({
      vaultName: vault.name,
      depositAsset: '0x...',
      depositAmount: '1000',
      to: userAddress,
      chainId: 1,
    })
    ```

    The same change applies to:

    * `prepareDepositAuthorization()`
    * `prepareDeposit()`
    * `prepareDepositPermitSignature()`
    * `prepareDepositWithPermitTxData()`
    * `prepareApproveDepositTokenTxData()`
  </Accordion>

  <Accordion title="Step 3 — Update withdrawal calls">
    ```ts theme={null}
    // Before (v0.4.2)
    await prepareWithdrawalAuthorization({
      yieldType: 'CORE',
      wantAsset: USDC,
      withdrawAmount: '1.0',
      userAddress,
      chainId: 1,
    })

    // After (v0.5.0)
    const [vault] = await getVaultsByConfig({ yieldType: 'CORE', chainId: 1 })

    await prepareWithdrawalAuthorization({
      vaultName: vault.name,
      wantAsset: USDC,
      withdrawAmount: '1.0',
      userAddress,
      chainId: 1,
    })
    ```

    The same change applies to:

    * `prepareWithdrawal()`
    * `prepareWithdrawOrderTxData()`
    * `prepareApproveWithdrawOrderTxData()`
    * `prepareCancelWithdrawOrderTxData()`
  </Accordion>

  <Accordion title="Step 4 — Update display helper calls">
    Display helpers that previously used `yieldType` to locate an account now use `vaultName`.

    ```ts theme={null}
    // Before (v0.4.2)
    const result = await getMinimumMint({
      yieldType: YieldType.CORE,
      chainId: 1,
      depositAssetAddress: USDC,
      depositAmount: '1000.0',
    })

    // After (v0.5.0)
    const [vault] = await getVaultsByConfig({
      yieldType: YieldType.CORE,
      chainId: 1,
    })

    const result = await getMinimumMint({
      vaultName: vault.name,
      chainId: 1,
      depositAssetAddress: USDC,
      depositAmount: '1000.0',
    })
    ```

    The same change applies to:

    * `getWithdrawalFee()`
    * `getMinimumWithdrawalOrderSize()`

    Additionally, `getVaultAPY()`, `getVaultTVL()`, and `getWithdrawalRequests()` now accept `vaultName` as an alternative to `vaultAddress`:

    ```ts theme={null}
    // New — use vaultName instead of looking up vaultAddress manually
    const apy = await getVaultAPY({ vaultName: vault.name })
    const tvl = await getVaultTVL({ vaultName: vault.name, chainId: 1 })
    ```
  </Accordion>

  <Accordion title="Step 5 — Update React hooks and components">
    If you wrapped SDK calls in React hooks, update the interface and params:

    ```ts theme={null}
    // Before (v0.4.2)
    interface DepositParams {
      amount: string
      depositAsset: `0x${string}`
      yieldType: YieldType
    }

    const params = {
      yieldType,
      depositAsset,
      depositAmount: amount,
      to: address,
      chainId,
    }

    // After (v0.5.0)
    interface DepositParams {
      amount: string
      depositAsset: `0x${string}`
      vaultName: string
    }

    const params = {
      vaultName,
      depositAsset,
      depositAmount: amount,
      to: address,
      chainId,
    }
    ```

    Use `getVaultsByConfig()` in a `useQuery` or `useEffect` to discover the account name at component mount time, then pass it to your deposit/withdrawal hooks.
  </Accordion>

  <Accordion title="Regex for bulk find-and-replace">
    Use these patterns to locate all call sites in your codebase:

    ```bash theme={null}
    # Find all yieldType usages in SDK calls
    rg "yieldType.*YieldType\." --type ts
    rg "yieldType.*['\"]CORE['\"]" --type ts

    # Find all affected function calls
    rg "prepare(Deposit|Withdrawal|WithdrawOrder|ApproveWithdraw|CancelWithdrawOrder)" --type ts
    rg "get(MinimumMint|WithdrawalFee|MinimumWithdrawalOrderSize)" --type ts
    ```
  </Accordion>
</Update>

***

<Update label="0.4.2" description="2026-02-13">
  ### Breaking Changes

  * Withdrawal flow migrated from AtomicQueue to WithdrawQueue.
  * Renamed withdrawal APIs:
    * `prepareWithdrawTransactionData()` -> `prepareWithdrawOrderTxData()`
    * `prepareApproveWithdrawToken()` -> `prepareApproveWithdrawOrderTxData()`
  * Added `prepareCancelWithdrawOrderTxData()` for order cancellation.
  * Withdrawal slippage parameters removed from the new flow.

  ### Highlights

  * Added unified `prepareWithdrawal()` wrapper for withdrawal execution.
  * Added unified `prepareWithdrawalAuthorization()` wrapper.
  * Added smart-wallet detection for deposit/withdraw authorization routing.
  * Added `forceMethod` parameter for explicit authorization routing.
</Update>

***

<Update label="0.3.0-beta.0" description="2025-01-30">
  ### Breaking Changes

  <Warning>
    This release contains breaking changes. Review the migration steps below
    before upgrading.
  </Warning>

  | Change                  | Before                             | After                          |
  | ----------------------- | ---------------------------------- | ------------------------------ |
  | Deposit parameter names | `depositToken`, `recipientAddress` | `depositAsset`, `to`           |
  | Node.js requirement     | 20+                                | 22+                            |
  | Yield type constants    | `PRIME`, `TBILL`, `LENDING`        | `CORE`, `TREASURY`, `FRONTIER` |

  <Accordion title="Migration: Update deposit function calls">
    ```ts theme={null}
    // Before (v0.2.x)
    await prepareDepositTxData({
      depositToken: "0x...",
      recipientAddress: "0x...",
      // ...
    });

    // After (v0.3.0)
    await prepareDepositTxData({
    depositAsset: "0x...",
    to: "0x...",
    // ...
    });

    ```
  </Accordion>

  <Accordion title="Migration: Update YieldType references">
    ```ts theme={null}
    // Before (v0.2.x)
    import { YieldType } from "@paxoslabs/amplify-sdk";
    YieldType.PRIME;
    YieldType.TBILL;
    YieldType.LENDING;

    // After (v0.3.0)
    import { YieldType } from "@paxoslabs/amplify-sdk";
    YieldType.CORE;
    YieldType.TREASURY;
    YieldType.FRONTIER;
    ```
  </Accordion>

  ### Features

  * Improved TypeScript inference for deposit functions
  * Added `eth_signTypedData_v4` helper for better wallet compatibility

  ### Bug Fixes

  * Fixed `instanceof` checks for `APIError` and `WithdrawError` in transpiled code

  ### Refactoring

  * Standardized parameter naming across deposit APIs to match contract terminology
  * Removed deprecated display module and bridge functionality
  * Added explicit exports for tree-shaking optimization
</Update>

***

## Previous Releases

<AccordionGroup>
  <Accordion title="0.2.3-beta.2 - January 15, 2025">
    ### Bug Fixes

    * Fixed spender address and decimals for permit flow
    * Improved cache-based lookup for token address resolution
    * Aligned `EIP712Domain` with viem's `TypedDataDomain`
  </Accordion>

  <Accordion title="0.2.0-beta.4 - January 10, 2025">
    ### Bug Fixes

    * Use non-interactive test command in release hooks
    * Resolved preact JSON VNode Injection vulnerability
    * Use `DistributorCodeDepositor` as approval spender
    * Aligned slippage defaults to `DEFAULT_SLIPPAGE_BPS` (50 bps)

    ### Documentation

    * Completed Quick Start deposit example in README
  </Accordion>

  <Accordion title="0.2.0-beta.0 - January 5, 2025">
    ### Refactoring

    * Converted `LogLevel` enum to `as const` pattern for better tree-shaking
  </Accordion>

  <Accordion title="0.2.0-alpha.0 - January 1, 2025">
    ### Features

    * **Unified Deposit API**: Added `prepareDeposit` and `prepareDepositAuthorization` wrapper functions
    * **Observability**: Added logging and telemetry infrastructure
    * **ERC-20 Enhancements**: Added `getTokenPermitInfoWithAllowance` with unified multicall

    ### Bug Fixes

    * Updated Sei chain ID from 713715 to 1329
    * Fixed missing multicall mock in deposit-with-permit tests
    * Prevented duplicate buffer-full warning messages in telemetry

    ### Refactoring

    * Converted `DepositAuthMethod` enum to `as const` pattern
    * Centralized `API_BASE_URL` constant
    * Use unified multicall for `isDepositSpendApproved`
  </Accordion>

  <Accordion title="0.1.1 - December 10, 2024">
    ### Bug Fixes

    * Corrected `DepositTxData` args tuple
    * Fixed withdraw documentation
    * Resolved `whatBump is not a function` release error

    ### Refactoring

    * Use `DistributorCodeDepositor` for all deposits and permit spender
  </Accordion>

  <Accordion title="0.1.0 - December 8, 2024">
    ### Features

    * Export `CommunityCodeDepositTxData` type
    * Fixed cache check for account data

    ### Bug Fixes

    * Updated `DistributorCodeDepositor` support for partner code deposits
    * Improved type safety and chain cache initialization

    ### Refactoring

    * Updated branding from Earn SDK to Amplify SDK
  </Accordion>

  <Accordion title="0.0.1-alpha.1 - November 1, 2024">
    ### Features

    * **Initial SDK Release**
      * Comprehensive `AmplifyVault` support
      * Multi-chain support for yield accounts
      * Complete deposit functionality with approval management
      * Slippage protection for all operations

    * **Withdraw Flow**
      * `prepareWithdrawTransactionData()` for transaction preparation
      * Automatic account data fetching via `fetchSupportedAssets()`
      * Three-field account resolution (yieldType + wantToken + chainId)
      * Configurable slippage protection (default 0.5%)

    * **Developer Experience**
      * Full TypeScript support with type safety
      * Comprehensive error handling with specific error codes
      * Exchange rate calculations

    ### Build System

    * Automated release workflow with conventional commits
    * Semantic versioning with alpha/beta/rc support
    * CI/CD pipeline with quality gates
    * Security auditing and dependency scanning
    * Automated NPM publishing with provenance
  </Accordion>
</AccordionGroup>

***

## SDK Rename Migration

<Info>
  The SDK was renamed from **Earn SDK** to **Amplify SDK** in version 0.1.0.
  Follow the migration steps below if upgrading from `@paxoslabs/earn-sdk`.
</Info>

<Steps>
  <Step title="Update package">
    ```bash npm uninstall @paxoslabs/earn-sdk npm install @paxoslabs/amplify-sdk theme={null}
    ```
  </Step>

  <Step title="Update imports">
    ```ts theme={null}
    // Before
    import { initEarnSDK, type EarnVault } from "@paxoslabs/earn-sdk";

    // After
    import { initAmplifySDK, type AmplifyVault } from "@paxoslabs/amplify-sdk";

    ```
  </Step>

  <Step title="Update function calls">
    ```ts theme={null}
    // Before
    await initEarnSDK("pxl_your_api_key");

    // After
    await initAmplifySDK("pxl_your_api_key");
    ```
  </Step>

  <Step title="Update type references">
    ```ts theme={null}
    // Before
    const vault: EarnVault = /* ... */;

    // After
    const vault: AmplifyVault = /_ ... _/;

    ```
  </Step>
</Steps>

<Note>
  API endpoints continue to use `/v1/earn-sdk/*` for backwards compatibility. No backend changes required.
</Note>

```
```
