diff --git a/src/CashuWallet.ts b/src/CashuWallet.ts index b7cf3547..b9b461ce 100644 --- a/src/CashuWallet.ts +++ b/src/CashuWallet.ts @@ -346,9 +346,9 @@ class CashuWallet { /** * Regenerates - * @param count? set number of blinded messages that should be generated + * @param count set number of blinded messages that should be generated * @param startIndex optionally set starting point for count (default is 0) - * @returns proofs and newKeys if they have changed + * @returns proofs (and newKeys, if they have changed) */ async restore( count: number, @@ -358,6 +358,7 @@ class CashuWallet { if (!this._seed) { throw new Error('CashuWallet must be initialized with mnemonic to use restore'); } + // create blank amounts for unknown restore amounts const amounts = Array(count).fill(0); const { blindedMessages, rs, secrets } = this.createBlindedMessages(amounts, startIndex, keysetId); @@ -484,7 +485,7 @@ class CashuWallet { /** * Creates blinded messages for a given amount * @param amount amount to create blinded messages for - * @param preference optional preference for splitting proofs into specific amounts. overrides amount param + * @param amountPreference optional preference for splitting proofs into specific amounts. overrides amount param * @param count? optionally set count to derive secret deterministically. CashuWallet class must be initialized with seed phrase to take effect * @returns blinded messages, secrets, rs, and amounts */ @@ -501,6 +502,7 @@ class CashuWallet { * Creates blinded messages for a according to @param amounts * @param amount array of amounts to create blinded messages for * @param count? optionally set count to derive secret deterministically. CashuWallet class must be initialized with seed phrase to take effect + * @param keyksetId? override the keysetId derived from the current mintKeys with a custom one. This should be a keyset that was fetched from the `/keysets` endpoint * @returns blinded messages, secrets, rs, and amounts */ private createBlindedMessages( @@ -526,7 +528,7 @@ class CashuWallet { const blindedMessage = new BlindedMessage(amounts[i], B_); blindedMessages.push(blindedMessage.getSerializedBlindedMessage()); } - return { amounts, blindedMessages, rs, secrets }; + return { blindedMessages, secrets, rs, amounts }; } /** diff --git a/src/model/types/index.ts b/src/model/types/index.ts index 4855c339..6b7a7c31 100644 --- a/src/model/types/index.ts +++ b/src/model/types/index.ts @@ -337,7 +337,7 @@ export type GetInfoResponse = { parameter: { peg_out_only: boolean }; }; /** - * Response from mint at /info endpoint + * Response from mint at /restore endpoint */ export type PostRestoreResponse = { outputs: Array; diff --git a/src/secrets.ts b/src/secrets.ts index ce70d912..e6834636 100644 --- a/src/secrets.ts +++ b/src/secrets.ts @@ -6,9 +6,6 @@ import { bytesToNumber } from './utils'; import { hexToNumber } from '@noble/curves/abstract/utils'; export const generateNewMnemonic = (): string => { const mnemonic = generateMnemonic(wordlist, 128); - if (!validateMnemonic(mnemonic, wordlist)) { - return generateNewMnemonic(); - } return mnemonic; };