periodically redeem cashu quotes
This commit is contained in:
parent
25c825be38
commit
b4de8989f1
1 changed files with 13 additions and 0 deletions
|
@ -170,4 +170,17 @@ export async function openWallet(mnemonic: string) {
|
|||
pendingBalance: wallet.pendingBalance,
|
||||
cashuBalance: wallet.cashuBalance,
|
||||
});
|
||||
let redeemCashuQuotesTimeout: ReturnType<typeof setTimeout>;
|
||||
async function redeemCashuQuotes() {
|
||||
await wallet.redeemCashuQuotes();
|
||||
let previousBalance = wallet.cashuBalance;
|
||||
if (previousBalance === wallet.cashuBalance) {
|
||||
walletState.update((state) => ({
|
||||
...state,
|
||||
cashuBalance: wallet.cashuBalance,
|
||||
}));
|
||||
}
|
||||
redeemCashuQuotesTimeout = setTimeout(redeemCashuQuotes, 1000 * 5);
|
||||
}
|
||||
redeemCashuQuotes();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue