-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconnectors.ts
62 lines (55 loc) · 1.78 KB
/
connectors.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import { InjectedConnector } from '@web3-react/injected-connector'
import { NetworkConnector } from '@web3-react/network-connector'
import { WalletConnectConnector } from '@web3-react/walletconnect-connector'
import { WalletLinkConnector } from '@web3-react/walletlink-connector'
const POLLING_INTERVAL = 12000
const RPC_URLS: { [chainId: number]: string } = {
1: process.env.RPC_URL_1 as string,
4: process.env.RPC_URL_4 as string
}
export const Networks: Record<string, Record<string, string>> = {
BSC: {
chainId: "56",
chainHex: '0x38',
rpc: 'https://bsc-dataseed.binance.org/',
explorer: 'https://bscscan.com/'
},
BSCTest: {
chainId: "97",
chainHex: '0x61',
rpc: 'https://testnet.bsc-dataseed.binance.org/',
explorer: 'https://testnet.bscscan.com/'
},
Local: {
chainId: "31337",
chainHex: '0x7A69',
rpc: 'http://127.0.0.1:8545/',
explorer: 'http://127.0.0.1:8545/explorer',
}
}
export const defaultChain = Networks[process.env.NEXT_PUBLIC_DEFAULT_CHAIN!.toString()];
export const injected = new InjectedConnector({
supportedChainIds: [
Number(defaultChain.chainId),
]
})
export const walletconnect = new WalletConnectConnector({
infuraId: '',
rpc: {
[defaultChain.chainId]: defaultChain.rpc
},
qrcode: true
})
export const network = new NetworkConnector({
urls: { [Networks.Local.chainId]: Networks.BSC.rpc },
defaultChainId: Number(Networks.Local.chainId)
})
export const walletlink = new WalletLinkConnector({
url: RPC_URLS[1],
appName: 'Foxtrot Command Public Private Sale',
supportedChainIds: [
Number(Networks.BSC.chainId),
Number(Networks.BSCTest.chainId),
Number(Networks.Local.chainId)
]
})