add modify safe settings type

This commit is contained in:
mmv 2019-07-10 18:25:54 +04:00
parent 9b709f8e29
commit 9a999fd2ea
5 changed files with 34 additions and 23 deletions

View File

@ -27,6 +27,9 @@ const getTxData = (tx: Transaction) => {
} else if (Number(tx.value) > 0) { } else if (Number(tx.value) > 0) {
txData.recipient = tx.recipient txData.recipient = tx.recipient
txData.value = fromWei(toBN(tx.value), 'ether') txData.value = fromWei(toBN(tx.value), 'ether')
} else if (tx.modifySettingsTx) {
txData.recipient = tx.recipient
txData.modifySettingsTx = true
} }
return txData return txData
@ -44,11 +47,15 @@ type Props = {
} }
const TxDescription = ({ tx, classes }: Props) => { const TxDescription = ({ tx, classes }: Props) => {
const { recipient, value } = getTxData(tx) const { recipient, value, modifySettingsTx } = getTxData(tx)
return ( return (
<Block className={classes.txDataContainer}> <Block className={classes.txDataContainer}>
<Paragraph noMargin> <Paragraph noMargin>
{modifySettingsTx ? (
<Bold>Modify Safe Settings</Bold>
) : (
<>
<Bold> <Bold>
Send Send
{' '} {' '}
@ -63,6 +70,8 @@ const TxDescription = ({ tx, classes }: Props) => {
{shortVersionOf(recipient, 4)} {shortVersionOf(recipient, 4)}
<OpenInNew style={openIconStyle} /> <OpenInNew style={openIconStyle} />
</a> </a>
</>
)}
</Paragraph> </Paragraph>
</Block> </Block>
) )

View File

@ -46,10 +46,9 @@ export const getTxTableData = (transactions: List<Transaction>): List<Transactio
const rows = transactions.map((tx: Transaction) => { const rows = transactions.map((tx: Transaction) => {
const txDate = tx.isExecuted ? tx.executionDate : tx.submissionDate const txDate = tx.isExecuted ? tx.executionDate : tx.submissionDate
return { return {
[TX_TABLE_NONCE_ID]: tx.nonce, [TX_TABLE_NONCE_ID]: tx.nonce,
[TX_TABLE_TYPE_ID]: 'Outgoing transfer', [TX_TABLE_TYPE_ID]: tx.modifySettingsTx ? 'Modify Safe Settings' : 'Outgoing transfer',
[TX_TABLE_DATE_ID]: formatDate(tx.isExecuted ? tx.executionDate : tx.submissionDate), [TX_TABLE_DATE_ID]: formatDate(tx.isExecuted ? tx.executionDate : tx.submissionDate),
[buildOrderFieldFrom(TX_TABLE_DATE_ID)]: getTime(txDate), [buildOrderFieldFrom(TX_TABLE_DATE_ID)]: getTime(txDate),
[TX_TABLE_AMOUNT_ID]: getTxAmount(tx), [TX_TABLE_AMOUNT_ID]: getTxAmount(tx),
@ -77,7 +76,7 @@ export const generateColumns = () => {
disablePadding: false, disablePadding: false,
label: 'Type', label: 'Type',
custom: false, custom: false,
width: 150, width: 200,
} }
const valueColumn: Column = { const valueColumn: Column = {

View File

@ -90,6 +90,7 @@ const buildTransactionFrom = async (safeAddress: string, tx: TxServiceModel, saf
creationTxHash, creationTxHash,
isTokenTransfer, isTokenTransfer,
decodedParams, decodedParams,
modifySettingsTx: tx.to === safeAddress,
}) })
} }

View File

@ -16,6 +16,7 @@ export type TransactionProps = {
submissionDate: Date, submissionDate: Date,
executionDate: Date, executionDate: Date,
symbol: string, symbol: string,
modifySettingsTx: boolean,
creationTxHash: string, creationTxHash: string,
executionTxHash?: string, executionTxHash?: string,
cancelled?: boolean, cancelled?: boolean,
@ -38,6 +39,7 @@ export const makeTransaction: RecordFactory<TransactionProps> = Record({
executionTxHash: undefined, executionTxHash: undefined,
creationTxHash: '', creationTxHash: '',
cancelled: false, cancelled: false,
modifySettingsTx: false,
status: 'awaiting', status: 'awaiting',
isTokenTransfer: false, isTokenTransfer: false,
decodedParams: {}, decodedParams: {},