Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Safenet): Add Safenet opt-in flow #4791

Draft
wants to merge 2 commits into
base: safenet
Choose a base branch
from

Conversation

germartinez
Copy link
Member

What it solves

This PR adds a banner in the Home page to initiate the process to create a new Safenet account.

Resolves https://github.com/safe-global/safenet/issues/276

How to test it

The Home page should display the Safenet banner when a non Safenet-enabled Safe account is connected. The button of the banner should display a modal window to create a new Safenet account or use the existing Safe to "migrate" (if compatible).

Screenshots

Image

Checklist

  • I've tested the branch on mobile 📱
  • I've documented how it affects the analytics (if at all) 📊
  • I've written a unit/e2e test for it (if applicable) 🧑‍💻

Copy link

github-actions bot commented Jan 17, 2025

Copy link

📦 Next.js Bundle Analysis for @safe-global/web

This analysis was generated by the Next.js Bundle Analysis action. 🤖

⚠️ Global Bundle Size Increased

Page Size (compressed)
global 1.05 MB (🟡 +62.88 KB)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

New Page Added

The following page was added to the bundle from the code in this PR:

Page Size (compressed) First Load
/settings/safenet 218.45 KB 1.26 MB

Thirty-one Pages Changed Size

The following pages changed size from the code in this PR compared to its base branch:

Page Size (compressed) First Load
/ 508 B (🟢 -2 B) 1.05 MB
/address-book 23.21 KB (🟡 +142 B) 1.07 MB
/apps 35.51 KB (🟡 +1.78 KB) 1.08 MB
/apps/custom 33.57 KB (🟡 +1.78 KB) 1.08 MB
/apps/open 55.68 KB (🟡 +2.07 KB) 1.1 MB
/balances 29.89 KB (🟡 +190 B) 1.08 MB
/balances/nfts 9.52 KB (🟢 -23 B) 1.06 MB
/bridge 2.56 KB (🟡 +2 B) 1.05 MB
/cookie 8.77 KB (🟡 +1 B) 1.06 MB
/home 66.22 KB (🟡 +6.96 KB) 1.11 MB
/new-safe/advanced-create 26.38 KB (🟢 -70 B) 1.08 MB
/new-safe/create 25.52 KB (🟢 -71 B) 1.08 MB
/privacy 14.57 KB (🟡 +2 B) 1.06 MB
/settings/appearance 2.25 KB (🟡 +2 B) 1.05 MB
/settings/environment-variables 3.27 KB (🟢 -1 B) 1.05 MB
/settings/modules 4.06 KB (🟡 +1 B) 1.05 MB
/settings/notifications 6.33 KB (🟢 -14.99 KB) 1.06 MB
/settings/safe-apps 20.35 KB (🟡 +2.08 KB) 1.07 MB
/settings/security 2.34 KB (🟡 +1 B) 1.05 MB
/settings/setup 30.88 KB (🟡 +152 B) 1.08 MB
/share/safe-app 7.56 KB (🟢 -5 B) 1.06 MB
/stake 618 B (🟢 -1 B) 1.05 MB
/swap 761 B (🟡 +1 B) 1.05 MB
/terms 12.93 KB (🟡 +1 B) 1.06 MB
/transactions 99.58 KB (🟡 +3 KB) 1.15 MB
/transactions/history 99.54 KB (🟡 +3 KB) 1.15 MB
/transactions/messages 60.37 KB (🟡 +2.07 KB) 1.11 MB
/transactions/msg 56.62 KB (🟡 +2.07 KB) 1.11 MB
/transactions/queue 49.47 KB (🟡 +2.08 KB) 1.1 MB
/transactions/tx 48.83 KB (🟡 +2.07 KB) 1.1 MB
/welcome/accounts 409 B (🟡 +2 B) 1.05 MB
Details

Only the gzipped size is provided here based on an expert tip.

First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

Next to the size is how much the size has increased or decreased compared with the base branch of this PR. If this percentage has increased by 20% or more, there will be a red status indicator applied, indicating that special attention should be given to this.

Copy link

Coverage report for apps/web

Caution

Test run failed

St.
Category Percentage Covered / Total
🟡 Statements 74.13% 14858/20042
🔴 Branches 51.86% 3562/6869
🔴 Functions 56.98% 2105/3694
🟡 Lines 75.66% 13482/17820

Test suite run failed

Failed tests: 3/1793. Failed suites: 2/242.
  ● ConfirmationView › should display a confirmation screen for a SETTINGS_CHANGE transaction

    expect(received).toMatchSnapshot()

    Snapshot name: `ConfirmationView should display a confirmation screen for a SETTINGS_CHANGE transaction 1`

    - Snapshot  -  8
    + Received  + 12

    @@ -279,18 +279,22 @@
                              data-testid="tx-data-row"
                            >
                              <div
                                class="MuiBox-root css-axw7ok"
                              >
    -                           <img
    -                             alt="ETH"
    -                             class="image"
    -                             height="26"
    -                             loading="lazy"
    -                             referrerpolicy="no-referrer"
    -                             src="/images/common/token-placeholder.svg"
    -                           />
    +                           <div
    +                             class="container"
    +                           >
    +                             <img
    +                               alt="ETH"
    +                               class="image"
    +                               height="26"
    +                               loading="lazy"
    +                               referrerpolicy="no-referrer"
    +                               src="/images/common/token-placeholder.svg"
    +                             />
    +                           </div>
                                <p
                                  class="MuiTypography-root MuiTypography-body1 css-w5uidf-MuiTypography-root"
                                >
                                  ETH
                                </p>

      116 |     )
      117 |
    > 118 |     expect(container).toMatchSnapshot()
          |                       ^
      119 |   })
      120 |
      121 |   it("should display a confirmation with method call when the transaction type is not found in the ConfirmationView's mapper", () => {

      at Object.toMatchSnapshot (src/components/tx/confirmation-views/ConfirmationView.test.tsx:118:23)

  ● ConfirmationView › should display a confirmation with method call when the transaction type is not found in the ConfirmationView's mapper

    expect(received).toMatchSnapshot()

    Snapshot name: `ConfirmationView should display a confirmation with method call when the transaction type is not found in the ConfirmationView's mapper 1`

    - Snapshot  -  8
    + Received  + 12

    @@ -168,18 +168,22 @@
                              data-testid="tx-data-row"
                            >
                              <div
                                class="MuiBox-root css-axw7ok"
                              >
    -                           <img
    -                             alt="ETH"
    -                             class="image"
    -                             height="26"
    -                             loading="lazy"
    -                             referrerpolicy="no-referrer"
    -                             src="/images/common/token-placeholder.svg"
    -                           />
    +                           <div
    +                             class="container"
    +                           >
    +                             <img
    +                               alt="ETH"
    +                               class="image"
    +                               height="26"
    +                               loading="lazy"
    +                               referrerpolicy="no-referrer"
    +                               src="/images/common/token-placeholder.svg"
    +                             />
    +                           </div>
                                <p
                                  class="MuiTypography-root MuiTypography-body1 css-w5uidf-MuiTypography-root"
                                >
                                  ETH
                                </p>

      131 |     )
      132 |
    > 133 |     expect(container).toMatchSnapshot()
          |                       ^
      134 |   })
      135 | })
      136 |

      at Object.toMatchSnapshot (src/components/tx/confirmation-views/ConfirmationView.test.tsx:133:23)


  ● SignOrExecute › should display a confirmation screen

    expect(received).toMatchSnapshot()

    Snapshot name: `SignOrExecute should display a confirmation screen 1`

    - Snapshot  -  1
    + Received  + 70

    @@ -76,11 +76,80 @@
                          role="region"
                        >
                          <div
                            class="MuiAccordionDetails-root css-w74p4c-MuiAccordionDetails-root"
                            data-testid="decoded-tx-details"
    -                     />
    +                     >
    +                       <div
    +                         class="MuiBox-root css-164r41r"
    +                       >
    +                         <div
    +                           class="MuiGrid-root MuiGrid-container css-86qz5o-MuiGrid-root"
    +                         >
    +                           <div
    +                             class="MuiGrid-root MuiGrid-item css-1wehkfy-MuiGrid-root"
    +                             data-testid="tx-row-title"
    +                             style="word-break: break-word;"
    +                           >
    +                             <p
    +                               class="MuiTypography-root MuiTypography-body1 css-shf88x-MuiTypography-root"
    +                             >
    +                               Safenet checks:
    +                             </p>
    +                           </div>
    +                           <div
    +                             class="MuiGrid-root MuiGrid-item MuiGrid-grid-xs-true css-1vd824g-MuiGrid-root"
    +                             data-testid="tx-data-row"
    +                           >
    +                             <div
    +                               class="safenetGradientRow MuiBox-root css-0"
    +                               style="border-radius: calc(var(--space-1) - 1px); display: flex; align-items: stretch; flex-direction: column; justify-content: space-between;"
    +                             >
    +                               <div
    +                                 class="MuiBox-root css-0"
    +                                 style="display: flex; flex-direction: row; justify-content: space-between; align-items: center;"
    +                               >
    +                                 <mock-icon
    +                                   aria-hidden=""
    +                                   class="MuiSvgIcon-root MuiSvgIcon-fontSizeSmall css-tqxw8e-MuiSvgIcon-root"
    +                                   focusable="false"
    +                                 />
    +                                 <h5
    +                                   class="MuiTypography-root MuiTypography-h5 css-1ukimg9-MuiTypography-root"
    +                                 >
    +                                   Powered by Safenet
    +                                 </h5>
    +                               </div>
    +                               <div
    +                                 class="MuiBox-root css-0"
    +                                 style="border-radius: 0 0 var(--space-1) var(--space-1); margin: 0px 1px 1px 1px;"
    +                               >
    +                                 <span
    +                                   class="MuiCircularProgress-root MuiCircularProgress-indeterminate MuiCircularProgress-colorPrimary css-k0aauw-MuiCircularProgress-root"
    +                                   role="progressbar"
    +                                   style="width: 22px; height: 22px;"
    +                                 >
    +                                   <svg
    +                                     class="MuiCircularProgress-svg css-54pwck-MuiCircularProgress-svg"
    +                                     viewBox="22 22 44 44"
    +                                   >
    +                                     <circle
    +                                       class="MuiCircularProgress-circle MuiCircularProgress-circleIndeterminate css-960umw-MuiCircularProgress-circle"
    +                                       cx="44"
    +                                       cy="44"
    +                                       fill="none"
    +                                       r="20.2"
    +                                       stroke-width="3.6"
    +                                     />
    +                                   </svg>
    +                                 </span>
    +                               </div>
    +                             </div>
    +                           </div>
    +                         </div>
    +                       </div>
    +                     </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>

      54 |
      55 |     expect(getByTestId('sign-btn')).toBeInTheDocument()
    > 56 |     expect(container).toMatchSnapshot()
         |                       ^
      57 |   })
      58 |
      59 |   it('should display an error screen', async () => {

      at Object.toMatchSnapshot (src/components/tx/SignOrExecuteForm/__tests__/SignOrExecute.test.tsx:56:23)

Report generated by 🧪jest coverage report action from 07f9265

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant