basicon
Version:
Minimal, trusted npm dependency for chain and token metadata & SVG icons. All locally served, no dynamic fetch, fully type-safe
80 lines (77 loc) • 2.66 kB
text/typescript
import * as react_jsx_runtime from 'react/jsx-runtime';
declare type ChainNativaCurrency = {
name: string;
symbol: string;
decimals: number;
};
declare type Testnet = {
chainId: number;
name: string;
icon: ChainIcon;
explorer: string;
nativeCurrency: ChainNativaCurrency;
};
declare type ChainFilters = {
chainIds?: number[];
nameContains?: string;
};
declare type Chain = {
chainId: number;
name: string;
icon: ChainIcon;
explorer: string;
nativeCurrency: ChainNativaCurrency;
testnets: Testnet[];
};
declare type TokenType = "ERC20" | "BEP20" | "Native";
declare type TokenAddress = {
chainId: number;
address: string;
decimals: number;
type: TokenType;
};
declare type Token = {
id: string;
name: string;
symbol: string;
icon: string;
addresses: TokenAddress[];
};
declare type TokenFilters = {
symbols?: string[];
nameContains?: string;
};
declare type Chains = Chain[];
declare type Tokens = Token[];
declare type TokenIconProps = {
name?: string;
symbol?: string;
chainId?: number;
address?: string;
size?: number;
className?: string;
};
declare type ChainIconProps = {
chainId?: number;
name?: string;
size?: number;
className?: string;
alt?: string;
theme?: 'light' | 'dark';
};
declare function getAllChains(): Chain[];
declare function getChainById(chainId: number): Chain | undefined;
declare function getChainByName(name: string): Chain | undefined;
declare function getChainList(filters?: ChainFilters): Chain[];
declare function getAllTokens(): Token[];
declare function getTokenBySymbol(symbol: string, chainId?: number): Token | undefined;
declare function getTokenByName(name: string, chainId?: number): Token | undefined;
declare function getTokenByAddress(chainId: number, address: string): Token | undefined;
declare function getTokenList(filters?: TokenFilters): Token[];
declare function TokenIcon({ name, symbol, chainId, address, size, className, }: TokenIconProps): react_jsx_runtime.JSX.Element | null;
declare type ChainIcon = {
light: string;
dark: string;
};
declare function ChainIcon({ chainId, name, size, className, theme }: ChainIconProps): react_jsx_runtime.JSX.Element | null;
export { type Chain, type ChainFilters, ChainIcon, type ChainIconProps, type ChainNativaCurrency, type Chains, type Testnet, type Token, type TokenAddress, type TokenFilters, TokenIcon, type TokenIconProps, type TokenType, type Tokens, getAllChains, getAllTokens, getChainById, getChainByName, getChainList, getTokenByAddress, getTokenByName, getTokenBySymbol, getTokenList };