Skip to content

Commit 1df39c5

Browse files
authored
chore: Fix alternative RPC url bug (pancakeswap#2415)
1 parent 4abce9f commit 1df39c5

File tree

5 files changed

+8
-14
lines changed

5 files changed

+8
-14
lines changed

.env.development

-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ REACT_APP_NODE_2 = "https://bsc-dataseed1.defibit.io"
1010
# 10+ nodes balanced in each region, global
1111
REACT_APP_NODE_3 = "https://bsc-dataseed.binance.org"
1212

13-
# Google Cloud Infrastructure Endpoint - Global
14-
REACT_APP_NODE_4 = "https://nodes.pancakeswap.com/"
15-
1613
REACT_APP_GRAPH_API_PROFILE = "https://api.thegraph.com/subgraphs/name/pancakeswap/profile"
1714
REACT_APP_GRAPH_API_PREDICTION = "https://api.thegraph.com/subgraphs/name/pancakeswap/prediction-v2"
1815
REACT_APP_GRAPH_API_LOTTERY = "https://api.thegraph.com/subgraphs/name/pancakeswap/lottery"

.env.production

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ REACT_APP_NODE_2 = "https://bsc-dataseed1.defibit.io"
1111
REACT_APP_NODE_3 = "https://bsc-dataseed.binance.org"
1212

1313
# Google Cloud Infrastructure Endpoint - Global
14-
# REACT_APP_NODE_4 = "https://nodes.pancakeswap.com/"
14+
# REACT_APP_NODE_ALT = "https://nodes.pancakeswap.com/"
1515

1616
REACT_APP_GRAPH_API_PROFILE = "https://api.thegraph.com/subgraphs/name/pancakeswap/profile"
1717
REACT_APP_GRAPH_API_PREDICTION = "https://api.thegraph.com/subgraphs/name/pancakeswap/prediction-v2"

.env.test

-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,3 @@ REACT_APP_CHAIN_ID = "56"
33
REACT_APP_NODE_1 = "https://bsc-dataseed1.ninicoin.io"
44
REACT_APP_NODE_2 = "https://bsc-dataseed1.ninicoin.io"
55
REACT_APP_NODE_3 = "https://bsc-dataseed1.ninicoin.io"
6-
REACT_APP_NODE_4 = "https://bsc-dataseed1.ninicoin.io"

public/index.html

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
<link rel="preconnect" href="%REACT_APP_NODE_1%" />
77
<link rel="preconnect" href="%REACT_APP_NODE_2%" />
88
<link rel="preconnect" href="%REACT_APP_NODE_3%" />
9-
<!-- <link rel="preconnect" href="%REACT_APP_NODE_4%" /> REMOVED UNTIL GOOGLE NODE IS FIXED -->
109
<link rel="preconnect" href="https://fonts.gstatic.com" />
1110
<link href="https://fonts.googleapis.com/css2?family=Kanit:wght@400;600&display=swap" rel="stylesheet" />
1211
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />

src/utils/getRpcUrl.ts

+7-8
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
import sample from 'lodash/sample'
22

3+
if (!process.env.REACT_APP_NODE_1 || !process.env.REACT_APP_NODE_2 || !process.env.REACT_APP_NODE_3) {
4+
throw Error('One base RPC URL is undefined')
5+
}
6+
37
// Array of available nodes to connect to
4-
export const nodes = [
5-
process.env.REACT_APP_NODE_1,
6-
process.env.REACT_APP_NODE_2,
7-
process.env.REACT_APP_NODE_3,
8-
// process.env.REACT_APP_NODE_4,
9-
]
8+
export const nodes = [process.env.REACT_APP_NODE_1, process.env.REACT_APP_NODE_2, process.env.REACT_APP_NODE_3]
109

11-
if (process.env.NODE_ENV === 'production') {
12-
nodes.push(process.env.REACT_APP_NODE_4)
10+
if (process.env.NODE_ENV === 'production' && process.env.REACT_APP_NODE_ALT) {
11+
nodes.push(process.env.REACT_APP_NODE_ALT)
1312
}
1413

1514
const getNodeUrl = () => {

0 commit comments

Comments
 (0)