2018-08-08 17:24:01 +02:00
|
|
|
// @flow
|
|
|
|
import { ensureOnce } from '~/utils/singleton'
|
2019-09-24 16:42:15 +04:00
|
|
|
import { ETHEREUM_NETWORK } from '~/logic/wallets/getWeb3'
|
2019-08-26 13:23:48 +02:00
|
|
|
import { TX_SERVICE_HOST, SIGNATURES_VIA_METAMASK, RELAY_API_URL } from '~/config/names'
|
2018-08-08 17:24:01 +02:00
|
|
|
import devConfig from './development'
|
|
|
|
import testConfig from './testing'
|
2019-09-25 15:05:59 +04:00
|
|
|
import stagingConfig from './staging'
|
2018-08-08 17:24:01 +02:00
|
|
|
import prodConfig from './production'
|
2019-09-24 17:35:22 +04:00
|
|
|
import mainnetDevConfig from './development-mainnet'
|
2019-09-24 14:30:09 +04:00
|
|
|
import mainnetProdConfig from './production-mainnet'
|
2019-09-25 15:05:59 +04:00
|
|
|
import mainnetStagingConfig from './staging-mainnet'
|
2018-08-08 17:24:01 +02:00
|
|
|
|
|
|
|
const configuration = () => {
|
|
|
|
if (process.env.NODE_ENV === 'test') {
|
|
|
|
return testConfig
|
|
|
|
}
|
|
|
|
|
|
|
|
if (process.env.NODE_ENV === 'production') {
|
2019-09-24 17:20:48 +04:00
|
|
|
if (process.env.REACT_APP_NETWORK === 'mainnet') {
|
2019-09-25 15:15:45 +04:00
|
|
|
return process.env.REACT_APP_ENV === 'production' ? mainnetProdConfig : mainnetStagingConfig
|
2019-09-24 14:30:09 +04:00
|
|
|
}
|
|
|
|
|
2019-09-25 15:15:45 +04:00
|
|
|
return process.env.REACT_APP_ENV === 'production' ? prodConfig : stagingConfig
|
2018-08-08 17:24:01 +02:00
|
|
|
}
|
|
|
|
|
2019-09-25 15:05:59 +04:00
|
|
|
return process.env.REACT_APP_NETWORK === 'mainnet' ? mainnetDevConfig : devConfig
|
2018-08-08 17:24:01 +02:00
|
|
|
}
|
|
|
|
|
2019-09-30 08:39:05 +02:00
|
|
|
export const getNetwork = () => (process.env.REACT_APP_NETWORK === 'mainnet' ? ETHEREUM_NETWORK.MAINNET : ETHEREUM_NETWORK.RINKEBY)
|
2019-09-24 14:30:09 +04:00
|
|
|
|
2018-08-08 17:24:01 +02:00
|
|
|
const getConfig = ensureOnce(configuration)
|
|
|
|
|
|
|
|
export const getTxServiceHost = () => {
|
|
|
|
const config = getConfig()
|
|
|
|
|
|
|
|
return config[TX_SERVICE_HOST]
|
|
|
|
}
|
|
|
|
|
|
|
|
export const getTxServiceUriFrom = (safeAddress: string) => `safes/${safeAddress}/transactions/`
|
2018-08-16 13:43:35 +02:00
|
|
|
|
2019-03-14 19:36:09 +04:00
|
|
|
export const getRelayUrl = () => getConfig()[RELAY_API_URL]
|
|
|
|
|
2018-08-22 13:38:35 +02:00
|
|
|
export const signaturesViaMetamask = () => {
|
|
|
|
const config = getConfig()
|
|
|
|
|
|
|
|
return config[SIGNATURES_VIA_METAMASK]
|
|
|
|
}
|
2019-12-04 10:19:13 -03:00
|
|
|
|
|
|
|
export const getIntercomId = () => (process.env.REACT_APP_ENV === 'production' ? process.env.REACT_APP_INTERCOM_ID : 'plssl1fl')
|