fix: move off deprecated gql fields (#7269)

This commit is contained in:
Zach Pomerantz 2023-09-06 13:48:02 -07:00 committed by GitHub
parent 652a8305c8
commit 147a9bcbb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 402 additions and 2318 deletions

File diff suppressed because it is too large Load Diff

@ -351,7 +351,7 @@ function parseRemoteActivity(assetActivity: AssetActivityPartsFragment): Activit
return parseUniswapXOrder(assetActivity as OrderActivity) return parseUniswapXOrder(assetActivity as OrderActivity)
} }
const changes = assetActivity.assetChanges.reduce( const changes = assetActivity.details.assetChanges.reduce(
(acc: TransactionChanges, assetChange) => { (acc: TransactionChanges, assetChange) => {
if (assetChange.__typename === 'NftApproval') acc.NftApproval.push(assetChange) if (assetChange.__typename === 'NftApproval') acc.NftApproval.push(assetChange)
else if (assetChange.__typename === 'NftApproveForAll') acc.NftApproveForAll.push(assetChange) else if (assetChange.__typename === 'NftApproveForAll') acc.NftApproveForAll.push(assetChange)
@ -377,13 +377,16 @@ function parseRemoteActivity(assetActivity: AssetActivityPartsFragment): Activit
status: assetActivity.details.status, status: assetActivity.details.status,
timestamp: assetActivity.timestamp, timestamp: assetActivity.timestamp,
logos: getLogoSrcs(changes), logos: getLogoSrcs(changes),
title: assetActivity.type, title: assetActivity.details.type,
descriptor: assetActivity.details.to, descriptor: assetActivity.details.to,
from: assetActivity.details.from, from: assetActivity.details.from,
nonce: assetActivity.details.nonce, nonce: assetActivity.details.nonce,
} }
const parsedFields = ActivityParserByType[assetActivity.type]?.(changes, assetActivity as TransactionActivity) const parsedFields = ActivityParserByType[assetActivity.details.type]?.(
changes,
assetActivity as TransactionActivity
)
return { ...defaultFields, ...parsedFields } return { ...defaultFields, ...parsedFields }
} catch (e) { } catch (e) {
console.error('Failed to parse activity', e, assetActivity) console.error('Failed to parse activity', e, assetActivity)

@ -110,37 +110,6 @@ fragment TransactionDetailsParts on TransactionDetails {
hash hash
nonce nonce
status status
}
fragment SwapOrderDetailsParts on SwapOrderDetails {
id
offerer
hash
orderStatus: status
inputToken {
...TokenAssetParts
}
inputTokenQuantity
outputToken {
...TokenAssetParts
}
outputTokenQuantity
}
fragment AssetActivityParts on AssetActivity {
id
timestamp
type
chain
details {
__typename
... on TransactionDetails {
...TransactionDetailsParts
}
... on SwapOrderDetails {
...SwapOrderDetailsParts
}
}
assetChanges { assetChanges {
__typename __typename
... on TokenTransfer { ... on TokenTransfer {
@ -161,6 +130,36 @@ fragment AssetActivityParts on AssetActivity {
} }
} }
fragment SwapOrderDetailsParts on SwapOrderDetails {
id
offerer
hash
orderStatus: status
inputToken {
...TokenAssetParts
}
inputTokenQuantity
outputToken {
...TokenAssetParts
}
outputTokenQuantity
}
fragment AssetActivityParts on AssetActivity {
id
timestamp
chain
details {
__typename
... on TransactionDetails {
...TransactionDetailsParts
}
... on SwapOrderDetails {
...SwapOrderDetailsParts
}
}
}
# TODO(UniswapX): return to a pagesize of 50 pre-launch # TODO(UniswapX): return to a pagesize of 50 pre-launch
query Activity($account: String!) { query Activity($account: String!) {
portfolios(ownerAddresses: [$account]) { portfolios(ownerAddresses: [$account]) {