Skip to content

Commit

Permalink
began meltProofs
Browse files Browse the repository at this point in the history
  • Loading branch information
Egge21M committed Dec 6, 2024
1 parent 454a1b0 commit 29854fa
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions src/CashuWallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ import {
MintQuoteResponse,
MintQuoteState,
MeltQuoteState,
SerializedDLEQ
SerializedDLEQ,
SignedMintQuoteResponse
} from './model/types/index.js';
import {
bytesToNumber,
Expand Down Expand Up @@ -692,7 +693,7 @@ class CashuWallet {
* @param options.pubkey? optionally locks ecash to pubkey. Will not be deterministic, even if counter is set!
* @returns proofs
*/
async mintProofs<T extends MintQuoteResponse>(
async mintProofs<T extends MintQuoteResponse | SignedMintQuoteResponse>(
amount: number,
quote: T | string,
options?: {
Expand Down Expand Up @@ -726,10 +727,22 @@ class CashuWallet {
options?.counter,
options?.pubkey
);
const mintPayload: MintPayload = {
outputs: blindedMessages,
quote: typeof quote === 'string' ? quote : quote.quote
};
let mintPayload: MintPayload;
if (typeof quote === 'string') {
mintPayload = {
outputs: blindedMessages,
quote: quote
};
} else {
mintPayload = {
outputs: blindedMessages,
quote: quote.quote
};
if ('pubkey' in quote) {
// TODO: Sign quote and add it
}
}

const { signatures } = await this.mint.mint(mintPayload);
return this.constructProofs(signatures, blindingFactors, secrets, keyset);
}
Expand Down

0 comments on commit 29854fa

Please sign in to comment.