2018-08-08 17:24:01 +02:00
|
|
|
// @flow
|
|
|
|
import { ensureOnce } from '~/utils/singleton'
|
2018-08-22 13:38:35 +02:00
|
|
|
import {
|
|
|
|
TX_SERVICE_HOST,
|
|
|
|
ENABLED_TX_SERVICE_REMOVAL_SENDER,
|
|
|
|
SIGNATURES_VIA_METAMASK,
|
|
|
|
} from '~/config/names'
|
2018-08-08 17:24:01 +02:00
|
|
|
import devConfig from './development'
|
|
|
|
import testConfig from './testing'
|
|
|
|
import prodConfig from './production'
|
|
|
|
|
|
|
|
const configuration = () => {
|
|
|
|
if (process.env.NODE_ENV === 'test') {
|
|
|
|
return testConfig
|
|
|
|
}
|
|
|
|
|
|
|
|
if (process.env.NODE_ENV === 'production') {
|
|
|
|
return prodConfig
|
|
|
|
}
|
|
|
|
|
|
|
|
return devConfig
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
2018-08-17 17:58:30 +02:00
|
|
|
export const allowedRemoveSenderInTxHistoryService = () => {
|
|
|
|
const config = getConfig()
|
|
|
|
|
|
|
|
return config[ENABLED_TX_SERVICE_REMOVAL_SENDER]
|
|
|
|
}
|
2018-08-22 13:38:35 +02:00
|
|
|
|
|
|
|
export const signaturesViaMetamask = () => {
|
|
|
|
const config = getConfig()
|
|
|
|
|
|
|
|
return config[SIGNATURES_VIA_METAMASK]
|
|
|
|
}
|