From 5f101c1cbc0d2d76df1e7d716c237f817bb364b5 Mon Sep 17 00:00:00 2001 From: Andrea Scartabelli Date: Tue, 19 Nov 2024 11:36:25 +0100 Subject: [PATCH] web-wallet: use `w3sper`'s minimum stake amount instead of env var Resolves #3010 --- web-wallet/CHANGELOG.md | 2 ++ web-wallet/README.md | 1 - .../src/lib/containers/StakeContract/StakeContract.svelte | 7 +++---- web-wallet/src/lib/stores/settingsStore.js | 1 - web-wallet/src/lib/stores/stores.d.ts | 1 - web-wallet/vite.config.js | 2 -- 6 files changed, 5 insertions(+), 9 deletions(-) diff --git a/web-wallet/CHANGELOG.md b/web-wallet/CHANGELOG.md index 1f584e1d11..1166a2bef5 100644 --- a/web-wallet/CHANGELOG.md +++ b/web-wallet/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added gas settings validation on Unstake / Widthdraw Rewards flows [#2000] - Add temporary link to the block explorer on the dashboard [#2882] - Update Staking-Related functionality to make use of w3sper [#3006] +- Add minimum stake amount supplied by w3sper instead of using an env var [#3010] ### Changed @@ -347,6 +348,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 [#2990]: https://github.com/dusk-network/rusk/issues/2990 [#3000]: https://github.com/dusk-network/rusk/issues/3000 [#3006]: https://github.com/dusk-network/rusk/issues/3006 +[#3010]: https://github.com/dusk-network/rusk/issues/3010 diff --git a/web-wallet/README.md b/web-wallet/README.md index 652dac0aa3..117137c3e9 100644 --- a/web-wallet/README.md +++ b/web-wallet/README.md @@ -45,7 +45,6 @@ VITE_GAS_LIMIT_UPPER=1000000000 VITE_GAS_PRICE_DEFAULT=1 VITE_GAS_PRICE_LOWER=1 VITE_MIGRATE_CONTRACT="" -VITE_MINIMUM_ALLOWED_STAKE=1000 VITE_MODE_MAINTENANCE=false VITE_NODE_URL="" # connect to a specific node ``` diff --git a/web-wallet/src/lib/containers/StakeContract/StakeContract.svelte b/web-wallet/src/lib/containers/StakeContract/StakeContract.svelte index ef19504af8..99cbe3d2fd 100644 --- a/web-wallet/src/lib/containers/StakeContract/StakeContract.svelte +++ b/web-wallet/src/lib/containers/StakeContract/StakeContract.svelte @@ -31,7 +31,7 @@ export let spendable = 0n; - $: [gasSettings, language, minAllowedStake] = collectSettings($settingsStore); + $: [gasSettings, language] = collectSettings($settingsStore); $: duskFormatter = createCurrencyFormatter(language, "DUSK", 9); const gasLimits = $gasStore; @@ -54,7 +54,6 @@ "gasPriceLower", ]), getKey("language"), - getKey("minAllowedStake"), ]); /** @type {Record boolean>} */ @@ -139,7 +138,7 @@ $: ({ currentOperation } = $operationsStore); const { hideStakingNotice } = $settingsStore; - $: ({ balance, syncStatus } = $walletStore); + $: ({ balance, minimumStake, syncStatus } = $walletStore); $: isSyncOK = !(syncStatus.isInProgress || !!syncStatus.error); $: if (!isSyncOK) { disableAllOperations(descriptor.operations); @@ -154,7 +153,7 @@ formatter={duskFormatter} {gasLimits} {gasSettings} - {minAllowedStake} + minAllowedStake={luxToDusk(minimumStake)} on:operationChange on:suppressStakingNotice rewards={luxToDusk(stakeInfo.reward)} diff --git a/web-wallet/src/lib/stores/settingsStore.js b/web-wallet/src/lib/stores/settingsStore.js index d7f77f8a02..e2f522e7bb 100644 --- a/web-wallet/src/lib/stores/settingsStore.js +++ b/web-wallet/src/lib/stores/settingsStore.js @@ -35,7 +35,6 @@ const initialState = { gasLimit: BigInt(import.meta.env.VITE_GAS_LIMIT_DEFAULT ?? 20000000), gasPrice: BigInt(import.meta.env.VITE_GAS_PRICE_DEFAULT ?? 1), hideStakingNotice: false, - minAllowedStake: parseInt(import.meta.env.VITE_MINIMUM_ALLOWED_STAKE, 10), userId: "", }; diff --git a/web-wallet/src/lib/stores/stores.d.ts b/web-wallet/src/lib/stores/stores.d.ts index 8f24ae0fcd..03139dc36a 100644 --- a/web-wallet/src/lib/stores/stores.d.ts +++ b/web-wallet/src/lib/stores/stores.d.ts @@ -18,7 +18,6 @@ type SettingsStoreContent = { gasPrice: bigint; hideStakingNotice: boolean; language: string; - minAllowedStake: number; userId: string; }; diff --git a/web-wallet/vite.config.js b/web-wallet/vite.config.js index 4c2f16ea12..6f4b8babec 100644 --- a/web-wallet/vite.config.js +++ b/web-wallet/vite.config.js @@ -51,7 +51,6 @@ export default defineConfig(({ mode }) => { VITE_GAS_PRICE_DEFAULT: env.VITE_GAS_PRICE_DEFAULT, VITE_GAS_PRICE_LOWER: env.VITE_GAS_PRICE_LOWER, VITE_GAS_PRICE_UPPER: env.VITE_GAS_PRICE_UPPER, - VITE_MINIMUM_ALLOWED_STAKE: env.VITE_MINIMUM_ALLOWED_STAKE, VITE_NODE_URL: env.VITE_NODE_URL, }, }, @@ -99,7 +98,6 @@ export default defineConfig(({ mode }) => { VITE_GAS_LIMIT_UPPER: "1000000000", VITE_GAS_PRICE_DEFAULT: "1", VITE_GAS_PRICE_LOWER: "1", - VITE_MINIMUM_ALLOWED_STAKE: "1234", VITE_NODE_URL: "", }, environment: "jsdom",