pub struct LightspeedClientBuilder { /* private fields */ }Expand description
Builder for creating Lightspeed client instances
Provides a fluent interface for configuring the client before initialization.
§Example
use lightspeed_sdk::{LightspeedClientBuilder, Priority};
use std::time::Duration;
let client = LightspeedClientBuilder::new("your-api-key")
.svs_rpc_url("https://basic.rpc.solanavibestation.com")
.default_priority(Priority::Standard)
.timeout(Duration::from_secs(60))
.debug(true)
.build()?;Implementations§
Source§impl LightspeedClientBuilder
impl LightspeedClientBuilder
Sourcepub fn new(api_key: impl Into<String>) -> Self
pub fn new(api_key: impl Into<String>) -> Self
Creates a new builder with the required API key
§Arguments
api_key- Your Lightspeed API key from Solana Vibe Station
Sourcepub fn svs_rpc_url(self, url: impl Into<String>) -> Self
pub fn svs_rpc_url(self, url: impl Into<String>) -> Self
Sets the SVS RPC URL
§Arguments
url- Your SVS RPC endpoint URL (e.g., “https://basic.rpc.solanavibestation.com”)
The URL will be automatically converted to the Lightspeed endpoint format.
Sourcepub fn default_priority(self, priority: Priority) -> Self
pub fn default_priority(self, priority: Priority) -> Self
Sets the default priority for transactions
Transactions sent without specifying priority will use this setting.
§Arguments
priority- Default priority level
Sourcepub fn keep_alive_interval(self, interval: Duration) -> Self
pub fn keep_alive_interval(self, interval: Duration) -> Self
Sets the keep-alive interval
Determines how frequently keep-alive requests are sent when automatic keep-alive is enabled.
§Arguments
interval- Duration between keep-alive requests
Sourcepub fn custom_endpoint(self, endpoint: impl Into<String>) -> Self
pub fn custom_endpoint(self, endpoint: impl Into<String>) -> Self
Sets a custom endpoint URL
This is primarily intended for testing or connecting to alternative Lightspeed deployments. When set, this overrides the SVS RPC URL processing.
§Arguments
endpoint- Custom endpoint URL
Sourcepub fn balance_check_rpc_url(self, url: impl Into<String>) -> Self
pub fn balance_check_rpc_url(self, url: impl Into<String>) -> Self
Sets the Solana RPC URL for balance checks
This RPC endpoint is used to query account balances before sending transactions (when balance checking is enabled). Defaults to the public SVS endpoint.
§Arguments
url- Solana RPC endpoint URL
Sourcepub fn check_balance_before_send(self, enabled: bool) -> Self
pub fn check_balance_before_send(self, enabled: bool) -> Self
Enables or disables balance checking before sending transactions
When enabled, the client will verify sufficient balance via RPC before submitting transactions. This prevents wasting transaction fees on transactions that will fail due to insufficient funds.
§Arguments
enabled- Whether to check balance before sending
Sourcepub fn build(self) -> Result<LightspeedClient, LightspeedError>
pub fn build(self) -> Result<LightspeedClient, LightspeedError>
Builds and returns the configured Lightspeed client
§Errors
Returns an error if client initialization fails due to invalid configuration or network issues.
Auto Trait Implementations§
impl Freeze for LightspeedClientBuilder
impl RefUnwindSafe for LightspeedClientBuilder
impl Send for LightspeedClientBuilder
impl Sync for LightspeedClientBuilder
impl Unpin for LightspeedClientBuilder
impl UnwindSafe for LightspeedClientBuilder
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more