Commit 0cc68796 authored by Jack Short's avatar Jack Short Committed by GitHub

fix: do not show assets in sudoswap xyk pools (#5793)

* fix: failed sudoswap listings do not throw error

* valid asset filter on collection queries

* responding to comments
parent a5534803
import { parseEther } from 'ethers/lib/utils'
import gql from 'graphql-tag'
import { GenieAsset, Markets, Trait } from 'nft/types'
import { wrapScientificNotation } from 'nft/utils'
import { isNotXYKPool, wrapScientificNotation } from 'nft/utils'
import { useCallback, useMemo } from 'react'
import {
......@@ -219,7 +219,7 @@ export function useNftAssets(params: AssetFetcherParams) {
return useMemo(() => {
return {
data: assets,
data: assets?.filter((asset) => isNotXYKPool(asset)),
hasNext,
loading,
loadMore,
......@@ -279,5 +279,5 @@ export function useSweepNftAssets(params: SweepFetcherParams) {
}),
[data?.nftAssets?.edges, data?.nftAssets?.totalCount]
)
return useMemo(() => ({ data: assets, loading }), [assets, loading])
return useMemo(() => ({ data: assets?.filter((asset) => isNotXYKPool(asset)), loading }), [assets, loading])
}
......@@ -342,7 +342,7 @@ export const CollectionNfts = ({ contractAddress, collectionStats, rarityVerifie
(asset) =>
asset.marketplace &&
isPooledMarket(asset.marketplace) &&
(asset.priceInfo.ETHPrice = calculatePrice(asset) ?? '')
(asset.priceInfo.ETHPrice = calculatePrice(asset) ?? '0')
)
if (sortBy === SortBy.HighToLow || sortBy === SortBy.LowToHigh) {
......
......@@ -210,7 +210,7 @@ export const Sweep = ({ contractAddress, minPrice, maxPrice }: SweepProps) => {
.filter((sweepAsset) => isInSameSudoSwapPool(asset, sweepAsset))
.findIndex((sweepAsset) => sweepAsset.tokenId === asset.tokenId)
)
asset.priceInfo.ETHPrice = poolPrice ?? ''
asset.priceInfo.ETHPrice = poolPrice ?? '0'
} else {
const isNFTX = asset.marketplace === Markets.NFTX
const poolPrice = calcPoolPrice(asset, isNFTX ? counterNFTX : counterNFT20)
......
import { DetailsOrigin, GenieAsset, UpdatedGenieAsset, WalletAsset } from 'nft/types'
import { DetailsOrigin, GenieAsset, Markets, UpdatedGenieAsset, WalletAsset } from 'nft/types'
import { calcSudoSwapPrice } from './pooledAssets'
export function getRarityStatus(
rarityStatusCache: Map<string, boolean>,
......@@ -44,3 +46,11 @@ export const generateTweetForPurchase = (assets: UpdatedGenieAsset[], txHashUrl:
} with @Uniswap 🦄\n\nhttps://app.uniswap.org/#/nfts/collection/0x60bb1e2aa1c9acafb4d34f71585d7e959f387769\n${txHashUrl}`
return `https://twitter.com/intent/tweet?text=${encodeURIComponent(tweetText)}`
}
// TODO: remove when BE supports SudoSwap XYK pools
export const isNotXYKPool = (asset: GenieAsset): boolean => {
if (asset.marketplace !== Markets.Sudoswap) return true
if (calcSudoSwapPrice(asset) === undefined) return false
return true
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment