add cancellation tx type, fix tx decsription for adding owner
This commit is contained in:
parent
4909533048
commit
f7d1e0fe7d
|
@ -40,7 +40,7 @@ type DescriptionDescProps = {
|
||||||
}
|
}
|
||||||
|
|
||||||
type AddressLinkProps = {
|
type AddressLinkProps = {
|
||||||
address: string
|
address: string,
|
||||||
}
|
}
|
||||||
|
|
||||||
const RinkebyAddressLink = ({ address }: AddressLinkProps) => (
|
const RinkebyAddressLink = ({ address }: AddressLinkProps) => (
|
||||||
|
@ -68,13 +68,6 @@ to:
|
||||||
|
|
||||||
const SettingsDescription = ({ removedOwner, addedOwner, newThreshold }: DescriptionDescProps) => (
|
const SettingsDescription = ({ removedOwner, addedOwner, newThreshold }: DescriptionDescProps) => (
|
||||||
<>
|
<>
|
||||||
{newThreshold && (
|
|
||||||
<Paragraph>
|
|
||||||
<Bold>Change required confirmations:</Bold>
|
|
||||||
<br />
|
|
||||||
{newThreshold}
|
|
||||||
</Paragraph>
|
|
||||||
)}
|
|
||||||
{removedOwner && (
|
{removedOwner && (
|
||||||
<Paragraph>
|
<Paragraph>
|
||||||
<Bold>Remove owner:</Bold>
|
<Bold>Remove owner:</Bold>
|
||||||
|
@ -89,19 +82,27 @@ const SettingsDescription = ({ removedOwner, addedOwner, newThreshold }: Descrip
|
||||||
<RinkebyAddressLink address={addedOwner} />
|
<RinkebyAddressLink address={addedOwner} />
|
||||||
</Paragraph>
|
</Paragraph>
|
||||||
)}
|
)}
|
||||||
|
{newThreshold && (
|
||||||
|
<Paragraph>
|
||||||
|
<Bold>Change required confirmations:</Bold>
|
||||||
|
<br />
|
||||||
|
{newThreshold}
|
||||||
|
</Paragraph>
|
||||||
|
)}
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
|
|
||||||
const TxDescription = ({ tx, classes }: Props) => {
|
const TxDescription = ({ tx, classes }: Props) => {
|
||||||
const {
|
const {
|
||||||
recipient, value, modifySettingsTx, removedOwner, addedOwner, newThreshold,
|
recipient, value, modifySettingsTx, removedOwner, addedOwner, newThreshold, cancellationTx,
|
||||||
} = getTxData(tx)
|
} = getTxData(tx)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Block className={classes.txDataContainer}>
|
<Block className={classes.txDataContainer}>
|
||||||
{modifySettingsTx ? (
|
{modifySettingsTx && (
|
||||||
<SettingsDescription removedOwner={removedOwner} newThreshold={newThreshold} addedOwner={addedOwner} />
|
<SettingsDescription removedOwner={removedOwner} newThreshold={newThreshold} addedOwner={addedOwner} />
|
||||||
) : (
|
)}
|
||||||
|
{!cancellationTx && !modifySettingsTx && (
|
||||||
<TransferDescription value={value} symbol={tx.symbol} recipient={recipient} />
|
<TransferDescription value={value} symbol={tx.symbol} recipient={recipient} />
|
||||||
)}
|
)}
|
||||||
</Block>
|
</Block>
|
||||||
|
|
|
@ -12,6 +12,7 @@ type DecodedTxData = {
|
||||||
removedOwner?: string,
|
removedOwner?: string,
|
||||||
newThreshold?: string,
|
newThreshold?: string,
|
||||||
addedOwner?: string,
|
addedOwner?: string,
|
||||||
|
cancellationTx?: boolean,
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getTxData = (tx: Transaction): DecodedTxData => {
|
export const getTxData = (tx: Transaction): DecodedTxData => {
|
||||||
|
@ -34,8 +35,8 @@ export const getTxData = (tx: Transaction): DecodedTxData => {
|
||||||
txData.newThreshold = tx.decodedParams.args[2]
|
txData.newThreshold = tx.decodedParams.args[2]
|
||||||
} else if (tx.decodedParams.methodName === 'changeThreshold') {
|
} else if (tx.decodedParams.methodName === 'changeThreshold') {
|
||||||
txData.newThreshold = tx.decodedParams.args[0]
|
txData.newThreshold = tx.decodedParams.args[0]
|
||||||
} else if (tx.decodedParams.methodName === 'addOWnerWithThreshold') {
|
} else if (tx.decodedParams.methodName === 'addOwnerWithThreshold') {
|
||||||
txData.addedOwner = tx.decodedParams.args[1]
|
txData.addedOwner = tx.decodedParams.args[0]
|
||||||
txData.newThreshold = tx.decodedParams.args[1]
|
txData.newThreshold = tx.decodedParams.args[1]
|
||||||
} else if (tx.decodedParams.methodName === 'swapOwner') {
|
} else if (tx.decodedParams.methodName === 'swapOwner') {
|
||||||
txData.addedOwner = tx.decodedParams.args[0]
|
txData.addedOwner = tx.decodedParams.args[0]
|
||||||
|
@ -44,6 +45,8 @@ export const getTxData = (tx: Transaction): DecodedTxData => {
|
||||||
}
|
}
|
||||||
/* eslint-enable */
|
/* eslint-enable */
|
||||||
}
|
}
|
||||||
|
} else if (tx.cancellationTx) {
|
||||||
|
txData.cancellationTx = true
|
||||||
}
|
}
|
||||||
|
|
||||||
return txData
|
return txData
|
||||||
|
|
|
@ -45,10 +45,16 @@ export type TransactionRow = SortRow<TxData>
|
||||||
export const getTxTableData = (transactions: List<Transaction>): List<TransactionRow> => {
|
export const getTxTableData = (transactions: List<Transaction>): List<TransactionRow> => {
|
||||||
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
|
||||||
|
let txType = 'Outgoing transfer'
|
||||||
|
if (tx.modifySettingsTx) {
|
||||||
|
txType = 'Modify Safe Settings'
|
||||||
|
} else if (tx.cancellationTx) {
|
||||||
|
txType = 'Cancellation transaction'
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
[TX_TABLE_NONCE_ID]: tx.nonce,
|
[TX_TABLE_NONCE_ID]: tx.nonce,
|
||||||
[TX_TABLE_TYPE_ID]: tx.modifySettingsTx ? 'Modify Safe Settings' : 'Outgoing transfer',
|
[TX_TABLE_TYPE_ID]: txType,
|
||||||
[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),
|
||||||
|
|
|
@ -52,7 +52,8 @@ const buildTransactionFrom = async (safeAddress: string, tx: TxServiceModel, saf
|
||||||
})
|
})
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
const modifySettingsTx = tx.to === safeAddress && Number(tx.value) === 0
|
const modifySettingsTx = tx.to === safeAddress && Number(tx.value) === 0 && !!tx.data
|
||||||
|
const cancellationTx = tx.to === safeAddress && Number(tx.value) === 0 && !tx.data
|
||||||
const isTokenTransfer = await isAddressAToken(tx.to)
|
const isTokenTransfer = await isAddressAToken(tx.to)
|
||||||
const creationTxHash = confirmations.last().hash
|
const creationTxHash = confirmations.last().hash
|
||||||
|
|
||||||
|
@ -97,6 +98,7 @@ const buildTransactionFrom = async (safeAddress: string, tx: TxServiceModel, saf
|
||||||
isTokenTransfer,
|
isTokenTransfer,
|
||||||
decodedParams,
|
decodedParams,
|
||||||
modifySettingsTx,
|
modifySettingsTx,
|
||||||
|
cancellationTx,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@ export type TransactionProps = {
|
||||||
executionDate: Date,
|
executionDate: Date,
|
||||||
symbol: string,
|
symbol: string,
|
||||||
modifySettingsTx: boolean,
|
modifySettingsTx: boolean,
|
||||||
|
cancellationTx: boolean,
|
||||||
creationTxHash: string,
|
creationTxHash: string,
|
||||||
executionTxHash?: string,
|
executionTxHash?: string,
|
||||||
cancelled?: boolean,
|
cancelled?: boolean,
|
||||||
|
@ -40,6 +41,7 @@ export const makeTransaction: RecordFactory<TransactionProps> = Record({
|
||||||
creationTxHash: '',
|
creationTxHash: '',
|
||||||
cancelled: false,
|
cancelled: false,
|
||||||
modifySettingsTx: false,
|
modifySettingsTx: false,
|
||||||
|
cancellationTx: false,
|
||||||
status: 'awaiting',
|
status: 'awaiting',
|
||||||
isTokenTransfer: false,
|
isTokenTransfer: false,
|
||||||
decodedParams: {},
|
decodedParams: {},
|
||||||
|
|
Loading…
Reference in New Issue