diff --git a/apps/arkmarket/src/app/components/latest-sales.tsx b/apps/arkmarket/src/app/components/latest-sales.tsx index b3368d34..2bbdbb31 100644 --- a/apps/arkmarket/src/app/components/latest-sales.tsx +++ b/apps/arkmarket/src/app/components/latest-sales.tsx @@ -83,11 +83,10 @@ export default function LatestSales() { - {data.data.map((sale, index) => { - // TOOD @YohanTz: Proper key when real data + {data.data.map((sale) => { return ( diff --git a/apps/arkmarket/src/app/token/[contractAddress]/[tokenId]/components/token-offers-list-item.tsx b/apps/arkmarket/src/app/token/[contractAddress]/[tokenId]/components/token-offers-list-item.tsx index 9ad51f30..5e7b4516 100644 --- a/apps/arkmarket/src/app/token/[contractAddress]/[tokenId]/components/token-offers-list-item.tsx +++ b/apps/arkmarket/src/app/token/[contractAddress]/[tokenId]/components/token-offers-list-item.tsx @@ -49,7 +49,11 @@ export default function TokenOffersListItem({
- + {offer.floor_difference ? (

- {" "} + {" "}

- + ); } diff --git a/apps/arkmarket/src/components/cells/token-price-cell.tsx b/apps/arkmarket/src/components/cells/token-price-cell.tsx index 0259a352..da211589 100644 --- a/apps/arkmarket/src/components/cells/token-price-cell.tsx +++ b/apps/arkmarket/src/components/cells/token-price-cell.tsx @@ -17,7 +17,7 @@ export default function TokenPriceCell({ token }: PriceCellProps) {

) : token.price ? ( - + ) : ( "_" )} diff --git a/apps/arkmarket/src/types/index.ts b/apps/arkmarket/src/types/index.ts index 1a85df6d..12479af4 100644 --- a/apps/arkmarket/src/types/index.ts +++ b/apps/arkmarket/src/types/index.ts @@ -182,11 +182,7 @@ export interface PortfolioActivity { to: string; token_id: string; transaction_hash: string | null; - currency?: { - contract: string; - decimals: number; - symbol: string; - } | null; + currency: Currency; } export interface PortfolioOffers { @@ -214,7 +210,7 @@ export interface PortfolioOffers { start_amount: string; start_date: number | null; }; - currency?: Currency | null; + currency: Currency; } export interface CollectionActivity { @@ -229,11 +225,7 @@ export interface CollectionActivity { token_id: string; token_metadata: TokenMetadata | null; transaction_hash: string | null; - currency?: { - contract: string; - decimals: number; - symbol: string; - } | null; + currency: Currency; } export interface TokenOffer { @@ -243,6 +235,7 @@ export interface TokenOffer { offer_id: number; price: string; source: string; + currency: Currency; } export interface TokenApiResponse { @@ -320,11 +313,7 @@ export interface TokenActivity { time_stamp: number; to: string | null; transaction_hash: string | null; - currency?: { - contract: string; - decimals: number; - symbol: string; - } | null; + currency: Currency; } export interface Filters { @@ -341,11 +330,7 @@ export interface LatestSales { timestamp: number; to: string; transaction_hash: string | null; - currency: { - contract: string; - decimals: number; - symbol: string; - } | null; + currency: Currency; } export interface TrendingNow { diff --git a/packages/ui/src/price-tag.tsx b/packages/ui/src/price-tag.tsx index f0a6bd6d..4798dd62 100644 --- a/packages/ui/src/price-tag.tsx +++ b/packages/ui/src/price-tag.tsx @@ -1,14 +1,16 @@ +import { formatUnits } from "viem"; + import type { PropsWithClassName } from "."; -import { cn, ellipsableStyles, formatUnits } from "."; +import { cn, ellipsableStyles } from "."; import { Ethereum, Starknet } from "./icons"; interface PriceTagProps { - price: number | bigint | string; - currency?: { + price: string; + currency: { contract: string; - decimals: number; symbol: string; - } | null; + decimals: number; + }; } function CurrencyIcon({ symbol }: { symbol: string }) { @@ -27,11 +29,7 @@ export function PriceTag({ price, currency, }: PropsWithClassName) { - if (!price) { - return null; - } - - const parsedPrice = parseFloat(formatUnits(price, 18)); + const formattedPrice = formatUnits(BigInt(price), currency.decimals); return (
- +

- {isNaN(parsedPrice) - ? formatUnits(price, currency?.decimals ?? 18) - : parsedPrice.toFixed(5)} - {` ${currency?.symbol ?? "ETH"}`} + {formattedPrice}{" "} + {currency.symbol}

);