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
312 stars 362 forks source link

Feat: display fiat balances for ERC20 tokens in counterfactual safes #3838

Open jmealy opened 3 weeks ago

jmealy commented 3 weeks ago

Blocked: https://5afe.slack.com/archives/C05HTQ67JAJ/p1718902866327009

What it solves

Resolves #3806

How this PR fixes it

  1. In the sidebar/login page safe list
    • For undeployed safes on supported chains, use /chains/{chainId}/safes/{safeAddress}/balances/{fiatCode} to get the total fiat balance.
    • For deployed safes, get the fiat total from the safe overviews, as before.
    • For undelpoyed safes on unsupported chains, show nothing. (remove loading skeleton)
  2. On the assets page
    • For undeployed safes on supported chains, get ERC20 asset balances from /chains/{chainId}/safes/{safeAddress}/balances/{fiatCode}
    • For undelpoyed safes on unsupported chains, only fetch the native token balance, as before.

How to test it

Screenshots

[1] image [2] image

Checklist

github-actions[bot] commented 3 weeks ago

Branch preview

βœ… Deploy successful!

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

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

github-actions[bot] commented 3 weeks 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 3 weeks 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 1003.85 KB (🟑 +108 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!

Two Pages Changed Size

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

Page Size (compressed) First Load
/balances 29.44 KB (🟑 +7 B) 1.01 MB
/home 60.08 KB (🟑 +40 B) 1.04 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.

github-actions[bot] commented 3 weeks ago

Coverage report

St.:grey_question:
Category Percentage Covered / Total
🟑 Statements
79.48% (+0.31% πŸ”Ό)
11536/14515
πŸ”΄ Branches
58.53% (+0.2% πŸ”Ό)
2792/4770
🟑 Functions
66.79% (+0.63% πŸ”Ό)
1850/2770
🟒 Lines
80.79% (+0.3% πŸ”Ό)
10397/12869
Show files with reduced coverage πŸ”»
|
St.:grey_question:
| File | Statements | Branches | Functions | Lines | | :-: | :- | :- | :- | :- | :- | | πŸ”΄ |
`...` / dispatch.ts
|
38.54% (-0.2% πŸ”»)
| 34.48% | 26.09% |
37.43% (-0.21% πŸ”»)
| | 🟒 |
`...` / useLoadBalances.ts
|
93.48% (+0.14% πŸ”Ό)
|
63.64% (-3.03% πŸ”»)
| 100% |
95.12% (+0.12% πŸ”Ό)
|

Test suite run success

1444 tests passing in 199 suites.

Report generated by πŸ§ͺjest coverage report action from d43c1c97b9dfe0e1caf69d5365341788f880f3cd

github-actions[bot] commented 2 weeks 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

liliya-soroka commented 2 weeks ago

@jmealy , I tried the feature on Polygon ( staging) and got the app crash

image

steps:

  1. create CF on Polygon (staging) - https://cf_balances--walletweb.review.5afe.dev/home?safe=matic:0x13317e62507cB96eD1269884379CBb6B3717Bd53&showCreationModal=true
image
github-actions[bot] commented 2 weeks 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

jmealy commented 2 weeks ago

@jmealy , I tried the feature on Polygon ( staging) and got the app crash image

steps:

  1. create CF on Polygon (staging) - https://cf_balances--walletweb.review.5afe.dev/home?safe=matic:0x13317e62507cB96eD1269884379CBb6B3717Bd53&showCreationModal=true
image

Thanks @liliya-soroka, this should be working now. You might need to clear your cache