pub struct WalletRepository { /* private fields */ }Expand description
FFI-compatible WalletRepository
Implementations§
Source§impl WalletRepository
impl WalletRepository
Sourcepub fn new(mnemonic: String, store: WalletStore) -> Result<Self, FfiError>
pub fn new(mnemonic: String, store: WalletStore) -> Result<Self, FfiError>
Create a new WalletRepository from locally persisted wallet state.
Construction does not make network requests to configured mints.
Accepts a WalletStore which can be:
Sqlite { path }— built-in Rust SQLite backendPostgres { url }— built-in Rust Postgres backendCustom { db }— foreign-language implementation ofWalletDatabase
Sourcepub fn new_with_proxy(
mnemonic: String,
store: WalletStore,
proxy_url: String,
) -> Result<Self, FfiError>
pub fn new_with_proxy( mnemonic: String, store: WalletStore, proxy_url: String, ) -> Result<Self, FfiError>
Create a new WalletRepository with proxy configuration.
Construction restores locally persisted wallet state without making network requests to configured mints. The proxy is used by subsequent mint operations.
Sourcepub async fn set_metadata_cache_ttl_for_mint(
&self,
mint_url: MintUrl,
ttl_secs: Option<u64>,
) -> Result<(), FfiError>
pub async fn set_metadata_cache_ttl_for_mint( &self, mint_url: MintUrl, ttl_secs: Option<u64>, ) -> Result<(), FfiError>
Set metadata cache TTL (time-to-live) in seconds for a specific mint
Controls how long cached mint metadata (keysets, keys, mint info) is considered fresh before requiring a refresh from the mint server for a specific mint.
§Arguments
mint_url- The mint URL to set the TTL forttl_secs- Optional TTL in seconds. If None, cache never expires.
Sourcepub async fn set_metadata_cache_ttl_for_all_mints(&self, ttl_secs: Option<u64>)
pub async fn set_metadata_cache_ttl_for_all_mints(&self, ttl_secs: Option<u64>)
Set metadata cache TTL (time-to-live) in seconds for all mints
Controls how long cached mint metadata is considered fresh for all mints in this WalletRepository.
§Arguments
ttl_secs- Optional TTL in seconds. If None, cache never expires for any mint.
Sourcepub async fn create_wallet(
&self,
mint_url: MintUrl,
unit: Option<CurrencyUnit>,
target_proof_count: Option<u32>,
) -> Result<(), FfiError>
pub async fn create_wallet( &self, mint_url: MintUrl, unit: Option<CurrencyUnit>, target_proof_count: Option<u32>, ) -> Result<(), FfiError>
Add a mint to this WalletRepository
Sourcepub async fn remove_wallet(
&self,
mint_url: MintUrl,
currency_unit: CurrencyUnit,
) -> Result<(), FfiError>
pub async fn remove_wallet( &self, mint_url: MintUrl, currency_unit: CurrencyUnit, ) -> Result<(), FfiError>
Remove mint from WalletRepository
Sourcepub fn mint_backup_public_key(&self) -> Result<String, FfiError>
pub fn mint_backup_public_key(&self) -> Result<String, FfiError>
Get the NUT-27 mint backup public key as hex.
Sourcepub async fn backup_mints(
&self,
relays: Vec<String>,
options: BackupOptions,
) -> Result<BackupResult, FfiError>
pub async fn backup_mints( &self, relays: Vec<String>, options: BackupOptions, ) -> Result<BackupResult, FfiError>
Backup the current mint list to Nostr relays using NUT-27.
Sourcepub async fn restore_mints(
&self,
relays: Vec<String>,
add_mints: bool,
options: RestoreOptions,
) -> Result<RestoreResult, FfiError>
pub async fn restore_mints( &self, relays: Vec<String>, add_mints: bool, options: RestoreOptions, ) -> Result<RestoreResult, FfiError>
Restore the mint list from Nostr relays using NUT-27.
Sourcepub async fn fetch_mint_backup(
&self,
relays: Vec<String>,
options: RestoreOptions,
) -> Result<MintBackup, FfiError>
pub async fn fetch_mint_backup( &self, relays: Vec<String>, options: RestoreOptions, ) -> Result<MintBackup, FfiError>
Fetch the NUT-27 mint backup without adding mints to the repository.
Sourcepub async fn get_balances(&self) -> Result<HashMap<WalletKey, Amount>, FfiError>
pub async fn get_balances(&self) -> Result<HashMap<WalletKey, Amount>, FfiError>
Get wallet balances for all mints
Sourcepub async fn get_wallets(&self) -> Vec<Arc<Wallet>>
pub async fn get_wallets(&self) -> Vec<Arc<Wallet>>
Get all wallets from WalletRepository
Sourcepub async fn get_wallet(
&self,
mint_url: MintUrl,
unit: CurrencyUnit,
) -> Result<Arc<Wallet>, FfiError>
pub async fn get_wallet( &self, mint_url: MintUrl, unit: CurrencyUnit, ) -> Result<Arc<Wallet>, FfiError>
Get a specific wallet from WalletRepository by mint URL
Returns an error if no wallet exists for the given mint URL.
Trait Implementations§
Source§impl<UT> LiftRef<UT> for WalletRepository
impl<UT> LiftRef<UT> for WalletRepository
type LiftType = Arc<WalletRepository>
Source§impl<UT> LowerError<UT> for WalletRepository
impl<UT> LowerError<UT> for WalletRepository
Source§fn lower_error(obj: Self) -> RustBuffer
fn lower_error(obj: Self) -> RustBuffer
Source§impl<UT> LowerReturn<UT> for WalletRepository
impl<UT> LowerReturn<UT> for WalletRepository
Source§type ReturnType = <Arc<WalletRepository> as LowerReturn<UniFfiTag>>::ReturnType
type ReturnType = <Arc<WalletRepository> as LowerReturn<UniFfiTag>>::ReturnType
Source§fn lower_return(obj: Self) -> Result<Self::ReturnType, RustCallError>
fn lower_return(obj: Self) -> Result<Self::ReturnType, RustCallError>
Source§fn handle_failed_lift(
error: LiftArgsError,
) -> Result<Self::ReturnType, RustCallError>
fn handle_failed_lift( error: LiftArgsError, ) -> Result<Self::ReturnType, RustCallError>
Source§impl<UT> TypeId<UT> for WalletRepository
impl<UT> TypeId<UT> for WalletRepository
Auto Trait Implementations§
impl !RefUnwindSafe for WalletRepository
impl !UnwindSafe for WalletRepository
impl Freeze for WalletRepository
impl Send for WalletRepository
impl Sync for WalletRepository
impl Unpin for WalletRepository
impl UnsafeUnpin for WalletRepository
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for 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