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
327 stars 392 forks source link

Feat: display contract names for WalletConnect txs #3760

Closed katspaugh closed 2 months ago

katspaugh commented 2 months ago

What it solves

For transactions made via WalletConnect, show the contract name instead of just WalletConnect in the tx summary.

How this PR fixes it

I've changed the appUrl or these txs from a hard-coded WalletConnect Safe App URL to the original dapp URL. Since our backend doesn't know anything about arbitrary dapp origins, it will not be able to annotate these txs as WalletConnect txs anymore, so we'll display a generic contract name instead. If the contract isn't verified, it will just say Contract interaction as usual.

How to test it

Screenshots

Before

Screenshot 2024-05-28 at 13 39 33

After

Screenshot 2024-05-28 at 14 12 26
github-actions[bot] commented 2 months ago

Branch preview

✅ Deploy successful!

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

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

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

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

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

🎉 Global Bundle Size Decreased

Page Size (compressed)
global 950.07 KB (-88 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!

Six 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/open 50.9 KB (🟢 -46 B) 1000.97 KB
/transactions 73.9 KB (🟡 +20 B) 1023.97 KB
/transactions/history 73.86 KB (🟡 +20 B) 1023.94 KB
/transactions/messages 34.74 KB (🟡 +893 B) 984.81 KB
/transactions/queue 29.14 KB (🟡 +20 B) 979.21 KB
/transactions/tx 18.88 KB (🟡 +21 B) 968.96 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 months ago

Coverage report

St.:grey_question:
Category Percentage Covered / Total
🟡 Statements
79.45% (-0.02% 🔻)
11298/14220
🔴 Branches
58.4% (-0.03% 🔻)
2700/4623
🟡 Functions
66.56% (-0.01% 🔻)
1819/2733
🟢 Lines
80.84% (-0.02% 🔻)
10191/12607
Show files with reduced coverage 🔻
|
St.:grey_question:
| File | Statements | Branches | Functions | Lines | | :-: | :- | :- | :- | :- | :- | | 🟢 |
`...` / gateway.ts
|
82.61% (-2.58% 🔻)
| 100% |
66.67% (-4.76% 🔻)
|
83.33% (-2.38% 🔻)
| | 🟢 |
`...` / tx-tracking.ts
|
90.91% (-3.03% 🔻)
|
92.86% (-0.89% 🔻)
| 100% |
90.63% (-3.13% 🔻)
|

Test suite run success

1438 tests passing in 197 suites.

Report generated by 🧪jest coverage report action from 4baccedd1edcb999b34de2c7118199a685c97210

katspaugh commented 2 months ago

Looks like Usame has partially reviewed it, so I'll provisionally move it to QA but happy to make any requested changes later.

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

francovenica commented 2 months ago

I think these are ok when the tx name are generic like "Contract interaction" or "WalletConnect" , but if the name is the specific dapp I'd leave that one: For example in this one, I think the "CowSwap" name says more than Wrapped ETH image image

The safe these were taken: sep:0x8f4A19C85b39032A37f7a6dCc65234f966F72551

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

katspaugh commented 2 months ago

I've also adjusted the Messages to display the EIP712 domain name and primaryType if available.

Screenshot 2024-06-04 at 10 32 44
katspaugh commented 2 months ago

I think these are ok when the tx name are generic like "Contract interaction" or "WalletConnect" , but if the name is the specific dapp I'd leave that one: For example in this one, I think the "CowSwap" name says more than Wrapped ETH

@francovenica the example you gave me has different txs on prod and staging. Nonce 378 on staging is not a Cow tx, and it's the same tx as nonce 380 with the prod CGW. So there's no issue there.

francovenica commented 2 months ago

@katspaugh Check in both snapshots the TxHash, is the same, so it is the same transaction

katspaugh commented 2 months ago

@francovenica I see, true! Still, the issue there is a prod/dev mismatch. Safe App ids are different across these environments, so a tx made in one env won't match with the same (if any) Safe App in another. If you switch the prod CGW toggle, tx 378 gets the correct icon.