Skip to content

Commit

Permalink
Err message
Browse files Browse the repository at this point in the history
  • Loading branch information
minibits-cash committed Dec 5, 2024
1 parent 8dcac7c commit 89254de
Showing 1 changed file with 26 additions and 29 deletions.
55 changes: 26 additions & 29 deletions src/CashuWallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ class CashuWallet {
});
return proofs;
} catch (error: any) {
throw new Error('Error when receiving: ' + error.message);
throw new Error('Receive failed: ' + error.message);
}
}

Expand All @@ -171,35 +171,32 @@ class CashuWallet {
fee?: number;
}
): Promise<Array<Proof>> {
const proofs: Array<Proof> = [];
try {
const amount = tokenEntry.proofs.reduce((total, curr) => total + curr.amount, 0);
let preference = options?.preference;
if (!preference) {
preference = getDefaultAmountPreference(amount);
}
const keys = await this.getKeys(options?.keysetId);
const { payload, blindedMessages } = this.createSwapPayload(
amount,
fee,
tokenEntry.proofs,
keys,
preference,
options?.counter,
options?.pubkey,
options?.privkey
);
const { signatures } = await CashuMint.split(tokenEntry.mint, payload);
const newProofs = this.constructProofs(
signatures,
blindedMessages.rs,
blindedMessages.secrets,
keys
);
proofs.push(...newProofs);
} catch (error: any) {
throw new Error('Error receiving token entry: ' + error.message);
const proofs: Array<Proof> = [];
const amount = tokenEntry.proofs.reduce((total, curr) => total + curr.amount, 0);
let preference = options?.preference;
if (!preference) {
preference = getDefaultAmountPreference(amount);
}
const keys = await this.getKeys(options?.keysetId);
const { payload, blindedMessages } = this.createSwapPayload(
amount,
fee,
tokenEntry.proofs,
keys,
preference,
options?.counter,
options?.pubkey,
options?.privkey
);
const { signatures } = await CashuMint.split(tokenEntry.mint, payload);
const newProofs = this.constructProofs(
signatures,
blindedMessages.rs,
blindedMessages.secrets,
keys
);
proofs.push(...newProofs);

return proofs;
}

Expand Down

0 comments on commit 89254de

Please sign in to comment.