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

# Migrating from 0.5.x to 1.0.0

> Breaking changes and a side-by-side upgrade guide for 1.0.0.

`@paxoslabs/amplify-sdk@1.0.0` is a hard break from `0.5.x`. There is no compatibility shim — every integration must be updated.

This page lists what changed and the smallest correct update for each surface.

## Removed APIs

The following are gone in `1.0.0`:

* `initAmplifySDK(...)`.
* All flat-function exports (`prepareDeposit`, `prepareDepositTxData`, `prepareDepositWithPermitTxData`, `prepareDepositPermitSignature`, `prepareDepositAuthorization`, `prepareWithdrawal`, `prepareWithdrawalAuthorization`, `prepareWithdrawOrderTxData`, `prepareApproveWithdrawOrderTxData`, `prepareCancelWithdrawOrderTxData`, `prepareApproveDepositTokenTxData`).
* All ABI exports.
* EIP-712 helpers (`parsePermitSignature`, `toEthSignTypedDataV4`, `PERMIT_TYPES`). Use viem (`signTypedData`) directly on the typed data the SDK returns.
* On-chain approval-status helpers (`isDepositSpendApproved`, `isWithdrawalSpendApproved`).
* The typed-error hierarchy (`VaultNotFoundByAddressError`, `UnauthorizedVaultAccessError`, `UnsupportedChainError`, `VaultConfigIncompleteError`, …). All errors now flow through a single `AmplifyError`.
* SDK-managed telemetry and logger.
* Display helpers (`getVaultTVL`, `getVaultAPY`, `getMinimumMint`, `getMinimumWithdrawalOrderSize`, `getDepositCap`, `getWithdrawalFee`, `getWithdrawalRequests`, `calculateDepositFee`). The same data is available directly via the client's `vaults.*`, `withdraw.*`, and `users.*` namespaces.

## The new shape

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

const client = new AmplifyClient({
  apiKey: process.env.PAXOS_LABS_API_KEY!,
})

const prepared = await client.amplify.deposit.prepare({
  vaultAddress,
  depositAsset,
  depositAmount, // base units (decimal string)
  userAddress,
  chainId,
})

// Submit with viem / wagmi:
//   sendTransaction({ to: prepared.transaction.to, data: prepared.transaction.data, value: BigInt(prepared.transaction.value) })
```

## Field-by-field rename table

### Deposit

| `0.5.x`                              | `1.0.0`                                                                                                        |
| ------------------------------------ | -------------------------------------------------------------------------------------------------------------- |
| `prepareDeposit({...})`              | `client.amplify.deposit.prepare({...})`                                                                        |
| `prepareDepositAuthorization({...})` | `client.core.authorization.detect({ vaultAddress, tokenAddress: depositAsset, amount, userAddress, chainId })` |
| `signature`                          | `permitSignature`                                                                                              |
| `deadline` (`bigint`)                | `permitDeadline` (`number`, Unix seconds)                                                                      |
| `vaultName`                          | removed — pass `vaultAddress`                                                                                  |
| `yieldType`                          | removed                                                                                                        |
| `distributorCode`                    | removed                                                                                                        |
| (implicit)                           | `userAddress` (required)                                                                                       |

### Withdraw

| `0.5.x`                                   | `1.0.0`                                                                                                        |
| ----------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
| `prepareWithdrawal({...})`                | `client.amplify.withdraw.prepare({...})`                                                                       |
| `prepareWithdrawalAuthorization({...})`   | `client.core.authorization.detect({ vaultAddress, tokenAddress: vaultAddress, amount, userAddress, chainId })` |
| `withdrawAmount`                          | `shareAmount` — base units of the share token                                                                  |
| `prepareCancelWithdrawOrderTxData({...})` | `client.amplify.withdraw.cancel({ vaultAddress, orderIndex, chainId })`                                        |
| `wantAsset` (on cancel)                   | removed                                                                                                        |
| `getWithdrawalFee({...})`                 | `client.amplify.withdraw.calculateFee({ offerAmount, wantAsset, vaultAddress, chainId })`                      |
| `getWithdrawalRequests({...})`            | `client.amplify.withdraw.listRequests({...})`                                                                  |

### Vaults / reads

| `0.5.x`                                                           | `1.0.0`                                                                                                      |
| ----------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| `getVaults()`, `findVaultByConfig(...)`, `getVaultsByConfig(...)` | `client.amplify.vaults.list({ filter?, pageSize?, pageToken? })`                                             |
| `getSupportedAssets(...)`, `getWithdrawSupportedAssets(...)`      | `client.amplify.vaults.listAssets({...})`                                                                    |
| `getVaultTVL(...)`                                                | `client.amplify.vaults.getTvls({...})`                                                                       |
| `getVaultAPY(...)`                                                | `client.amplify.vaults.getApys({...})`                                                                       |
| `getDepositCap(...)`                                              | `client.amplify.vaults.getSupplyCaps({...})`                                                                 |
| `getMinimumMint(...)`, `getMinimumWithdrawalOrderSize(...)`       | Read from `client.amplify.vaults.list()` deployment data (`depositSupplyCap`, `minimumWithdrawalOrderSize`). |
| `calculateDepositFee(...)`                                        | Read from `client.amplify.vaults.list()` deployment `assets[].depositFees`.                                  |

### Users

| `0.5.x`                  | `1.0.0`                                                   |
| ------------------------ | --------------------------------------------------------- |
| (custom GraphQL queries) | `client.amplify.users.getPositions({ userAddress, ... })` |

## Error handling

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

try {
  await client.amplify.deposit.prepare({ /* ... */ })
} catch (err) {
  if (err instanceof AmplifyTimeoutError) {
    // Retry or surface a timeout state.
  } else if (err instanceof AmplifyError) {
    // err.statusCode, err.body, err.message, err.rawResponse
  } else {
    throw err
  }
}
```

There are no longer separate error classes per failure mode. Switch on `err.statusCode` and inspect `err.body` for backend-provided error details.

## Permit deposits

```ts theme={null}
const auth = await client.core.authorization.detect({
  vaultAddress,
  tokenAddress: depositAsset,
  amount,
  userAddress,
  chainId,
})

if (auth.method === 'permit' && auth.permitData) {
  const sig = await wallet.signTypedData({
    domain: auth.permitData.domain,
    types: auth.permitData.types,
    primaryType: 'Permit',
    message: auth.permitData.value,
  })

  const prepared = await client.amplify.deposit.prepare({
    vaultAddress,
    depositAsset,
    depositAmount,
    userAddress,
    chainId,
    permitSignature: sig,
    permitDeadline: Number(auth.permitData.deadline),
  })
}
```

## Withdrawals

Withdrawals settle through `WithdrawQueue.submitOrder` and require a prior ERC-20 `approve(WithdrawQueue, amount)` on the share token. Call `client.core.authorization.detect({ tokenAddress: vaultAddress, ... })` to detect whether allowance is already sufficient (`method: 'already_approved'`); otherwise submit a standard `approve` transaction before calling `client.amplify.withdraw.prepare(...)`.

## Decimals

Token amounts in `1.0.0` are decimal strings in base units. The SDK does not parse human-readable inputs. Always read `decimals()` live from the token contract (e.g. via viem's `readContract` / `useBalance`) and convert with `parseUnits(value, decimals).toString()` before calling the SDK.
