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 {
RELAY_API_URL,
SIGNATURES_VIA_METAMASK,
TX_SERVICE_HOST
} from "src/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"
} from 'src/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'
const configuration = () => {
if (process.env.NODE_ENV === "test") {
if (process.env.NODE_ENV === 'test') {
return testConfig
}
if (process.env.NODE_ENV === "production") {
if (process.env.REACT_APP_NETWORK === "mainnet") {
return process.env.REACT_APP_ENV === "production"
if (process.env.NODE_ENV === 'production') {
if (process.env.REACT_APP_NETWORK === 'mainnet') {
return process.env.REACT_APP_ENV === 'production'
? mainnetProdConfig
: mainnetStagingConfig
}
return process.env.REACT_APP_ENV === "production"
return process.env.REACT_APP_ENV === 'production'
? prodConfig
: stagingConfig
}
return process.env.REACT_APP_NETWORK === "mainnet"
return process.env.REACT_APP_NETWORK === 'mainnet'
? mainnetDevConfig
: devConfig
}
export const getNetwork = () =>
process.env.REACT_APP_NETWORK === "mainnet"
process.env.REACT_APP_NETWORK === 'mainnet'
? ETHEREUM_NETWORK.MAINNET
: ETHEREUM_NETWORK.RINKEBY
export const getNetworkId = () =>
process.env.REACT_APP_NETWORK === "mainnet" ? 1 : 4
process.env.REACT_APP_NETWORK === 'mainnet' ? 1 : 4
const getConfig = ensureOnce(configuration)
@ -74,9 +73,9 @@ export const getGoogleAnalyticsTrackingID = () =>
: process.env.REACT_APP_GOOGLE_ANALYTICS_ID_RINKEBY
export const getIntercomId = () =>
process.env.REACT_APP_ENV === "production"
process.env.REACT_APP_ENV === 'production'
? process.env.REACT_APP_INTERCOM_ID
: "plssl1fl"
: 'plssl1fl'
export const getExchangeRatesUrl = () => 'https://api.exchangeratesapi.io/latest'
@ -88,4 +87,4 @@ export const buildSafeCreationTxUrl = (safeAddress) => {
const base = getSafeCreationTxUri(address)
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 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({
address: {
@ -25,9 +26,7 @@ export const CreationTx = (props) => {
const { tx } = props
const classes = useStyles()
if (!tx) return null
const isCreationTx = tx.type === 'creation'
console.log('Classes', classes)
const isCreationTx = tx.type === TransactionTypes.CREATION
return !isCreationTx ? null : (
<>

View File

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

View File

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

View File

@ -24,6 +24,7 @@ import { safeNonceSelector, safeThresholdSelector } from 'src/routes/safe/store/
import { IncomingTx } from './IncomingTx'
import { CreationTx } from './CreationTx'
import { OutgoingTx } from './OutgoingTx'
import { TransactionTypes } from 'src/routes/safe/store/models/types/transaction'
const useStyles = makeStyles(styles as any)
@ -35,7 +36,7 @@ const ExpandedTx = ({ cancelTx, tx }) => {
const openApproveModal = () => setOpenModal('approveTx')
const closeModal = () => setOpenModal(null)
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 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 Block from 'src/components/layout/Block'
import Row from 'src/components/layout/Row'
import { extendedTransactionsSelector } from 'src/routes/safe/container/selector'
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'
@ -101,49 +101,27 @@ const TxsTable = ({ classes }) => {
</Row>
</TableCell>
<TableCell className={classes.expandCellStyle}>
{!row.tx.creationTx && (
<IconButton disableRipple>
{expandedTx === row.safeTxHash ? <ExpandLess /> : <ExpandMore />}
</IconButton>
)}
<IconButton disableRipple>
{expandedTx === row.tx.safeTxHash ? <ExpandLess /> : <ExpandMore />}
</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>
</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>
))
}

View File

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

View File

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