pub struct SdkBuilder { /* private fields */ }Expand description
Builder for creating BreezSdk instances with customizable components.
Implementations§
Source§impl SdkBuilder
impl SdkBuilder
Sourcepub fn new(config: Config, seed: Seed) -> Self
pub fn new(config: Config, seed: Seed) -> Self
Creates a new SdkBuilder with the provided configuration and seed.
For external signer support, use new_with_signer instead.
§Arguments
config: The configuration to be used.seed: The seed for wallet generation.
Sourcepub fn new_with_signer(
config: Config,
breez_signer: Arc<dyn ExternalBreezSigner>,
spark_signer: Arc<dyn ExternalSparkSigner>,
) -> Self
pub fn new_with_signer( config: Config, breez_signer: Arc<dyn ExternalBreezSigner>, spark_signer: Arc<dyn ExternalSparkSigner>, ) -> Self
Creates a new SdkBuilder with the provided configuration and external signers.
§Arguments
config: The configuration to be used.breez_signer: External signer for non-Spark SDK signing (LNURL-auth, real-time sync, message signing, ECIES).spark_signer: External high-level Spark signer for the Spark wallet.
Sourcepub fn new_with_signing_only_signer(
config: Config,
breez_signer: Arc<dyn ExternalSigningSigner>,
spark_signer: Arc<dyn ExternalSparkSigner>,
) -> Self
pub fn new_with_signing_only_signer( config: Config, breez_signer: Arc<dyn ExternalSigningSigner>, spark_signer: Arc<dyn ExternalSparkSigner>, ) -> Self
Creates a new SdkBuilder with a signing-only external signer.
Use this for a signer that can’t perform the SDK’s local ECIES/HMAC operations (for example a policy-restricted enclave). The SDK keeps session tokens in plaintext and disables the features that rely on ECIES/HMAC.
§Arguments
config: The configuration to be used.breez_signer: Signing-only external signer for non-Spark SDK signing.spark_signer: External high-level Spark signer for the Spark wallet.
Sourcepub fn with_account_number(self, account_number: u32) -> Self
pub fn with_account_number(self, account_number: u32) -> Self
Sets the account number for key derivation. All wallet keys derive from
the seed at m/8797555'/<account number>', so each account number
yields an independent wallet from the same seed.
When unset, the account number defaults to 0 on Regtest and 1 on all other networks.
Note: This only applies when using a seed-based signer. It has no effect
when using an external signer (created with new_with_signer).
§Arguments
account_number: The account number in the derivation path.
Sourcepub fn with_storage_backend(self, storage: Arc<dyn StorageBackend>) -> Self
pub fn with_storage_backend(self, storage: Arc<dyn StorageBackend>) -> Self
Sets the storage backend to be used by the SDK.
Build the StorageBackend with
default_storage,
postgres_storage,
mysql_storage or
custom_storage.
Arguments:
storage: The storage backend to be used.
Sourcepub fn with_session_store(self, session_store: Arc<dyn SessionStore>) -> Self
pub fn with_session_store(self, session_store: Arc<dyn SessionStore>) -> Self
Overrides the session store used to cache Spark operator and SSP auth
tokens, replacing the one the StorageBackend provides.
Supply any [SessionStore]: a different persistence layer, or a decorator
that wraps the backend’s own store (from
default_session_store) to transform
tokens on read/write while keeping its persistence. One such transform is
at-rest encryption, which the SDK does not apply itself: wrap the store in
a [SessionStore] that encrypts in set_session and decrypts in
get_session.
Arguments:
session_store: The session store to use in place of the backend’s.
Sourcepub fn with_storage(self, storage: Arc<dyn Storage>) -> Self
👎Deprecated: use with_storage_backend(custom_storage(storage))
pub fn with_storage(self, storage: Arc<dyn Storage>) -> Self
with_storage_backend(custom_storage(storage))Deprecated. Use
with_storage_backend with
custom_storage.
Arguments:
storage: The storage implementation to be used.
Threads a shared SdkContext into this builder.
Construct the context once via new_shared_sdk_context and pass the
same Arc to every SdkBuilder whose SDKs should share its underlying
resources (operator gRPC channels, SSP HTTP client, database pool).
If not set, build() constructs a context internally from the SDK’s
own network and api key — fine for a single-SDK process with no DB
backend.
Sourcepub fn with_chain_service(
self,
chain_service: Arc<dyn BitcoinChainService>,
) -> Self
pub fn with_chain_service( self, chain_service: Arc<dyn BitcoinChainService>, ) -> Self
Sets the chain service to be used by the SDK. Arguments:
chain_service: The chain service to be used.
Sourcepub fn with_rest_chain_service(
self,
url: String,
api_type: ChainApiType,
credentials: Option<Credentials>,
) -> Self
pub fn with_rest_chain_service( self, url: String, api_type: ChainApiType, credentials: Option<Credentials>, ) -> Self
Configures a REST chain service to be used by the SDK.
The service is constructed during build() so it can
reuse the shared HTTP client carried by the SdkContext.
Arguments:
url: The base URL of the REST API.api_type: The API type to be used.credentials: Optional credentials for basic authentication.
Sourcepub fn with_fiat_service(self, fiat_service: Arc<dyn FiatService>) -> Self
pub fn with_fiat_service(self, fiat_service: Arc<dyn FiatService>) -> Self
Sets the fiat service to be used by the SDK. Arguments:
fiat_service: The fiat service to be used.
pub fn with_lnurl_client(self, lnurl_client: Arc<dyn RestClient>) -> Self
pub fn with_lnurl_server_client( self, lnurl_serverclient: Arc<dyn LnurlServerClient>, ) -> Self
Sourcepub fn with_payment_observer(
self,
payment_observer: Arc<dyn PaymentObserver>,
) -> Self
pub fn with_payment_observer( self, payment_observer: Arc<dyn PaymentObserver>, ) -> Self
Sets the payment observer to be used by the SDK. This observer will receive callbacks before outgoing payments for Lightning, Spark and onchain Bitcoin. Arguments:
payment_observer: The payment observer to be used.
Trait Implementations§
Source§impl Clone for SdkBuilder
impl Clone for SdkBuilder
Source§fn clone(&self) -> SdkBuilder
fn clone(&self) -> SdkBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for SdkBuilder
impl !RefUnwindSafe for SdkBuilder
impl Send for SdkBuilder
impl Sync for SdkBuilder
impl Unpin for SdkBuilder
impl UnsafeUnpin for SdkBuilder
impl !UnwindSafe for SdkBuilder
Blanket Implementations§
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request