Skip to main content

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.

@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

import { AmplifyClient, AmplifyError } from '@paxoslabs/amplify-sdk'

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

const prepared = await client.deposit.prepareDeposit({
  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.x1.0.0
prepareDeposit({...})client.deposit.prepareDeposit({...})
prepareDepositAuthorization({...})client.permit.authorize({ vaultAddress, tokenAddress: depositAsset, amount, userAddress, chainId })
signaturepermitSignature
deadline (bigint)permitDeadline (number, Unix seconds)
vaultNameremoved — pass vaultAddress
yieldTyperemoved
distributorCoderemoved
(implicit)userAddress (required)

Withdraw

0.5.x1.0.0
prepareWithdrawal({...})client.withdraw.prepareWithdrawal({...})
prepareWithdrawalAuthorization({...})client.permit.authorize({ vaultAddress, tokenAddress: vaultAddress, amount, userAddress, chainId })
withdrawAmountshareAmount — base units of the share token
prepareCancelWithdrawOrderTxData({...})client.withdraw.cancel({ vaultAddress, orderIndex, chainId })
wantAsset (on cancel)removed
getWithdrawalFee({...})client.withdraw.calculateFee({ offerAmount, wantAsset, vaultAddress, chainId })
getWithdrawalRequests({...})client.withdraw.listRequests({...})

Vaults / reads

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

Users

0.5.x1.0.0
(custom GraphQL queries)client.users.getPositions({ userAddress, ... })

Error handling

import { AmplifyError, AmplifyTimeoutError } from '@paxoslabs/amplify-sdk'

try {
  await client.deposit.prepareDeposit({ /* ... */ })
} 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

const auth = await client.permit.authorize({
  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.deposit.prepareDeposit({
    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.permit.authorize({ tokenAddress: vaultAddress, ... }) to detect whether allowance is already sufficient (method: 'already_approved'); otherwise submit a standard approve transaction before calling client.withdraw.prepareWithdrawal(...).

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.