diff --git a/src/components/layout/Hairline/index.js b/src/components/layout/Hairline/index.js index b23445d8..223244f0 100644 --- a/src/components/layout/Hairline/index.js +++ b/src/components/layout/Hairline/index.js @@ -14,7 +14,7 @@ const calculateStyleFrom = (color?: string, margin?: Size) => ({ type Props = { margin?: Size, color?: string, - style?: Object + style?: Object, } const Hairline = ({ margin, color, style }: Props) => { diff --git a/src/logic/contracts/safeContracts.js b/src/logic/contracts/safeContracts.js index 16c6bf2f..cc4cab95 100644 --- a/src/logic/contracts/safeContracts.js +++ b/src/logic/contracts/safeContracts.js @@ -10,7 +10,7 @@ import { ZERO_ADDRESS } from '~/logic/wallets/ethAddresses' let proxyFactoryMaster let safeMaster -const createGnosisSafeContract = async (web3: any) => { +const createGnosisSafeContract = (web3: any) => { const gnosisSafe = contract(GnosisSafeSol) gnosisSafe.setProvider(web3.currentProvider) diff --git a/src/logic/wallets/getWeb3.js b/src/logic/wallets/getWeb3.js index edd5d304..390f6b43 100644 --- a/src/logic/wallets/getWeb3.js +++ b/src/logic/wallets/getWeb3.js @@ -37,7 +37,7 @@ export const openTxInEtherScan = (tx: string, network: string) => `https://${net export const getEtherScanLink = (address: string, network: string) => `https://${network}.etherscan.io/address/${address}` let web3 -export const getWeb3 = () => web3 +export const getWeb3 = () => web3 || (window.web3 && new Web3(window.web3.currentProvider)) || (window.ethereum && new Web3(window.ethereum)) const getProviderName: Function = (web3Provider): boolean => { let name diff --git a/src/routes/load/components/OwnerList/index.jsx b/src/routes/load/components/OwnerList/index.jsx deleted file mode 100644 index 0a51c8d9..00000000 --- a/src/routes/load/components/OwnerList/index.jsx +++ /dev/null @@ -1,177 +0,0 @@ -// @flow -import * as React from 'react' -import Block from '~/components/layout/Block' -import { withStyles } from '@material-ui/core/styles' -import Field from '~/components/forms/Field' -import { required } from '~/components/forms/validator' -import TextField from '~/components/forms/TextField' -import OpenInNew from '@material-ui/icons/OpenInNew' -import Identicon from '~/components/Identicon' -import OpenPaper from '~/components/Stepper/OpenPaper' -import Col from '~/components/layout/Col' -import Row from '~/components/layout/Row' -import Link from '~/components/layout/Link' -import Paragraph from '~/components/layout/Paragraph' -import Hairline from '~/components/layout/Hairline' -import { - xs, sm, md, lg, border, secondary, -} from '~/theme/variables' -import { getOwnerNameBy } from '~/routes/open/components/fields' -import { getEtherScanLink, getWeb3 } from '~/logic/wallets/getWeb3' -import { FIELD_LOAD_ADDRESS } from '~/routes/load/components/fields' -import { getGnosisSafeContract } from '~/logic/contracts/safeContracts' - - -const openIconStyle = { - height: '16px', - color: secondary, -} - -const styles = () => ({ - details: { - padding: lg, - borderRight: `solid 1px ${border}`, - height: '100%', - }, - owners: { - display: 'flex', - justifyContent: 'flex-start', - }, - ownerNames: { - maxWidth: '400px', - }, - ownerAddresses: { - alignItems: 'center', - marginLeft: `${sm}`, - }, - address: { - paddingLeft: '6px', - }, - open: { - paddingLeft: sm, - width: 'auto', - '&:hover': { - cursor: 'pointer', - }, - }, - title: { - padding: `${md} ${lg}`, - }, - owner: { - padding: `0 ${lg}`, - marginBottom: '12px', - }, - header: { - padding: `${sm} ${lg}`, - }, - name: { - marginRight: `${sm}`, - }, -}) - -type LayoutProps = { - network: string, -} - -type Props = LayoutProps & { - values: Object, - classes: Object, -} - -type State = { - owners: Array, -} - -class OwnerListComponent extends React.PureComponent { - state = { - owners: [], - } - - mounted = false - - componentDidMount = async () => { - this.mounted = true - - const { values } = this.props - const safeAddress = values[FIELD_LOAD_ADDRESS] - const web3 = getWeb3() - - const GnosisSafe = getGnosisSafeContract(web3) - const gnosisSafe = await GnosisSafe.at(safeAddress) - const owners = await gnosisSafe.getOwners() - - if (!owners) { - return - } - - if (this.mounted) { - this.setState(() => ({ owners: owners.sort() })) - } - } - - componentWillUnmount() { - this.mounted = false - } - - render() { - const { network, classes } = this.props - const { owners } = this.state - - return ( - - - - {`This Safe has ${owners.length} owners. Optional: Provide a name for each owner.`} - - - - - NAME - ADDRESS - - - - { owners.map((x, index) => ( - - - - - - - - - {owners[index]} - - - - - - - - )) } - - - ) - } -} - -const OwnerListPage = withStyles(styles)(OwnerListComponent) - -const OwnerList = ({ network }: LayoutProps) => (controls: React$Node, { values }: Object) => ( - - - - - -) - -export default OwnerList