Repository: dusk-network/rusk (language: rust)

Issue:
Increase web wallet refresh rate
####Summary
Coming from fast blockchains like Solana—and even slower ones like Ethereum—having a wallet that reflects the latest on-chain data is crucial. Users expect a seamless and responsive experience with blockchains that handle transactions quickly.

Currently, the web wallet's 3-minute refresh rate feels outdated and could hinder user adoption. With Dusk's 10-second block time, the chain itself provides an excellent user experience, but the web wallet lags behind in reflecting updates.

As a comparison, transactions on wallets like MetaMask (Ethereum) or others for Solana and Tezos are typically visible within seconds without requiring a manual refresh.

####Possible Solution

- Increase the automatic refresh rate of the web wallet to 10 seconds for a better real-time experience.

- A 1-minute refresh rate could be a reasonable compromise and significantly improve usability compared to 3 minutes.

- Offer users the option to configure their preferred refresh rate in the wallet settings.

- Another idea would be to increase refresh rate after an action is performed like 
 claiming rewards.

####Additional Context
Currently, users must refresh the entire page and unlock their wallets again to see updates, which is inconvenient and could discourage new users from adopting the wallet.





Discussion / hints:
It's actually 5 minutes (even worse).

I do agree that the refresh rate should be shorter – I would personally go with 30 seconds.

The five minutes refresh rate was added as a temporary measure, also because there were some issues with the overload of the network. I think this is mostly now resolved.

I have taken this with the team, so that I can check if there are some other concerns around this, but I totally agree with you.

Fix patch:
diff --git a/web-wallet/CHANGELOG.md b/web-wallet/CHANGELOG.md
index f4220430a..63de92ef8 100644
--- a/web-wallet/CHANGELOG.md
+++ b/web-wallet/CHANGELOG.md
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 ### Added
 
 - Add memo field to send flow [#3112]
+- Add "VITE_SYNC_INTERVAL" ENV variable [#3403]
 
 ### Changed
 
@@ -565,6 +566,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 [#3362]: https://github.com/dusk-network/rusk/issues/3362
 [#3381]: https://github.com/dusk-network/rusk/issues/3381
 [#3387]: https://github.com/dusk-network/rusk/issues/3387
+[#3403]: https://github.com/dusk-network/rusk/issues/3403
 [#3420]: https://github.com/dusk-network/rusk/issues/3420
 
 <!-- VERSIONS -->
diff --git a/web-wallet/README.md b/web-wallet/README.md
index 8619b0c40..07df89c53 100644
--- a/web-wallet/README.md
+++ b/web-wallet/README.md
@@ -43,6 +43,7 @@ VITE_GAS_LIMIT_LOWER=10000000
 VITE_GAS_LIMIT_UPPER=1000000000
 VITE_GAS_PRICE_DEFAULT=1
 VITE_GAS_PRICE_LOWER=1
+VITE_SYNC_INTERVAL=300000
 VITE_MODE_MAINTENANCE=false
 VITE_REOWN_PROJECT_ID="" # the ID of the Bridge project (as on Reown Cloud)
 VITE_NODE_URL="" # connect to a specific node
diff --git a/web-wallet/src/lib/stores/walletStore.js b/web-wallet/src/lib/stores/walletStore.js
index 3123bc053..a5a2869cd 100644
--- a/web-wallet/src/lib/stores/walletStore.js
+++ b/web-wallet/src/lib/stores/walletStore.js
@@ -13,7 +13,10 @@ import { transactions } from "$lib/mock-data";
 import networkStore from "./networkStore";
 import settingsStore from "./settingsStore";
 
-const AUTO_SYNC_INTERVAL = 5 * 60 * 1000;
+const VITE_SYNC_INTERVAL = import.meta.env.VITE_SYNC_INTERVAL;
+const AUTO_SYNC_INTERVAL = !isNaN(Number(VITE_SYNC_INTERVAL))
+  ? Number(VITE_SYNC_INTERVAL)
+  : 5 * 60 * 1000;
 
 let autoSyncId = 0;
 
diff --git a/web-wallet/vite.config.js b/web-wallet/vite.config.js
index f7e515fdf..88c74f072 100644
--- a/web-wallet/vite.config.js
+++ b/web-wallet/vite.config.js
@@ -51,6 +51,7 @@ export default defineConfig(({ mode }) => {
         VITE_GAS_PRICE_UPPER: env.VITE_GAS_PRICE_UPPER,
         VITE_NODE_URL: env.VITE_NODE_URL,
         VITE_REOWN_PROJECT_ID: env.VITE_REOWN_PROJECT_ID,
+        VITE_SYNC_INTERVAL: env.VITE_SYNC_INTERVAL,
       },
     },
     plugins:
@@ -97,6 +98,7 @@ export default defineConfig(({ mode }) => {
         VITE_GAS_PRICE_DEFAULT: "1",
         VITE_GAS_PRICE_LOWER: "1",
         VITE_NODE_URL: "",
+        VITE_SYNC_INTERVAL: "300000",
       },
       environment: "jsdom",
       include: ["src/**/*.{test,spec}.{js,ts}"],


Test patch:
diff --git a/web-wallet/src/lib/stores/__tests__/walletStore.spec.js b/web-wallet/src/lib/stores/__tests__/walletStore.spec.js
index 531b44437..8e0dbfbdf 100644
--- a/web-wallet/src/lib/stores/__tests__/walletStore.spec.js
+++ b/web-wallet/src/lib/stores/__tests__/walletStore.spec.js
@@ -23,10 +23,15 @@ import { getSeedFromMnemonic } from "$lib/wallet";
 
 import { networkStore, walletStore } from "..";
 
+const VITE_SYNC_INTERVAL = import.meta.env.VITE_SYNC_INTERVAL;
+
 describe("Wallet store", async () => {
   vi.useFakeTimers();
 
-  const AUTO_SYNC_INTERVAL = 5 * 60 * 1000;
+  const AUTO_SYNC_INTERVAL = !isNaN(Number(VITE_SYNC_INTERVAL))
+    ? Number(VITE_SYNC_INTERVAL)
+    : 5 * 60 * 1000;
+
   const cachedBalance = {
     shielded: {
       spendable: 10n,