Skip to content
This repository was archived by the owner on May 19, 2023. It is now read-only.

Commit 99bc3ed

Browse files
committed
feat: registered 8545 networkInfo for local tests
1 parent 795dd98 commit 99bc3ed

File tree

7 files changed

+69
-7
lines changed

7 files changed

+69
-7
lines changed

dist/index.js

Lines changed: 21 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.modern.js

Lines changed: 21 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.modern.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/src/App.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ import {
1515
import '@rsksmart/rif-ui/dist/index.css';
1616
import Routes from './Routes';
1717

18+
const requiredNetworkId = 8545
19+
1820
const App = () => {
1921

2022
const headerProps = {
@@ -35,7 +37,7 @@ const App = () => {
3537
account={account}
3638
setProvider={setProvider}
3739
currentNetworkId={networkInfo?.networkId}
38-
requiredNetworkId={1}
40+
requiredNetworkId={requiredNetworkId}
3941
/>
4042
</>
4143
)}
@@ -148,7 +150,7 @@ const App = () => {
148150
return (
149151
<ThemeProvider theme={theme}>
150152
<Web3Provider.Provider
151-
requiredNetworkId={1}
153+
requiredNetworkId={requiredNetworkId}
152154
actions={{
153155
onConnectedAccountChange: onConnectedAccountChange,
154156
onConnectedNetworkChange: onConnectedNetworkChange

src/data/networks.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,5 +1111,25 @@
11111111
],
11121112
"faucets": [],
11131113
"infoURL": "https://poa.network"
1114+
},
1115+
{
1116+
"name": "Local Tests",
1117+
"chainId": 1337,
1118+
"shortName": "test",
1119+
"chain": "localtests",
1120+
"network": "localTests",
1121+
"networkId": 8545,
1122+
"nativeCurrency": {
1123+
"name": "Local Tests Ether",
1124+
"symbol": "LT",
1125+
"decimals": 18
1126+
},
1127+
"rpc": [
1128+
"http://localhost:8545"
1129+
],
1130+
"faucets": [
1131+
"http://localhost:8545"
1132+
],
1133+
"infoURL": "http://localhost:8545"
11141134
}
11151135
]

src/providers/Web3Provider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ const shouldReadAccount = (
7272
networkInfo?: NetworkInfo,
7373
): boolean => {
7474
// the consumer did not provide enough information to validate the network, so we do not check
75-
if (!requiredNetworkId || !networkInfo) return true
75+
if (!requiredNetworkId) return true
7676

7777
if (requiredNetworkId === networkInfo?.networkId) {
7878
// only when chainId is provided we compare it

0 commit comments

Comments
 (0)