import { BorrowSDK, ChainType } from '@satsterminal-sdk/borrow';
async function withdrawToMyWallet() {
const sdk = new BorrowSDK({
apiKey: process.env.API_KEY!,
chain: ChainType.ARBITRUM,
wallet: walletProvider
});
await sdk.setup();
// Check available balance
const positions = await sdk.getWalletPositions();
const usdcBalance = positions.data.find(
p => p.attributes.fungible_info?.symbol === 'USDC'
)?.attributes.quantity.float || 0;
console.log('Available USDC:', usdcBalance);
if (usdcBalance < 10) {
console.log('Insufficient balance');
return;
}
// Withdraw to your personal wallet (gasless!)
const myWallet = '0x742d35Cc6634C0532925a3b844Bc9e7595f...';
const txHash = await sdk.withdrawToEVM({
chain: ChainType.ARBITRUM,
amount: usdcBalance.toString(),
destinationAddress: myWallet
});
console.log('Withdrawal complete!');
console.log('TX Hash:', txHash);
console.log('View:', `https://arbiscan.io/tx/${txHash}`);
}