From d13321512dbef505e98ead33ecd467a7dc351a35 Mon Sep 17 00:00:00 2001 From: Norton Andreev Date: Thu, 15 Aug 2024 18:54:05 +0300 Subject: [PATCH] Fixes --- web-wallet/src/lib/stores/walletStore.js | 2 +- .../(welcome)/setup/create/NetworkSync.svelte | 10 +++-- .../(welcome)/setup/restore/+page.svelte | 30 +++++++++++--- .../setup/restore/NetworkSyncProgress.svelte | 39 +++++++++++++++++++ ...Sync.svelte => NetworkSyncSettings.svelte} | 2 +- 5 files changed, 72 insertions(+), 11 deletions(-) create mode 100644 web-wallet/src/routes/(welcome)/setup/restore/NetworkSyncProgress.svelte rename web-wallet/src/routes/(welcome)/setup/restore/{NetworkSync.svelte => NetworkSyncSettings.svelte} (95%) diff --git a/web-wallet/src/lib/stores/walletStore.js b/web-wallet/src/lib/stores/walletStore.js index 6fcd2844a5..67a1d89044 100644 --- a/web-wallet/src/lib/stores/walletStore.js +++ b/web-wallet/src/lib/stores/walletStore.js @@ -137,7 +137,7 @@ const stake = async (amount, gasSettings) => /** @type {WalletStoreServices["sync"]} */ function sync(from) { - console.log("calling sync"); + console.log("calling sync with from", from); if (!walletInstance) { throw new Error("No wallet instance to sync"); diff --git a/web-wallet/src/routes/(welcome)/setup/create/NetworkSync.svelte b/web-wallet/src/routes/(welcome)/setup/create/NetworkSync.svelte index 6f2a40fccc..48bf0b2170 100644 --- a/web-wallet/src/routes/(welcome)/setup/create/NetworkSync.svelte +++ b/web-wallet/src/routes/(welcome)/setup/create/NetworkSync.svelte @@ -1,8 +1,10 @@ - +

Store the current block height in case you want to resync from it next time you reset your wallet. This can significantly reduce the initial sync time. @@ -30,7 +32,7 @@ This can later be retrieved from Settings. Find out more in our docsdocumentation. - + diff --git a/web-wallet/src/routes/(welcome)/setup/restore/+page.svelte b/web-wallet/src/routes/(welcome)/setup/restore/+page.svelte index 75370e3b30..371b171ef4 100644 --- a/web-wallet/src/routes/(welcome)/setup/restore/+page.svelte +++ b/web-wallet/src/routes/(welcome)/setup/restore/+page.svelte @@ -4,7 +4,7 @@ import { fade } from "svelte/transition"; import TermsOfService from "../TermsOfService.svelte"; import PasswordSetup from "../PasswordSetup.svelte"; - import NetworkSyncing from "./NetworkSync.svelte"; + import NetworkSyncing from "./NetworkSyncSettings.svelte"; import AllSet from "../AllSet.svelte"; import MnemonicAuthenticate from "./MnemonicAuthenticate.svelte"; import { Wizard, WizardStep } from "$lib/dusk/components"; @@ -16,6 +16,7 @@ } from "$lib/wallet"; import { goto } from "$lib/navigation"; import { onDestroy } from "svelte"; + import NetworkSyncProgress from "./NetworkSyncProgress.svelte"; /** @type {boolean} */ let notice = false; @@ -32,6 +33,9 @@ /** @type {boolean} */ let isValidBlockHeight = false; + /** @type {boolean} */ + let isSyncCompleted = false; + /** @type {boolean} */ let showPasswordSetup = false; @@ -63,7 +67,7 @@ {:else} - + { + console.log("blockHeight", blockHeight); + await initializeWallet(mnemonicPhrase, blockHeight); + mnemonicPhrase = []; + }, disabled: !isValidBlockHeight, }} > @@ -119,17 +128,28 @@ Network
Syncing - +
+

+ Network
+ Syncing +

+ + + { - await initializeWallet(mnemonicPhrase, blockHeight); - mnemonicPhrase = []; await goto("/dashboard"); }, disabled: false, diff --git a/web-wallet/src/routes/(welcome)/setup/restore/NetworkSyncProgress.svelte b/web-wallet/src/routes/(welcome)/setup/restore/NetworkSyncProgress.svelte new file mode 100644 index 0000000000..fc425d84b3 --- /dev/null +++ b/web-wallet/src/routes/(welcome)/setup/restore/NetworkSyncProgress.svelte @@ -0,0 +1,39 @@ + + + + {#if sync.inProgress} + {#if !sync.current || !sync.latest} + Syncing + {:else} + + Syncing: {sync.current.toLocaleString()}/{sync.latest.toLocaleString()} + + + {/if} + {:else} + Sync completed! + {/if} + diff --git a/web-wallet/src/routes/(welcome)/setup/restore/NetworkSync.svelte b/web-wallet/src/routes/(welcome)/setup/restore/NetworkSyncSettings.svelte similarity index 95% rename from web-wallet/src/routes/(welcome)/setup/restore/NetworkSync.svelte rename to web-wallet/src/routes/(welcome)/setup/restore/NetworkSyncSettings.svelte index fa08078413..faa5726259 100644 --- a/web-wallet/src/routes/(welcome)/setup/restore/NetworkSync.svelte +++ b/web-wallet/src/routes/(welcome)/setup/restore/NetworkSyncSettings.svelte @@ -1,6 +1,6 @@