Skip to main content

default_server_config

Function default_server_config 

Source
pub fn default_server_config(network: Network) -> Config
Expand description

Builds a Config suitable for multi-tenant server-mode deployments.

This preset returns the same configuration as default_config with background_tasks_enabled set to false. In server mode, the SDK is treated as a library: the host orchestrates sync, claiming, and event delivery (typically via webhooks) explicitly, so an ephemeral SDK instance stays cheap and predictable.

Config fields whose background services are gated off are reset to their inactive shape: real_time_sync_server_url is set to None, and both leaf_optimization_config.auto_enabled and token_optimization_config.auto_enabled are set to false. The SDK rejects builds where background_tasks_enabled is false and any of those fields is left in its active shape, so flip the flag via this helper rather than by hand.

Explicit operations (sync_wallet, claim_deposit, list_unclaimed_deposits, refund_deposit, refund_pending_conversions, etc.) continue to work and are the intended entry points in this mode.

Stable Balance is not supported in this mode because its conversion worker is a background service.

One-time setup that the SDK normally applies automatically — notably private_enabled_default — is NOT applied in this mode. Drive setup explicitly via update_user_settings (and any other relevant APIs) so ephemeral per-request SDK instances incur no implicit setup overhead.

get_info reads balance directly from the spark wallet in this mode rather than from the background-maintained storage cache, so balance reflects the latest local sync and ensure_synced=true is rejected with an invalid-input error