Refactor getEtherscanLink
This commit is contained in:
parent
e7383adc44
commit
365f4cdfb0
|
@ -1,28 +1,29 @@
|
||||||
|
// @flow
|
||||||
// Grab NODE_ENV and REACT_APP_* environment variables and prepare them to be
|
// Grab NODE_ENV and REACT_APP_* environment variables and prepare them to be
|
||||||
// injected into the application via DefinePlugin in Webpack configuration.
|
// injected into the application via DefinePlugin in Webpack configuration.
|
||||||
|
|
||||||
var REACT_APP = /^REACT_APP_/i;
|
const REACT_APP = /^REACT_APP_/i
|
||||||
|
|
||||||
function getClientEnvironment(publicUrl) {
|
function getClientEnvironment(publicUrl) {
|
||||||
var processEnv = Object
|
const processEnv = Object.keys(process.env)
|
||||||
.keys(process.env)
|
.filter((key) => REACT_APP.test(key))
|
||||||
.filter(key => REACT_APP.test(key))
|
.reduce(
|
||||||
.reduce((env, key) => {
|
(env, key) => {
|
||||||
env[key] = JSON.stringify(process.env[key]);
|
env[key] = JSON.stringify(process.env[key])
|
||||||
return env;
|
return env
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
// Useful for determining whether we’re running in production mode.
|
// Useful for determining whether we’re running in production mode.
|
||||||
// Most importantly, it switches React into the correct mode.
|
// Most importantly, it switches React into the correct mode.
|
||||||
'NODE_ENV': JSON.stringify(
|
NODE_ENV: JSON.stringify(process.env.NODE_ENV || 'development'),
|
||||||
process.env.NODE_ENV || 'development'
|
|
||||||
),
|
|
||||||
// Useful for resolving the correct path to static assets in `public`.
|
// Useful for resolving the correct path to static assets in `public`.
|
||||||
// For example, <img src={process.env.PUBLIC_URL + '/img/logo.png'} />.
|
// For example, <img src={process.env.PUBLIC_URL + '/img/logo.png'} />.
|
||||||
// This should only be used as an escape hatch. Normally you would put
|
// This should only be used as an escape hatch. Normally you would put
|
||||||
// images into the `src` and `import` them in code to get their paths.
|
// images into the `src` and `import` them in code to get their paths.
|
||||||
'PUBLIC_URL': JSON.stringify(publicUrl)
|
PUBLIC_URL: JSON.stringify(publicUrl),
|
||||||
});
|
},
|
||||||
return {'process.env': processEnv};
|
)
|
||||||
|
return { 'process.env': processEnv }
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = getClientEnvironment;
|
module.exports = getClientEnvironment
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
/*eslint-disable*/
|
/*eslint-disable*/
|
||||||
process.env.NODE_ENV = 'development'
|
process.env.NODE_ENV = 'development'
|
||||||
process.env.NETWORK = 'mainnet'
|
|
||||||
|
|
||||||
// Load environment variables from .env file. Suppress warnings using silent
|
// Load environment variables from .env file. Suppress warnings using silent
|
||||||
// if this file is missing. dotenv will never modify any environment variables
|
// if this file is missing. dotenv will never modify any environment variables
|
||||||
|
|
|
@ -2,11 +2,9 @@
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import Tooltip from '@material-ui/core/Tooltip'
|
import Tooltip from '@material-ui/core/Tooltip'
|
||||||
import { withStyles } from '@material-ui/core/styles'
|
import { withStyles } from '@material-ui/core/styles'
|
||||||
import { connect } from 'react-redux'
|
|
||||||
import Img from '~/components/layout/Img'
|
import Img from '~/components/layout/Img'
|
||||||
import { getEtherScanLink } from '~/logic/wallets/getWeb3'
|
import { getEtherScanLink } from '~/logic/wallets/getWeb3'
|
||||||
import { xs } from '~/theme/variables'
|
import { xs } from '~/theme/variables'
|
||||||
import { networkSelector } from '~/logic/wallets/store/selectors'
|
|
||||||
import SearchIcon from './search.svg'
|
import SearchIcon from './search.svg'
|
||||||
|
|
||||||
const styles = () => ({
|
const styles = () => ({
|
||||||
|
@ -26,17 +24,16 @@ const styles = () => ({
|
||||||
type EtherscanBtnProps = {
|
type EtherscanBtnProps = {
|
||||||
type: 'tx' | 'address',
|
type: 'tx' | 'address',
|
||||||
value: string,
|
value: string,
|
||||||
currentNetwork: string,
|
|
||||||
classes: Object,
|
classes: Object,
|
||||||
}
|
}
|
||||||
|
|
||||||
const EtherscanBtn = ({
|
const EtherscanBtn = ({
|
||||||
type, value, currentNetwork, classes,
|
type, value, classes,
|
||||||
}: EtherscanBtnProps) => (
|
}: EtherscanBtnProps) => (
|
||||||
<Tooltip title="Show details on Etherscan" placement="top">
|
<Tooltip title="Show details on Etherscan" placement="top">
|
||||||
<a
|
<a
|
||||||
className={classes.container}
|
className={classes.container}
|
||||||
href={getEtherScanLink(type, value, currentNetwork)}
|
href={getEtherScanLink(type, value)}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
aria-label="Show details on Etherscan"
|
aria-label="Show details on Etherscan"
|
||||||
|
@ -48,7 +45,4 @@ const EtherscanBtn = ({
|
||||||
|
|
||||||
const EtherscanBtnWithStyles = withStyles(styles)(EtherscanBtn)
|
const EtherscanBtnWithStyles = withStyles(styles)(EtherscanBtn)
|
||||||
|
|
||||||
export default connect<Object, Object, ?Function, ?Object>(
|
export default EtherscanBtnWithStyles
|
||||||
(state) => ({ currentNetwork: networkSelector(state) }),
|
|
||||||
null,
|
|
||||||
)(EtherscanBtnWithStyles)
|
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
// @flow
|
// @flow
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { connect } from 'react-redux'
|
|
||||||
import OpenInNew from '@material-ui/icons/OpenInNew'
|
import OpenInNew from '@material-ui/icons/OpenInNew'
|
||||||
import { getEtherScanLink } from '~/logic/wallets/getWeb3'
|
import { getEtherScanLink } from '~/logic/wallets/getWeb3'
|
||||||
import { shortVersionOf } from '~/logic/wallets/ethAddresses'
|
import { shortVersionOf } from '~/logic/wallets/ethAddresses'
|
||||||
import { secondary } from '~/theme/variables'
|
import { secondary } from '~/theme/variables'
|
||||||
import { networkSelector } from '~/logic/wallets/store/selectors'
|
|
||||||
|
|
||||||
const openIconStyle = {
|
const openIconStyle = {
|
||||||
height: '13px',
|
height: '13px',
|
||||||
|
@ -15,17 +13,13 @@ const openIconStyle = {
|
||||||
type EtherscanLinkProps = {
|
type EtherscanLinkProps = {
|
||||||
type: 'tx' | 'address',
|
type: 'tx' | 'address',
|
||||||
value: string,
|
value: string,
|
||||||
currentNetwork: string,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const EtherscanLink = ({ type, value, currentNetwork }: EtherscanLinkProps) => (
|
const EtherscanLink = ({ type, value }: EtherscanLinkProps) => (
|
||||||
<a href={getEtherScanLink(type, value, currentNetwork)} target="_blank" rel="noopener noreferrer">
|
<a href={getEtherScanLink(type, value)} target="_blank" rel="noopener noreferrer">
|
||||||
{shortVersionOf(value, 4)}
|
{shortVersionOf(value, 4)}
|
||||||
<OpenInNew style={openIconStyle} />
|
<OpenInNew style={openIconStyle} />
|
||||||
</a>
|
</a>
|
||||||
)
|
)
|
||||||
|
|
||||||
export default connect<Object, Object, ?Function, ?Object>(
|
export default EtherscanLink
|
||||||
(state) => ({ currentNetwork: networkSelector(state) }),
|
|
||||||
null,
|
|
||||||
)(EtherscanLink)
|
|
||||||
|
|
|
@ -123,7 +123,7 @@ const UserDetails = ({
|
||||||
{address}
|
{address}
|
||||||
</Paragraph>
|
</Paragraph>
|
||||||
{userAddress && (
|
{userAddress && (
|
||||||
<Link className={classes.open} to={getEtherScanLink('address', userAddress, network)} target="_blank">
|
<Link className={classes.open} to={getEtherScanLink('address', userAddress)} target="_blank">
|
||||||
<OpenInNew style={openIconStyle} />
|
<OpenInNew style={openIconStyle} />
|
||||||
</Link>
|
</Link>
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -13,18 +13,17 @@ const configuration = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (process.env.NODE_ENV === 'production') {
|
if (process.env.NODE_ENV === 'production') {
|
||||||
if (process.env.NETWORK === 'mainnet') {
|
if (process.env.REACT_APP_NETWORK === 'mainnet') {
|
||||||
return mainnetProdConfig
|
return mainnetProdConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
return prodConfig
|
return prodConfig
|
||||||
}
|
}
|
||||||
console.log(process.env)
|
|
||||||
|
|
||||||
return devConfig
|
return devConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getNetwork = () => (process.env.NETWORK === 'mainnet' ? ETHEREUM_NETWORK.MAIN : ETHEREUM_NETWORK.RINKEBY)
|
export const getNetwork = () => (process.env.REACT_APP_NETWORK === 'mainnet' ? ETHEREUM_NETWORK.MAIN : ETHEREUM_NETWORK.RINKEBY)
|
||||||
|
|
||||||
const getConfig = ensureOnce(configuration)
|
const getConfig = ensureOnce(configuration)
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
import Web3 from 'web3'
|
import Web3 from 'web3'
|
||||||
import ENS from 'ethereum-ens'
|
import ENS from 'ethereum-ens'
|
||||||
import type { ProviderProps } from '~/logic/wallets/store/model/provider'
|
import type { ProviderProps } from '~/logic/wallets/store/model/provider'
|
||||||
|
import { getNetwork } from '~/config/index'
|
||||||
|
|
||||||
export const ETHEREUM_NETWORK = {
|
export const ETHEREUM_NETWORK = {
|
||||||
MAIN: 'MAIN',
|
MAIN: 'MAIN',
|
||||||
|
@ -33,7 +34,12 @@ export const ETHEREUM_NETWORK_IDS = {
|
||||||
42: ETHEREUM_NETWORK.KOVAN,
|
42: ETHEREUM_NETWORK.KOVAN,
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getEtherScanLink = (type: 'address' | 'tx', value: string, network: string) => `https://${network.toLowerCase() === 'mainnet' ? '' : `${network.toLowerCase()}.`}etherscan.io/${type}/${value}`
|
export const getEtherScanLink = (type: 'address' | 'tx', value: string) => {
|
||||||
|
const network = getNetwork()
|
||||||
|
return `https://${
|
||||||
|
network.toLowerCase() === 'mainnet' ? '' : `${network.toLowerCase()}.`
|
||||||
|
}etherscan.io/${type}/${value}`
|
||||||
|
}
|
||||||
|
|
||||||
let web3
|
let web3
|
||||||
export const getWeb3 = () => web3 || (window.web3 && new Web3(window.web3.currentProvider)) || (window.ethereum && new Web3(window.ethereum))
|
export const getWeb3 = () => web3 || (window.web3 && new Web3(window.web3.currentProvider)) || (window.ethereum && new Web3(window.ethereum))
|
||||||
|
|
|
@ -39,7 +39,7 @@ const styles = {
|
||||||
}
|
}
|
||||||
|
|
||||||
const Opening = ({
|
const Opening = ({
|
||||||
classes, name = 'Safe creation process', tx, network,
|
classes, name = 'Safe creation process', tx,
|
||||||
}: Props) => (
|
}: Props) => (
|
||||||
<Page align="center">
|
<Page align="center">
|
||||||
<Paragraph color="primary" size="xxl" weight="bold" align="center">
|
<Paragraph color="primary" size="xxl" weight="bold" align="center">
|
||||||
|
@ -70,7 +70,7 @@ const Opening = ({
|
||||||
Follow progress on
|
Follow progress on
|
||||||
{' '}
|
{' '}
|
||||||
<a
|
<a
|
||||||
href={getEtherScanLink('tx', tx, network)}
|
href={getEtherScanLink('tx', tx)}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
className={classes.etherscan}
|
className={classes.etherscan}
|
||||||
|
|
|
@ -106,7 +106,7 @@ class Layout extends React.Component<Props, State> {
|
||||||
}
|
}
|
||||||
|
|
||||||
const { address, ethBalance, name } = safe
|
const { address, ethBalance, name } = safe
|
||||||
const etherScanLink = getEtherScanLink('address', address, network)
|
const etherScanLink = getEtherScanLink('address', address)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|
|
@ -26,7 +26,6 @@ type Props = {
|
||||||
safeName: string,
|
safeName: string,
|
||||||
owners: List<Owner>,
|
owners: List<Owner>,
|
||||||
threshold: number,
|
threshold: number,
|
||||||
network: string,
|
|
||||||
addSafeOwner: Function,
|
addSafeOwner: Function,
|
||||||
createTransaction: Function,
|
createTransaction: Function,
|
||||||
}
|
}
|
||||||
|
@ -58,7 +57,6 @@ const AddOwner = ({
|
||||||
safeName,
|
safeName,
|
||||||
owners,
|
owners,
|
||||||
threshold,
|
threshold,
|
||||||
network,
|
|
||||||
createTransaction,
|
createTransaction,
|
||||||
addSafeOwner,
|
addSafeOwner,
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
|
@ -138,7 +136,6 @@ const AddOwner = ({
|
||||||
onClose={onClose}
|
onClose={onClose}
|
||||||
safeName={safeName}
|
safeName={safeName}
|
||||||
owners={owners}
|
owners={owners}
|
||||||
network={network}
|
|
||||||
values={values}
|
values={values}
|
||||||
onClickBack={onClickBack}
|
onClickBack={onClickBack}
|
||||||
onSubmit={onAddOwner}
|
onSubmit={onAddOwner}
|
||||||
|
|
|
@ -31,14 +31,13 @@ type Props = {
|
||||||
classes: Object,
|
classes: Object,
|
||||||
safeName: string,
|
safeName: string,
|
||||||
owners: List<Owner>,
|
owners: List<Owner>,
|
||||||
network: string,
|
|
||||||
values: Object,
|
values: Object,
|
||||||
onClickBack: Function,
|
onClickBack: Function,
|
||||||
onSubmit: Function,
|
onSubmit: Function,
|
||||||
}
|
}
|
||||||
|
|
||||||
const ReviewAddOwner = ({
|
const ReviewAddOwner = ({
|
||||||
classes, onClose, safeName, owners, network, values, onClickBack, onSubmit,
|
classes, onClose, safeName, owners, values, onClickBack, onSubmit,
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
const handleSubmit = () => {
|
const handleSubmit = () => {
|
||||||
onSubmit()
|
onSubmit()
|
||||||
|
@ -80,7 +79,6 @@ const ReviewAddOwner = ({
|
||||||
{values.threshold}
|
{values.threshold}
|
||||||
{' '}
|
{' '}
|
||||||
out of
|
out of
|
||||||
{' '}
|
|
||||||
{owners.size + 1}
|
{owners.size + 1}
|
||||||
{' '}
|
{' '}
|
||||||
owner(s)
|
owner(s)
|
||||||
|
@ -112,7 +110,7 @@ const ReviewAddOwner = ({
|
||||||
<Paragraph size="md" color="disabled" noMargin>
|
<Paragraph size="md" color="disabled" noMargin>
|
||||||
{owner.address}
|
{owner.address}
|
||||||
</Paragraph>
|
</Paragraph>
|
||||||
<Link className={classes.open} to={getEtherScanLink('address', owner.address, network)} target="_blank">
|
<Link className={classes.open} to={getEtherScanLink('address', owner.address)} target="_blank">
|
||||||
<OpenInNew style={openIconStyle} />
|
<OpenInNew style={openIconStyle} />
|
||||||
</Link>
|
</Link>
|
||||||
</Block>
|
</Block>
|
||||||
|
@ -141,7 +139,11 @@ const ReviewAddOwner = ({
|
||||||
<Paragraph size="md" color="disabled" noMargin>
|
<Paragraph size="md" color="disabled" noMargin>
|
||||||
{values.ownerAddress}
|
{values.ownerAddress}
|
||||||
</Paragraph>
|
</Paragraph>
|
||||||
<Link className={classes.open} to={getEtherScanLink('address', values.ownerAddress, network)} target="_blank">
|
<Link
|
||||||
|
className={classes.open}
|
||||||
|
to={getEtherScanLink('address', values.ownerAddress)}
|
||||||
|
target="_blank"
|
||||||
|
>
|
||||||
<OpenInNew style={openIconStyle} />
|
<OpenInNew style={openIconStyle} />
|
||||||
</Link>
|
</Link>
|
||||||
</Block>
|
</Block>
|
||||||
|
|
|
@ -34,7 +34,6 @@ type Props = {
|
||||||
isOpen: boolean,
|
isOpen: boolean,
|
||||||
safeAddress: string,
|
safeAddress: string,
|
||||||
ownerAddress: string,
|
ownerAddress: string,
|
||||||
network: string,
|
|
||||||
selectedOwnerName: string,
|
selectedOwnerName: string,
|
||||||
editSafeOwner: Function,
|
editSafeOwner: Function,
|
||||||
}
|
}
|
||||||
|
@ -47,7 +46,6 @@ const EditOwnerComponent = ({
|
||||||
ownerAddress,
|
ownerAddress,
|
||||||
selectedOwnerName,
|
selectedOwnerName,
|
||||||
editSafeOwner,
|
editSafeOwner,
|
||||||
network,
|
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
const handleSubmit = (values) => {
|
const handleSubmit = (values) => {
|
||||||
editSafeOwner({ safeAddress, ownerAddress, ownerName: values.ownerName })
|
editSafeOwner({ safeAddress, ownerAddress, ownerName: values.ownerName })
|
||||||
|
@ -94,7 +92,7 @@ const EditOwnerComponent = ({
|
||||||
<Paragraph style={{ marginLeft: 10 }} size="md" color="disabled" noMargin>
|
<Paragraph style={{ marginLeft: 10 }} size="md" color="disabled" noMargin>
|
||||||
{ownerAddress}
|
{ownerAddress}
|
||||||
</Paragraph>
|
</Paragraph>
|
||||||
<Link className={classes.open} to={getEtherScanLink('address', ownerAddress, network)} target="_blank">
|
<Link className={classes.open} to={getEtherScanLink('address', ownerAddress)} target="_blank">
|
||||||
<OpenInNew style={openIconStyle} />
|
<OpenInNew style={openIconStyle} />
|
||||||
</Link>
|
</Link>
|
||||||
</Block>
|
</Block>
|
||||||
|
|
|
@ -28,7 +28,6 @@ type Props = {
|
||||||
ownerName: string,
|
ownerName: string,
|
||||||
owners: List<Owner>,
|
owners: List<Owner>,
|
||||||
threshold: number,
|
threshold: number,
|
||||||
network: string,
|
|
||||||
createTransaction: Function,
|
createTransaction: Function,
|
||||||
removeSafeOwner: Function,
|
removeSafeOwner: Function,
|
||||||
}
|
}
|
||||||
|
@ -71,7 +70,6 @@ const RemoveOwner = ({
|
||||||
ownerName,
|
ownerName,
|
||||||
owners,
|
owners,
|
||||||
threshold,
|
threshold,
|
||||||
network,
|
|
||||||
createTransaction,
|
createTransaction,
|
||||||
removeSafeOwner,
|
removeSafeOwner,
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
|
@ -136,7 +134,6 @@ const RemoveOwner = ({
|
||||||
onClose={onClose}
|
onClose={onClose}
|
||||||
ownerAddress={ownerAddress}
|
ownerAddress={ownerAddress}
|
||||||
ownerName={ownerName}
|
ownerName={ownerName}
|
||||||
network={network}
|
|
||||||
onSubmit={ownerSubmitted}
|
onSubmit={ownerSubmitted}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
@ -154,7 +151,6 @@ const RemoveOwner = ({
|
||||||
onClose={onClose}
|
onClose={onClose}
|
||||||
safeName={safeName}
|
safeName={safeName}
|
||||||
owners={owners}
|
owners={owners}
|
||||||
network={network}
|
|
||||||
values={values}
|
values={values}
|
||||||
ownerAddress={ownerAddress}
|
ownerAddress={ownerAddress}
|
||||||
ownerName={ownerName}
|
ownerName={ownerName}
|
||||||
|
|
|
@ -29,12 +29,11 @@ type Props = {
|
||||||
classes: Object,
|
classes: Object,
|
||||||
ownerAddress: string,
|
ownerAddress: string,
|
||||||
ownerName: string,
|
ownerName: string,
|
||||||
network: string,
|
|
||||||
onSubmit: Function,
|
onSubmit: Function,
|
||||||
}
|
}
|
||||||
|
|
||||||
const CheckOwner = ({
|
const CheckOwner = ({
|
||||||
classes, onClose, ownerAddress, ownerName, network, onSubmit,
|
classes, onClose, ownerAddress, ownerName, onSubmit,
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
const handleSubmit = (values) => {
|
const handleSubmit = (values) => {
|
||||||
onSubmit(values)
|
onSubmit(values)
|
||||||
|
@ -69,7 +68,7 @@ const CheckOwner = ({
|
||||||
<Paragraph size="md" color="disabled" noMargin>
|
<Paragraph size="md" color="disabled" noMargin>
|
||||||
{ownerAddress}
|
{ownerAddress}
|
||||||
</Paragraph>
|
</Paragraph>
|
||||||
<Link className={classes.open} to={getEtherScanLink('address', ownerAddress, network)} target="_blank">
|
<Link className={classes.open} to={getEtherScanLink('address', ownerAddress)} target="_blank">
|
||||||
<OpenInNew style={openIconStyle} />
|
<OpenInNew style={openIconStyle} />
|
||||||
</Link>
|
</Link>
|
||||||
</Block>
|
</Block>
|
||||||
|
|
|
@ -31,7 +31,6 @@ type Props = {
|
||||||
classes: Object,
|
classes: Object,
|
||||||
safeName: string,
|
safeName: string,
|
||||||
owners: List<Owner>,
|
owners: List<Owner>,
|
||||||
network: string,
|
|
||||||
values: Object,
|
values: Object,
|
||||||
ownerAddress: string,
|
ownerAddress: string,
|
||||||
ownerName: string,
|
ownerName: string,
|
||||||
|
@ -44,7 +43,6 @@ const ReviewRemoveOwner = ({
|
||||||
onClose,
|
onClose,
|
||||||
safeName,
|
safeName,
|
||||||
owners,
|
owners,
|
||||||
network,
|
|
||||||
values,
|
values,
|
||||||
ownerAddress,
|
ownerAddress,
|
||||||
ownerName,
|
ownerName,
|
||||||
|
@ -126,7 +124,7 @@ Safe owner(s)
|
||||||
</Paragraph>
|
</Paragraph>
|
||||||
<Link
|
<Link
|
||||||
className={classes.open}
|
className={classes.open}
|
||||||
to={getEtherScanLink('address', owner.address, network)}
|
to={getEtherScanLink('address', owner.address)}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
>
|
>
|
||||||
<OpenInNew style={openIconStyle} />
|
<OpenInNew style={openIconStyle} />
|
||||||
|
@ -160,7 +158,7 @@ Safe owner(s)
|
||||||
</Paragraph>
|
</Paragraph>
|
||||||
<Link
|
<Link
|
||||||
className={classes.open}
|
className={classes.open}
|
||||||
to={getEtherScanLink('address', ownerAddress, network)}
|
to={getEtherScanLink('address', ownerAddress)}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
>
|
>
|
||||||
<OpenInNew style={openIconStyle} />
|
<OpenInNew style={openIconStyle} />
|
||||||
|
|
|
@ -4,6 +4,7 @@ import { List } from 'immutable'
|
||||||
import { withStyles } from '@material-ui/core/styles'
|
import { withStyles } from '@material-ui/core/styles'
|
||||||
import { SharedSnackbarConsumer } from '~/components/SharedSnackBar'
|
import { SharedSnackbarConsumer } from '~/components/SharedSnackBar'
|
||||||
import Modal from '~/components/Modal'
|
import Modal from '~/components/Modal'
|
||||||
|
import { type Owner } from '~/routes/safe/store/models/owner'
|
||||||
import { getGnosisSafeInstanceAt, SENTINEL_ADDRESS } from '~/logic/contracts/safeContracts'
|
import { getGnosisSafeInstanceAt, SENTINEL_ADDRESS } from '~/logic/contracts/safeContracts'
|
||||||
import OwnerForm from './screens/OwnerForm'
|
import OwnerForm from './screens/OwnerForm'
|
||||||
import ReviewReplaceOwner from './screens/Review'
|
import ReviewReplaceOwner from './screens/Review'
|
||||||
|
@ -25,7 +26,6 @@ type Props = {
|
||||||
ownerAddress: string,
|
ownerAddress: string,
|
||||||
ownerName: string,
|
ownerName: string,
|
||||||
owners: List<Owner>,
|
owners: List<Owner>,
|
||||||
network: string,
|
|
||||||
threshold: string,
|
threshold: string,
|
||||||
createTransaction: Function,
|
createTransaction: Function,
|
||||||
replaceSafeOwner: Function,
|
replaceSafeOwner: Function,
|
||||||
|
@ -73,7 +73,6 @@ const ReplaceOwner = ({
|
||||||
ownerAddress,
|
ownerAddress,
|
||||||
ownerName,
|
ownerName,
|
||||||
owners,
|
owners,
|
||||||
network,
|
|
||||||
threshold,
|
threshold,
|
||||||
createTransaction,
|
createTransaction,
|
||||||
replaceSafeOwner,
|
replaceSafeOwner,
|
||||||
|
@ -136,7 +135,6 @@ const ReplaceOwner = ({
|
||||||
ownerAddress={ownerAddress}
|
ownerAddress={ownerAddress}
|
||||||
ownerName={ownerName}
|
ownerName={ownerName}
|
||||||
owners={owners}
|
owners={owners}
|
||||||
network={network}
|
|
||||||
onSubmit={ownerSubmitted}
|
onSubmit={ownerSubmitted}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
@ -145,7 +143,6 @@ const ReplaceOwner = ({
|
||||||
onClose={onClose}
|
onClose={onClose}
|
||||||
safeName={safeName}
|
safeName={safeName}
|
||||||
owners={owners}
|
owners={owners}
|
||||||
network={network}
|
|
||||||
values={values}
|
values={values}
|
||||||
ownerAddress={ownerAddress}
|
ownerAddress={ownerAddress}
|
||||||
ownerName={ownerName}
|
ownerName={ownerName}
|
||||||
|
|
|
@ -46,13 +46,12 @@ type Props = {
|
||||||
classes: Object,
|
classes: Object,
|
||||||
ownerAddress: string,
|
ownerAddress: string,
|
||||||
ownerName: string,
|
ownerName: string,
|
||||||
network: string,
|
|
||||||
onSubmit: Function,
|
onSubmit: Function,
|
||||||
owners: List<Owner>,
|
owners: List<Owner>,
|
||||||
}
|
}
|
||||||
|
|
||||||
const OwnerForm = ({
|
const OwnerForm = ({
|
||||||
classes, onClose, ownerAddress, ownerName, network, onSubmit, owners,
|
classes, onClose, ownerAddress, ownerName, onSubmit, owners,
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
const handleSubmit = (values) => {
|
const handleSubmit = (values) => {
|
||||||
onSubmit(values)
|
onSubmit(values)
|
||||||
|
@ -102,7 +101,7 @@ const OwnerForm = ({
|
||||||
</Paragraph>
|
</Paragraph>
|
||||||
<Link
|
<Link
|
||||||
className={classes.open}
|
className={classes.open}
|
||||||
to={getEtherScanLink('address', ownerAddress, network)}
|
to={getEtherScanLink('address', ownerAddress)}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
>
|
>
|
||||||
<OpenInNew style={openIconStyle} />
|
<OpenInNew style={openIconStyle} />
|
||||||
|
|
|
@ -31,7 +31,6 @@ type Props = {
|
||||||
classes: Object,
|
classes: Object,
|
||||||
safeName: string,
|
safeName: string,
|
||||||
owners: List<Owner>,
|
owners: List<Owner>,
|
||||||
network: string,
|
|
||||||
values: Object,
|
values: Object,
|
||||||
ownerAddress: string,
|
ownerAddress: string,
|
||||||
ownerName: string,
|
ownerName: string,
|
||||||
|
@ -45,7 +44,6 @@ const ReviewRemoveOwner = ({
|
||||||
onClose,
|
onClose,
|
||||||
safeName,
|
safeName,
|
||||||
owners,
|
owners,
|
||||||
network,
|
|
||||||
values,
|
values,
|
||||||
ownerAddress,
|
ownerAddress,
|
||||||
ownerName,
|
ownerName,
|
||||||
|
@ -129,7 +127,7 @@ const ReviewRemoveOwner = ({
|
||||||
</Paragraph>
|
</Paragraph>
|
||||||
<Link
|
<Link
|
||||||
className={classes.open}
|
className={classes.open}
|
||||||
to={getEtherScanLink('address', owner.address, network)}
|
to={getEtherScanLink('address', owner.address)}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
>
|
>
|
||||||
<OpenInNew style={openIconStyle} />
|
<OpenInNew style={openIconStyle} />
|
||||||
|
@ -161,7 +159,7 @@ const ReviewRemoveOwner = ({
|
||||||
<Paragraph size="md" color="disabled" noMargin>
|
<Paragraph size="md" color="disabled" noMargin>
|
||||||
{ownerAddress}
|
{ownerAddress}
|
||||||
</Paragraph>
|
</Paragraph>
|
||||||
<Link className={classes.open} to={getEtherScanLink('address', ownerAddress, network)} target="_blank">
|
<Link className={classes.open} to={getEtherScanLink('address', ownerAddress)} target="_blank">
|
||||||
<OpenInNew style={openIconStyle} />
|
<OpenInNew style={openIconStyle} />
|
||||||
</Link>
|
</Link>
|
||||||
</Block>
|
</Block>
|
||||||
|
@ -187,7 +185,7 @@ const ReviewRemoveOwner = ({
|
||||||
<Paragraph size="md" color="disabled" noMargin>
|
<Paragraph size="md" color="disabled" noMargin>
|
||||||
{values.ownerAddress}
|
{values.ownerAddress}
|
||||||
</Paragraph>
|
</Paragraph>
|
||||||
<Link className={classes.open} to={getEtherScanLink('address', values.ownerAddress, network)} target="_blank">
|
<Link className={classes.open} to={getEtherScanLink('address', values.ownerAddress)} target="_blank">
|
||||||
<OpenInNew style={openIconStyle} />
|
<OpenInNew style={openIconStyle} />
|
||||||
</Link>
|
</Link>
|
||||||
</Block>
|
</Block>
|
||||||
|
|
|
@ -219,7 +219,6 @@ class ManageOwners extends React.Component<Props, State> {
|
||||||
safeName={safeName}
|
safeName={safeName}
|
||||||
owners={owners}
|
owners={owners}
|
||||||
threshold={threshold}
|
threshold={threshold}
|
||||||
network={network}
|
|
||||||
userAddress={userAddress}
|
userAddress={userAddress}
|
||||||
createTransaction={createTransaction}
|
createTransaction={createTransaction}
|
||||||
addSafeOwner={addSafeOwner}
|
addSafeOwner={addSafeOwner}
|
||||||
|
@ -233,7 +232,6 @@ class ManageOwners extends React.Component<Props, State> {
|
||||||
ownerName={selectedOwnerName}
|
ownerName={selectedOwnerName}
|
||||||
owners={owners}
|
owners={owners}
|
||||||
threshold={threshold}
|
threshold={threshold}
|
||||||
network={network}
|
|
||||||
userAddress={userAddress}
|
userAddress={userAddress}
|
||||||
createTransaction={createTransaction}
|
createTransaction={createTransaction}
|
||||||
removeSafeOwner={removeSafeOwner}
|
removeSafeOwner={removeSafeOwner}
|
||||||
|
@ -259,7 +257,6 @@ class ManageOwners extends React.Component<Props, State> {
|
||||||
ownerAddress={selectedOwnerAddress}
|
ownerAddress={selectedOwnerAddress}
|
||||||
selectedOwnerName={selectedOwnerName}
|
selectedOwnerName={selectedOwnerName}
|
||||||
owners={owners}
|
owners={owners}
|
||||||
network={network}
|
|
||||||
editSafeOwner={editSafeOwner}
|
editSafeOwner={editSafeOwner}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
|
|
|
@ -41,7 +41,7 @@ const OwnerComponent = withStyles(styles)(({ owner, classes, isExecutor }: Owner
|
||||||
<ListItemText
|
<ListItemText
|
||||||
primary={owner.name}
|
primary={owner.name}
|
||||||
secondary={(
|
secondary={(
|
||||||
<a href={getEtherScanLink('address', owner.address, 'rinkeby')} target="_blank" rel="noopener noreferrer">
|
<a href={getEtherScanLink('address', owner.address)} target="_blank" rel="noopener noreferrer">
|
||||||
{shortVersionOf(owner.address, 4)}
|
{shortVersionOf(owner.address, 4)}
|
||||||
{' '}
|
{' '}
|
||||||
<OpenInNew style={openIconStyle} />
|
<OpenInNew style={openIconStyle} />
|
||||||
|
|
|
@ -74,7 +74,7 @@ const ExpandedTx = ({
|
||||||
<Paragraph noMargin>
|
<Paragraph noMargin>
|
||||||
<Bold>TX hash: </Bold>
|
<Bold>TX hash: </Bold>
|
||||||
{tx.executionTxHash ? (
|
{tx.executionTxHash ? (
|
||||||
<a href={getEtherScanLink('tx', tx.executionTxHash, 'rinkeby')} target="_blank" rel="noopener noreferrer">
|
<a href={getEtherScanLink('tx', tx.executionTxHash)} target="_blank" rel="noopener noreferrer">
|
||||||
{shortVersionOf(tx.executionTxHash, 4)}
|
{shortVersionOf(tx.executionTxHash, 4)}
|
||||||
<OpenInNew style={openIconStyle} />
|
<OpenInNew style={openIconStyle} />
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -39,7 +39,6 @@ type Props = {
|
||||||
safeAddress: string,
|
safeAddress: string,
|
||||||
createTransaction: Function,
|
createTransaction: Function,
|
||||||
processTransaction: Function,
|
processTransaction: Function,
|
||||||
currentNetwork: string,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const TxsTable = ({
|
const TxsTable = ({
|
||||||
|
@ -52,16 +51,15 @@ const TxsTable = ({
|
||||||
safeAddress,
|
safeAddress,
|
||||||
createTransaction,
|
createTransaction,
|
||||||
processTransaction,
|
processTransaction,
|
||||||
currentNetwork,
|
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
const [expandedTx, setExpandedTx] = useState<string | null>(null)
|
const [expandedTx, setExpandedTx] = useState<string | null>(null)
|
||||||
|
|
||||||
const handleTxExpand = (safeTxHash) => {
|
const handleTxExpand = (safeTxHash) => {
|
||||||
setExpandedTx(prevTx => (prevTx === safeTxHash ? null : safeTxHash))
|
setExpandedTx((prevTx) => (prevTx === safeTxHash ? null : safeTxHash))
|
||||||
}
|
}
|
||||||
|
|
||||||
const columns = generateColumns()
|
const columns = generateColumns()
|
||||||
const autoColumns = columns.filter(c => !c.custom)
|
const autoColumns = columns.filter((c) => !c.custom)
|
||||||
const filteredData = getTxTableData(transactions)
|
const filteredData = getTxTableData(transactions)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -118,7 +116,6 @@ const TxsTable = ({
|
||||||
threshold={threshold}
|
threshold={threshold}
|
||||||
owners={owners}
|
owners={owners}
|
||||||
granted={granted}
|
granted={granted}
|
||||||
currentNetwork={currentNetwork}
|
|
||||||
userAddress={userAddress}
|
userAddress={userAddress}
|
||||||
createTransaction={createTransaction}
|
createTransaction={createTransaction}
|
||||||
processTransaction={processTransaction}
|
processTransaction={processTransaction}
|
||||||
|
@ -127,8 +124,7 @@ const TxsTable = ({
|
||||||
</TableCell>
|
</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
))
|
))}
|
||||||
}
|
|
||||||
</Table>
|
</Table>
|
||||||
</Block>
|
</Block>
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue