Before wiring up calldata, align on a few terms used throughout the docs.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.
Vaults and share tokens
- Vault — an on-chain contract that issues an ERC-20 share token representing a user’s position. The vault address is the share token address.
- Share token — the ERC-20 a user holds after depositing. Its
decimals()may differ from the underlying asset’s decimals; always read live, never assume. - Deposit asset — the ERC-20 a user deposits into the vault.
- Want asset — the ERC-20 a user receives when withdrawing; can be the same as the deposit asset, or different.
How the SDK works
For transactions (deposit.prepareDeposit, withdraw.prepareWithdrawal, withdraw.cancel), the response includes ABI-encoded calldata that your app submits via the user’s wallet — viem, wagmi, ethers, or anything else that can call eth_sendTransaction.
For reads (vaults.list, vaults.getApys, users.getPositions, …), the response is the parsed JSON payload.
The SDK does not sign transactions or hold private keys.
The deposit flow
- Authorize — call
client.permit.authorize({ tokenAddress: depositAsset, ... }). The response tells you whether the user already has allowance, needs a standardapprove()transaction, or can use an EIP-2612 permit signature. - Sign or approve — if
method === 'permit', ask the user’s wallet to sign the typed data the API returned. Ifmethod === 'approval', submit the encodedapprove()transaction. - Prepare — call
client.deposit.prepareDeposit(...). If you signed a permit in step 2, passpermitSignature+permitDeadline. - Submit — send the transaction the prepare response returned.
The withdrawal flow
Withdrawals settle through aWithdrawQueue contract. There is no inline permit path:
- Authorize — call
client.permit.authorize({ tokenAddress: vaultAddress, ... })against the share token. Ifmethod !== 'already_approved', the user must submit a standardapprove(WithdrawQueue, amount)transaction first. - Prepare — call
client.withdraw.prepareWithdrawal(...). The response is calldata forWithdrawQueue.submitOrder. - Submit — send the transaction.
- (Optional) Cancel —
client.withdraw.cancel(...)returns calldata for cancelling a pending order. Look uporderIndexviaclient.withdraw.listRequests(...).
Amounts and decimals
All amount fields in the SDK are decimal strings in token base units. For a user input of “10” against a 6-decimal token, send"10000000". For 18 decimals, send "10000000000000000000".
Always read decimals() live from the relevant token contract. Different vaults and chains use different decimals; hardcoded fallbacks are bugs.
Errors
Every method throwsAmplifyError with statusCode?, body?, message, and rawResponse?. Timeouts surface as AmplifyTimeoutError. Use err instanceof AmplifyError (or AmplifyTimeoutError) to narrow.