diff --git a/src/CashuWallet.ts b/src/CashuWallet.ts index 0442bb04..2518664a 100644 --- a/src/CashuWallet.ts +++ b/src/CashuWallet.ts @@ -20,7 +20,8 @@ import { type TokenEntry, CheckStateEnum, SerializedBlindedSignature, - MeltQuoteState + MeltQuoteState, + MintQuoteResponse } from './model/types/index.js'; import { bytesToNumber, @@ -331,12 +332,14 @@ class CashuWallet { /** * Requests a mint quote form the mint. Response returns a Lightning payment request for the requested given amount and unit. * @param amount Amount requesting for mint. + * @param description optional description for the mint quote * @returns the mint will return a mint quote with a Lightning invoice for minting tokens of the specified amount and unit */ - async createMintQuote(amount: number) { + async createMintQuote(amount: number, description?: string) { const mintQuotePayload: MintQuotePayload = { unit: this._unit, - amount: amount + amount: amount, + description: description }; return await this.mint.createMintQuote(mintQuotePayload); } diff --git a/src/model/types/wallet/payloads.ts b/src/model/types/wallet/payloads.ts index 43539a91..7e8b6766 100644 --- a/src/model/types/wallet/payloads.ts +++ b/src/model/types/wallet/payloads.ts @@ -98,6 +98,10 @@ export type MintQuotePayload = { * Amount to be minted */ amount: number; + /** + * Description for the invoice + */ + description?: string; }; /** diff --git a/test/integration.test.ts b/test/integration.test.ts index 2d069392..936c8245 100644 --- a/test/integration.test.ts +++ b/test/integration.test.ts @@ -61,6 +61,13 @@ describe('mint api', () => { // because local invoice, fee should be 0 expect(fee).toBe(0); }); + test('invoice with description', async () => { + const mint = new CashuMint(mintUrl); + const wallet = new CashuWallet(mint, { unit }); + const quote = await wallet.createMintQuote(100, 'test description'); + expect(quote).toBeDefined(); + console.log(`invoice with description: ${quote.request}`); + }); test('get fee for external invoice', async () => { const mint = new CashuMint(mintUrl); const wallet = new CashuWallet(mint, { unit });