Skip to content

Commit

Permalink
filter if proxy isnt the selected ont
Browse files Browse the repository at this point in the history
  • Loading branch information
Tbaut committed Aug 31, 2023
1 parent cd5d446 commit 14a274f
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions packages/ui/src/components/Transactions/TransactionList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { PendingTx, usePendingTx } from '../../hooks/usePendingTx'
import { useMultiProxy } from '../../contexts/MultiProxyContext'
import { ApiPromise } from '@polkadot/api'
import { useApi } from '../../contexts/ApiContext'
import { getDifference, getDisplayArgs, getIntersection } from '../../utils'
import { getDifference, getDisplayArgs, getIntersection, isProxyCall } from '../../utils'
import { useAccounts } from '../../contexts/AccountsContext'
import { ISanitizedCall, parseGenericCall } from '../../utils'
import { GenericCall } from '@polkadot/types'
Expand Down Expand Up @@ -163,11 +163,20 @@ const TransactionList = ({ className }: Props) => {

Promise.all(agregatedDataPromise)
.then((res) => {
const filtered = res.filter((agg) => agg !== undefined) as AggregatedData[]
const definedTxs = res.filter((agg) => agg !== undefined) as AggregatedData[]
const timestampObj: AggGroupedByDate = {}

// remove the proxy transaction that aren't for the selected proxy
const relevantTxs = definedTxs.filter((agg) => {
if (!isProxyCall(agg.name) || !agg?.args || !(agg.args as any).real.Id) {
return true
}

return (agg.args as any).real.Id === selectedMultiProxy?.proxy
})

// sort by date, the newest first
const sorted = filtered.sort(sortByLatest)
const sorted = relevantTxs.sort(sortByLatest)

// populate the object
sorted.forEach((data) => {
Expand All @@ -179,7 +188,7 @@ const TransactionList = ({ className }: Props) => {
setAggregatedData(timestampObj)
})
.catch(console.error)
}, [api, pendingTxData, selectedMultiProxy])
}, [aggregatedData.args, api, pendingTxData, selectedMultiProxy])

return (
<Box className={className}>
Expand Down

0 comments on commit 14a274f

Please sign in to comment.