Repository: dusk-network/rusk (language: rust)

Issue:
web-wallet: Remove VITE_FEATURE_MOONLIGHT_TRANSACTIONS env var



Discussion / hints:

Fix patch:
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,
       }}
     >
       <div in:fade|global class="operation__send">
@@ -213,19 +193,12 @@
           bind:value={sendToAddress}
         />
         {#if addressInfo.type === "account"}
-          <Banner
-            title="Public account detected"
-            variant={enableMoonlightTransactions ? "info" : "warning"}
-          >
-            {#if enableMoonlightTransactions}
-              <p>
-                This transaction will be public and sent from your <strong
-                  >public</strong
-                > account.
-              </p>
-            {:else}
-              <p>Public transactions are currently unavailable.</p>
-            {/if}
+          <Banner title="Public account detected" variant="info">
+            <p>
+              This transaction will be public and sent from your <strong
+                >public</strong
+              > account.
+            </p>
           </Banner>
         {/if}
         <ScanQR
diff --git a/web-wallet/src/routes/(app)/dashboard/receive/+page.svelte b/web-wallet/src/routes/(app)/dashboard/receive/+page.svelte
index aea164bd6b..271325d42c 100644
--- a/web-wallet/src/routes/(app)/dashboard/receive/+page.svelte
+++ b/web-wallet/src/routes/(app)/dashboard/receive/+page.svelte
@@ -25,19 +25,13 @@
   $: currentAddress = currentProfile
     ? currentProfile[addressProp].toString()
     : "";
-  $: icons =
-    import.meta.env.VITE_FEATURE_ALLOCATE === "true"
-      ? [
-          mdiArrowBottomLeftThin,
-          addressToShow === "shielded" ? mdiShieldLock : mdiShieldLockOpen,
-        ]
-      : [mdiArrowBottomLeftThin];
+  $: icons = [
+    mdiArrowBottomLeftThin,
+    addressToShow === "shielded" ? mdiShieldLock : mdiShieldLockOpen,
+  ];
 </script>
 
 <IconHeadingCard gap="medium" heading="Receive" {icons}>
-  {#if import.meta.env.VITE_FEATURE_ALLOCATE === "true"}
-    <ExclusiveChoice {options} bind:value={addressToShow} />
-  {/if}
-
+  <ExclusiveChoice {options} bind:value={addressToShow} />
   <Receive address={currentAddress} />
 </IconHeadingCard>
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}
   />
 </IconHeadingCard>
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",


Test patch:
diff --git a/web-wallet/src/lib/components/__tests__/__snapshots__/Send.spec.js.snap b/web-wallet/src/lib/components/__tests__/__snapshots__/Send.spec.js.snap
index 9ffc6e3dd8..d7cbfc6d9c 100644
--- a/web-wallet/src/lib/components/__tests__/__snapshots__/Send.spec.js.snap
+++ b/web-wallet/src/lib/components/__tests__/__snapshots__/Send.spec.js.snap
@@ -108,15 +108,15 @@ exports[`Send > Address step > should display a warning if the address input is
       
        
       <div
-        class="banner banner--warning"
+        class="banner banner--info"
       >
         <svg
-          class="dusk-icon dusk-icon--size--large banner__icon banner__icon--warning"
+          class="dusk-icon dusk-icon--size--large banner__icon banner__icon--info"
           role="graphics-symbol"
           viewBox="0 0 24 24"
         >
           <path
-            d="M12,2L1,21H23M12,6L19.53,19H4.47M11,10V14H13V10M11,16V18H13V16"
+            d="M11,15H13V17H11V15M11,7H13V13H11V7M12,2C6.47,2 2,6.5 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20Z"
           />
         </svg>
         
@@ -129,9 +129,12 @@ exports[`Send > Address step > should display a warning if the address input is
           </strong>
            
           <p>
-            Public transactions are currently unavailable.
+            This transaction will be public and sent from your 
+            <strong>
+              public
+            </strong>
+             account.
           </p>
-          
         </div>
       </div>
        
@@ -195,7 +198,6 @@ exports[`Send > Address step > should display a warning if the address input is
        
       <button
         class="dusk-button dusk-button--type--button dusk-button--variant--tertiary dusk-button--size--default dusk-icon-button--labeled"
-        disabled=""
         type="button"
       >
         <span
@@ -336,15 +338,15 @@ exports[`Send > Address step > should display a warning if the address input is
       
        
       <div
-        class="banner banner--warning"
+        class="banner banner--info"
       >
         <svg
-          class="dusk-icon dusk-icon--size--large banner__icon banner__icon--warning"
+          class="dusk-icon dusk-icon--size--large banner__icon banner__icon--info"
           role="graphics-symbol"
           viewBox="0 0 24 24"
         >
           <path
-            d="M12,2L1,21H23M12,6L19.53,19H4.47M11,10V14H13V10M11,16V18H13V16"
+            d="M11,15H13V17H11V15M11,7H13V13H11V7M12,2C6.47,2 2,6.5 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20Z"
           />
         </svg>
         
@@ -357,9 +359,12 @@ exports[`Send > Address step > should display a warning if the address input is
           </strong>
            
           <p>
-            Public transactions are currently unavailable.
+            This transaction will be public and sent from your 
+            <strong>
+              public
+            </strong>
+             account.
           </p>
-          
         </div>
       </div>
        
@@ -452,7 +457,6 @@ exports[`Send > Address step > should display a warning if the address input is
        
       <button
         class="dusk-button dusk-button--type--button dusk-button--variant--tertiary dusk-button--size--default dusk-icon-button--labeled"
-        disabled=""
         type="button"
       >
         <span
diff --git a/web-wallet/src/routes/(app)/dashboard/receive/__tests__/__snapshots__/page.spec.js.snap b/web-wallet/src/routes/(app)/dashboard/receive/__tests__/__snapshots__/page.spec.js.snap
index 3b147b4791..6fd9292bbc 100644
--- a/web-wallet/src/routes/(app)/dashboard/receive/__tests__/__snapshots__/page.spec.js.snap
+++ b/web-wallet/src/routes/(app)/dashboard/receive/__tests__/__snapshots__/page.spec.js.snap
@@ -335,127 +335,3 @@ exports[`Receive > should render the receive page with a double icon and a choic
    
 </div>
 `;
-
-exports[`Receive > should render the receive page with a single icon and no choice for shielded / unshielded if the feature flag is not true 1`] = `
-<div
-  class="dusk-card dusk-card--gap-medium"
->
-  <div
-    class="dusk-card__header-container"
-  >
-    <header
-      class="dusk-card__header"
-      slot="header"
-    >
-      <div
-        class="dusk-card__heading-container"
-      >
-        <h3
-          class="h4"
-        >
-          Receive
-        </h3>
-         
-        <div
-          class="dusk-card__heading-icons"
-        >
-          
-          <svg
-            class="dusk-icon dusk-icon--size--default"
-            role="graphics-symbol"
-            viewBox="0 0 24 24"
-          >
-            <path
-              d="M12.07 19L9.24 16.18L19 6.42L17.58 5L7.82 14.76L5 11.94V19Z"
-            />
-          </svg>
-          
-        </div>
-      </div>
-    </header>
-  </div>
-   
-  <div
-    class="dusk-card__body-container"
-  >
-     
-    <div
-      class="receive svelte-14g7par"
-    >
-      <figure
-        class="receive__address-qr-figure svelte-14g7par"
-      >
-        <img
-          alt="Key QR code"
-          class="dusk-qr-code receive__qr"
-          height="0"
-          src="data:image/png;base64,00"
-          width="0"
-        />
-        
-         
-        <figcaption
-          class="receive__address svelte-14g7par"
-        >
-          <samp>
-            2zFZwXf4JEvD2Vmd4kqx5tHDv73LkRr2Ydb84Knr2gmFJJoEEpZPtTbuQCrojM85QDHAvosxoZdnpLPSNRqzqmai
-          </samp>
-        </figcaption>
-      </figure>
-       
-      <div
-        class="receive__buttons svelte-14g7par"
-      >
-        <a
-          aria-disabled="false"
-          class="dusk-anchor dusk-anchor--on-surface dusk-anchor-button dusk-anchor-button--variant--tertiary dusk-anchor-button--size--default dusk-icon-button--labeled receive__button"
-          href="/some-base-path/dashboard"
-        >
-          <svg
-            class="dusk-icon dusk-icon--size--default dusk-anchor-button__icon"
-            role="graphics-symbol"
-            viewBox="0 0 24 24"
-          >
-            <path
-              d="M20,11V13H8L13.5,18.5L12.08,19.92L4.16,12L12.08,4.08L13.5,5.5L8,11H20Z"
-            />
-          </svg>
-          
-           
-          <span
-            class="dusk-anchor-button__text"
-          >
-            Back
-          </span>
-          
-          
-        </a>
-         
-        <button
-          class="dusk-button dusk-button--type--button dusk-button--variant--primary dusk-button--size--default dusk-icon-button--labeled receive__button"
-          type="button"
-        >
-          <svg
-            class="dusk-icon dusk-icon--size--default dusk-button__icon"
-            role="graphics-symbol"
-            viewBox="0 0 24 24"
-          >
-            <path
-              d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"
-            />
-          </svg>
-          
-           
-          <span
-            class="dusk-button__text"
-          >
-            Copy
-          </span>
-          
-        </button>
-      </div>
-    </div>
-  </div>
-   
-</div>
-`;
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);