From 935272cbf257ab812b99703dfae4797376d2d914 Mon Sep 17 00:00:00 2001 From: gudnuf Date: Fri, 19 Apr 2024 11:54:17 -0700 Subject: [PATCH 1/3] pass keysetId to `CashuWallet.send` + getKeys bug --- src/CashuWallet.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/CashuWallet.ts b/src/CashuWallet.ts index d19685c2..fe6d5225 100644 --- a/src/CashuWallet.ts +++ b/src/CashuWallet.ts @@ -222,12 +222,13 @@ class CashuWallet { counter?: number; pubkey?: string; privkey?: string; + keysetId?: string; } ): Promise { if (options?.preference) { amount = options?.preference?.reduce((acc, curr) => acc + curr.amount * curr.count, 0); } - const keyset = await this.getKeys(); + const keyset = await this.getKeys(options?.keysetId); let amountAvailable = 0; const proofsToSend: Array = []; const proofsToKeep: Array = []; @@ -319,7 +320,7 @@ class CashuWallet { * Initialize the wallet with the mints public keys */ private async getKeys(keysetId?: string, unit?: string): Promise { - if (!this._keys || this._keys.id !== keysetId) { + if (!this._keys || (keysetId !== undefined && this._keys.id !== keysetId)) { const allKeys = await this.mint.getKeys(keysetId); let keys; if (keysetId) { From 90d692b555188c83c5f83508d521c9c1cdc03890 Mon Sep 17 00:00:00 2001 From: gudnuf Date: Fri, 19 Apr 2024 11:56:00 -0700 Subject: [PATCH 2/3] `meltQuote` optional in `CashuWallet.payLnInvoice` --- src/CashuWallet.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CashuWallet.ts b/src/CashuWallet.ts index fe6d5225..fa0397b5 100644 --- a/src/CashuWallet.ts +++ b/src/CashuWallet.ts @@ -449,7 +449,7 @@ class CashuWallet { async payLnInvoice( invoice: string, proofsToSend: Array, - meltQuote: MeltQuoteResponse, + meltQuote?: MeltQuoteResponse, options?: { keysetId?: string; counter?: number; From b60254ed2cef6281fd64102948b79adf21071619 Mon Sep 17 00:00:00 2001 From: gandlaf21 Date: Mon, 20 May 2024 11:51:06 +0900 Subject: [PATCH 3/3] format --- src/model/types/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/model/types/index.ts b/src/model/types/index.ts index 64de1356..da3ac722 100644 --- a/src/model/types/index.ts +++ b/src/model/types/index.ts @@ -389,8 +389,8 @@ export type Token = { */ memo?: string; /** - * the unit of the token - */ + * the unit of the token + */ unit?: string; }; /**