CashuMint
@cashu/cashu-ts / CashuMint
Class: CashuMint
Defined in: cashu-ts/src/CashuMint.ts:36
Class represents Cashu Mint API. This class contains Lower level functions that are implemented by CashuWallet.
Constructors
new CashuMint()
new CashuMint(
_mintUrl,_customRequest?):CashuMint
Defined in: cashu-ts/src/CashuMint.ts:42
Parameters
_mintUrl
string
requires mint URL to create this object
_customRequest?
<T>(options) => Promise<T>
if passed, use custom request implementation for network communication with the mint
Returns
CashuMint
Accessors
mintUrl
Get Signature
get mintUrl():
string
Defined in: cashu-ts/src/CashuMint.ts:47
Returns
string
webSocketConnection
Get Signature
get webSocketConnection():
undefined|WSConnection
Defined in: cashu-ts/src/CashuMint.ts:481
Returns
undefined | WSConnection
Methods
check()
check(
checkPayload):Promise<CheckStateResponse>
Defined in: cashu-ts/src/CashuMint.ts:415
Checks if specific proofs have already been redeemed
Parameters
checkPayload
Returns
Promise<CheckStateResponse>
redeemed and unredeemed ordered list of booleans
checkMeltQuote()
checkMeltQuote(
quote):Promise<MeltQuoteResponse>
Defined in: cashu-ts/src/CashuMint.ts:278
Gets an existing melt quote.
Parameters
quote
string
Quote ID
Returns
Promise<MeltQuoteResponse>
checkMintQuote()
checkMintQuote(
quote):Promise<MintQuoteResponse>
Defined in: cashu-ts/src/CashuMint.ts:164
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
connectWebSocket()
connectWebSocket():
Promise<void>
Defined in: cashu-ts/src/CashuMint.ts:447
Tries to establish a websocket connection with the websocket mint url according to NUT-17
Returns
Promise<void>
createMeltQuote()
createMeltQuote(
meltQuotePayload):Promise<MeltQuoteResponse>
Defined in: cashu-ts/src/CashuMint.ts:237
Requests a new melt quote from the mint.
Parameters
meltQuotePayload
Returns
Promise<MeltQuoteResponse>
createMintQuote()
createMintQuote(
mintQuotePayload):Promise<MintQuoteResponse>
Defined in: cashu-ts/src/CashuMint.ts:134
Requests a new mint quote from the mint.
Parameters
mintQuotePayload
Payload for creating a new mint quote
Returns
Promise<MintQuoteResponse>
the mint will create and return a new mint quote containing a payment request for the specified amount and unit
disconnectWebSocket()
disconnectWebSocket():
void
Defined in: cashu-ts/src/CashuMint.ts:475
Closes a websocket connection
Returns
void
getInfo()
getInfo():
Promise<GetInfoResponse>
Defined in: cashu-ts/src/CashuMint.ts:70
fetches mints info at the /info endpoint
Returns
Promise<GetInfoResponse>
getKeys()
getKeys(
keysetId?,mintUrl?):Promise<MintActiveKeys>
Defined in: cashu-ts/src/CashuMint.ts:380
Get the mints public keys
Parameters
keysetId?
string
optional param to get the keys for a specific keyset. If not specified, the keys from all active keysets are fetched
mintUrl?
string
Returns
Promise<MintActiveKeys>
the mints public keys
getKeySets()
getKeySets():
Promise<MintAllKeysets>
Defined in: cashu-ts/src/CashuMint.ts:406
Get the mints keysets in no specific order
Returns
Promise<MintAllKeysets>
all the mints past and current keysets.
melt()
melt(
meltPayload):Promise<MeltQuoteResponse>
Defined in: cashu-ts/src/CashuMint.ts:318
Ask mint to perform a melt operation. This pays a lightning invoice and destroys tokens matching its amount + fees
Parameters
meltPayload
Returns
Promise<MeltQuoteResponse>
mint()
mint(
mintPayload):Promise<MintResponse>
Defined in: cashu-ts/src/CashuMint.ts:198
Mints new tokens by requesting blind signatures on the provided outputs.
Parameters
mintPayload
Payload containing the outputs to get blind signatures on
Returns
Promise<MintResponse>
serialized blinded signatures
restore()
restore(
restorePayload):Promise<PostRestoreResponse>
Defined in: cashu-ts/src/CashuMint.ts:438
Parameters
restorePayload
outputs
Returns
Promise<PostRestoreResponse>
swap()
swap(
swapPayload):Promise<SwapResponse>
Defined in: cashu-ts/src/CashuMint.ts:104
Performs a swap operation with ecash inputs and outputs.
Parameters
swapPayload
payload containing inputs and outputs
Returns
Promise<SwapResponse>
signed outputs
check()
staticcheck(mintUrl,checkPayload,customRequest?):Promise<CheckStateResponse>
Defined in: cashu-ts/src/CashuMint.ts:328
Checks if specific proofs have already been redeemed
Parameters
mintUrl
string
checkPayload
customRequest?
<T>(options) => Promise<T>
Returns
Promise<CheckStateResponse>
redeemed and unredeemed ordered list of booleans
checkMeltQuote()
staticcheckMeltQuote(mintUrl,quote,customRequest?):Promise<MeltQuoteResponse>
Defined in: cashu-ts/src/CashuMint.ts:247
Gets an existing melt quote.
Parameters
mintUrl
string
quote
string
Quote ID
customRequest?
<T>(options) => Promise<T>
Returns
Promise<MeltQuoteResponse>
checkMintQuote()
staticcheckMintQuote(mintUrl,quote,customRequest?):Promise<MintQuoteResponse>
Defined in: cashu-ts/src/CashuMint.ts:145
Gets an existing mint quote from the mint.
Parameters
mintUrl
string
quote
string
Quote ID
customRequest?
<T>(options) => Promise<T>
Returns
Promise<MintQuoteResponse>
the mint will create and return a Lightning invoice for the specified amount
createMeltQuote()
staticcreateMeltQuote(mintUrl,meltQuotePayload,customRequest?):Promise<MeltQuoteResponse>
Defined in: cashu-ts/src/CashuMint.ts:208
Requests a new melt quote from the mint.
Parameters
mintUrl
string
meltQuotePayload
customRequest?
<T>(options) => Promise<T>
Returns
Promise<MeltQuoteResponse>
createMintQuote()
staticcreateMintQuote(mintUrl,mintQuotePayload,customRequest?):Promise<MintQuoteResponse>
Defined in: cashu-ts/src/CashuMint.ts:115
Requests a new mint quote from the mint.
Parameters
mintUrl
string
mintQuotePayload
Payload for creating a new mint quote
customRequest?
<T>(options) => 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
getInfo()
staticgetInfo(mintUrl,customRequest?):Promise<GetInfoResponse>
Defined in: cashu-ts/src/CashuMint.ts:56
fetches mints info at the /info endpoint
Parameters
mintUrl
string
customRequest?
<T>(options) => Promise<T>
Returns
Promise<GetInfoResponse>
getKeys()
staticgetKeys(mintUrl,keysetId?,customRequest?):Promise<MintActiveKeys>
Defined in: cashu-ts/src/CashuMint.ts:354
Get the mints public keys
Parameters
mintUrl
string
keysetId?
string
optional param to get the keys for a specific keyset. If not specified, the keys from all active keysets are fetched
customRequest?
<T>(options) => Promise<T>
Returns
Promise<MintActiveKeys>
getKeySets()
staticgetKeySets(mintUrl,customRequest?):Promise<MintAllKeysets>
Defined in: cashu-ts/src/CashuMint.ts:394
Get the mints keysets in no specific order
Parameters
mintUrl
string
customRequest?
<T>(options) => Promise<T>
Returns
Promise<MintAllKeysets>
all the mints past and current keysets.
melt()
staticmelt(mintUrl,meltPayload,customRequest?):Promise<MeltQuoteResponse>
Defined in: cashu-ts/src/CashuMint.ts:289
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
customRequest?
<T>(options) => Promise<T>
Returns
Promise<MeltQuoteResponse>
mint()
staticmint(mintUrl,mintPayload,customRequest?):Promise<MintResponse>
Defined in: cashu-ts/src/CashuMint.ts:175
Mints new tokens by requesting blind signatures on the provided outputs.
Parameters
mintUrl
string
mintPayload
Payload containing the outputs to get blind signatures on
customRequest?
<T>(options) => Promise<T>
Returns
Promise<MintResponse>
serialized blinded signatures
restore()
staticrestore(mintUrl,restorePayload,customRequest?):Promise<PostRestoreResponse>
Defined in: cashu-ts/src/CashuMint.ts:419
Parameters
mintUrl
string
restorePayload
customRequest?
<T>(options) => Promise<T>
Returns
Promise<PostRestoreResponse>
swap()
staticswap(mintUrl,swapPayload,customRequest?):Promise<SwapResponse>
Defined in: cashu-ts/src/CashuMint.ts:81
Performs a swap operation with ecash inputs and outputs.
Parameters
mintUrl
string
swapPayload
payload containing inputs and outputs
customRequest?
<T>(options) => Promise<T>
Returns
Promise<SwapResponse>
signed outputs