From 2f11bf2d62561465f1b383949604248f3f6756a4 Mon Sep 17 00:00:00 2001 From: thesn10 <38666407+thesn10@users.noreply.github.com> Date: Wed, 24 Jun 2026 23:22:36 +0200 Subject: [PATCH] fix: use SDK SolistingStateCurrency type in priceStr --- app/src/lib/format.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/src/lib/format.ts b/app/src/lib/format.ts index 039585a..c218012 100644 --- a/app/src/lib/format.ts +++ b/app/src/lib/format.ts @@ -1,3 +1,5 @@ +import type { SolistingStateCurrency } from '@solisting/sdk' + export function abbrev(pk: string | null | undefined): string { if (!pk) return '—' return `${pk.slice(0, 4)}…${pk.slice(-4)}` @@ -25,10 +27,14 @@ export function exact(ts: number): string { return new Date(ts * 1000).toUTCString() } +type CurrencyWithSymbol = + | { __kind: 'Sol' } + | (Extract & { symbol?: string }) + export function priceStr( - currency: { __kind: 'Sol' } | { __kind: 'Spl'; decimals: number; symbol?: string }, + currency: CurrencyWithSymbol, price: bigint | number, ): string { if (currency.__kind === 'Sol') return fmtSol(price) - return fmtTok(price, currency.decimals, (currency as { symbol?: string }).symbol ?? 'SPL') + return fmtTok(price, currency.decimals, currency.symbol ?? 'SPL') }