From f5ff92dea59195fd3fa2c02d563860c015614886 Mon Sep 17 00:00:00 2001 From: Norton Andreev Date: Fri, 20 Dec 2024 16:20:55 +0200 Subject: [PATCH] web-wallet: Remove VITE_FEATURE_MOONLIGHT_TRANSACTIONS flag Resolves #3246 --- web-wallet/CHANGELOG.md | 1 + web-wallet/README.md | 1 - .../src/lib/components/Send/Send.svelte | 41 +----- .../__tests__/__snapshots__/Send.spec.js.snap | 28 ++-- .../(app)/dashboard/receive/+page.svelte | 16 +-- .../__tests__/__snapshots__/page.spec.js.snap | 124 ------------------ .../dashboard/receive/__tests__/page.spec.js | 15 --- .../routes/(app)/dashboard/send/+page.svelte | 2 - web-wallet/vite.config.js | 3 - 9 files changed, 29 insertions(+), 202 deletions(-) diff --git a/web-wallet/CHANGELOG.md b/web-wallet/CHANGELOG.md index 3f76016f68..cdbced7453 100644 --- a/web-wallet/CHANGELOG.md +++ b/web-wallet/CHANGELOG.md @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Remove Beta ribbon [#3164] - Remove "UsageIndicator" component [#3245] +- Remove "VITE_FEATURE_MOONLIGHT_TRANSACTIONS" flag [#3246] ### Fixed diff --git a/web-wallet/README.md b/web-wallet/README.md index 3a3d5913be..9311813137 100644 --- a/web-wallet/README.md +++ b/web-wallet/README.md @@ -35,7 +35,6 @@ N.B. the current `0.1.2` version of the library has no option to pick the networ VITE_BASE_PATH="" VITE_FEATURE_ALLOCATE=true VITE_FEATURE_MIGRATE=true -VITE_FEATURE_MOONLIGHT_TRANSACTIONS=true VITE_FEATURE_STAKE=true VITE_FEATURE_TRANSFER=true VITE_FEATURE_TRANSACTION_HISTORY=true diff --git a/web-wallet/src/lib/components/Send/Send.svelte b/web-wallet/src/lib/components/Send/Send.svelte index de8ca260db..fea27e89d7 100644 --- a/web-wallet/src/lib/components/Send/Send.svelte +++ b/web-wallet/src/lib/components/Send/Send.svelte @@ -47,9 +47,6 @@ /** @type {GasStoreContent} */ export let gasLimits; - /** @type {boolean} */ - export let enableMoonlightTransactions = false; - /** @type {string} */ export let shieldedAddress; @@ -110,21 +107,6 @@ let activeStep = 0; - /** - * Validates an address/account depending on moonlight transactions being enabled. - * - * Note. This function can be removed when the VITE_FEATURE_MOONLIGHT_TRANSACTIONS flag is removed. - * - * @param {{isValid: boolean, type?: "address" | "account", isSelfReferential? : boolean}} addressInfo - */ - function isValid(addressInfo) { - return !addressInfo.isValid - ? true - : isMoonlightTransaction - ? !enableMoonlightTransactions - : false; - } - $: sendAmountInLux = sendAmount ? duskToLux(sendAmount) : 0n; // Calculate the maximum gas fee based on the gas limit and gas price. @@ -166,8 +148,6 @@ publicAddress ); - $: isMoonlightTransaction = addressInfo.type === "account"; - $: if (addressInfo.type) { dispatch("keyChange", { type: addressInfo.type, @@ -191,7 +171,7 @@ }} nextButton={{ action: () => activeStep++, - disabled: isValid(addressInfo), + disabled: !addressInfo.isValid, }} >
@@ -213,19 +193,12 @@ bind:value={sendToAddress} /> {#if addressInfo.type === "account"} - - {#if enableMoonlightTransactions} -

- This transaction will be public and sent from your public account. -

- {:else} -

Public transactions are currently unavailable.

- {/if} + +

+ This transaction will be public and sent from your public account. +

{/if} Address step > should display a warning if the address input is
@@ -195,7 +198,6 @@ exports[`Send > Address step > should display a warning if the address input is - - - - - -`; diff --git a/web-wallet/src/routes/(app)/dashboard/receive/__tests__/page.spec.js b/web-wallet/src/routes/(app)/dashboard/receive/__tests__/page.spec.js index d8d582bb6f..474bdf9544 100644 --- a/web-wallet/src/routes/(app)/dashboard/receive/__tests__/page.spec.js +++ b/web-wallet/src/routes/(app)/dashboard/receive/__tests__/page.spec.js @@ -48,21 +48,6 @@ describe("Receive", () => { vi.useRealTimers(); }); - it("should render the receive page with a single icon and no choice for shielded / unshielded if the feature flag is not true", async () => { - vi.stubEnv("VITE_FEATURE_ALLOCATE", "false"); - - const { container, getByRole, getByText } = render(Receive); - - await vi.runAllTimersAsync(); - - expect(() => getByRole("radiogroup")).toThrow(); - expect(getByText(expectedAddress)).toBeInTheDocument(); - expect(() => getByText(expectedAccount)).toThrow(); - expect(container.firstChild).toMatchSnapshot(); - - vi.unstubAllEnvs(); - }); - it("should render the receive page with a double icon and a choice to switch from shielded to unshielded address", async () => { const { container, getByRole, getByText } = render(Receive); diff --git a/web-wallet/src/routes/(app)/dashboard/send/+page.svelte b/web-wallet/src/routes/(app)/dashboard/send/+page.svelte index 825ccfc268..326da48175 100644 --- a/web-wallet/src/routes/(app)/dashboard/send/+page.svelte +++ b/web-wallet/src/routes/(app)/dashboard/send/+page.svelte @@ -63,8 +63,6 @@ {gasLimits} {gasSettings} availableBalance={spendable} - enableMoonlightTransactions={import.meta.env - .VITE_FEATURE_MOONLIGHT_TRANSACTIONS === "true"} on:keyChange={keyChangeHandler} /> diff --git a/web-wallet/vite.config.js b/web-wallet/vite.config.js index a008c54190..6057f59419 100644 --- a/web-wallet/vite.config.js +++ b/web-wallet/vite.config.js @@ -40,8 +40,6 @@ export default defineConfig(({ mode }) => { MODE_MAINTENANCE: env.VITE_MODE_MAINTENANCE, VITE_FEATURE_ALLOCATE: env.VITE_FEATURE_ALLOCATE, VITE_FEATURE_MIGRATE: env.VITE_FEATURE_MIGRATE, - VITE_FEATURE_MOONLIGHT_TRANSACTIONS: - env.VITE_FEATURE_MOONLIGHT_TRANSACTIONS, VITE_FEATURE_STAKE: env.VITE_FEATURE_STAKE, VITE_FEATURE_TRANSACTION_HISTORY: env.VITE_FEATURE_TRANSACTION_HISTORY, VITE_FEATURE_TRANSFER: env.VITE_FEATURE_TRANSFER, @@ -89,7 +87,6 @@ export default defineConfig(({ mode }) => { APP_VERSION: "0.1.5", VITE_FEATURE_ALLOCATE: "true", VITE_FEATURE_MIGRATE: "true", - VITE_FEATURE_MOONLIGHT_TRANSACTIONS: "true", VITE_FEATURE_STAKE: "true", VITE_FEATURE_TRANSACTION_HISTORY: "true", VITE_FEATURE_TRANSFER: "true",