2025-09-19 00:49:45 +08:00
|
|
|
use crate::swqos::SwqosConfig;
|
2025-09-27 14:24:41 +08:00
|
|
|
use solana_commitment_config::CommitmentConfig;
|
2025-09-17 11:14:15 +08:00
|
|
|
|
|
|
|
|
#[derive(Debug, Clone)]
|
|
|
|
|
pub struct TradeConfig {
|
|
|
|
|
pub rpc_url: String,
|
|
|
|
|
pub swqos_configs: Vec<SwqosConfig>,
|
|
|
|
|
pub commitment: CommitmentConfig,
|
2025-11-07 16:57:28 +08:00
|
|
|
/// Whether to create WSOL ATA on startup (default: true)
|
|
|
|
|
/// If true, SDK will check WSOL ATA on initialization and create if not exists
|
|
|
|
|
pub create_wsol_ata_on_startup: bool,
|
2025-11-21 13:05:39 +08:00
|
|
|
/// Whether to use seed optimization for WSOL ATA operations (default: false)
|
|
|
|
|
pub wsol_use_seed: bool,
|
|
|
|
|
/// Whether to use seed optimization for other mint ATA operations (default: true)
|
|
|
|
|
pub mint_use_seed: bool,
|
2025-09-17 11:14:15 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl TradeConfig {
|
|
|
|
|
pub fn new(
|
|
|
|
|
rpc_url: String,
|
|
|
|
|
swqos_configs: Vec<SwqosConfig>,
|
|
|
|
|
commitment: CommitmentConfig,
|
2025-11-21 13:05:39 +08:00
|
|
|
create_wsol_ata_on_startup: bool,
|
|
|
|
|
wsol_use_seed: bool,
|
|
|
|
|
mint_use_seed: bool,
|
2025-09-17 11:14:15 +08:00
|
|
|
) -> Self {
|
2025-11-07 16:57:28 +08:00
|
|
|
Self {
|
|
|
|
|
rpc_url,
|
|
|
|
|
swqos_configs,
|
|
|
|
|
commitment,
|
2025-11-21 13:05:39 +08:00
|
|
|
create_wsol_ata_on_startup,
|
|
|
|
|
wsol_use_seed,
|
|
|
|
|
mint_use_seed,
|
2025-11-07 16:57:28 +08:00
|
|
|
}
|
|
|
|
|
}
|
2025-09-17 11:14:15 +08:00
|
|
|
}
|
|
|
|
|
|
2025-04-02 13:39:59 +08:00
|
|
|
pub type SolanaRpcClient = solana_client::nonblocking::rpc_client::RpcClient;
|
2025-04-10 11:04:55 +08:00
|
|
|
pub type AnyResult<T> = anyhow::Result<T>;
|