Struct mutiny_core::MutinyWallet
source · 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>
impl<S: MutinyStorage> MutinyWallet<S>
pub async fn new( storage: S, config: MutinyWalletConfig, session_id: Option<String> ) -> Result<MutinyWallet<S>, MutinyError>
sourcepub async fn start(&mut self) -> Result<(), MutinyError>
pub async fn start(&mut self) -> Result<(), MutinyError>
Starts up all the nodes again.
Not needed after NodeManager’s new()
function.
sourcepub async fn check_subscribed(&self) -> Result<Option<u64>, MutinyError>
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.
sourcepub async fn pay_subscription_invoice(
&self,
inv: &Bolt11Invoice,
autopay: bool
) -> Result<(), MutinyError>
pub async fn pay_subscription_invoice( &self, inv: &Bolt11Invoice, autopay: bool ) -> Result<(), MutinyError>
Pay the subscription invoice. This will post a NWC automatically afterwards.
sourcepub async fn sync_nostr_contacts(
&self,
primal_url: Option<&str>,
npub: XOnlyPublicKey
) -> Result<(), MutinyError>
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
sourcepub async fn stop(&self) -> Result<(), MutinyError>
pub async fn stop(&self) -> Result<(), MutinyError>
Stops all of the nodes and background processes. Returns after node has been stopped.
pub async fn change_password( &mut self, old: Option<String>, new: Option<String> ) -> Result<(), MutinyError>
sourcepub async fn reset_onchain_tracker(&mut self) -> Result<(), MutinyError>
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.
sourcepub async fn restore_mnemonic(
storage: S,
m: Mnemonic
) -> Result<(), MutinyError>
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>
impl<S: Clone + MutinyStorage> Clone for MutinyWallet<S>
source§fn clone(&self) -> MutinyWallet<S>
fn clone(&self) -> MutinyWallet<S>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more