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
314 stars 372 forks source link

feat: add link to tx for order notifications [SWAP-61] #3803

Closed compojoom closed 1 month ago

compojoom commented 1 month ago

What it solves

We don’t always have the txId in the order information, but when we do we add a link to the notification. It’s highly likely that order created events won’t ever have a txId as this event is created before submitting the tx to the blockchain.

I had to extract getTxLink to a separate file as having it in useTxNotifications was causing a circular dependency error in our tests.

Resolves #

How this PR fixes it

This PR cannot guarantee that the push notification displayed will have a "view transaction" link. It all depends in what order the updates to the order will come through (whether they will be triggered through the widget or through the transaction service). If the user leaves the widget page after submitting a tx, then updates will most probably come from the tx service and there will be "view transaction" link in the notification.

How to test it

Submit an order and watch the push notifications. The "order executed" one should have a link to "view transaction".

Screenshots

grafik

Checklist

github-actions[bot] commented 1 month ago

Branch preview

✅ Deploy successful!

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

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

github-actions[bot] commented 1 month 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 1 month 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.31 KB (-45 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!

github-actions[bot] commented 1 month ago

Coverage report

St.:grey_question:
Category Percentage Covered / Total
🟡 Statements
79.43% (-0.07% 🔻)
11304/14231
🔴 Branches
58.38% (-0.21% 🔻)
2702/4628
🟡 Functions
66.53% (-0.28% 🔻)
1819/2734
🟢 Lines
80.82% (-0.04% 🔻)
10197/12617
Show new covered files 🐣
|
St.:grey_question:
| File | Statements | Branches | Functions | Lines | | :-: | :- | :- | :- | :- | :- | | 🟡 |
`...` / tx-link.ts
| 50% | 100% | 0% | 66.67% |
Show files with reduced coverage 🔻
|
St.:grey_question:
| File | Statements | Branches | Functions | Lines | | :-: | :- | :- | :- | :- | :- | | 🟡 |
`...` / transactions.ts
|
68.1% (-2.59% 🔻)
|
30.56% (-5.56% 🔻)
| 36.36% |
71.72% (-3.03% 🔻)
| | 🟢 |
`...` / swapOrderSlice.ts
|
84.81% (-2.69% 🔻)
|
75% (-7.61% 🔻)
| 77.78% |
85.92% (-3.15% 🔻)
| | 🟢 |
`...` / index.tsx
|
82.35% (-8.82% 🔻)
|
66.67% (-16.67% 🔻)
|
50% (-12.5% 🔻)
|
83.87% (-9.68% 🔻)
| | 🟢 |
`...` / index.tsx
|
96.67% (-3.33% 🔻)
| 72.22% |
76.92% (-23.08% 🔻)
|
96.55% (-3.45% 🔻)
| | 🟢 |
`...` / useHideAssets.ts
|
92.45% (-0.88% 🔻)
| 71.43% |
92.31% (-1.44% 🔻)
|
93.62% (-0.61% 🔻)
| | 🟢 |
`...` / swaps.ts
|
60% (-15% 🔻)
| 100% | 100% | 100% | | 🟢 |
`...` / useLoadBalances.ts
|
91.11% (-2.22% 🔻)
| 66.67% | 100% | 95% | | 🟢 |
`...` / useUserNonce.ts
|
91.67% (-8.33% 🔻)
| 100% | 100% |
90% (-10% 🔻)
| | 🟢 |
`...` / tx-tracking.ts
|
90.91% (-3.03% 🔻)
| 92.86% | 100% |
90.63% (-3.13% 🔻)
| | 🟢 |
`...` / index.tsx
|
87.5% (-0.22% 🔻)
|
73.33% (-2.42% 🔻)
| 60% |
86.54% (-0.25% 🔻)
|

Test suite run success

1438 tests passing in 197 suites.

Report generated by 🧪jest coverage report action from 25fcd4f7e6174ae0a1ad5b662178b4a13717436c

notion-workspace[bot] commented 1 month ago

Add link on the tx to the Order notifications