From 7acb6cb2d07f9e3a5863fb3ad87aec2a719d6959 Mon Sep 17 00:00:00 2001 From: Egge Date: Tue, 3 Dec 2024 19:48:51 +0100 Subject: [PATCH] fixed receive + integration test --- src/CashuWallet.ts | 2 +- test/integration.test.ts | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/CashuWallet.ts b/src/CashuWallet.ts index 43e1ac3e..66750ef8 100644 --- a/src/CashuWallet.ts +++ b/src/CashuWallet.ts @@ -278,7 +278,7 @@ class CashuWallet { options?.counter, options?.pubkey, options?.privkey, - { keep: options?.blindingData } + options?.blindingData ? { keep: options.blindingData, send: [] } : undefined ); const { signatures } = await this.mint.swap(swapTransaction.payload); return swapTransaction.blindingData.map((d, i) => d.toProof(signatures[i], keys)); diff --git a/test/integration.test.ts b/test/integration.test.ts index 40dbe798..c99f3b5c 100644 --- a/test/integration.test.ts +++ b/test/integration.test.ts @@ -403,7 +403,6 @@ describe('dleq', () => { } as Token; const encodedToken = getEncodedTokenV4(token); const newProofs = await wallet.receive(encodedToken, { requireDleq: true }); - console.log(getEncodedTokenV4(token)); expect(newProofs).toBeDefined(); }); test('send strip dleq', async () => { @@ -479,23 +478,24 @@ describe('Custom Outputs', () => { const mint = new CashuMint(mintUrl); const wallet = new CashuWallet(mint); const keys = await wallet.getKeys(); - const quoteRes = await wallet.createMintQuote(50); + const quoteRes = await wallet.createMintQuote(51); await new Promise((res, rej) => { wallet.onMintQuotePaid(quoteRes.quote, res, rej); }); - const proofs = await wallet.mintProofs(50, quoteRes.quote); + const proofs = await wallet.mintProofs(51, quoteRes.quote); const pubkey1 = 'ffffff'; const pubkey2 = 'fafafa'; - const amountMinusFees = wallet.getFeesForProofs(proofs); + const amountMinusFees = 51 - wallet.getFeesForProofs(proofs); const pk1Data = BlindingData.createP2PKData(pubkey1, 8, keys); const pk2Data = BlindingData.createP2PKData(pubkey2, 13, keys); const randomData = BlindingData.createRandomData(amountMinusFees - 8 - 13, keys); - const newProofs = wallet.receive( + const newProofs = await wallet.receive( { mint: mintUrl, proofs }, { blindingData: [...pk1Data, ...pk2Data, ...randomData] } ); - console.log(newProofs); + mint.disconnectWebSocket(); + expect(sumProofs(newProofs)).toBe(amountMinusFees); }); });