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
a880d7b8
Unverified
Commit
a880d7b8
authored
Oct 22, 2024
by
tom goriunov
Committed by
GitHub
Oct 22, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
`Unrecognized chain ID` error when adding network via mobile MetaMask (#2312)
Fixes #2267
parent
49bfadeb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletion
+3
-1
useAddOrSwitchChain.tsx
lib/web3/useAddOrSwitchChain.tsx
+3
-1
No files found.
lib/web3/useAddOrSwitchChain.tsx
View file @
a880d7b8
import
_get
from
'
lodash/get
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
config
from
'
configs/app
'
;
import
config
from
'
configs/app
'
;
...
@@ -24,9 +25,10 @@ export default function useAddOrSwitchChain() {
...
@@ -24,9 +25,10 @@ export default function useAddOrSwitchChain() {
const
errorObj
=
getErrorObj
(
error
);
const
errorObj
=
getErrorObj
(
error
);
const
code
=
errorObj
&&
'
code
'
in
errorObj
?
errorObj
.
code
:
undefined
;
const
code
=
errorObj
&&
'
code
'
in
errorObj
?
errorObj
.
code
:
undefined
;
const
originalErrorCode
=
_get
(
errorObj
,
'
data.originalError.code
'
);
// This error code indicates that the chain has not been added to Wallet.
// This error code indicates that the chain has not been added to Wallet.
if
(
code
===
4902
)
{
if
(
code
===
4902
||
originalErrorCode
===
4902
)
{
const
params
=
[
{
const
params
=
[
{
chainId
:
hexadecimalChainId
,
chainId
:
hexadecimalChainId
,
chainName
:
config
.
chain
.
name
,
chainName
:
config
.
chain
.
name
,
...
...
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