Mainnet compatibility wip
This commit is contained in:
parent
26d494fe9f
commit
e7383adc44
|
@ -1,5 +1,6 @@
|
|||
/*eslint-disable*/
|
||||
process.env.NODE_ENV = 'development'
|
||||
process.env.NETWORK = 'mainnet'
|
||||
|
||||
// Load environment variables from .env file. Suppress warnings using silent
|
||||
// if this file is missing. dotenv will never modify any environment variables
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// @flow
|
||||
import { ensureOnce } from '~/utils/singleton'
|
||||
import { ETHEREUM_NETWORK } from '~/logic/wallets/getWeb3'
|
||||
import { TX_SERVICE_HOST, SIGNATURES_VIA_METAMASK, RELAY_API_URL } from '~/config/names'
|
||||
import devConfig from './development'
|
||||
import testConfig from './testing'
|
||||
|
@ -18,11 +19,12 @@ const configuration = () => {
|
|||
|
||||
return prodConfig
|
||||
}
|
||||
console.log(process.env)
|
||||
|
||||
return devConfig
|
||||
}
|
||||
|
||||
export const getNetwork = () => process.env.NETWORK || 'rinkeby'
|
||||
export const getNetwork = () => (process.env.NETWORK === 'mainnet' ? ETHEREUM_NETWORK.MAIN : ETHEREUM_NETWORK.RINKEBY)
|
||||
|
||||
const getConfig = ensureOnce(configuration)
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ export const ETHEREUM_NETWORK_IDS = {
|
|||
42: ETHEREUM_NETWORK.KOVAN,
|
||||
}
|
||||
|
||||
export const getEtherScanLink = (type: 'address' | 'tx', value: string, network: string) => `https://${network === 'mainnet' ? '' : `${network}.`}etherscan.io/${type}/${value}`
|
||||
export const getEtherScanLink = (type: 'address' | 'tx', value: string, network: string) => `https://${network.toLowerCase() === 'mainnet' ? '' : `${network.toLowerCase()}.`}etherscan.io/${type}/${value}`
|
||||
|
||||
let web3
|
||||
export const getWeb3 = () => web3 || (window.web3 && new Web3(window.web3.currentProvider)) || (window.ethereum && new Web3(window.ethereum))
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// @flow
|
||||
import type { Dispatch as ReduxDispatch } from 'redux'
|
||||
import { ETHEREUM_NETWORK_IDS, ETHEREUM_NETWORK } from '~/logic/wallets/getWeb3'
|
||||
import { ETHEREUM_NETWORK_IDS } from '~/logic/wallets/getWeb3'
|
||||
import { getNetwork } from '~/config'
|
||||
import type { ProviderProps } from '~/logic/wallets/store/model/provider'
|
||||
import { makeProvider } from '~/logic/wallets/store/model/provider'
|
||||
import addProvider from './addProvider'
|
||||
|
@ -23,7 +24,7 @@ export const processProviderResponse = (dispatch: ReduxDispatch<*>, provider: Pr
|
|||
|
||||
const SUCCESS_MSG = 'Wallet connected sucessfully'
|
||||
const UNLOCK_MSG = 'Unlock your wallet to connect'
|
||||
const WRONG_NETWORK = 'You are connected to wrong network. Please use RINKEBY'
|
||||
const WRONG_NETWORK = `You are connected to wrong network. Please use ${getNetwork()}`
|
||||
export const WALLET_ERROR_MSG = 'Error connecting to your wallet'
|
||||
|
||||
const handleProviderNotification = (openSnackbar: Function, provider: ProviderProps) => {
|
||||
|
@ -34,7 +35,7 @@ const handleProviderNotification = (openSnackbar: Function, provider: ProviderPr
|
|||
return
|
||||
}
|
||||
|
||||
if (ETHEREUM_NETWORK_IDS[network] !== ETHEREUM_NETWORK.RINKEBY) {
|
||||
if (ETHEREUM_NETWORK_IDS[network] !== getNetwork()) {
|
||||
openSnackbar(WRONG_NETWORK, 'error')
|
||||
return
|
||||
}
|
||||
|
|
|
@ -183,6 +183,7 @@ class Layout extends React.Component<Props, State> {
|
|||
fetchTransactions={fetchTransactions}
|
||||
safeAddress={address}
|
||||
userAddress={userAddress}
|
||||
currentNetwork={network}
|
||||
granted={granted}
|
||||
createTransaction={createTransaction}
|
||||
processTransaction={processTransaction}
|
||||
|
|
|
@ -39,6 +39,7 @@ type Props = {
|
|||
safeAddress: string,
|
||||
createTransaction: Function,
|
||||
processTransaction: Function,
|
||||
currentNetwork: string,
|
||||
}
|
||||
|
||||
const TxsTable = ({
|
||||
|
@ -51,6 +52,7 @@ const TxsTable = ({
|
|||
safeAddress,
|
||||
createTransaction,
|
||||
processTransaction,
|
||||
currentNetwork,
|
||||
}: Props) => {
|
||||
const [expandedTx, setExpandedTx] = useState<string | null>(null)
|
||||
|
||||
|
@ -116,6 +118,7 @@ const TxsTable = ({
|
|||
threshold={threshold}
|
||||
owners={owners}
|
||||
granted={granted}
|
||||
currentNetwork={currentNetwork}
|
||||
userAddress={userAddress}
|
||||
createTransaction={createTransaction}
|
||||
processTransaction={processTransaction}
|
||||
|
|
|
@ -16,6 +16,7 @@ type Props = {
|
|||
granted: boolean,
|
||||
createTransaction: Function,
|
||||
processTransaction: Function,
|
||||
currentNetwork: string,
|
||||
}
|
||||
|
||||
const Transactions = ({
|
||||
|
@ -28,6 +29,7 @@ const Transactions = ({
|
|||
createTransaction,
|
||||
processTransaction,
|
||||
fetchTransactions,
|
||||
currentNetwork,
|
||||
}: Props) => {
|
||||
useEffect(() => {
|
||||
fetchTransactions(safeAddress)
|
||||
|
@ -43,6 +45,7 @@ const Transactions = ({
|
|||
threshold={threshold}
|
||||
owners={owners}
|
||||
userAddress={userAddress}
|
||||
currentNetwork={currentNetwork}
|
||||
granted={granted}
|
||||
safeAddress={safeAddress}
|
||||
createTransaction={createTransaction}
|
||||
|
|
Loading…
Reference in New Issue