Files
sol-trade-sdk/src/common/types.rs
T

40 lines
1.2 KiB
Rust
Raw Normal View History

use crate::swqos::SwqosConfig;
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,
/// 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,
/// 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,
create_wsol_ata_on_startup: bool,
wsol_use_seed: bool,
mint_use_seed: bool,
2025-09-17 11:14:15 +08:00
) -> Self {
Self {
rpc_url,
swqos_configs,
commitment,
create_wsol_ata_on_startup,
wsol_use_seed,
mint_use_seed,
}
}
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;
pub type AnyResult<T> = anyhow::Result<T>;