add awaiting_execution status to the txs
This commit is contained in:
parent
44f3a45158
commit
4991b0ebc9
|
@ -33,13 +33,15 @@ export type SelectorProps = {
|
||||||
transactions: List<Transaction>,
|
transactions: List<Transaction>,
|
||||||
}
|
}
|
||||||
|
|
||||||
const getTxStatus = (tx: Transaction): TransactionStatus => {
|
const getTxStatus = (tx: Transaction, safe: Safe): TransactionStatus => {
|
||||||
let txStatus = 'awaiting'
|
let txStatus = 'awaiting_confirmations'
|
||||||
|
|
||||||
if (tx.isExecuted) {
|
if (tx.isExecuted) {
|
||||||
txStatus = 'success'
|
txStatus = 'success'
|
||||||
} else if (tx.cancelled) {
|
} else if (tx.cancelled) {
|
||||||
txStatus = 'cancelled'
|
txStatus = 'cancelled'
|
||||||
|
} else if (tx.confirmations.size === safe.owners.size) {
|
||||||
|
txStatus = 'awaiting_execution'
|
||||||
}
|
}
|
||||||
|
|
||||||
return txStatus
|
return txStatus
|
||||||
|
@ -103,8 +105,9 @@ const extendedSafeTokensSelector: Selector<GlobalState, RouterProps, List<Token>
|
||||||
)
|
)
|
||||||
|
|
||||||
const extendedTransactionsSelector: Selector<GlobalState, RouterProps, List<Transaction>> = createSelector(
|
const extendedTransactionsSelector: Selector<GlobalState, RouterProps, List<Transaction>> = createSelector(
|
||||||
|
safeSelector,
|
||||||
safeTransactionsSelector,
|
safeTransactionsSelector,
|
||||||
(transactions) => {
|
(safe, transactions) => {
|
||||||
const extendedTransactions = transactions.map((tx: Transaction) => {
|
const extendedTransactions = transactions.map((tx: Transaction) => {
|
||||||
let extendedTx = tx
|
let extendedTx = tx
|
||||||
|
|
||||||
|
@ -120,7 +123,7 @@ const extendedTransactionsSelector: Selector<GlobalState, RouterProps, List<Tran
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return extendedTx.set('status', getTxStatus(extendedTx))
|
return extendedTx.set('status', getTxStatus(extendedTx, safe))
|
||||||
})
|
})
|
||||||
|
|
||||||
return extendedTransactions
|
return extendedTransactions
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { List, Record } from 'immutable'
|
||||||
import type { RecordFactory, RecordOf } from 'immutable'
|
import type { RecordFactory, RecordOf } from 'immutable'
|
||||||
import { type Confirmation } from '~/routes/safe/store/models/confirmation'
|
import { type Confirmation } from '~/routes/safe/store/models/confirmation'
|
||||||
|
|
||||||
export type TransactionStatus = 'awaiting' | 'success' | 'cancelled'
|
export type TransactionStatus = 'awaiting_confirmations' | 'success' | 'cancelled' | 'awaiting_execution'
|
||||||
|
|
||||||
export type TransactionProps = {
|
export type TransactionProps = {
|
||||||
name: string,
|
name: string,
|
||||||
|
|
Loading…
Reference in New Issue