safe-global / safe-wallet-web

Safe{Wallet} – smart contract wallet for Ethereum (ex-Gnosis Safe multisig)
https://app.safe.global
GNU General Public License v3.0
311 stars 360 forks source link

Feat: Do not show swaps feature to users from blocked counties [SW-48] #3892

Closed jmealy closed 1 day ago

jmealy commented 2 days ago

What it solves

We need to block access to the swaps feature for users on the OFAC list of sanctioned countries.

How this PR fixes it

How to test it

Screenshots

image

Checklist

github-actions[bot] commented 2 days ago

Branch preview

✅ Deploy successful!

Website: https://geoblocking--walletweb.review.5afe.dev/home?safe=eth:0xA77DE01e157f9f57C7c4A326eeE9C4874D0598b6

Storybook: https://geoblocking--walletweb.review.5afe.dev/storybook/

notion-workspace[bot] commented 2 days ago

Hide Swap feature if user is from a sanctioned country

github-actions[bot] commented 2 days ago

ESLint Summary View Full Report

Annotations are provided inline on the Files Changed tab. You can also see all annotations that were generated on the annotations page.

Type Occurrences Fixable
Errors 0 0
Warnings 0 0
Ignored 0 N/A

Report generated by eslint-plus-action

github-actions[bot] commented 2 days ago

📦 Next.js Bundle Analysis for safe-wallet-web

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

⚠️ Global Bundle Size Increased

Page Size (compressed)
global 1000.77 KB (🟡 +109 B)
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
/403 574 B 1001.33 KB

Five Pages Changed Size

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

Page Size (compressed) First Load
/apps 50.18 KB (🟡 +56 B) 1.03 MB
/apps/custom 41.8 KB (🟡 +56 B) 1.02 MB
/balances 29.49 KB (🟡 +55 B) 1.01 MB
/home 58.71 KB (🟡 +75 B) 1.03 MB
/swap 604 B (🟡 +55 B) 1001.36 KB
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.

github-actions[bot] commented 2 days ago

Coverage report

St.:grey_question:
Category Percentage Covered / Total
🟡 Statements
78.85% (-0.04% 🔻)
11586/14694
🔴 Branches
57.96% (-0.06% 🔻)
2810/4848
🟡 Functions
65.72% (-0.11% 🔻)
1846/2809
🟢 Lines
80.25% (-0.05% 🔻)
10449/13020
Show new covered files 🐣
|
St.:grey_question:
| File | Statements | Branches | Functions | Lines | | :-: | :- | :- | :- | :- | :- | | 🟢 |
`...` / useIsSwapFeatureEnabled.ts
| 100% | 100% | 100% | 100% | | 🔴 |
`...` / index.tsx
| 40% | 0% | 0% | 38.46% |
Show files with reduced coverage 🔻
|
St.:grey_question:
| File | Statements | Branches | Functions | Lines | | :-: | :- | :- | :- | :- | :- | | 🟡 |
`...` / utils.ts
|
73.63% (-1.63% 🔻)
|
56.25% (-6.91% 🔻)
|
70.59% (-5.6% 🔻)
|
75.95% (-1.43% 🔻)
| | 🟢 |
`...` / index.tsx
|
91.3% (-0.36% 🔻)
| 75% | 50% |
95.24% (-0.22% 🔻)
| | 🟢 |
`...` / index.tsx
|
88.33% (-0.56% 🔻)
|
72.22% (+1.17% 🔼)
| 60% |
87.5% (-0.64% 🔻)
|

Test suite run success

1419 tests passing in 197 suites.

Report generated by 🧪jest coverage report action from 638aa480a79509d94d06689b6477d721e8ae30c2