fix: hide pending orders from GQL (#6955)

* fix: hide pending orders from GQL

* fix: update comment and add TODO
This commit is contained in:
cartcrom 2023-07-15 18:03:21 +01:00 committed by GitHub
parent 4c58258f01
commit e9f469d399
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -12,6 +12,7 @@ import {
NftApproveForAllPartsFragment, NftApproveForAllPartsFragment,
NftTransferPartsFragment, NftTransferPartsFragment,
SwapOrderDetailsPartsFragment, SwapOrderDetailsPartsFragment,
SwapOrderStatus,
TokenApprovalPartsFragment, TokenApprovalPartsFragment,
TokenAssetPartsFragment, TokenAssetPartsFragment,
TokenTransferPartsFragment, TokenTransferPartsFragment,
@ -289,6 +290,10 @@ function getLogoSrcs(changes: TransactionChanges): string[] {
} }
function parseUniswapXOrder({ details, chain, timestamp }: OrderActivity): Activity | undefined { function parseUniswapXOrder({ details, chain, timestamp }: OrderActivity): Activity | undefined {
// We currently only have a polling mechanism for locally-sent pending orders, so we hide remote pending orders since they won't update upon completion
// TODO(WEB-2487): Add polling mechanism for remote orders to allow displaying remote pending orders
if (details.orderStatus === SwapOrderStatus.Open) return undefined
const { inputToken, inputTokenQuantity, outputToken, outputTokenQuantity, orderStatus } = details const { inputToken, inputTokenQuantity, outputToken, outputTokenQuantity, orderStatus } = details
const uniswapXOrderStatus = OrderStatusTable[orderStatus] const uniswapXOrderStatus = OrderStatusTable[orderStatus]
const { status, statusMessage, title } = OrderTextTable[uniswapXOrderStatus] const { status, statusMessage, title } = OrderTextTable[uniswapXOrderStatus]