chore: fixes after merge

This commit is contained in:
fernandomg 2020-05-27 13:32:06 -03:00
parent 43acdfb95c
commit 62f1a82793
9 changed files with 75 additions and 86 deletions

View File

@ -1,48 +1,47 @@
// import { ensureOnce } from 'src/utils/singleton'
import { ensureOnce } from "src/utils/singleton"
import { ETHEREUM_NETWORK, getWeb3 } from 'src/logic/wallets/getWeb3' import { ETHEREUM_NETWORK, getWeb3 } from 'src/logic/wallets/getWeb3'
import { import {
RELAY_API_URL, RELAY_API_URL,
SIGNATURES_VIA_METAMASK, SIGNATURES_VIA_METAMASK,
TX_SERVICE_HOST TX_SERVICE_HOST
} from "src/config/names" } from 'src/config/names'
import devConfig from "./development" import devConfig from './development'
import testConfig from "./testing" import testConfig from './testing'
import stagingConfig from "./staging" import stagingConfig from './staging'
import prodConfig from "./production" import prodConfig from './production'
import mainnetDevConfig from "./development-mainnet" import mainnetDevConfig from './development-mainnet'
import mainnetProdConfig from "./production-mainnet" import mainnetProdConfig from './production-mainnet'
import mainnetStagingConfig from "./staging-mainnet" import mainnetStagingConfig from './staging-mainnet'
const configuration = () => { const configuration = () => {
if (process.env.NODE_ENV === "test") { if (process.env.NODE_ENV === 'test') {
return testConfig return testConfig
} }
if (process.env.NODE_ENV === "production") { if (process.env.NODE_ENV === 'production') {
if (process.env.REACT_APP_NETWORK === "mainnet") { if (process.env.REACT_APP_NETWORK === 'mainnet') {
return process.env.REACT_APP_ENV === "production" return process.env.REACT_APP_ENV === 'production'
? mainnetProdConfig ? mainnetProdConfig
: mainnetStagingConfig : mainnetStagingConfig
} }
return process.env.REACT_APP_ENV === "production" return process.env.REACT_APP_ENV === 'production'
? prodConfig ? prodConfig
: stagingConfig : stagingConfig
} }
return process.env.REACT_APP_NETWORK === "mainnet" return process.env.REACT_APP_NETWORK === 'mainnet'
? mainnetDevConfig ? mainnetDevConfig
: devConfig : devConfig
} }
export const getNetwork = () => export const getNetwork = () =>
process.env.REACT_APP_NETWORK === "mainnet" process.env.REACT_APP_NETWORK === 'mainnet'
? ETHEREUM_NETWORK.MAINNET ? ETHEREUM_NETWORK.MAINNET
: ETHEREUM_NETWORK.RINKEBY : ETHEREUM_NETWORK.RINKEBY
export const getNetworkId = () => export const getNetworkId = () =>
process.env.REACT_APP_NETWORK === "mainnet" ? 1 : 4 process.env.REACT_APP_NETWORK === 'mainnet' ? 1 : 4
const getConfig = ensureOnce(configuration) const getConfig = ensureOnce(configuration)
@ -74,9 +73,9 @@ export const getGoogleAnalyticsTrackingID = () =>
: process.env.REACT_APP_GOOGLE_ANALYTICS_ID_RINKEBY : process.env.REACT_APP_GOOGLE_ANALYTICS_ID_RINKEBY
export const getIntercomId = () => export const getIntercomId = () =>
process.env.REACT_APP_ENV === "production" process.env.REACT_APP_ENV === 'production'
? process.env.REACT_APP_INTERCOM_ID ? process.env.REACT_APP_INTERCOM_ID
: "plssl1fl" : 'plssl1fl'
export const getExchangeRatesUrl = () => 'https://api.exchangeratesapi.io/latest' export const getExchangeRatesUrl = () => 'https://api.exchangeratesapi.io/latest'
@ -88,4 +87,4 @@ export const buildSafeCreationTxUrl = (safeAddress) => {
const base = getSafeCreationTxUri(address) const base = getSafeCreationTxUri(address)
return `${host}${base}` return `${host}${base}`
} }

View File

@ -1,11 +1,12 @@
// @flow
import React from 'react'
import { formatDate } from '../../columns'
import Bold from '../../../../../../../components/layout/Bold'
import Paragraph from '../../../../../../../components/layout/Paragraph'
import EtherscanLink from '../../../../../../../components/EtherscanLink'
import { makeStyles } from '@material-ui/core/styles' import { makeStyles } from '@material-ui/core/styles'
import Block from '../../../../../../../components/layout/Block' import React from 'react'
import { formatDate } from 'src/routes/safe/components/Transactions/TxsTable/columns'
import Bold from 'src/components/layout/Bold'
import Paragraph from 'src/components/layout/Paragraph'
import EtherscanLink from 'src/components/EtherscanLink'
import Block from 'src/components/layout/Block'
import { TransactionTypes } from 'src/routes/safe/store/models/types/transaction'
const useStyles = makeStyles({ const useStyles = makeStyles({
address: { address: {
@ -25,9 +26,7 @@ export const CreationTx = (props) => {
const { tx } = props const { tx } = props
const classes = useStyles() const classes = useStyles()
if (!tx) return null if (!tx) return null
const isCreationTx = tx.type === 'creation' const isCreationTx = tx.type === TransactionTypes.CREATION
console.log('Classes', classes)
return !isCreationTx ? null : ( return !isCreationTx ? null : (
<> <>

View File

@ -1,8 +1,8 @@
import React from 'react' import React from 'react'
import { INCOMING_TX_TYPES } from '../../../../../store/models/incomingTransaction' import { INCOMING_TX_TYPES } from 'src/routes/safe/store/models/incomingTransaction'
import { formatDate } from '../../columns' import { formatDate } from 'src/routes/safe/components/Transactions/TxsTable/columns'
import Bold from '../../../../../../../components/layout/Bold' import Bold from 'src/components/layout/Bold'
import Paragraph from '../../../../../../../components/layout/Paragraph' import Paragraph from 'src/components/layout/Paragraph'
export const IncomingTx = (props) => { export const IncomingTx = (props) => {
const { tx } = props const { tx } = props

View File

@ -1,8 +1,8 @@
// @flow
import React from 'react' import React from 'react'
import { formatDate } from '../../columns'
import Bold from '../../../../../../../components/layout/Bold' import { formatDate } from 'src/routes/safe/components/Transactions/TxsTable/columns'
import Paragraph from '../../../../../../../components/layout/Paragraph' import Bold from 'src/components/layout/Bold'
import Paragraph from 'src/components/layout/Paragraph'
export const OutgoingTx = (props) => { export const OutgoingTx = (props) => {
const { tx } = props const { tx } = props

View File

@ -24,6 +24,7 @@ import { safeNonceSelector, safeThresholdSelector } from 'src/routes/safe/store/
import { IncomingTx } from './IncomingTx' import { IncomingTx } from './IncomingTx'
import { CreationTx } from './CreationTx' import { CreationTx } from './CreationTx'
import { OutgoingTx } from './OutgoingTx' import { OutgoingTx } from './OutgoingTx'
import { TransactionTypes } from 'src/routes/safe/store/models/types/transaction'
const useStyles = makeStyles(styles as any) const useStyles = makeStyles(styles as any)
@ -35,7 +36,7 @@ const ExpandedTx = ({ cancelTx, tx }) => {
const openApproveModal = () => setOpenModal('approveTx') const openApproveModal = () => setOpenModal('approveTx')
const closeModal = () => setOpenModal(null) const closeModal = () => setOpenModal(null)
const isIncomingTx = !!INCOMING_TX_TYPES[tx.type] const isIncomingTx = !!INCOMING_TX_TYPES[tx.type]
const isCreationTx = tx.type === 'creation' const isCreationTx = tx.type === TransactionTypes.CREATION
const thresholdReached = !isIncomingTx && threshold <= tx.confirmations.size const thresholdReached = !isIncomingTx && threshold <= tx.confirmations.size
const canExecute = !isIncomingTx && nonce === tx.nonce const canExecute = !isIncomingTx && nonce === tx.nonce

View File

@ -19,8 +19,8 @@ import Table from 'src/components/Table'
import { cellWidth } from 'src/components/Table/TableHead' import { cellWidth } from 'src/components/Table/TableHead'
import Block from 'src/components/layout/Block' import Block from 'src/components/layout/Block'
import Row from 'src/components/layout/Row' import Row from 'src/components/layout/Row'
import { extendedTransactionsSelector } from 'src/routes/safe/container/selector'
import { safeCancellationTransactionsSelector } from 'src/routes/safe/store/selectors' import { safeCancellationTransactionsSelector } from 'src/routes/safe/store/selectors'
import { extendedTransactionsSelector } from 'src/routes/safe/store/selectors/transactions'
export const TRANSACTION_ROW_TEST_ID = 'transaction-row' export const TRANSACTION_ROW_TEST_ID = 'transaction-row'
@ -101,49 +101,27 @@ const TxsTable = ({ classes }) => {
</Row> </Row>
</TableCell> </TableCell>
<TableCell className={classes.expandCellStyle}> <TableCell className={classes.expandCellStyle}>
{!row.tx.creationTx && ( <IconButton disableRipple>
<IconButton disableRipple> {expandedTx === row.tx.safeTxHash ? <ExpandLess /> : <ExpandMore />}
{expandedTx === row.safeTxHash ? <ExpandLess /> : <ExpandMore />} </IconButton>
</IconButton> </TableCell>
)} </TableRow>
<TableRow>
<TableCell
className={classes.extendedTxContainer}
colSpan={6}
style={{ paddingBottom: 0, paddingTop: 0 }}
>
<Collapse
component={() => (
<ExpandedTxComponent cancelTx={row[TX_TABLE_RAW_CANCEL_TX_ID]} tx={row[TX_TABLE_RAW_TX_ID]} />
)}
in={expandedTx === row.tx.safeTxHash}
timeout="auto"
unmountOnExit
/>
</TableCell> </TableCell>
</TableRow> </TableRow>
{!row.tx.creationTx && (
<TableRow>
<TableCell
className={classes.extendedTxContainer}
colSpan={6}
style={{ paddingBottom: 0, paddingTop: 0 }}
>
<Collapse
component={() => (
<ExpandedTxComponent cancelTx={row[TX_TABLE_RAW_CANCEL_TX_ID]} tx={row[TX_TABLE_RAW_TX_ID]} />
)}
in={expandedTx === row.tx.safeTxHash}
timeout="auto"
unmountOnExit
/>
</TableCell>
</TableRow>
)}
{row.tx.creationTx && (
<TableRow>
<TableCell
className={classes.extendedTxContainer}
colSpan={6}
style={{ paddingBottom: 0, paddingTop: 0 }}
>
<Collapse
component={() => (
<ExpandedTxComponent cancelTx={row[TX_TABLE_RAW_CANCEL_TX_ID]} tx={row[TX_TABLE_RAW_TX_ID]} />
)}
in={expandedTx === row.tx.safeTxHash}
timeout="auto"
unmountOnExit
/>
</TableCell>
</TableRow>
)}
</React.Fragment> </React.Fragment>
)) ))
} }

View File

@ -1,9 +1,11 @@
// @flow
import axios from 'axios' import axios from 'axios'
import { List } from 'immutable' import { List } from 'immutable'
import { buildSafeCreationTxUrl } from '../../../../config'
import { buildSafeCreationTxUrl } from 'src/config'
import { addOrUpdateTransactions } from './transactions/addOrUpdateTransactions' import { addOrUpdateTransactions } from './transactions/addOrUpdateTransactions'
import { makeTransaction } from '../models/transaction' import { makeTransaction } from 'src/routes/safe/store/models/transaction'
import { TransactionTypes, TransactionStatus } from 'src/routes/safe/store/models/types/transaction'
import { web3ReadOnly } from 'src/logic/wallets/getWeb3'
const getCreationTx = async (safeAddress) => { const getCreationTx = async (safeAddress) => {
const url = buildSafeCreationTxUrl(safeAddress) const url = buildSafeCreationTxUrl(safeAddress)
@ -29,17 +31,21 @@ const fetchSafeCreationTx = (safeAddress) => async (dispatch) => {
transactionHash, transactionHash,
type, type,
} = creationTxFetched } = creationTxFetched
const txType = type || 'creation' const txType = type || TransactionTypes.CREATION
const safeTxHash = web3ReadOnly.utils.toHex('this is the creation transaction')
const creationTxAsRecord = makeTransaction({ const creationTxAsRecord = makeTransaction({
created, created,
creator, creator,
factoryAddress, factoryAddress,
masterCopy, masterCopy,
nonce: -1,
setupData, setupData,
creationTx, creationTx,
executionTxHash: transactionHash, executionTxHash: transactionHash,
type: txType, type: txType,
safeTxHash,
status: TransactionStatus.SUCCESS,
submissionDate: created, submissionDate: created,
}) })

View File

@ -33,6 +33,8 @@ export type TransactionProps = {
blockNumber?: number | null blockNumber?: number | null
cancelled?: boolean cancelled?: boolean
confirmations: import('immutable').List<any> confirmations: import('immutable').List<any>
created: boolean
creator: string
creationTx: boolean creationTx: boolean
customTx: boolean customTx: boolean
data?: string | null data?: string | null
@ -41,6 +43,7 @@ export type TransactionProps = {
executionDate?: string | null executionDate?: string | null
executionTxHash?: string | null executionTxHash?: string | null
executor: string executor: string
factoryAddress: string
gasPrice: number gasPrice: number
gasToken: string gasToken: string
isCancellationTx: boolean isCancellationTx: boolean
@ -49,6 +52,7 @@ export type TransactionProps = {
isPending?: boolean isPending?: boolean
isSuccessful: boolean isSuccessful: boolean
isTokenTransfer: boolean isTokenTransfer: boolean
masterCopy: string
modifySettingsTx: boolean modifySettingsTx: boolean
multiSendTx: boolean multiSendTx: boolean
nonce?: number | null nonce?: number | null
@ -60,9 +64,11 @@ export type TransactionProps = {
refundReceiver: string refundReceiver: string
safeTxGas: number safeTxGas: number
safeTxHash: string safeTxHash: string
setupData: string
status?: TransactionStatus status?: TransactionStatus
submissionDate?: string | null submissionDate?: string | null
symbol?: string | null symbol?: string | null
transactionHash: string
type: TransactionTypes type: TransactionTypes
upgradeTx: boolean upgradeTx: boolean
value: string value: string