Module wallet

Source
Expand description

§CDK Wallet

The CDK Wallet is a high level Cashu wallet. The Wallet is for a single mint and single unit. Multiple Wallets can be created to support multi mints and multi units.

§Example

§Create Wallet

  use std::sync::Arc;
  use cdk::nuts::CurrencyUnit;
  use cdk::wallet::Wallet;
  use cdk_sqlite::wallet::memory;
  use rand::Rng;

  #[tokio::main]
  async fn main() -> anyhow::Result<()> {
    let seed = rand::thread_rng().gen::<[u8; 32]>();
    let mint_url = "https://testnut.cashu.space";
    let unit = CurrencyUnit::Sat;

    let localstore = memory::empty().await?;
    let wallet = Wallet::new(mint_url, unit, Arc::new(localstore), &seed, None);
    Ok(())
  }

Re-exports§

pub use multi_mint_wallet::MultiMintWallet;

Modules§

multi_mint_wallet
MultiMint Wallet
subscription
Client for subscriptions
types
Wallet Types
util
Wallet Utility Functions

Structs§

AuthHttpClient
Http Client
AuthWallet
CDK Auth Wallet
HttpClient
Http Client
MeltQuote
Melt Quote Info
MintQuote
Mint Quote Info
PreparedSend
Prepared send
SendMemo
Send memo
SendOptions
Send options
Wallet
CDK Wallet
WalletBuilder
Builder for creating a new Wallet

Enums§

SendKind
Send Kind
WalletSubscription
Wallet Subscription filter

Traits§

AuthMintConnector
Interface that connects a wallet to a mint. Typically represents an [HttpClient].
MintConnector
Interface that connects a wallet to a mint. Typically represents an HttpClient.