Overview
Manage your funds with the LFG SDK through deposits, withdrawals, and transfers. This guide covers all fund movement operations.Deposit
Move funds from wallet to trading subaccount
Withdraw
Move funds from subaccount back to wallet
Transfer
Transfer between subaccounts
Deposit to Subaccount
Basic Deposit
Deposit USDC from your wallet to a trading subaccount:SubaccountInfo
required
The subaccount to deposit into
string
required
Amount in USDC to deposit (as string)
string
Optional memo for the transaction
Deposit with Memo
Check Source Balance Before Deposit
Deposits require gas fees. Ensure you have enough USDC for both the deposit
amount and gas.
Withdraw from Subaccount
Basic Withdrawal
Withdraw USDC from a subaccount back to your wallet:SubaccountInfo
required
The subaccount to withdraw from
string
required
Amount in USDC to withdraw (as string)
string
required
Address to receive the withdrawal
string
Optional memo for the transaction
Withdraw to Different Address
Safe Withdrawal with Balance Check
Transfer Between Subaccounts
Basic Transfer
Transfer USDC from one subaccount to another:SubaccountInfo
required
The source subaccount (sending funds)
string
required
The recipient wallet address (can be same wallet)
number
required
The destination subaccount number
string
required
Amount in USDC to transfer (as string)
string
Optional memo for the transaction
Transfer Between Different Wallets
Transfer from your subaccount to another user’s subaccount:Send Tokens from Source
Send tokens directly from your source wallet (outside subaccounts):This sends tokens from your source wallet, not from subaccounts. Use
transferToSubaccount for subaccount transfers.Transaction Memos
Adding Memos to Transactions
Memos help you track and organize transactions:Memo Best Practices
Handling Transaction Errors
Retry Logic
Error Handling
Fund Management Strategies
Automated Rebalancing
Emergency Withdrawal
Best Practices
Always Check Balances First
Always Check Balances First
Verify sufficient funds before initiating transfers:
Use Meaningful Memos
Use Meaningful Memos
Add descriptive memos to track transaction purposes:
Maintain Adequate Margin
Maintain Adequate Margin
Never withdraw all free collateral while holding positions:
Handle Network Errors
Handle Network Errors
Implement retry logic for network failures:
Next Steps
Market Data
Query markets and orderbooks
Balances Guide
Monitor balances and positions
CompositeClient Reference
Complete CompositeClient API
ValidatorClient Reference
Detailed ValidatorClient documentation