import { type ReactNode } from 'react'; /** * What an asset looks like, answered once for the whole surface. * * Two questions were being answered in two places by two copies of the same * idea: a token list kept a set of token marks and a chain panel kept a set of * chain marks, each with its own rule for what to draw when the file is not * there. Two lists are two chances for a screen to draw a frame it cannot fill, * and the second list had already drifted. * * So there is one resolver, and it answers with a whole identity rather than a * path: where the thing lives, what it is called, the mark this build serves * for it, the chain badge that goes on it, and the letters to draw when there * is no mark. A caller cannot ask for half of that and cannot supply a path of * its own. * * Which files a build serves is the build's own fact and not this package's, so * an app states it once at its root and every asset below resolves against it. * A build that states nothing draws letters, which always resolve and never * fetch. */ /** * Where a build serves its marks from, by name. * * Both answer null for a name they have no file for, and null is the ordinary * answer rather than the exception: an indexer returns id, symbol, name and * decimals and no image, so most of a chain's tokens have no mark at all. * Asking the network instead would leave a broken frame where something * readable would have stood. */ export interface Marks { /** A token's mark, by its symbol, lower-cased. */ token?(symbol: string): string | null; /** A chain's mark, by the venue key an asset states. */ chain?(key: string): string | null; /** A region's flag, by its ISO 3166 code, lower-cased. Drawn beside the * currency a sum is stated in. */ region?(code: string): string | null; } /** * The marks a tree draws with. One at an app's root. * * A provider rather than a prop on every asset: which files a build serves is * one fact stated once, and repeating it down fifteen screens is fifteen * chances for one of them to disagree. */ export declare const Marks: ({ value, children }: { value: Marks; children: ReactNode; }) => import("react").FunctionComponentElement>; /** Everything drawing an asset needs, and nothing a caller has to look up. */ export interface Identity { /** Where the asset is, lower-cased. Absent for a thing that has no address — * a chain's own coin before it is wrapped, a wallet. */ address?: string; symbol?: string; /** Where the mark is served from, or null where this build serves none. */ icon: string | null; /** The chain's own mark, drawn on the asset's, where the caller named a chain * and the build serves one for it. It is what tells two tokens sharing a * symbol on two chains apart. */ badge: string | null; /** The letters drawn in place of a mark. Always resolves. */ fallback: string; } /** What a caller knows about an asset before this answers. */ export interface Of { symbol?: string; address?: string; /** The venue key, where the caller knows which chain it is reading. */ chain?: string; } /** * The letters an asset is known by, at most three. * * Two is not enough on a chain whose assets are mostly one letter plus a name: * LUX and LUSD both reduce to `LU`, and letters that collide mislead faster * than none would. Three separates them. * * Three does not separate everything — USDC and USDT still meet — and it is not * meant to. The letters are an aid to scanning, not an identifier: the symbol * is in the row beside them, and the shade comes from the address, so two * assets sharing letters still differ on the page. */ export declare function letters(symbol?: string, address?: string): string; /** One asset, as a build can draw it. */ export declare function identify({ symbol, address, chain }: Of, marks?: Marks): Identity; /** The marks the tree around this component draws with. */ export declare const useMarks: () => Marks; /** The same answer, for a component drawing inside a tree that states its own. */ export declare const useIdentity: (of: Of) => Identity; //# sourceMappingURL=asset.d.ts.map