import Decimal from "decimal.js"; import type { PubkeyStr } from "../../shared"; import type { DepositAssetResponse, GlobalDepositAssetResponse } from "./wire"; export interface Token { id: number; pubkey: PubkeyStr; name: string; symbol: string; shortSymbol: string; description?: string; decimals: number; iconUrlLow: string; iconUrlMedium: string; iconUrlHigh: string; } /** * Display priority for sorting: lower values come first. BTC/WBTC tie at 0, * ETH/WETH tie at 1, SOL at 2; everything else falls to the alphabetical tail. */ export declare function tokenDisplayPriority(token: Pick): number; /** * Shape accepted by {@link sortByDisplayPriority}. Either a token with a * top-level `symbol`, or a composite (e.g. `DepositAssetPair`, `OrderBookPair`) * that carries its display token on `base`. */ export type DisplaySortable = Pick | { readonly base: Pick; }; /** * Returns a new array ordered for display: priority groups first * (BTC/WBTC → ETH/WETH → SOL), then all remaining items alphabetically by the * display token's symbol. * * Accepts both pure tokens and composite types whose display token lives on * `base` (e.g. `DepositAssetPair`, `OrderBookPair`). */ export declare function sortByDisplayPriority(items: readonly T[]): T[]; export interface ConditionalToken extends Token { outcomeIndex: number; outcome: string; depositAsset: PubkeyStr; depositSymbol: string; depositShortSymbol: string; } export interface DepositAsset extends Token { marketPda: PubkeyStr; depositAsset: PubkeyStr; numOutcomes: number; minOrderSize?: Decimal; } /** * A base/quote pairing of two `DepositAsset`s. * * Populated on `Market.depositAssetPairs` during wire→domain conversion — * one entry per unique base/quote combination across the market's orderbook * pairs. */ export interface DepositAssetPair { /** Stable identifier of the form `"{basePubkey}-{quotePubkey}"`. */ id: string; base: DepositAsset; quote: DepositAsset; } /** * A globally whitelisted deposit asset (platform-scoped, not market-bound). * * Distinct from `DepositAsset`, which is bound to a specific market. */ export interface GlobalDepositAsset extends Token { depositAsset: PubkeyStr; whitelistIndex: number; active: boolean; } export interface TokenMetadata { pubkey: PubkeyStr; symbol: string; shortSymbol: string; decimals: number; iconUrlLow: string; iconUrlMedium: string; iconUrlHigh: string; name: string; } export interface ValidatedTokens { token: DepositAsset; conditionals: ConditionalToken[]; metadata: Record; } export declare class TokenValidationError extends Error { readonly details: string[]; constructor(mint: string, details: string[]); } export declare function isUsdStablecoin(pubkey: string): boolean; export declare function currencySymbol(pubkey: string): "" | "$"; export declare function validatedTokensFromWire(source: DepositAssetResponse): ValidatedTokens; export declare function globalDepositAssetFromWire(source: GlobalDepositAssetResponse): GlobalDepositAsset; //# sourceMappingURL=tokens.d.ts.map