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: display contract names for WalletConnect txs #3760

Merged
merged 9 commits into from
Jun 5, 2024
Merged

Feat: display contract names for WalletConnect txs #3760

merged 9 commits into from
Jun 5, 2024

Conversation

katspaugh
Copy link
Member

@katspaugh katspaugh commented May 28, 2024

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

  • Make txs via WalletConnect
  • Check how they are displayed in the queue/history

Screenshots

Before

Screenshot 2024-05-28 at 13 39 33

After

Screenshot 2024-05-28 at 14 12 26

Copy link

github-actions bot commented May 28, 2024

Copy link

github-actions bot commented May 28, 2024

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
  • Result: ✅ success
  • Annotations: 0 total

Report generated by eslint-plus-action

Copy link

github-actions bot commented May 28, 2024

📦 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.

Copy link

github-actions bot commented May 28, 2024

Coverage report

St.
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.
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 4bacced

@katspaugh
Copy link
Member Author

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

@francovenica francovenica self-assigned this May 29, 2024
Copy link

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
  • Result: ✅ success
  • Annotations: 0 total

Report generated by eslint-plus-action

@francovenica
Copy link
Contributor

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

Copy link

github-actions bot commented Jun 4, 2024

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
  • Result: ✅ success
  • Annotations: 0 total

Report generated by eslint-plus-action

@katspaugh
Copy link
Member Author

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
Copy link
Member Author

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.

Copy link
Member

@schmanu schmanu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice addition to show the Domains for WalletConnect messages!

@francovenica
Copy link
Contributor

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

@katspaugh
Copy link
Member Author

katspaugh commented Jun 5, 2024

@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.

@katspaugh katspaugh merged commit c1f4064 into dev Jun 5, 2024
13 of 14 checks passed
@katspaugh katspaugh deleted the wc-tx branch June 5, 2024 06:26
@github-actions github-actions bot locked and limited conversation to collaborators Jun 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants