fix issue with cashu
This commit is contained in:
parent
5089dc9365
commit
b194ace128
2 changed files with 20 additions and 14 deletions
15
cashu.ts
15
cashu.ts
|
@ -34,10 +34,11 @@ export default class PortalBtcWalletCashu {
|
|||
}
|
||||
|
||||
async redeemCashuQuotes() {
|
||||
const attempt = this.npubCash.tryRedeemUnredeemedCashuQuotes(
|
||||
await this.cashuStore.getLastRedeemedCashuQuoteTimestamp(),
|
||||
);
|
||||
for await (const quote of attempt) {
|
||||
const { proofs, quotes } = await this.npubCash
|
||||
.tryRedeemUnredeemedCashuQuotes(
|
||||
await this.cashuStore.getLastRedeemedCashuQuoteTimestamp(),
|
||||
);
|
||||
for (const quote of quotes) {
|
||||
this.cashuTxns.push({
|
||||
txId: `cashu-quote-${quote.quoteId}`,
|
||||
paymentType: "receive",
|
||||
|
@ -46,12 +47,10 @@ export default class PortalBtcWalletCashu {
|
|||
status: "complete",
|
||||
});
|
||||
}
|
||||
const proofs = await attempt.next();
|
||||
if (!proofs.done || typeof proofs.value === "undefined") return [];
|
||||
this.proofs.push(...proofs.value);
|
||||
this.proofs.push(...proofs);
|
||||
await this.persistState();
|
||||
this.onBalanceUpdated?.();
|
||||
return proofs.value;
|
||||
return proofs;
|
||||
}
|
||||
|
||||
async persistState() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue