@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
viem.
Construct the client
AmplifyEnvironment.Production).
Authentication
The API key is sent on every request as thex-api-key HTTP header. The SDK reads it from the apiKey constructor option. There is no other auth mode.
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:
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
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
Error handling
Every SDK method throws on failure. Two error classes only:End-to-end: deposit flow (permit + approval + already-approved)
End-to-end: withdrawal flow
Share-token approvals always go to theWithdrawQueue — never to the vault contract itself, never via permit.
End-to-end: cancel a pending withdrawal
Common pitfalls
depositAmount/shareAmountare 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 withdrawsubmitOrderto revert with panic0x11. Readdeployment.withdrawQueueAddress. - Approve
shareAmount + feeAmount, notshareAmount.submitOrderpulls the inclusive amount. An exact-share approve reverts with panic0x11. Always callclient.amplify.withdraw.calculateFeefirst, then approveBigInt(shareAmount) + BigInt(fee.feeAmount). - Preflight withdraw fees.
submitOrderalso panics0x11whenfeeAmount >= shareAmount(post-fee math underflows). Bail out beforewithdraw.preparewhen the fee would consume the offer. - Permit is for deposit assets only. Share tokens never return
method: 'permit'fromauthorization.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
readContractagainst each token before depositing. - Use
client.amplify.vaults.list()as the source of truth for addresses. Hardcoding contract addresses leaks across chain redeploys. Look upboringVaultAddress,depositorAddress, andwithdrawQueueAddressper(vault, chainId)at runtime. AmplifyTimeoutErroris its own class. Retry timeouts; do not retryAmplifyError(400/401/403/404/422) without first fixing inputs.- Branch errors on
err.statusCodeanderr.body.AmplifyErroris the single non-timeout error class — there are no per-failure subclasses. responseFormat: 'encoded'is the default. You always gettransaction.to,transaction.data,transaction.value. PassresponseFormat: 'full'if you want the ABI fragment, function name, and args back too.moduleResolutionmust bebundler/node16/nodenext. Legacynoderesolution can’t see the package’sexportsmap and types collapse toany.