diff --git a/web-wallet/CHANGELOG.md b/web-wallet/CHANGELOG.md index 2b031764f5..4a05434b78 100644 --- a/web-wallet/CHANGELOG.md +++ b/web-wallet/CHANGELOG.md @@ -17,6 +17,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- Fix creation of a new wallet causing the sync to start from genesis [#3362] + ## [1.2.0] - 2025-01-16 ### Added @@ -537,6 +539,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 [#3339]: https://github.com/dusk-network/rusk/issues/3339 [#3354]: https://github.com/dusk-network/rusk/issues/3354 [#3356]: https://github.com/dusk-network/rusk/issues/3356 +[#3362]: https://github.com/dusk-network/rusk/issues/3362 diff --git a/web-wallet/src/routes/(welcome)/setup/create/+page.js b/web-wallet/src/routes/(welcome)/setup/create/+page.js new file mode 100644 index 0000000000..f3df926d83 --- /dev/null +++ b/web-wallet/src/routes/(welcome)/setup/create/+page.js @@ -0,0 +1,15 @@ +import { error } from "@sveltejs/kit"; + +import { networkStore } from "$lib/stores"; + +/** @type {import("./$types").PageLoad} */ +export async function load() { + return { + currentBlockHeight: await networkStore.getCurrentBlockHeight().catch(() => { + error( + 500, + "Unable to retrieve current block height: the network may be down." + ); + }), + }; +} diff --git a/web-wallet/src/routes/(welcome)/setup/create/+page.svelte b/web-wallet/src/routes/(welcome)/setup/create/+page.svelte index 3fea8663f2..cc7363aec0 100644 --- a/web-wallet/src/routes/(welcome)/setup/create/+page.svelte +++ b/web-wallet/src/routes/(welcome)/setup/create/+page.svelte @@ -19,6 +19,9 @@ import PasswordSetup from "../PasswordSetup.svelte"; import { goto } from "$lib/navigation"; + /** @type {import("./$types").PageData} */ + export let data; + /** @type {boolean} */ let notice = false; @@ -47,6 +50,7 @@ let enteredMnemonicPhrase = []; const { userId } = $settingsStore; + const { currentBlockHeight } = data; $: if (showPasswordSetup) { password = showPasswordSetup ? password : ""; @@ -141,7 +145,7 @@ }} nextButton={{ action: async () => { - await initializeWallet(mnemonicPhrase.join(" ")); + await initializeWallet(mnemonicPhrase.join(" "), currentBlockHeight); mnemonicPhrase = []; }, disabled: false, @@ -151,7 +155,7 @@ Network
Syncing - + { - currentBlock = block; - }); + export let currentBlockHeight; const numberFormatter = createNumberFormatter(language); @@ -27,9 +23,8 @@ diff --git a/web-wallet/src/routes/(welcome)/setup/create/__tests__/__snapshots__/page.spec.js.snap b/web-wallet/src/routes/(welcome)/setup/create/__tests__/__snapshots__/page.spec.js.snap index 0c81731ed8..d21d4a4db2 100644 --- a/web-wallet/src/routes/(welcome)/setup/create/__tests__/__snapshots__/page.spec.js.snap +++ b/web-wallet/src/routes/(welcome)/setup/create/__tests__/__snapshots__/page.spec.js.snap @@ -1787,7 +1787,6 @@ exports[`Create > ensures the Network Syncing step renders as expected 1`] = `