Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.positions.finance/llms.txt

Use this file to discover all available pages before exploring further.

Withdrawals are a two-step process: Queue -> Complete.

Step 1: Queue Withdrawal

const amountToWithdraw = 50;
const txQueue = await sdk.queueWithdraw(usdcAddress, amountToWithdraw);
console.log("Withdrawal queued:", txQueue);

Step 2: Complete Withdrawal

Once the protocol (or backend keeper) approves the withdrawal, the user must finalize it on-chain. You can find approved requests by filtering transactions.
// 1. Find approved withdrawal requests
const transactions = await sdk.getTransactions({
    type: "withdraw",
    status: "approved"
});

// 2. Complete them
for (const tx of transactions.data) {
    if (tx.platform === "lending-pool") {
        console.log(`Completing withdrawal for ${tx.amount} ${tx.asset}...`);

        const txComplete = await sdk.completeWithdraw(
            tx.asset as Address,
            tx.requestId!
        );
        console.log("Withdrawal completed:", txComplete);
    }
}