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'
|
|
|
|
import prodConfig from './production'
|
2019-09-24 14:30:09 +04:00
|
|
|
import mainnetProdConfig from './production-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 14:30:09 +04:00
|
|
|
if (process.env.NETWORK === 'mainnet') {
|
|
|
|
return mainnetProdConfig
|
|
|
|
}
|
|
|
|
|
2018-08-08 17:24:01 +02:00
|
|
|
return prodConfig
|
|
|
|
}
|
2019-09-24 16:42:15 +04:00
|
|
|
console.log(process.env)
|
2018-08-08 17:24:01 +02:00
|
|
|
|
|
|
|
return devConfig
|
|
|
|
}
|
|
|
|
|
2019-09-24 16:42:15 +04:00
|
|
|
export const getNetwork = () => (process.env.NETWORK === 'mainnet' ? ETHEREUM_NETWORK.MAIN : 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]
|
|
|
|
}
|