Skip to content

Types

Glossary of Types in Token components & utilities.

GetTokensError

type GetTokensError = {
  code: number; // The Error code
  error: string; // The Error message
};

GetTokensResponse

type GetTokensResponse = Token[] | GetTokensError;

GetTokensOptions

type GetTokensOptions = {
  limit?: string; // The maximum number of tokens to return (default: 50)
  search?: string; // A string to search for in the token name, symbol or address
  page?: string; // The page number to return (default: 1)
};

FormatAmountOptions

export type FormatAmountOptions = {
  locale?: string; // User locale (default: browser locale)
  minimumFractionDigits?: number; // Minimum fraction digits for number decimals (default: 0)
  maximumFractionDigits?: number; // Maximum fraction digits for number decimals (default: 0)
};

Token

type Token = {
  address: Address; // The address of the token contract
  chainId: number; // The chain id of the token contract
  decimals: number; // The number of token decimals
  image: string | null; // A string url of the token logo
  name: string;
  symbol: string; // A ticker symbol or shorthand, up to 11 characters
};

TokenChipReact

type TokenChipReact = {
  token: Token; // Rendered token
};

TokenImageReact

type TokenImageReact = {
  src: string | null; // url for the token images
  size: number; // size of the image in px (default: 24)
};

TokenRowReact

type TokenRowReact = {
  token: Token; // Rendered token
  amount?: string; // Token amount
  onClick: (token: Token) => void; // Component on click handler
};

TokenSearchReact

export type TokenSearchReact = {
  onChange: (value: string) => void; // Search callback function
  delayMs?: number; // Debounce delay in milliseconds
};

TokenSearchReact

export type TokenSelectDropdownReact = {
  options: Token[]; // List of tokens
  setToken: (token: Token) => void; // Token setter
  token?: Token; // Selected token
};