Commit c48a7f26 authored by Noah Zinsmeister's avatar Noah Zinsmeister Committed by GitHub

improve network env stuff (#621)

* improve network env setup
parent b21a6e39
REACT_APP_NETWORK_ID="1" REACT_APP_CHAIN_ID="1"
REACT_APP_NETWORK_URL="" REACT_APP_NETWORK_URL=""
REACT_APP_PORTIS_ID="" REACT_APP_PORTIS_ID=""
REACT_APP_FORTMATIC_KEY="" REACT_APP_FORTMATIC_KEY=""
REACT_APP_IS_PRODUCTION_DEPLOY="false"
\ No newline at end of file
...@@ -5,10 +5,16 @@ ...@@ -5,10 +5,16 @@
status = 451 status = 451
force = true force = true
conditions = {Country=["BY","CU","IR","IQ","CI","LR","KP","SD","SY","ZW"]} conditions = {Country=["BY","CU","IR","IQ","CI","LR","KP","SD","SY","ZW"]}
headers = {Link = "<https://uniswap.exchange>"} headers = {Link="<https://uniswap.exchange>"}
# support SPA setup # support SPA setup
[[redirects]] [[redirects]]
from = "/*" from = "/*"
to = "/index.html" to = "/index.html"
status = 200 status = 200
[build.environment]
REACT_APP_IS_PRODUCTION_DEPLOY = "false"
[context.production.environment]
REACT_APP_IS_PRODUCTION_DEPLOY = "true"
...@@ -7,35 +7,43 @@ import { NetworkConnector } from './Network' ...@@ -7,35 +7,43 @@ import { NetworkConnector } from './Network'
import { FortmaticConnector } from './Fortmatic' import { FortmaticConnector } from './Fortmatic'
const POLLING_INTERVAL = 10000 const POLLING_INTERVAL = 10000
const NETWORK_URL =
process.env.REACT_APP_IS_PRODUCTION_DEPLOY === 'true'
? process.env.REACT_APP_NETWORK_URL_PROD
: process.env.REACT_APP_NETWORK_URL
export const network = new NetworkConnector({ export const network = new NetworkConnector({
urls: { 1: process.env.REACT_APP_NETWORK_URL }, urls: { [Number(process.env.REACT_APP_CHAIN_ID)]: NETWORK_URL },
pollingInterval: POLLING_INTERVAL * 3 pollingInterval: POLLING_INTERVAL * 3
}) })
export const injected = new InjectedConnector({ export const injected = new InjectedConnector({
supportedChainIds: [1] supportedChainIds: [Number(process.env.REACT_APP_CHAIN_ID)]
}) })
// mainnet only
export const walletconnect = new WalletConnectConnector({ export const walletconnect = new WalletConnectConnector({
rpc: { 1: process.env.REACT_APP_NETWORK_URL }, rpc: { 1: NETWORK_URL },
bridge: 'https://bridge.walletconnect.org', bridge: 'https://bridge.walletconnect.org',
qrcode: false, qrcode: false,
pollingInterval: POLLING_INTERVAL pollingInterval: POLLING_INTERVAL
}) })
// mainnet only
export const fortmatic = new FortmaticConnector({ export const fortmatic = new FortmaticConnector({
apiKey: process.env.REACT_APP_FORTMATIC_KEY, apiKey: process.env.REACT_APP_FORTMATIC_KEY,
chainId: 1 chainId: 1
}) })
// mainnet only
export const portis = new PortisConnector({ export const portis = new PortisConnector({
dAppId: process.env.REACT_APP_PORTIS_ID, dAppId: process.env.REACT_APP_PORTIS_ID,
networks: [1] networks: [1]
}) })
// mainnet only
export const walletlink = new WalletLinkConnector({ export const walletlink = new WalletLinkConnector({
url: process.env.REACT_APP_NETWORK_URL, url: NETWORK_URL,
appName: 'Uniswap', appName: 'Uniswap',
appLogoUrl: appLogoUrl:
'https://mpng.pngfly.com/20181202/bex/kisspng-emoji-domain-unicorn-pin-badges-sticker-unicorn-tumblr-emoji-unicorn-iphoneemoji-5c046729264a77.5671679315437924251569.jpg' 'https://mpng.pngfly.com/20181202/bex/kisspng-emoji-domain-unicorn-pin-badges-sticker-unicorn-tumblr-emoji-unicorn-iphoneemoji-5c046729264a77.5671679315437924251569.jpg'
......
...@@ -12,7 +12,7 @@ export const SUPPORTED_THEMES = { ...@@ -12,7 +12,7 @@ export const SUPPORTED_THEMES = {
LIGHT: 'LIGHT' LIGHT: 'LIGHT'
} }
export const SUPPORTED_WALLETS = { const MAINNET_WALLETS = {
INJECTED: { INJECTED: {
connector: injected, connector: injected,
name: 'Injected', name: 'Injected',
...@@ -29,7 +29,15 @@ export const SUPPORTED_WALLETS = { ...@@ -29,7 +29,15 @@ export const SUPPORTED_WALLETS = {
description: 'Easy-to-use browser extension.', description: 'Easy-to-use browser extension.',
href: null, href: null,
color: '#E8831D' color: '#E8831D'
}, }
}
export const SUPPORTED_WALLETS =
process.env.REACT_APP_CHAIN_ID !== '1'
? MAINNET_WALLETS
: {
...MAINNET_WALLETS,
...{
WALLET_CONNECT: { WALLET_CONNECT: {
connector: walletconnect, connector: walletconnect,
name: 'WalletConnect', name: 'WalletConnect',
...@@ -82,7 +90,8 @@ export const SUPPORTED_WALLETS = { ...@@ -82,7 +90,8 @@ export const SUPPORTED_WALLETS = {
color: '#4A6C9B', color: '#4A6C9B',
mobile: true mobile: true
} }
} }
}
// list of tokens that lock fund on adding liquidity - used to disable button // list of tokens that lock fund on adding liquidity - used to disable button
export const brokenTokens = [ export const brokenTokens = [
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment