1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00

fix pool tx (#1288)

Signed-off-by: mihaisc <mihai.scarlat@smartcontrol.ro>
This commit is contained in:
mihaisc 2022-03-31 04:50:32 -07:00 committed by GitHub
parent eb3ddcee90
commit 45dad876e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 13 deletions

View File

@ -23,7 +23,7 @@ const txHistoryQueryByPool = gql`
poolTransactions(
orderBy: timestamp
orderDirection: desc
where: { pool: $pool }
where: { pool: $pool, user: $user }
first: 1000
) {
baseToken {
@ -40,6 +40,9 @@ const txHistoryQueryByPool = gql`
tx
timestamp
pool {
datatoken {
id
}
id
}
}
@ -67,6 +70,9 @@ const txHistoryQuery = gql`
tx
timestamp
pool {
datatoken {
id
}
id
}
}
@ -124,7 +130,7 @@ export default function PoolTransactions({
accountId
}: {
poolAddress?: string
poolChainId?: number[]
poolChainId?: number
minimal?: boolean
accountId: string
}): ReactElement {
@ -146,7 +152,7 @@ export default function PoolTransactions({
const result = await fetchDataForMultipleChains(
poolAddress ? txHistoryQueryByPool : txHistoryQuery,
variables,
poolAddress ? poolChainId : chainIds
poolAddress ? [poolChainId] : chainIds
)
for (let i = 0; i < result.length; i++) {
@ -166,24 +172,24 @@ export default function PoolTransactions({
return
}
const poolTransactions: PoolTransaction[] = []
const dtList: string[] = []
for (let i = 0; i < data.length; i++) {
dtList.push(data[i]?.datatoken?.address)
}
let dtList: string[] = []
dtList = [...new Set(data.map((item) => item.pool.datatoken.id))]
if (dtList.length === 0) {
setTransactions([])
setIsLoading(false)
return
}
const ddoList = await getAssetsFromDtList(dtList, chainIds, cancelToken)
const ddoList = !minimal
? await getAssetsFromDtList(dtList, chainIds, cancelToken)
: []
for (let i = 0; i < data.length; i++) {
poolTransactions.push({
...data[i],
networkId: getAsset(ddoList, data[i].datatoken.address).chainId,
asset: getAsset(ddoList, data[i].datatoken.address)
networkId: !minimal
? getAsset(ddoList, data[i].pool.datatoken.id).chainId
: poolChainId,
asset: !minimal ? getAsset(ddoList, data[i].pool.datatoken.id) : null
})
}
const sortedTransactions = poolTransactions.sort(

View File

@ -208,7 +208,7 @@ export default function Pool(): ReactElement {
<PoolTransactions
accountId={accountId}
poolAddress={asset?.accessDetails?.addressOrId}
poolChainId={[asset?.chainId]}
poolChainId={asset?.chainId}
minimal
/>
</AssetActionHistoryTable>