-
Notifications
You must be signed in to change notification settings - Fork 33
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(widget): add unsupported network #2860
Conversation
WalkthroughThe changes introduce a Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Widget
participant Provider
User ->> Widget: Switch Network
Widget ->> CHAINS_BY_ID: Get chain by ID
CHAINS_BY_ID ->> Widget: Return Chain Object
Widget ->> Provider: wallet_addEthereumChain with nativeCurrency
Provider ->> Widget: Confirm Network Switch
Widget ->> User: Network Switched
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
- Added
nativeCurrency
field to each chain object inpackages/widget/src/constants/chains.ts
- Updated
Chain
interface inpackages/widget/src/types/index.d.ts
to include native currency properties - Enhanced
switchNetwork
function inpackages/widget/src/utils/actions/switchNetwork.ts
to add unrecognized networks usingwallet_addEthereumChain
method
3 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (3)
- packages/widget/src/constants/chains.ts (21 hunks)
- packages/widget/src/types/index.d.ts (1 hunks)
- packages/widget/src/utils/actions/switchNetwork.ts (2 hunks)
Additional comments not posted (24)
packages/widget/src/utils/actions/switchNetwork.ts (2)
2-2
: EnsureCHAINS_BY_ID
contains all necessary chain data.The new import for
CHAINS_BY_ID
is used to retrieve chain details. Verify thatCHAINS_BY_ID
includes all required chain information.
13-22
: LGTM! But verify error handling forprovider.send
.The code changes are approved.
Ensure that the
provider.send
calls handle errors appropriately, especially forwallet_addEthereumChain
andwallet_switchEthereumChain
.packages/widget/src/types/index.d.ts (1)
87-91
: LGTM! But verify the implementation ofnativeCurrency
across all chain objects.The code changes are approved.
Ensure that all chain objects correctly implement the new
nativeCurrency
property.packages/widget/src/constants/chains.ts (21)
16-20
: LGTM!The addition of the
nativeCurrency
property to theETHEREUM
chain object is correct.
35-39
: LGTM!The addition of the
nativeCurrency
property to theARBITRUM
chain object is correct.
54-58
: LGTM!The addition of the
nativeCurrency
property to theBNBCHAIN
chain object is correct.
73-77
: LGTM!The addition of the
nativeCurrency
property to theAVALANCHE
chain object is correct.
92-96
: LGTM!The addition of the
nativeCurrency
property to theCANTO
chain object is correct.
111-115
: LGTM!The addition of the
nativeCurrency
property to theOPTIMISM
chain object is correct.
130-134
: LGTM!The addition of the
nativeCurrency
property to thePOLYGON
chain object is correct.
149-153
: LGTM!The addition of the
nativeCurrency
property to theDFK
chain object is correct.
168-172
: LGTM!The addition of the
nativeCurrency
property to theKLAYTN
chain object is correct.
187-191
: LGTM!The addition of the
nativeCurrency
property to theFANTOM
chain object is correct.
206-210
: LGTM!The addition of the
nativeCurrency
property to theCRONOS
chain object is correct.
225-229
: LGTM!The addition of the
nativeCurrency
property to theBOBA
chain object is correct.
244-248
: LGTM!The addition of the
nativeCurrency
property to theMETIS
chain object is correct.
263-267
: LGTM!The addition of the
nativeCurrency
property to theAURORA
chain object is correct.
282-286
: LGTM!The addition of the
nativeCurrency
property to theHARMONY
chain object is correct.
301-305
: LGTM!The addition of the
nativeCurrency
property to theMOONBEAM
chain object is correct.
320-324
: LGTM!The addition of the
nativeCurrency
property to theMOONRIVER
chain object is correct.
339-343
: LGTM!The addition of the
nativeCurrency
property to theDOGE
chain object is correct.
358-362
: LGTM!The addition of the
nativeCurrency
property to theBASE
chain object is correct.
378-382
: LGTM!The addition of the
nativeCurrency
property to theBLAST
chain object is correct.
397-401
: LGTM!The addition of the
nativeCurrency
property to theSCROLL
chain object is correct.
Deploying sanguine-fe with
|
Latest commit: |
84eaf76
|
Status: | ✅ Deploy successful! |
Preview URL: | https://eaa4eda7.sanguine-fe.pages.dev |
Branch Preview URL: | https://widget-add-unrecognized-netw.sanguine-fe.pages.dev |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2860 +/- ##
===================================================
+ Coverage 25.35936% 25.67477% +0.31540%
===================================================
Files 784 769 -15
Lines 56350 55315 -1035
Branches 80 80
===================================================
- Hits 14290 14202 -88
+ Misses 40581 39637 -944
+ Partials 1479 1476 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
(updates since last review)
- Added
networkName
andnetworkUrl
properties to chain objects inpackages/widget/src/constants/chains.ts
- Updated
Chain
interface inpackages/widget/src/types/index.d.ts
to includenetworkName
andnetworkUrl
- Enhanced
switchNetwork
function inpackages/widget/src/utils/actions/switchNetwork.ts
to supportnetworkName
andnetworkUrl
parameters
3 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
(updates since last review)
- Updated network URLs for Fantom and Scroll chains in
packages/widget/src/constants/chains.ts
- Ensured URLs are correctly formatted without trailing slashes
1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (3)
- packages/widget/src/constants/chains.ts (21 hunks)
- packages/widget/src/types/index.d.ts (1 hunks)
- packages/widget/src/utils/actions/switchNetwork.ts (2 hunks)
Files skipped from review as they are similar to previous changes (3)
- packages/widget/src/constants/chains.ts
- packages/widget/src/types/index.d.ts
- packages/widget/src/utils/actions/switchNetwork.ts
Summary by CodeRabbit
New Features
Enhancements
These changes improve clarity and usability for end-users interacting with various blockchain networks within the app.