Class represents Cashu Mint API. This class contains Lower level functions that are implemented by CashuWallet.

Constructors

  • Parameters

    • _mintUrl: string

      requires mint URL to create this object

    • Optional_customRequest: <T>(options: RequestOptions) => Promise<T>

      if passed, use custom request implementation for network communication with the mint

    Returns CashuMint

Accessors

  • get webSocketConnection(): undefined | WSConnection
  • Returns undefined | WSConnection

Methods

  • Gets an existing mint quote from the mint.

    Parameters

    • quote: string

      Quote ID

    Returns Promise<MintQuoteResponse>

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

  • Tries to establish a websocket connection with the websocket mint url according to NUT-17

    Returns Promise<void>

  • Closes a websocket connection

    Returns void

  • Get the mints public keys

    Parameters

    • OptionalkeysetId: string

      optional param to get the keys for a specific keyset. If not specified, the keys from all active keysets are fetched

    • OptionalmintUrl: string

    Returns Promise<MintActiveKeys>

    the mints public keys

  • Checks if specific proofs have already been redeemed

    Parameters

    • mintUrl: string
    • checkPayload: CheckStatePayload
    • OptionalcustomRequest: <T>(options: RequestOptions) => Promise<T>

    Returns Promise<CheckStateResponse>

    redeemed and unredeemed ordered list of booleans

  • Gets an existing melt quote.

    Parameters

    • mintUrl: string
    • quote: string

      Quote ID

    • OptionalcustomRequest: <T>(options: RequestOptions) => Promise<T>

    Returns Promise<MeltQuoteResponse>

  • Gets an existing mint quote from the mint.

    Parameters

    • mintUrl: string
    • quote: string

      Quote ID

    • OptionalcustomRequest: <T>(options: RequestOptions) => Promise<T>

    Returns Promise<MintQuoteResponse>

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

  • Requests a new mint quote from the mint.

    Parameters

    • mintUrl: string
    • mintQuotePayload: MintQuotePayload

      Payload for creating a new mint quote

    • OptionalcustomRequest: <T>(options: RequestOptions) => Promise<T>

    Returns Promise<MintQuoteResponse>

    the mint will create and return a new mint quote containing a payment request for the specified amount and unit

  • fetches mints info at the /info endpoint

    Parameters

    • mintUrl: string
    • OptionalcustomRequest: <T>(options: RequestOptions) => Promise<T>

    Returns Promise<GetInfoResponse>

  • Get the mints public keys

    Parameters

    • mintUrl: string
    • OptionalkeysetId: string

      optional param to get the keys for a specific keyset. If not specified, the keys from all active keysets are fetched

    • OptionalcustomRequest: <T>(options: RequestOptions) => Promise<T>

    Returns Promise<MintActiveKeys>

  • Get the mints keysets in no specific order

    Parameters

    • mintUrl: string
    • OptionalcustomRequest: <T>(options: RequestOptions) => Promise<T>

    Returns Promise<MintAllKeysets>

    all the mints past and current keysets.

  • Requests the mint to pay for a Bolt11 payment request by providing ecash as inputs to be spent. The inputs contain the amount and the fee_reserves for a Lightning payment. The payload can also contain blank outputs in order to receive back overpaid Lightning fees.

    Parameters

    • mintUrl: string
    • meltPayload: MeltPayload
    • OptionalcustomRequest: <T>(options: RequestOptions) => Promise<T>

    Returns Promise<MeltQuoteResponse>

  • Mints new tokens by requesting blind signatures on the provided outputs.

    Parameters

    • mintUrl: string
    • mintPayload: MintPayload

      Payload containing the outputs to get blind signatures on

    • OptionalcustomRequest: <T>(options: RequestOptions) => Promise<T>

    Returns Promise<MintResponse>

    serialized blinded signatures

  • Performs a swap operation with ecash inputs and outputs.

    Parameters

    • mintUrl: string
    • swapPayload: SwapPayload

      payload containing inputs and outputs

    • OptionalcustomRequest: <T>(options: RequestOptions) => Promise<T>

    Returns Promise<SwapResponse>

    signed outputs