Skip to main content

withdrawFunds

Initiate a withdrawal from active positions to user's EOA. Supports both full and partial withdrawals. Processed asynchronously by backend.

Funds are always withdrawn to the Safe owner's address (the userAddress parameter).

Signature

withdrawFunds(userAddress: string, chainId: SupportedChainId, amount?: string): Promise<WithdrawResponse>

Parameters

ParameterTypeRequiredDescription
userAddressstringUser's EOA address (owner of the Safe)
chainIdSupportedChainIdChain to withdraw from
amountstringAmount to withdraw (omit for full withdrawal)

Returns

Withdraw response with status message

Return Type

interface WithdrawResponse {
success: boolean;
message: string;
txHash?: string;
type: 'full' | 'partial';
amount: string;
}

Example

// Full withdrawal (withdrawn to user's EOA)
const result = await sdk.withdrawFunds("0xUser...", 42161);
console.log(result.message); // "Withdrawal request sent"

// Partial withdrawal of 50 USDC (6 decimals)
const partial = await sdk.withdrawFunds(
"0xUser...",
42161,
"50000000" // 50 USDC = 50 * 10^6
);
console.log(partial.type); // "partial"