Operation - Withdraw
Key Steps
Usage
Example
import { parseEther } from 'viem';
import { publicClient, walletClient, protocolConfig, collateral } from 'satoshi-sdk';
async function withdrawCollateral() {
// Step 1: Define the amount to withdraw
const withdrawCollAmt = parseEther('0.01'); // Withdrawing 0.01 ETH worth of collateral
// Step 2: Execute the withdrawal transaction
const receipt = await satoshiClient.Postition.doWithdraw({
publicClient,
walletClient,
protocolConfig,
collateral,
withdrawCollAmt,
});
console.log('Withdrawal successful:', receipt);
}
withdrawCollateral();Last updated