Class CashuMint

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

Hierarchy

  • CashuMint

Constructors

  • Parameters

    • _mintUrl: string

      requires mint URL to create this object

    • Optional _customRequest: (<T>(options) => Promise<T>)

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

        • <T>(options): Promise<T>
        • Type Parameters

          • T

          Parameters

          • options: RequestOptions

          Returns Promise<T>

    Returns CashuMint

Properties

_customRequest?: (<T>(options) => Promise<T>)

Type declaration

    • <T>(options): Promise<T>
    • if passed, use custom request implementation for network communication with the mint

      Type Parameters

      • T

      Parameters

      • options: RequestOptions

      Returns Promise<T>

_mintUrl: string

requires mint URL to create this object

Accessors

Methods

  • Estimate fees for a given LN invoice

    Parameters

    • checkfeesPayload: {
          pr: string;
      }

      Payload containing LN invoice that needs to get a fee estimate

      • pr: string

    Returns Promise<{
        fee: number;
    }>

    estimated Fee

  • Get the mints keysets in no specific order

    Returns Promise<{
        keysets: string[];
    }>

    all the mints past and current keysets.

  • Get the mints public keys

    Parameters

    • Optional keysetId: string

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

    Returns Promise<MintKeys>

    the mints public keys

  • 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

  • Checks if specific proofs have already been redeemed

    Parameters

    • mintUrl: string
    • checkPayload: CheckSpendablePayload
    • Optional customRequest: (<T>(options) => Promise<T>)
        • <T>(options): Promise<T>
        • Type Parameters

          • T

          Parameters

          • options: RequestOptions

          Returns Promise<T>

    Returns Promise<CheckSpendableResponse>

    redeemed and unredeemed ordered list of booleans

  • Estimate fees for a given LN invoice

    Parameters

    • mintUrl: string
    • checkfeesPayload: {
          pr: string;
      }

      Payload containing LN invoice that needs to get a fee estimate

      • pr: string
    • Optional customRequest: (<T>(options) => Promise<T>)
        • <T>(options): Promise<T>
        • Type Parameters

          • T

          Parameters

          • options: RequestOptions

          Returns Promise<T>

    Returns Promise<{
        fee: number;
    }>

    estimated Fee

  • fetches mints info at the /info endpoint

    Parameters

    • mintUrl: string
    • Optional customRequest: (<T>(options) => Promise<T>)
        • <T>(options): Promise<T>
        • Type Parameters

          • T

          Parameters

          • options: RequestOptions

          Returns Promise<T>

    Returns Promise<GetInfoResponse>

  • Get the mints keysets in no specific order

    Parameters

    • mintUrl: string
    • Optional customRequest: (<T>(options) => Promise<T>)
        • <T>(options): Promise<T>
        • Type Parameters

          • T

          Parameters

          • options: RequestOptions

          Returns Promise<T>

    Returns Promise<{
        keysets: string[];
    }>

    all the mints past and current keysets.

  • Get the mints public keys

    Parameters

    • mintUrl: string
    • Optional keysetId: string

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

    • Optional customRequest: (<T>(options) => Promise<T>)
        • <T>(options): Promise<T>
        • Type Parameters

          • T

          Parameters

          • options: RequestOptions

          Returns Promise<T>

    Returns Promise<MintKeys>

  • Ask mint to perform a melt operation. This pays a lightning invoice and destroys tokens matching its amount + fees

    Parameters

    • mintUrl: string
    • meltPayload: MeltPayload
    • Optional customRequest: (<T>(options) => Promise<T>)
        • <T>(options): Promise<T>
        • Type Parameters

          • T

          Parameters

          • options: RequestOptions

          Returns Promise<T>

    Returns Promise<MeltResponse>

  • Requests the mint to perform token minting after the LN invoice has been paid

    Parameters

    • mintUrl: string
    • payloads: {
          outputs: SerializedBlindedMessage[];
      }

      outputs (Blinded messages) that can be written

    • hash: string

      hash (id) used for by the mint to keep track of wether the invoice has been paid yet

    • Optional customRequest: (<T>(options) => Promise<T>)
        • <T>(options): Promise<T>
        • Type Parameters

          • T

          Parameters

          • options: RequestOptions

          Returns Promise<T>

    Returns Promise<{
        promises: SerializedBlindedSignature[];
    }>

    serialized blinded signatures

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

    Parameters

    • mintUrl: string
    • amount: number

      Amount requesting for mint.

    • Optional customRequest: (<T>(options) => Promise<T>)
        • <T>(options): Promise<T>
        • Type Parameters

          • T

          Parameters

          • options: RequestOptions

          Returns Promise<T>

    Returns Promise<RequestMintResponse>

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

  • Ask mint to perform a split operation

    Parameters

    • mintUrl: string
    • splitPayload: SplitPayload

      data needed for performing a token split

    • Optional customRequest: (<T>(options) => Promise<T>)
        • <T>(options): Promise<T>
        • Type Parameters

          • T

          Parameters

          • options: RequestOptions

          Returns Promise<T>

    Returns Promise<SplitResponse>

    split tokens

Generated using TypeDoc