A deposit moves an ERC-20 asset from the user’s wallet into a BoringVault and mints share tokens back. The flow is the same regardless of vault: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.
- Call
client.permit.authorize(...)to discover whether the deposit asset needs a permit signature, a separateapprovetransaction, or already has sufficient allowance. - Handle the three response shapes (
permit/approval/already_approved). - Call
client.deposit.prepareDeposit(...)to get ABI-encoded calldata. - Submit the returned transaction with the user’s wallet.
client refers to a singleton AmplifyClient created on the server — see Project setup for the wiring. All token amounts are base-units decimal strings; the SDK does no decimal parsing.
See the AI Coding Reference for the full parameter list on every method shown here.
Step 1: Decide on permit vs. approval
method:
method | What to do |
|---|---|
permit | Sign auth.permitData off-chain (gasless) and pass permitSignature + permitDeadline to prepareDeposit. |
approval | Submit auth.approvalTransaction first, wait for it to confirm, then call prepareDeposit. |
already_approved | Sufficient allowance already exists. Go straight to prepareDeposit. |
2a — Permit path
For permit-supporting tokens (USDC mainnet, DAI, most modern ERC-20s with EIP-2612), sign the typed data with viem and forward the signature to the backend. The With wagmi:
primaryType is always 'Permit'.2b — Approval path
When the token does not support permit (or you want to force a standard ERC-20 flow), the backend returns a ready-to-submit
approvalTransaction containing ABI-encoded approve() calldata. Submit it to the deposit asset address and wait for the receipt before calling prepareDeposit.Step 3 — Prepare the deposit
vaultAddress— BoringVault contract address.depositAsset— ERC-20 token address you’re depositing.depositAmount— amount in base units (decimal string).userAddress— wallet that signs and submits the deposit. Also the default share recipient whentois omitted.chainId— EVM chain ID.
to— destination address that receives the vault shares. Defaults touserAddress.permitSignature+permitDeadline— required together when you came through the permit branch in Step 2a.responseFormat—'encoded'(default),'full', or'structured'. Pass'full'to also receiveabi,functionName, andargs.
End-to-end example
Converting user input to base units
Error handling
err.body and err.rawResponse server-side and return a generic message to the client.
Next steps
- Withdrawals guide — redeem shares for the underlying asset.
- AI Coding Reference — all parameters and response shapes.
- Migrating from 0.5.x — field-by-field rename table.