feat(tauri): send tauri event on btc balance change (#113)

Closes #43. This PR creates a new event, which is emitted by the watcher daemon when the BTC balance changes. Then, on the guest side, we simply update the balance when this event is received.
This commit is contained in:
Einliterflasche 2024-10-13 18:01:29 +02:00 committed by GitHub
parent ec86fa13cd
commit 639f540876
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 532 additions and 115 deletions

View file

@ -67,6 +67,11 @@ export async function initEventListeners() {
store.dispatch(receivedCliLog(event.payload));
});
listen<BalanceResponse>("balance-change", (event) => {
console.log("Received balance change event", event.payload);
store.dispatch(rpcSetBalance(event.payload.balance));
});
listen<TauriDatabaseStateEvent>("swap-database-state-update", (event) => {
console.log("Received swap database state update event", event.payload);
getSwapInfo(event.payload.swap_id);