Update Transactions component for displaying Txs correctly
This commit is contained in:
parent
8d6d2f512e
commit
81fccccdab
|
@ -1,5 +1,6 @@
|
||||||
// @flow
|
// @flow
|
||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
|
import { List } from 'immutable'
|
||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
import { type Transaction } from '~/routes/safe/store/model/transaction'
|
import { type Transaction } from '~/routes/safe/store/model/transaction'
|
||||||
import NoTransactions from '~/routes/safe/component/Transactions/NoTransactions'
|
import NoTransactions from '~/routes/safe/component/Transactions/NoTransactions'
|
||||||
|
@ -17,12 +18,18 @@ type Props = SelectorProps & Actions & {
|
||||||
|
|
||||||
}
|
}
|
||||||
class Transactions extends React.Component<Props, {}> {
|
class Transactions extends React.Component<Props, {}> {
|
||||||
|
componentDidMount() {
|
||||||
|
this.props.fetchTransactions(this.props.safeAddress)
|
||||||
|
}
|
||||||
|
|
||||||
onProcessTx = async (tx: Transaction, alreadyConfirmed: number) => {
|
onProcessTx = async (tx: Transaction, alreadyConfirmed: number) => {
|
||||||
const {
|
const {
|
||||||
fetchTransactions, safeAddress, userAddress, threshold,
|
fetchTransactions, safeAddress, userAddress, threshold,
|
||||||
} = this.props
|
} = this.props
|
||||||
|
|
||||||
const confirmations = tx.get('confirmations')
|
const confirmations = tx.get('confirmations')
|
||||||
|
const usersConfirmed = List(confirmations.map((confirmation: Confirmation) =>
|
||||||
|
confirmation.get('owner').get('address')))
|
||||||
const userHasAlreadyConfirmed = confirmations.filter((confirmation: Confirmation) => {
|
const userHasAlreadyConfirmed = confirmations.filter((confirmation: Confirmation) => {
|
||||||
const ownerAddress = confirmation.get('owner').get('address')
|
const ownerAddress = confirmation.get('owner').get('address')
|
||||||
const samePerson = sameAddress(ownerAddress, userAddress)
|
const samePerson = sameAddress(ownerAddress, userAddress)
|
||||||
|
@ -34,7 +41,7 @@ class Transactions extends React.Component<Props, {}> {
|
||||||
throw new Error('Owner has already confirmed this transaction')
|
throw new Error('Owner has already confirmed this transaction')
|
||||||
}
|
}
|
||||||
|
|
||||||
await processTransaction(safeAddress, tx, alreadyConfirmed, userAddress, threshold)
|
await processTransaction(safeAddress, tx, alreadyConfirmed, userAddress, threshold, usersConfirmed)
|
||||||
fetchTransactions(safeAddress)
|
fetchTransactions(safeAddress)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue