Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
frontend
Commits
fae30fca
Unverified
Commit
fae30fca
authored
Sep 05, 2023
by
tom goriunov
Committed by
GitHub
Sep 05, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1138 from jasonzysun/main
fix error in args of wallet_addEthereumChain request
parents
e9a45f37
3eca473f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
17 deletions
+14
-17
useAddOrSwitchChain.tsx
lib/web3/useAddOrSwitchChain.tsx
+14
-17
No files found.
lib/web3/useAddOrSwitchChain.tsx
View file @
fae30fca
...
...
@@ -27,26 +27,23 @@ export default function useAddOrSwitchChain() {
// This error code indicates that the chain has not been added to Wallet.
if
(
code
===
4902
)
{
const
params
=
{
method
:
'
wallet_addEthereumChain
'
,
params
:
[
{
chainId
:
hexadecimalChainId
,
chainName
:
config
.
chain
.
name
,
nativeCurrency
:
{
name
:
config
.
chain
.
currency
.
name
,
symbol
:
config
.
chain
.
currency
.
symbol
,
decimals
:
config
.
chain
.
currency
.
decimals
,
},
rpcUrls
:
[
config
.
chain
.
rpcUrl
],
blockExplorerUrls
:
[
config
.
app
.
baseUrl
],
}
],
// in wagmi types for wallet_addEthereumChain method is not provided
// eslint-disable-next-line @typescript-eslint/no-explicit-any
}
as
any
;
const
params
=
[
{
chainId
:
hexadecimalChainId
,
chainName
:
config
.
chain
.
name
,
nativeCurrency
:
{
name
:
config
.
chain
.
currency
.
name
,
symbol
:
config
.
chain
.
currency
.
symbol
,
decimals
:
config
.
chain
.
currency
.
decimals
,
},
rpcUrls
:
[
config
.
chain
.
rpcUrl
],
blockExplorerUrls
:
[
config
.
app
.
baseUrl
],
}
]
as
never
;
// in wagmi types for wallet_addEthereumChain method is not provided
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return
await
provider
.
request
({
method
:
'
wallet_addEthereumChain
'
,
params
,
params
:
params
,
});
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment