Skip to main content
Single-page, greppable reference for @paxoslabs/amplify-sdk 1.0.0. Drop the rendered page into an AI coding assistant (Cursor, Copilot, Claude Code) and it has everything required to integrate without extra docs lookups. The public surface is AmplifyClient, the Amplify type-only namespace, AmplifyError, and AmplifyTimeoutError.

Install

No required peer dependencies. To submit the calldata the SDK returns, bring your own EVM client — examples below use viem.

Construct the client

Full constructor signature:
Construct once at module scope and reuse across requests. The SDK defaults to production (AmplifyEnvironment.Production).

Authentication

The API key is sent on every request as the x-api-key HTTP header. The SDK reads it from the apiKey constructor option. There is no other auth mode.
Missing/invalid keys surface as AmplifyError with statusCode: 401. Access denied for a specific vault surfaces as statusCode: 403.

Imports cheat sheet

Subclient + method index

AmplifyClient exposes one subclient per resource. Every subclient method:
Every method takes an optional second argument: requestOptions ({ timeoutInSeconds?, maxRetries?, abortSignal?, headers? }).

client.amplify.deposit.prepare(request)

Returns ABI-encoded calldata for a vault deposit on the DistributorCodeDepositor.
  • Request: Amplify.amplify.deposit.PrepareDepositRequest
  • Response: Amplify.PrepareDepositResponseDto

client.amplify.withdraw.prepare(request)

Returns calldata for WithdrawQueue.submitOrder. Caller must have pre-approved deployment.withdrawQueueAddress to spend share tokens.
  • Request: Amplify.amplify.withdraw.PrepareWithdrawRequest
  • Response: Amplify.PrepareWithdrawResponseDto

client.amplify.withdraw.cancel(request)

Returns calldata for cancelling a pending withdrawal order. Look up orderIndex via listRequests.
  • Request: Amplify.amplify.withdraw.CancelWithdrawRequest
  • Response: Amplify.PrepareCancelWithdrawResponseDto

client.amplify.withdraw.calculateFee(request)

Computes the fee charged for a hypothetical withdrawal.
  • Request: Amplify.CalculateFeeRequest
  • Response: Amplify.CalculateWithdrawalFeeResponseDto

client.amplify.withdraw.listRequests(request?)

Lists withdrawal requests with cursor pagination and AIP-160 filters.
  • Request: Amplify.amplify.withdraw.ListRequestsWithdrawRequest
  • Response: Amplify.WithdrawalRequestsResponseDto

client.core.authorization.detect(request)

Tells you whether the token needs EIP-2612 permit signing, a standard ERC-20 approve, or is already approved for the requested amount.
  • Request: Amplify.core.authorization.DetectAuthorizationRequest
  • Response: Amplify.AuthorizationResponseDto
For deposits pass tokenAddress = depositAsset. For withdrawals pass tokenAddress = vaultAddress (the share token). Share tokens always resolve to approval or already_approved — there is no permit path for shares.

client.amplify.users.getPositions(request)

Returns one row per (user, vault, chain) with share balance and base-asset value.
  • Request: Amplify.GetPositionsRequest
  • Response: Amplify.UserPositionsResponseDto

client.amplify.vaults.list(request?)

Returns all vaults the API key can see, grouped by vault name, with one deployments[] entry per chain.
  • Request: Amplify.amplify.vaults.ListVaultsRequest
  • Response: Amplify.VaultsResponseDto

client.amplify.vaults.listAssets(request?)

Per-asset capability listing across all visible vaults.
  • Request: Amplify.ListAssetsRequest
  • Response: Amplify.VaultAssetsResponseDto

client.amplify.vaults.getApys(request?)

Historical + current APY series.
  • Request: Amplify.GetApysRequest
  • Response: Amplify.VaultApysResponseDto

client.amplify.vaults.getTvls(request?)

Historical + current TVL series, optionally aggregated across chains.
  • Request: Amplify.GetTvlsRequest
  • Response: Amplify.VaultTvlsResponseDto

client.amplify.vaults.getSupplyCaps(request?)

Current totalSupplyInBase, supplyCap, and percentageFilled per (vault, chain).
  • Request: Amplify.GetSupplyCapsRequest
  • Response: Amplify.SupplyCapsResponseDto

client.amplify.smartDeposits.getAddress(request)

Returns a deterministic Smart Deposit Address for routing on-ramp funds directly into a vault.
  • Request: Amplify.amplify.SmartDepositAddressRequestDto
  • Response: Amplify.SmartDepositAddressResponseDto
When customerId is provided, each unique value produces a distinct deposit address even when other parameters are identical. The customerId is included in webhook payloads for reconciliation. Must contain only alphanumeric characters, hyphens, and underscores (max 256 characters).

Error handling

Every SDK method throws on failure. Two error classes only:
Standard handling pattern:
Retry helper that only retries timeouts:

End-to-end: deposit flow (permit + approval + already-approved)

End-to-end: withdrawal flow

Share-token approvals always go to the WithdrawQueue — never to the vault contract itself, never via permit.

End-to-end: cancel a pending withdrawal

Common pitfalls

  • depositAmount / shareAmount are base units. Always decimal strings. parseUnits('1.5', 6).toString() for USDC; never '1.5'.
  • Share approvals go to the WithdrawQueue. Approving the vault address itself causes the withdraw submitOrder to revert with panic 0x11. Read deployment.withdrawQueueAddress.
  • Approve shareAmount + feeAmount, not shareAmount. submitOrder pulls the inclusive amount. An exact-share approve reverts with panic 0x11. Always call client.amplify.withdraw.calculateFee first, then approve BigInt(shareAmount) + BigInt(fee.feeAmount).
  • Preflight withdraw fees. submitOrder also panics 0x11 when feeAmount >= shareAmount (post-fee math underflows). Bail out before withdraw.prepare when the fee would consume the offer.
  • Permit is for deposit assets only. Share tokens never return method: 'permit' from authorization.detect. Don’t try to bypass and sign typed data manually.
  • Decimal invariant on Amplify vaults. Deposit, base, and share token decimals must match — otherwise on-chain deposit reverts. Verify with viem’s readContract against each token before depositing.
  • Use client.amplify.vaults.list() as the source of truth for addresses. Hardcoding contract addresses leaks across chain redeploys. Look up boringVaultAddress, depositorAddress, and withdrawQueueAddress per (vault, chainId) at runtime.
  • AmplifyTimeoutError is its own class. Retry timeouts; do not retry AmplifyError (400/401/403/404/422) without first fixing inputs.
  • Branch errors on err.statusCode and err.body. AmplifyError is the single non-timeout error class — there are no per-failure subclasses.
  • responseFormat: 'encoded' is the default. You always get transaction.to, transaction.data, transaction.value. Pass responseFormat: 'full' if you want the ABI fragment, function name, and args back too.
  • moduleResolution must be bundler / node16 / nodenext. Legacy node resolution can’t see the package’s exports map and types collapse to any.