pub struct MutinyWallet<S: MutinyStorage> {
    pub config: MutinyWalletConfig,
    pub storage: S,
    pub node_manager: Arc<NodeManager<S>>,
    pub nostr: Arc<NostrManager<S>>,
}
Expand description

MutinyWallet is the main entry point for the library. It contains the NodeManager, which is the main interface to manage the bitcoin and the lightning functionality.

Fields§

§config: MutinyWalletConfig§storage: S§node_manager: Arc<NodeManager<S>>§nostr: Arc<NostrManager<S>>

Implementations§

source§

impl<S: MutinyStorage> MutinyWallet<S>

source

pub async fn new( storage: S, config: MutinyWalletConfig, session_id: Option<String> ) -> Result<MutinyWallet<S>, MutinyError>

source

pub async fn start(&mut self) -> Result<(), MutinyError>

Starts up all the nodes again. Not needed after NodeManager’s new() function.

source

pub async fn check_subscribed(&self) -> Result<Option<u64>, MutinyError>

Checks whether or not the user is subscribed to Mutiny+. Submits a NWC string to keep the subscription active if not expired.

Returns None if there’s no subscription at all. Returns Some(u64) for their unix expiration timestamp, which may be in the past or in the future, depending on whether or not it is currently active.

source

pub async fn pay_subscription_invoice( &self, inv: &Bolt11Invoice, autopay: bool ) -> Result<(), MutinyError>

Pay the subscription invoice. This will post a NWC automatically afterwards.

source

pub async fn sync_nostr_contacts( &self, primal_url: Option<&str>, npub: XOnlyPublicKey ) -> Result<(), MutinyError>

Get contacts from the given npub and sync them to the wallet

source

pub async fn stop(&self) -> Result<(), MutinyError>

Stops all of the nodes and background processes. Returns after node has been stopped.

source

pub async fn change_password( &mut self, old: Option<String>, new: Option<String> ) -> Result<(), MutinyError>

source

pub async fn reset_onchain_tracker(&mut self) -> Result<(), MutinyError>

Resets BDK’s keychain tracker. This will require a re-sync of the blockchain.

This can be useful if you get stuck in a bad state.

source

pub async fn restore_mnemonic( storage: S, m: Mnemonic ) -> Result<(), MutinyError>

Restores the mnemonic after deleting the previous state.

Backup the state beforehand. Does not restore lightning data. Should refresh or restart afterwards. Wallet should be stopped.

Trait Implementations§

source§

impl<S: Clone + MutinyStorage> Clone for MutinyWallet<S>

source§

fn clone(&self) -> MutinyWallet<S>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl<S> !RefUnwindSafe for MutinyWallet<S>

§

impl<S> !Send for MutinyWallet<S>

§

impl<S> !Sync for MutinyWallet<S>

§

impl<S> Unpin for MutinyWallet<S>where S: Unpin,

§

impl<S> !UnwindSafe for MutinyWallet<S>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more