Withdrawals are routed through the WithdrawQueue flow.
Recommended sequence: prepareWithdrawalAuthorization() then
prepareWithdrawal().
Step 1: Check Authorization
import {
prepareWithdrawalAuthorization,
isWithdrawApprovalAuth,
} from "@paxoslabs/amplify-sdk";
const auth = await prepareWithdrawalAuthorization({
yieldType: "CORE",
wantAsset: USDC,
withdrawAmount: "10.0",
userAddress,
chainId: 1,
});
if (isWithdrawApprovalAuth(auth)) {
const approvalHash = await walletClient.writeContract(auth.txData);
await publicClient.waitForTransactionReceipt({ hash: approvalHash });
}
Step 2: Submit Withdrawal Order
import { prepareWithdrawal } from "@paxoslabs/amplify-sdk";
const txData = await prepareWithdrawal({
yieldType: "CORE",
wantAsset: USDC,
withdrawAmount: "10.0",
userAddress,
chainId: 1,
});
const hash = await walletClient.writeContract(txData);
Optional Low-Level APIs
prepareWithdrawOrderTxData for manual order construction
prepareApproveWithdrawOrderTxData for manual approval construction
prepareCancelWithdrawOrderTxData for order cancel flows
Checking Withdrawal Status
After submitting a withdrawal order, use getWithdrawalRequests to poll for status updates:
import { getWithdrawalRequests } from "@paxoslabs/amplify-sdk";
const { withdrawalRequests } = await getWithdrawalRequests({
userAddress,
chainId: 1,
status: "PENDING",
});
for (const request of withdrawalRequests) {
console.log(`${request.id}: ${request.status} — ${request.orderAmount}`);
}
Withdrawal Request Statuses
| Status | Description |
|---|
PENDING | Order submitted, awaiting fulfillment by vault operator |
COMPLETE | Order fulfilled, stablecoins sent to user |
PENDING_REFUND | Order is being refunded |
REFUNDED | Vault shares returned to user |
Withdrawal orders are fulfilled by the vault operator, typically within 24
hours of submission. Use getWithdrawalRequests to display current status to
users.
Smart Wallet Behavior
In auto mode, smart wallets are routed to approval mode so approve + withdraw can
be batched atomically.