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