mirror of
https://github.com/status-im/safe-react.git
synced 2025-01-16 04:54:11 +00:00
Use safe tx hash as transaction id
This commit is contained in:
parent
11a4b84c9b
commit
6cda678c9e
@ -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
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user