Skip to content

Commit

Permalink
fixed receive + integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
Egge21M committed Dec 3, 2024
1 parent c50540d commit 7acb6cb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/CashuWallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
12 changes: 6 additions & 6 deletions test/integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down Expand Up @@ -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);
});
});

0 comments on commit 7acb6cb

Please sign in to comment.