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

Refactor: Replace onboard with Eip1193Provider in dispatch calls #3745

Merged
merged 5 commits into from
Jun 3, 2024

Conversation

usame-algan
Copy link
Member

@usame-algan usame-algan commented May 24, 2024

What it solves

Resolves #3744

This ports part of the changes over from #3727

How this PR fixes it

How to test it

  1. All transaction flows and message flows need to be tested
  2. Gas estimation should still work
  3. Being prompted to switch the chain when transacting should still work

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) 🧑‍💻

@usame-algan usame-algan requested a review from schmanu May 24, 2024 14:27
Copy link

github-actions bot commented May 24, 2024

tsconfig.json Outdated Show resolved Hide resolved
Copy link

github-actions bot commented May 24, 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 24, 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 KB (-33 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.94 KB (🟡 +30 B) 1000.94 KB
/transactions 73.88 KB (🟡 +30 B) 1023.88 KB
/transactions/history 73.84 KB (🟡 +30 B) 1023.84 KB
/transactions/messages 33.87 KB (🟡 +30 B) 983.87 KB
/transactions/queue 29.11 KB (🟡 +30 B) 979.11 KB
/transactions/tx 18.86 KB (🟡 +30 B) 968.86 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 24, 2024

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
79.47% (+0% 🔼)
11308/14229
🔴 Branches
58.44% (-0.02% 🔻)
2704/4627
🟡 Functions
66.57% (-0.1% 🔻)
1820/2734
🟢 Lines
80.85% (+0% 🔼)
10198/12613
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🟢
... / helpers.ts
83.33% (-16.67% 🔻)
100%
80% (-20% 🔻)
83.33% (-16.67% 🔻)
🟡
... / sdk.ts
68.04% (-1.75% 🔻)
38.1%
61.54% (-7.69% 🔻)
66.67% (-1.94% 🔻)
🟢
... / useSafeMessage.ts
94.74% (-5.26% 🔻)
100%
75% (-25% 🔻)
94.44% (-5.56% 🔻)
🟡
... / CounterfactualForm.tsx
68.57% (-0.55% 🔻)
40% (-2.86% 🔻)
66.67%
68.66% (-0.57% 🔻)
🟢
... / ReviewSignMessageOnChain.tsx
86.11% (-0.65% 🔻)
61.9% (-3.1% 🔻)
83.33%
86.76% (-0.74% 🔻)
🔴
... / recovery-sender.ts
13.21% (-1.34% 🔻)
0% 0%
13.21% (-1.34% 🔻)

Test suite run success

1437 tests passing in 197 suites.

Report generated by 🧪jest coverage report action from 0aa42f8

@katspaugh katspaugh changed the title fix: Replace onboard with Eip1193Provider in dispatch calls Refactor: Replace onboard with Eip1193Provider in dispatch calls May 27, 2024
src/services/tx/tx-sender/sdk.ts Outdated Show resolved Hide resolved
const signer = await getAssertedChainSigner(onboard, chainId)
export const getUncheckedSafeSDK = async (provider: Eip1193Provider): Promise<Safe> => {
const browserProvider = createWeb3(provider)
const signer = await browserProvider.getSigner()
Copy link
Member

Choose a reason for hiding this comment

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

If we update to the latest protocol-kit it actually expects EIP 1193 Providers and removes all adapters.
Should we use the opportunity to do this in this PR?

https://docs.safe.global/sdk/protocol-kit/reference/migrate-to-v4

Copy link
Member Author

Choose a reason for hiding this comment

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

Thats really nice! Doesn't look like too big of a change but just to be safe I would do the migration in a follow-up PR after this is merged.

Copy link
Member Author

Choose a reason for hiding this comment

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

Added an issue: #3750

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

@liliya-soroka
Copy link
Member

liliya-soroka commented May 30, 2024

Switch network doesn't work for rabby wallet. On prod we are showing the error with information about wrong chain in the wallet. In the PR there is no such error.
@usame-algan

@usame-algan
Copy link
Member Author

usame-algan commented May 30, 2024

Switch network doesn't work for rabby wallet. On prod we are showing the error with information about wrong chain in the wallet. In the PR there is no such error. @usame-algan

Thanks for reporting! I can reproduce that the error notification is not visible anymore. I found a way however to fix this error for adding networks in Rabby so I will create a separate PR to dev instead of only fixing the notification. Created a PR here: #3776

Copy link

github-actions bot commented May 31, 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 katspaugh merged commit 0e20e87 into dev Jun 3, 2024
14 checks passed
@katspaugh katspaugh deleted the eip1193-provider branch June 3, 2024 16:35
@github-actions github-actions bot locked and limited conversation to collaborators Jun 3, 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.

Use Eip1193Provider instead of onboard for dispatch calls
4 participants