refactor: split auto_handle_wsol into create/close_wsol_ata params
- Replace auto_handle_wsol with create_wsol_ata and close_wsol_ata - Enable fine-grained control over wSOL account lifecycle - Update all trading protocols and documentation - Add open_seed_optimize support in fast functions This provides better flexibility for batch operations and advanced trading.
This commit is contained in:
@@ -47,16 +47,25 @@ sol-trade-sdk = "0.6.1"
|
||||
|
||||
### Important Parameter Description
|
||||
|
||||
#### auto_handle_wsol Parameter
|
||||
#### create_wsol_ata and close_wsol_ata Parameters
|
||||
|
||||
In PumpSwap, Bonk, and Raydium CPMM trading, the `auto_handle_wsol` parameter is used to automatically handle wSOL (Wrapped SOL):
|
||||
In PumpSwap, Bonk, and Raydium trading, the `create_wsol_ata` and `close_wsol_ata` parameters provide fine-grained control over wSOL (Wrapped SOL) account management:
|
||||
|
||||
- **Mechanism**:
|
||||
- When `auto_handle_wsol: true`, the SDK automatically handles the conversion between SOL and wSOL
|
||||
- **create_wsol_ata**:
|
||||
- When `create_wsol_ata: true`, the SDK automatically creates and wraps SOL to wSOL before trading
|
||||
- When buying: automatically wraps SOL to wSOL for trading
|
||||
- When selling: automatically unwraps the received wSOL to SOL
|
||||
- Default value is `true`
|
||||
|
||||
- **close_wsol_ata**:
|
||||
- When `close_wsol_ata: true`, the SDK automatically closes the wSOL account and unwraps to SOL after trading
|
||||
- When selling: automatically unwraps the received wSOL to SOL and reclaims rent
|
||||
- Default value is `true`
|
||||
|
||||
- **Benefits of Separate Parameters**:
|
||||
- Allows independent control of wSOL account creation and closure
|
||||
- Useful for batch operations where you want to create once and close after multiple transactions
|
||||
- Provides flexibility for advanced trading strategies
|
||||
|
||||
#### lookup_table_key Parameter
|
||||
|
||||
The `lookup_table_key` parameter is an optional `Pubkey` that specifies an address lookup table for transaction optimization. You need to use `AddressLookupTableCache` to manage the cached address lookup table before using it.
|
||||
|
||||
Reference in New Issue
Block a user