use findLast in fetch transactions because it adds new confirmations to the beginning

This commit is contained in:
mmv 2019-07-08 17:55:03 +04:00
parent d68dc9d77c
commit 84d610b1ce
2 changed files with 3 additions and 2 deletions

View File

@ -49,7 +49,7 @@ const buildTransactionFrom = async (safeAddress: string, tx: TxServiceModel, saf
}), }),
) )
const isToken = await isAddressAToken(tx.to) const isToken = await isAddressAToken(tx.to)
const creationTxHash = confirmations.find(conf => conf.type === TX_TYPE_CONFIRMATION).hash const creationTxHash = confirmations.findLast(conf => conf.type === TX_TYPE_CONFIRMATION).hash
let executionTxHash let executionTxHash
const executionTx = confirmations.find(conf => conf.type === TX_TYPE_EXECUTION) const executionTx = confirmations.find(conf => conf.type === TX_TYPE_EXECUTION)

View File

@ -10,7 +10,8 @@ import { approveTransaction, executeTransaction, CALL } from '~/logic/safe/trans
// https://gnosis-safe.readthedocs.io/en/latest/contracts/signatures.html#pre-validated-signatures // https://gnosis-safe.readthedocs.io/en/latest/contracts/signatures.html#pre-validated-signatures
// https://github.com/gnosis/safe-contracts/blob/master/test/gnosisSafeTeamEdition.js#L26 // https://github.com/gnosis/safe-contracts/blob/master/test/gnosisSafeTeamEdition.js#L26
const generateSignaturesFromTxConfirmations = (tx: Transaction) => { const generateSignaturesFromTxConfirmations = (tx: Transaction) => {
// The constant parts need to be sorted so that the recovered signers are sorted ascending (natural order) by address (not checksummed). // The constant parts need to be sorted so that the recovered signers are sorted ascending
// (natural order) by address (not checksummed).
const confirmedAdresses = tx.confirmations.map(conf => conf.owner.address).sort() const confirmedAdresses = tx.confirmations.map(conf => conf.owner.address).sort()
let sigs = '0x' let sigs = '0x'