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: Native Swaps #3231

Merged
merged 86 commits into from
May 10, 2024
Merged

Feat: Native Swaps #3231

merged 86 commits into from
May 10, 2024

Conversation

compojoom
Copy link
Contributor

@compojoom compojoom commented Feb 9, 2024

What it solves

Resolves #3585

How this PR fixes it

Adds a native swap widget to a new page and shows decoded info for swap orders.

How to test it

  1. Open a Safe
  2. Go to the dashboard
  3. Observe a Swap button in the top right
  4. Observe a Swap button in the Sidebar
  5. Go to the Assets page
  6. Observe a Swap button next to each asset

Screenshots

Checklist

  • I've tested the branch on mobile 📱
  • I've documented how it affects the analytics (if at all) 📊
  • I've written a unit/e2e test for it (if applicable) 🧑‍💻

Copy link

github-actions bot commented Feb 9, 2024

Copy link

github-actions bot commented Feb 9, 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 Feb 9, 2024

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
79.19% (-0.13% 🔻)
11626/14682
🔴 Branches
58.16% (-0.56% 🔻)
2754/4735
🟡 Functions
66.19% (-0.26% 🔻)
1860/2810
🟢 Lines
80.53% (-0.06% 🔻)
10479/13012
Show new covered files 🐣
St.
File Statements Branches Functions Lines
🟢
... / swapParamsSlice.ts
63.64% 100% 33.33% 85.71%
🟢
... / swapOrderSlice.ts
87.5% 82.61% 77.78% 89.06%
🟢
... / DataRow.tsx
83.33% 66.67% 100% 100%
🟡
... / index.tsx
71.43% 100% 0% 76.92%
🟢
... / swaps.ts
66.67% 100% 100% 100%
🟡
... / utils.ts
76.67% 65.22% 75% 78.85%
🟡
... / index.tsx
59.26% 0% 0% 66.67%
🟢
... / index.tsx
75% 0% 0% 85.71%
🟡
... / DataTable.tsx
50% 100% 0% 66.67%
🟢
... / index.tsx
88.89% 100% 0% 100%
🟢
... / index.tsx
100% 100% 100% 100%
🟢
... / index.tsx
69.23% 100% 0% 81.82%
🟢
... / useIsExpiredSwap.ts
92.86% 100% 100% 91.67%
🟢
... / index.tsx
57.14% 0% 0% 80%
🔴
... / index.tsx
52.5% 0% 0% 58.33%
🔴
... / index.tsx
38.46% 0% 0% 41.67%
🔴
... / useCustomAppCommunicator.tsx
49.37% 0% 15.79% 49.35%
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🟡
... / extractTxInfo.ts
78.57% (-4.29% 🔻)
47.5% (+1.79% 🔼)
100%
78.05% (-4.3% 🔻)
🟢 src/utils/chains.ts
91.67% (-8.33% 🔻)
100% 100% 100%
🟢
... / index.tsx
95% (+0.26% 🔼)
90.63% (-5.67% 🔻)
50% 100%
🟢
... / useSafeWalletProvider.tsx
81.82%
63.16% (-1.55% 🔻)
69.23% 83.87%
🟢
... / index.tsx
93.33% (+5.83% 🔼)
50% (-7.14% 🔻)
100% 100%
🟡
... / index.tsx
60% (-2.16% 🔻)
0% 0%
66.67% (-3.03% 🔻)
🟢
... / tx-tracking.ts
93.94% (-2.83% 🔻)
93.75% (-6.25% 🔻)
100%
93.75% (-2.92% 🔻)
🟢
... / index.tsx
100%
90.48% (-2.38% 🔻)
100% 100%
🟡
... / index.tsx
73.53% (+0.2% 🔼)
26.47% (-4.56% 🔻)
42.86% (-7.14% 🔻)
75%
🟡
... / useTransactionType.ts
69.44% (-3.28% 🔻)
42.11% (-3.61% 🔻)
100%
70.59% (-3.61% 🔻)
🟢
... / index.tsx
87.5% (+1.14% 🔼)
50% (-2.94% 🔻)
50%
86.96% (+1.24% 🔼)
🟢
... / index.tsx
89.47% (-4.28% 🔻)
62.5% (-8.93% 🔻)
100%
88.89% (-4.44% 🔻)
🟢
... / useTransactionStatus.ts
88% (-3.3% 🔻)
60% (-6.67% 🔻)
100%
90.91% (-4.09% 🔻)
🔴
... / index.tsx
52.38% (-0.25% 🔻)
0% 0%
55% (-0.56% 🔻)
🟢
... / index.ts
95.45% (-4.55% 🔻)
66.67% 100% 100%

Test suite run success

1464 tests passing in 202 suites.

Report generated by 🧪jest coverage report action from 330d73e

Copy link

github-actions bot commented Feb 9, 2024

📦 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 1011.96 KB (🟡 +1.51 KB)
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!

New Page Added

The following page was added to the bundle from the code in this PR:

Page Size (compressed) First Load
/swap 28.25 KB 1.02 MB

Thirteen 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 50.02 KB (🟡 +3.47 KB) 1.04 MB
/apps/custom 41.64 KB (🟡 +3.47 KB) 1.03 MB
/apps/open 84.88 KB (🟡 +10.85 KB) 1.07 MB
/balances 30.58 KB (🟡 +724 B) 1.02 MB
/home 63.54 KB (🟡 +3.83 KB) 1.05 MB
/new-safe/create 32.23 KB (🟡 +6 B) 1.02 MB
/new-safe/load 18.35 KB (🟡 +6 B) 1.01 MB
/settings/safe-apps 25.33 KB (🟡 +3.47 KB) 1.01 MB
/transactions 108.02 KB (🟡 +6.57 KB) 1.09 MB
/transactions/history 107.99 KB (🟡 +6.57 KB) 1.09 MB
/transactions/messages 67.81 KB (🟡 +6.56 KB) 1.05 MB
/transactions/queue 63.12 KB (🟡 +6.57 KB) 1.05 MB
/transactions/tx 52.95 KB (🟡 +6.57 KB) 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.

Copy link

github-actions bot commented Mar 7, 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 Apr 8, 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 Apr 10, 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

@usame-algan usame-algan changed the title Feat swaps Feat: Native Swaps Apr 15, 2024
Copy link

github-actions bot commented Apr 16, 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 Apr 17, 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 Apr 18, 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 Apr 22, 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 Apr 26, 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 Apr 29, 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 1, 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 2, 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

jmealy and others added 9 commits May 8, 2024 18:24
* Add token symbols to swap transaction summary

fix: make icons circular

fix: increase overlap and right margin of token symbols

fix: align text for swap orders with other tx types

feat: implement swap label according to design

* fix: icons are square in dark mode

.

---------

Co-authored-by: Daniel Dimitrov <daniel@compojoom.com>
…3654)

* feat: check if recipient address is blocked

only update params when changed

fix: Move state setters into useEffect, adjust text slightly

fix: Always set tradeType

* fix: Adjust wording

---------

Co-authored-by: Usame Algan <usame@safe.global>
Co-authored-by: Usame Algan <5880855+usame-algan@users.noreply.github.com>
* Fix: tx summary pending and expired status overlap

* remove duplicate fix
…ry (#3669)

* fix: overlapping text in tx summary

* fix: give more space to info block
* refactor: remove chainId
* refactor: address review comments
* feat: add partially filled state

* refactor: use new icon for partial fill

* fix: wrong calculation for partially filled

* improve tests
* fix: mobile view on desktop res

* reserve column for actions even if not present to keep things aligned

* fix: remove whitespace

* fix: incorrent column names for actions and status
@compojoom compojoom marked this pull request as ready for review May 8, 2024 16:27
Copy link

github-actions bot commented May 8, 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

package.json Outdated Show resolved Hide resolved
public/images/transactions/cow-logo.png Outdated Show resolved Hide resolved
const router = useRouter()

return (
<CheckWallet allowSpendingLimit={!!spendingLimit}>
Copy link
Member

Choose a reason for hiding this comment

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

@liliya-soroka @francovenica have you checked swaps with a spending limit?

src/components/balances/AssetsTable/index.tsx Outdated Show resolved Hide resolved
src/components/common/BlockedAddress/index.tsx Outdated Show resolved Hide resolved
src/features/counterfactual/FirstTxFlow.tsx Outdated Show resolved Hide resolved
src/features/swap/index.tsx Outdated Show resolved Hide resolved
SWAP_TOKENS: {
action: 'Swap total asset',
category: SWAP_CATEGORY,
},
Copy link
Member

Choose a reason for hiding this comment

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

@alicecha have you already reviewed the analytics events on this branch?

src/features/swap/hooks/useIsExpiredSwap.ts Outdated Show resolved Hide resolved
src/features/swap/hooks/useIsExpiredSwap.ts Outdated Show resolved Hide resolved
Copy link
Member

@katspaugh katspaugh left a comment

Choose a reason for hiding this comment

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

🎉

@compojoom compojoom merged commit eeaf972 into dev May 10, 2024
18 of 19 checks passed
@compojoom compojoom deleted the feat-cow-swap branch May 10, 2024 08:19
@github-actions github-actions bot locked and limited conversation to collaborators May 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Native Swaps
8 participants