2018-08-08 17:24:01 +02:00
|
|
|
// @flow
|
2019-12-05 05:54:42 -03:00
|
|
|
import { ensureOnce } from "~/utils/singleton"
|
|
|
|
import { ETHEREUM_NETWORK } from "~/logic/wallets/getWeb3"
|
|
|
|
import {
|
|
|
|
RELAY_API_URL,
|
|
|
|
SIGNATURES_VIA_METAMASK,
|
|
|
|
TX_SERVICE_HOST
|
|
|
|
} from "~/config/names"
|
|
|
|
import devConfig from "./development"
|
|
|
|
import testConfig from "./testing"
|
|
|
|
import stagingConfig from "./staging"
|
|
|
|
import prodConfig from "./production"
|
|
|
|
import mainnetDevConfig from "./development-mainnet"
|
|
|
|
import mainnetProdConfig from "./production-mainnet"
|
|
|
|
import mainnetStagingConfig from "./staging-mainnet"
|
2018-08-08 17:24:01 +02:00
|
|
|
|
|
|
|
const configuration = () => {
|
2019-12-05 05:54:42 -03:00
|
|
|
if (process.env.NODE_ENV === "test") {
|
2018-08-08 17:24:01 +02:00
|
|
|
return testConfig
|
|
|
|
}
|
|
|
|
|
2019-12-05 05:54:42 -03:00
|
|
|
if (process.env.NODE_ENV === "production") {
|
|
|
|
if (process.env.REACT_APP_NETWORK === "mainnet") {
|
|
|
|
return process.env.REACT_APP_ENV === "production"
|
|
|
|
? mainnetProdConfig
|
|
|
|
: mainnetStagingConfig
|
2019-09-24 14:30:09 +04:00
|
|
|
}
|
|
|
|
|
2019-12-05 05:54:42 -03:00
|
|
|
return process.env.REACT_APP_ENV === "production"
|
|
|
|
? prodConfig
|
|
|
|
: stagingConfig
|
2018-08-08 17:24:01 +02:00
|
|
|
}
|
|
|
|
|
2019-12-05 05:54:42 -03:00
|
|
|
return process.env.REACT_APP_NETWORK === "mainnet"
|
|
|
|
? mainnetDevConfig
|
|
|
|
: devConfig
|
2018-08-08 17:24:01 +02:00
|
|
|
}
|
|
|
|
|
2019-12-05 05:54:42 -03: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]
|
|
|
|
}
|
|
|
|
|
2019-12-05 05:54:42 -03:00
|
|
|
export const getTxServiceUriFrom = (safeAddress: string) =>
|
|
|
|
`safes/${safeAddress}/transactions/`
|
2018-08-16 13:43:35 +02:00
|
|
|
|
2019-12-13 10:45:28 -03:00
|
|
|
export const getIncomingTxServiceUriTo = (safeAddress: string) =>
|
|
|
|
`safes/${safeAddress}/incoming-transactions/`
|
|
|
|
|
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
|
|
|
|
2019-12-05 05:54:42 -03:00
|
|
|
export const getGoogleAnalyticsTrackingID = () =>
|
|
|
|
getNetwork() === ETHEREUM_NETWORK.MAINNET
|
|
|
|
? process.env.REACT_APP_GOOGLE_ANALYTICS_ID_MAINNET
|
|
|
|
: process.env.REACT_APP_GOOGLE_ANALYTICS_ID_RINKEBY
|
|
|
|
|
|
|
|
export const getIntercomId = () =>
|
|
|
|
process.env.REACT_APP_ENV === "production"
|
|
|
|
? process.env.REACT_APP_INTERCOM_ID
|
|
|
|
: "plssl1fl"
|