Cashu mint instance is used to make api calls.
Optional
options: {Optional
bip39seed?: Uint8Array<ArrayBufferLike>BIP39 seed for deterministic secrets.
Optional
denominationTarget?: numberTarget number proofs per denomination (default: see
Optional
keepFactory?: OutputDataFactoryA function that will be used by all parts of the library that produce proofs to be kept (change, etc.). This can lead to poor performance, in which case the seed should be directly provided.
Optional
keys?: MintKeys | MintKeys[]Public keys from the mint (will be fetched from mint if not provided)
Optional
keysets?: MintKeyset[]Keysets from the mint (will be fetched from mint if not provided)
Optional
logger?: LoggerOptional
mintInfo?: GetInfoResponseMint info from the mint (will be fetched from mint if not provided)
Optional
unit?: stringOptionally set unit (default is 'sat')
Restores batches of deterministic proofs until no more signatures are returned from the mint.
Optional
gapLimit: number = 300The amount of empty counters that should be returned before restoring
ends (defaults to 300). Default is 300
Optional
batchSize: number = 100The amount of proofs that should be restored at a time (defaults to
100). Default is 100
Optional
counter: number = 0The counter that should be used as a starting point (defaults to 0). Default
is 0
Optional
keysetId: stringWhich keysetId to use for the restoration. If none is passed the instance's default one will be used.
Return an existing melt quote from the mint.
ID of the melt quote.
The mint will return an existing melt quote.
Return an existing melt quote from the mint.
ID of the melt quote.
The mint will return an existing melt quote.
Gets an existing mint quote from the mint.
Quote ID.
The mint will create and return a Lightning invoice for the specified amount.
Gets an existing mint quote from the mint.
Quote ID.
The mint will create and return a Lightning invoice for the specified amount.
Get an array of the states of proofs from the mint (as an array of CheckStateEnum's)
(only the secret
field is required)
Requests a mint quote from the mint that is locked to a public key.
Amount requesting for mint.
Public key to lock the quote to.
Optional
description: stringOptional description for the mint quote.
The mint will return a mint quote with a Lightning invoice for minting tokens of the
specified amount and unit. The quote will be locked to the specified pubkey
.
Requests a melt quote from the mint. Response returns amount and fees for a given unit in order to pay a Lightning invoice.
LN invoice that needs to get a fee estimate.
The mint will create and return a melt quote for the invoice with an amount and fee reserve.
Requests a mint quote form the mint. Response returns a Lightning payment request for the requested given amount and unit.
Amount requesting for mint.
Optional
description: stringOptional description for the mint quote.
The mint will return a mint quote with a Lightning invoice for minting tokens of the specified amount and unit.
Requests a multi path melt quote from the mint.
LN invoice that needs to get a fee estimate.
The mint will create and return a melt quote for the invoice with an amount and fee reserve.
Choose a keyset to activate based on the lowest input fee.
Note: this function will filter out deprecated base64 keysets.
Keysets to choose from.
Active keyset.
Get all active keys from the mint and set the keyset with the lowest fees as the active wallet keyset.
Keyset.
Calculates the fees based on inputs for a given keyset.
Number of inputs.
KeysetId used to lookup input_fee_ppk
Fee amount.
Calculates the fees based on inputs (proofs)
Input proofs to calculate fees for.
Fee amount.
Get public keys from the mint. If keys were already fetched, it will return those.
If keysetId
is set, it will fetch and return that specific keyset. Otherwise, we select an
active keyset with the unit of the wallet.
Optional
keysetId: stringOptional keysetId to get keys for.
Optional
forceRefresh: booleanKeyset.
Get keysets from the mint with the unit of the wallet.
Keysets with wallet's unit.
Get information about the mint.
Mint info.
Get stored information about the mint or request it if not loaded.
Mint info.
Load mint information, keysets and keys. This function can be called if no keysets are passed in the constructor.
Melt proofs for a melt quote. proofsToSend must be at least amount+fee_reserve form the melt quote. This function does not perform coin selection!. Returns melt quote and change proofs.
ID of the melt quote.
Proofs to melt.
Optional
options: MeltProofOptionsOptional parameters for configuring the Melting Proof operation.
Mint proofs for a given mint quote.
Amount to request.
ID of mint quote (when quote is a string)
Optional
options: MintProofOptions & { privateKey: string }Optional parameters for configuring the Mint Proof operation.
Proofs.
Mint proofs for a given mint quote.
Amount to request.
ID of mint quote (when quote is a string)
Optional
options: MintProofOptionsOptional parameters for configuring the Mint Proof operation.
Proofs.
Register a callback to be called whenever a melt quote's state changes.
Callback function that will be called whenever a melt quote state changes.
Register a callback to be called when a single melt quote gets paid.
Callback function that will be called when this melt quote gets paid.
Register a callback to be called when a single mint quote gets paid.
Mint quote id that should be subscribed to.
Callback function that will be called when this mint quote gets paid.
Register a callback to be called whenever a mint quote's state changes.
List of mint quote IDs that should be subscribed to.
Callback function that will be called whenever a mint quote state changes.
Register a callback to be called whenever a subscribed proof state changes.
List of proofs that should be subscribed to.
Callback function that will be called whenever a proof's state changes.
Receive an encoded or raw Cashu token (only supports single tokens. It will only process the first token in the token array)
Cashu token, either as string or decoded.
Optional
options: ReceiveOptionsOptional configuration for token processing.
New token with newly created proofs, token entries that had errors.
Regenerates.
Set starting point for count (first cycle for each keyset should usually be 0)
Set number of blinded messages that should be generated.
Optional
options: RestoreOptionsOptional
keysetId?: stringSelects proofs to send based on amount and fee inclusion.
Array of Proof objects available to select from.
The target amount to send.
Optional boolean to include fees; Default: false.
SendResponse containing proofs to keep and proofs to send.
Send proofs of a given amount, by providing at least the required amount of proofs.
Amount to send.
Array of proofs (accumulated amount of proofs must be >= than amount)
Optional
options: SendOptionsOptional parameters for configuring the send operation.
Splits and creates sendable tokens if no amount is specified, the amount is implied by the cumulative amount of all proofs if both amount and preference are set, but the preference cannot fulfill the amount, then we use the default split.
Optional
options: SwapOptionsOptional parameters for configuring the swap operation.
Promise of the change- and send-proofs.
Class that represents a Cashu wallet. This class should act as the entry point for this library.