Use safe tx hash as transaction id

This commit is contained in:
Germán Martínez 2019-07-23 11:36:16 +02:00
parent 11a4b84c9b
commit 6cda678c9e
3 changed files with 9 additions and 23 deletions

View File

@ -54,8 +54,8 @@ const TxsTable = ({
}: Props) => {
const [expandedTx, setExpandedTx] = useState<string | null>(null)
const handleTxExpand = (creationTxHash) => {
setExpandedTx(prevTx => (prevTx === creationTxHash ? null : creationTxHash))
const handleTxExpand = (safeTxHash) => {
setExpandedTx(prevTx => (prevTx === safeTxHash ? null : safeTxHash))
}
const columns = generateColumns()
@ -77,8 +77,8 @@ const TxsTable = ({
<React.Fragment key={index}>
<TableRow
tabIndex={-1}
className={cn(classes.row, expandedTx === row.tx.creationTxHash && classes.expandedRow)}
onClick={() => handleTxExpand(row.tx.creationTxHash)}
className={cn(classes.row, expandedTx === row.tx.safeTxHash && classes.expandedRow)}
onClick={() => handleTxExpand(row.tx.safeTxHash)}
data-testid={TRANSACTION_ROW_TEST_ID}
>
{autoColumns.map((column: Column) => (
@ -98,7 +98,7 @@ const TxsTable = ({
</Row>
</TableCell>
<TableCell style={expandCellStyle}>
<IconButton disableRipple>{expandedTx === row.nonce ? <ExpandLess /> : <ExpandMore />}</IconButton>
<IconButton disableRipple>{expandedTx === row.safeTxHash ? <ExpandLess /> : <ExpandMore />}</IconButton>
</TableCell>
</TableRow>
<TableRow>
@ -108,7 +108,7 @@ const TxsTable = ({
className={classes.extendedTxContainer}
>
<Collapse
in={expandedTx === row.tx.creationTxHash}
in={expandedTx === row.tx.safeTxHash}
timeout="auto"
component={ExpandedTxComponent}
unmountOnExit

View File

@ -38,19 +38,6 @@ type TxServiceModel = {
isExecuted: boolean,
}
const compareConfirmations = (a, b) => {
const confA = a.hash.toLowerCase()
const confB = b.hash.toLowerCase()
let comparison = 0
if (confA > confB) {
comparison = 1
} else if (confA < confB) {
comparison = -1
}
return comparison
}
export const buildTransactionFrom = async (
safeAddress: string,
tx: TxServiceModel,
@ -72,7 +59,6 @@ export const buildTransactionFrom = async (
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 creationTxHash = confirmations.sort(compareConfirmations).first().hash
let executionTxHash
const executionTx = confirmations.find(conf => conf.type === TX_TYPE_EXECUTION)
@ -109,7 +95,7 @@ export const buildTransactionFrom = async (
submissionDate: tx.submissionDate,
executionDate: tx.executionDate,
executionTxHash,
creationTxHash,
safeTxHash: tx.safeTxHash,
isTokenTransfer,
decodedParams,
modifySettingsTx,

View File

@ -18,7 +18,7 @@ export type TransactionProps = {
symbol: string,
modifySettingsTx: boolean,
cancellationTx: boolean,
creationTxHash: string,
safeTxHash: string,
executionTxHash?: string,
cancelled?: boolean,
status?: TransactionStatus,
@ -38,7 +38,7 @@ export const makeTransaction: RecordFactory<TransactionProps> = Record({
executionDate: '',
symbol: '',
executionTxHash: undefined,
creationTxHash: '',
safeTxHash: '',
cancelled: false,
modifySettingsTx: false,
cancellationTx: false,