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: TWAP decoding on confirmation screen [SW-2] #3865

Closed compojoom closed 6 days ago

compojoom commented 1 week ago

known issue:

What it solves

Ads decoding for twap transactions on the confirm transaction screen

How to test it

Create a twap order with the native swap. On the confirmation screen the decoding of the order should be displayed and it should be according to the designs.

Screenshots

grafik

Checklist

notion-workspace[bot] commented 1 week ago

Order Confirm Transaction decoding

github-actions[bot] commented 1 week ago

Branch preview

✅ Deploy successful!

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

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

github-actions[bot] commented 1 week 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 week ago

Coverage report

St.:grey_question:
Category Percentage Covered / Total
🟡 Statements
78.78% (-0.05% 🔻)
11386/14453
🔴 Branches
58.09% (-0.13% 🔻)
2753/4739
🟡 Functions
65.74% (-0.05% 🔻)
1827/2779
🟢 Lines
80.16% (-0.01% 🔻)
10261/12801
Show new covered files 🐣
|
St.:grey_question:
| File | Statements | Branches | Functions | Lines | | :-: | :- | :- | :- | :- | :- | | 🟢 |
`...` / constants.ts
| 50% | 100% | 100% | 100% | | 🟡 |
`...` / PartDuration.tsx
| 50% | 100% | 0% | 60% | | 🟡 |
`...` / PartSellAmount.tsx
| 62.5% | 0% | 0% | 71.43% | | 🟡 |
`...` / PartBuyAmount.tsx
| 62.5% | 0% | 0% | 71.43% |
Show files with reduced coverage 🔻
|
St.:grey_question:
| File | Statements | Branches | Functions | Lines | | :-: | :- | :- | :- | :- | :- | | 🟢 |
`...` / transaction-guards.ts
|
78.98% (-0.88% 🔻)
|
51.11% (+3.61% 🔼)
|
78% (+0.92% 🔼)
|
80.37% (+0.18% 🔼)
| | 🟡 |
`...` / extractTxInfo.ts
|
76.74% (-1.83% 🔻)
|
45.45% (-2.05% 🔻)
| 100% |
76.19% (-1.86% 🔻)
| | 🟡 |
`...` / DataTable.tsx
| 50% |
0% (-100% 🔻)
| 0% | 66.67% |

Test suite run success

1413 tests passing in 195 suites.

Report generated by 🧪jest coverage report action from 13d84674f8dbaa5ebad2543bf24163691832b1e7

github-actions[bot] commented 1 week 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.1 KB (🟡 +277 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!

Ten 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 53.31 KB (🟢 -77 B) 1.03 MB
/new-safe/create 33.76 KB (🟢 -62 B) 1.01 MB
/new-safe/load 16.39 KB (🟢 -62 B) 1016.49 KB
/share/safe-app 9.72 KB (🟢 -409 B) 1009.82 KB
/swap 30.1 KB (🟡 +29 B) 1.01 MB
/transactions 73.31 KB (🟢 -81 B) 1.05 MB
/transactions/history 73.27 KB (🟢 -80 B) 1.05 MB
/transactions/messages 37.81 KB (🟢 -78 B) 1.01 MB
/transactions/queue 30.89 KB (🟢 -83 B) 1.01 MB
/transactions/tx 20.66 KB (🟢 -80 B) 1020.76 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.

usame-algan commented 1 week ago

The tx modal title is missing. According to Figma it should says TWAP

Screenshot 2024-06-25 at 14 59 23
github-actions[bot] commented 1 week 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 1 week ago

I was asked to take a look at this ticket now before being in Ready for QA. I tested this on Sepolia since is the only network I have enough funds to even trigger a TWAP

When I created a TWAP order for the first time, I had to use the checkbox that edits the fallbackhandler in the CowSwap form. The tx at that moment looked like this instead on how the design looks

image

Once I've executed this tx I tried again, with the correct fallbackhandler now in place, the 2nd tx actually had the decoding expected in this ticket, but there are still some issues:

image

I didn't execute this transaction, I just queued it first and then I went to execute it in the queue. When I did that the form looks nothing like it looked before:

compojoom commented 1 week ago

When I created a TWAP order for the first time, I had to use the checkbox that edits the fallbackhandler in the CowSwap form. The tx at that moment looked like this instead on how the design looks

Did you maybe use the production gateway instead of staging? I just tested it again and for me it looks fine:

grafik

compojoom commented 1 week ago

The title looks messy, with the name of the order and the tokens being swap tossed there not aligned Also in my case an error won't allow me to execute the tx. I didn't see this error while I was creating the tx, so maybe is there an issue with proposed transactions that are already signed?

This should now be fixed

francovenica commented 1 week ago

@compojoom Did you try a safe where you have to enable the update of the fallbackhandler? When I had to do that for the 1st tx it would look without any decoding. The 2nd tx (once the fallbackhandler was updated) the decoding was showing properly. I used stg CGW, but since I was able to see the decoding in my 2nd attempt I assume that's not a factor.

francovenica commented 1 week ago

I can execute the tx now, so that's fixed.

The issue I reported at the beggining is still there: It seems that, when you upgrade fallbackhandler along the creation of the TWAP, the decoding in the tx form doesn't show as expected. I tried with Prod CGW this time

image image

compojoom commented 6 days ago

I tested with setting the fallback handler - it works on my end. We fixed something on the gateway yesterday that might have caused the issue for you. Please try again.

usame-algan commented 6 days ago

Just tested using TWAP on a new safe that doesn't have the fallback handler yet. This is the view I am getting which looks correct to me. @francovenica it looks like you are not seeing the decoded data. Could you share what the transaction-confirmation network request returns for you? localhost_3000_swap_safe=sep_0x361A14639600e025321893158437E15a30D6CE9A (2)

compojoom commented 6 days ago

The title looks messy, with the name of the order and the tokens being swap tossed there not aligned

Not sure how this got there. Fix it. Hope that it doesn't break something else, but tested with swap and limit and it looks fine.

compojoom commented 6 days ago

The title is not "TWAP" but "Twap order". Maybe is trying to be consistent with the other types of orders (swap and limit), but in this case it should be at least "TWAP" all in uppercase I fixed that

The text in the decoding is centered instead of being aligned left. I assume again that is to be consistent with the other types of orders. If that's the case then the designs should be updated @TanyaEfremova I talked to Tania, I reduced the margin between the elements, also moved them a bit more to the left. Now they are closer to the figma design.

Check the alignment of the text above with the text below. I draw a line to see how the texts are not aligned. That's ok. They cannot be vertically aligned as the parts are inside of the other table so it is expected that there is few px missmatch.

francovenica commented 6 days ago

Ok, works now. The alignments and text changing is fine as well

image

LGTM