diff --git a/web-wallet/CHANGELOG.md b/web-wallet/CHANGELOG.md index 025f42be61..1280c4f08a 100644 --- a/web-wallet/CHANGELOG.md +++ b/web-wallet/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +- Show current block height on Wallet Creation [#1561] - Added gas settings validation on Unstake / Widthdraw Rewards flows [#2000] ### Changed @@ -225,6 +226,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 [#1545]: https://github.com/dusk-network/rusk/issues/1545 [#1547]: https://github.com/dusk-network/rusk/issues/1547 [#1552]: https://github.com/dusk-network/rusk/issues/1552 +[#1561]: https://github.com/dusk-network/rusk/issues/1561 [#1565]: https://github.com/dusk-network/rusk/issues/1565 [#1567]: https://github.com/dusk-network/rusk/issues/1567 [#1576]: https://github.com/dusk-network/rusk/issues/1576 diff --git a/web-wallet/src/lib/dusk/components/CopyField/CopyField.svelte b/web-wallet/src/lib/dusk/components/CopyField/CopyField.svelte new file mode 100644 index 0000000000..f4ad126254 --- /dev/null +++ b/web-wallet/src/lib/dusk/components/CopyField/CopyField.svelte @@ -0,0 +1,48 @@ + + +
+ +
+ + diff --git a/web-wallet/src/lib/dusk/components/index.js b/web-wallet/src/lib/dusk/components/index.js index 71cfa640da..5786c0f84b 100644 --- a/web-wallet/src/lib/dusk/components/index.js +++ b/web-wallet/src/lib/dusk/components/index.js @@ -1,6 +1,7 @@ export { default as Agreement } from "./Agreement/Agreement.svelte"; export { default as Anchor } from "./Anchor/Anchor.svelte"; export { default as AnchorButton } from "./AnchorButton/AnchorButton.svelte"; +export { default as CopyField } from "./CopyField/CopyField.svelte"; export { default as Badge } from "./Badge/Badge.svelte"; export { default as Button } from "./Button/Button.svelte"; export { default as Card } from "./Card/Card.svelte"; diff --git a/web-wallet/src/lib/dusk/number/createNumberFormatter.js b/web-wallet/src/lib/dusk/number/createNumberFormatter.js new file mode 100644 index 0000000000..495ecad184 --- /dev/null +++ b/web-wallet/src/lib/dusk/number/createNumberFormatter.js @@ -0,0 +1,17 @@ +/** + * Creates a locale aware number formatter + * + * @param {String} locale A BCP 47 language tag + * @param {Number|Undefined} digits The minimum fraction digits that should display + * @returns {(value: number | bigint) => string} + */ +const createNumberFormatter = (locale, digits = undefined) => { + const formatter = new Intl.NumberFormat(locale, { + style: "decimal", + maximumFractionDigits: digits, + }); + + return (value) => formatter.format(value); +}; + +export default createNumberFormatter; diff --git a/web-wallet/src/lib/dusk/number/index.js b/web-wallet/src/lib/dusk/number/index.js new file mode 100644 index 0000000000..deba021927 --- /dev/null +++ b/web-wallet/src/lib/dusk/number/index.js @@ -0,0 +1 @@ +export { default as createNumberFormatter } from "./createNumberFormatter"; diff --git a/web-wallet/src/routes/(welcome)/login/+page.svelte b/web-wallet/src/routes/(welcome)/login/+page.svelte index eed95f8cdc..a0d3f2f4a4 100644 --- a/web-wallet/src/routes/(welcome)/login/+page.svelte +++ b/web-wallet/src/routes/(welcome)/login/+page.svelte @@ -48,11 +48,6 @@ Promise.reject(new Error("Wrong password")) ); - function checkLastPosExists() { - const lastPos = localStorage.getItem("lastPos"); - return lastPos !== null ? true : false; - } - const loginInfo = loginInfoStorage.get(); const modeLabel = loginInfo ? "Password" : "Mnemonic phrase"; @@ -75,9 +70,7 @@ getSeed(secretText.trim()) .then(getWallet) .then(checkLocalData) - .then((wallet) => - walletStore.init(wallet, checkLastPosExists() ? undefined : 0) - ) + .then((wallet) => walletStore.init(wallet)) .then(() => goto("/dashboard")) .catch((err) => { if (err.message === localDataCheckErrorMsg) { diff --git a/web-wallet/src/routes/(welcome)/setup/create/+page.svelte b/web-wallet/src/routes/(welcome)/setup/create/+page.svelte index 2efb076235..d34c9f624a 100644 --- a/web-wallet/src/routes/(welcome)/setup/create/+page.svelte +++ b/web-wallet/src/routes/(welcome)/setup/create/+page.svelte @@ -13,6 +13,7 @@ import TermsOfService from "../TermsOfService.svelte"; import MnemonicPhrase from "./MnemonicPhrase.svelte"; import MnemonicValidate from "./MnemonicValidate.svelte"; + import NetworkSync from "./NetworkSync.svelte"; import SwapNDUSK from "./SwapNDUSK.svelte"; import AllSet from "../AllSet.svelte"; import MnemonicPreSetup from "./MnemonicPreSetup.svelte"; @@ -62,7 +63,7 @@ {:else} - + + +

+ Network
+ Syncing +

+ +
+ import { AppAnchor } from "$lib/components"; + import { Card, CopyField } from "$lib/dusk/components"; + import { createNumberFormatter } from "$lib/dusk/number"; + import { settingsStore, walletStore } from "$lib/stores"; + $: ({ language } = $settingsStore); + + $: currentBlock = 0; + + walletStore.getCurrentBlockHeight().then((block) => { + currentBlock = block; + }); + + const numberFormatter = createNumberFormatter(language); + + + +

+ Store the current block height in case you want to resync from it next time + you reset your wallet. This can significantly reduce the sync time. +

+ + + + + This can later be retrieved from Settings. Find out more in our docs. + +