Class CashuWallet

Class that represents a Cashu wallet. This class should act as the entry point for this library

Hierarchy

  • CashuWallet

Constructors

  • Parameters

    • mint: CashuMint

      Cashu mint instance is used to make api calls

    • Optional keys: MintKeys

      public keys from the mint

    Returns CashuWallet

Properties

_keys: MintKeys
_keysetId: string = ''
mint: CashuMint

Accessors

  • get keys(): MintKeys
  • Returns MintKeys

  • set keys(keys): void
  • Parameters

    Returns void

  • get keysetId(): string
  • Returns string

Methods

  • returns proofs that are already spent (use for keeping wallet state clean)

    Type Parameters

    • T extends {
          secret: string;
      }

    Parameters

    • proofs: T[]

      (only the 'secret' field is required)

    Returns Promise<T[]>

  • Parameters

    • amount: number

    Returns BlindedMessageData & {
        amounts: number[];
    }

  • Estimate fees for a given LN invoice

    Parameters

    • invoice: string

      LN invoice that needs to get a fee estimate

    Returns Promise<number>

    estimated Fee

  • Returns Promise<void>

  • Executes a payment of an invoice on the Lightning network. The combined amount of Proofs has to match the payment amount including fees.

    Parameters

    • invoice: string
    • proofsToSend: Proof[]

      the exact amount to send including fees

    • Optional feeReserve: number

    Returns Promise<PayLnInvoiceResponse>

  • Use a cashu token to pay an ln invoice

    Parameters

    • invoice: string

      Lightning invoice

    • token: string

      cashu token

    Returns Promise<PayLnInvoiceResponse>

  • Receive an encoded Cashu token

    Parameters

    • encodedToken: string

      Cashu token

    Returns Promise<ReceiveResponse>

    New token with newly created proofs, token entries that had errors, and newKeys if they have changed

  • Receive a single cashu token entry

    Parameters

    • tokenEntry: TokenEntry

      a single entry of a cashu token

    Returns Promise<ReceiveTokenEntryResponse>

    New token entry with newly created proofs, proofs that had errors, and newKeys if they have changed

  • Starts a minting process by requesting an invoice from the mint

    Parameters

    • amount: number

      Amount requesting for mint.

    Returns Promise<RequestMintResponse>

    the mint will create and return a Lightning invoice for the specified amount

  • Parameters

    • amount: number
    • hash: string

    Returns Promise<{
        newKeys?: MintKeys;
        proofs: Proof[];
    }>

  • Splits and creates sendable tokens

    Parameters

    • amount: number

      amount to send

    • proofs: Proof[]

      proofs matching that amount

    Returns Promise<SendResponse>

    promise of the change- and send-proofs

  • Parameters

    • amount: number
    • amountAvailable: number

    Returns {
        amount1: number;
        amount2: number;
    }

    • amount1: number
    • amount2: number

Generated using TypeDoc