From e3b3a3ea44b7d388e0771741065ff3ecdcef5107 Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 25 Nov 2022 13:14:25 +0200 Subject: [PATCH] fix: get last tx --- src/web3/store/transactionsSelectors.ts | 31 +++++++++++++------------ 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/src/web3/store/transactionsSelectors.ts b/src/web3/store/transactionsSelectors.ts index 84abebb..fdc8a95 100644 --- a/src/web3/store/transactionsSelectors.ts +++ b/src/web3/store/transactionsSelectors.ts @@ -23,12 +23,27 @@ export const selectTXByHash = ( return state.transactionsPool[hash]; }; +export const selectAllTransactionsByWallet = ( + state: ITransactionsState, + from: string +) => { + return selectAllTransactions(state).filter((tx) => tx.from == from); +}; + +export const selectPendingTransactionByWallet = ( + state: ITransactionsState, + from: string +) => { + return selectPendingTransactions(state).filter((tx) => tx.from == from); +}; + export const selectLastTxByTypeAndPayload = ( state: ITransactionsState, + from: string, type: T['type'], payload: T['payload'] ) => { - const allTransactions = selectAllTransactions(state); + const allTransactions = selectAllTransactionsByWallet(state, from); const filteredTransactions = allTransactions.filter( (tx) => tx.type === type && isEqual(tx.payload, payload) ); @@ -41,17 +56,3 @@ export const selectLastTxByTypeAndPayload = ( return undefined; } }; - -export const selectAllTransactionsByWallet = ( - state: ITransactionsState, - from: string -) => { - return selectAllTransactions(state).filter((tx) => tx.from == from); -}; - -export const selectPendingTransactionByWallet = ( - state: ITransactionsState, - from: string -) => { - return selectPendingTransactions(state).filter((tx) => tx.from == from); -};