Skip to content
This repository has been archived by the owner on Nov 10, 2023. It is now read-only.

Fix: deep-linked tx – use current timestamp as fallback #3146

Merged
merged 2 commits into from
Dec 14, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 2 additions & 16 deletions src/logic/safe/store/actions/createTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,11 @@ import { TxParameters } from 'src/routes/safe/container/hooks/useTransactionPara
import { isTxPendingError } from 'src/logic/wallets/getWeb3'
import { Errors, logError } from 'src/logic/exceptions/CodedException'
import { currentChainId } from 'src/logic/config/store/selectors'
import { extractShortChainName, generateSafeRoute, history, SAFE_ROUTES } from 'src/routes/routes'
import { extractShortChainName, history, SAFE_ROUTES } from 'src/routes/routes'
import { getPrefixedSafeAddressSlug, SAFE_ADDRESS_SLUG, TRANSACTION_ID_SLUG } from 'src/routes/routes'
import { generatePath } from 'react-router-dom'
import { getContractErrorMessage } from 'src/logic/contracts/safeContractErrors'
import { getLastTransaction, getLastTxNonce } from '../selectors/gatewayTransactions'
import { getShortName } from 'src/config'
import { IS_PRODUCTION } from 'src/utils/constants'

export interface CreateTransactionArgs {
navigateToTransactionsTab?: boolean
Expand Down Expand Up @@ -71,19 +69,7 @@ const navigateToTx = (safeAddress: string, txId: string) => {
[TRANSACTION_ID_SLUG]: txId,
})

// TODO: uncomment once we fix deep linking bugs
// history.push(txRoute)

if (!IS_PRODUCTION) {
console.info('Created transaction', txRoute)
}

history.push(
generateSafeRoute(SAFE_ROUTES.TRANSACTIONS_QUEUE, {
shortName: getShortName(),
safeAddress,
}),
)
history.push(txRoute)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Transaction deeplinking must be enabled to test this ticket. Whether we disabled it again after needs to be decided.

}

export const createTransaction =
Expand Down
6 changes: 4 additions & 2 deletions src/routes/safe/components/Transactions/TxList/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,13 @@ export const makeTxFromDetails = (txDetails: TransactionDetails): Transaction =>
? txDetails.detailedExecutionInfo
: getMultisigExecutionInfo(txDetails)

// Will only be used as a fallback whilst waiting on backend tx creation cache
const now = new Date().getTime()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JFYI, there's a short version of the same: Date.now() (w/o new).

const timestamp = isTxQueued(txDetails.txStatus)
? isMultiSigExecutionDetails(txDetails.detailedExecutionInfo)
? txDetails.detailedExecutionInfo.submittedAt
: 0
: txDetails.executedAt || 0
: now
: txDetails.executedAt || now

const tx: Transaction = {
id: txDetails.txId,
Expand Down