UNPKG

maia-core-sdk

Version:

⚒️ An SDK for building applications on top of Maia DAO Ecosytem

65 lines (64 loc) 2.57 kB
import type { AcrossInfo, TokenExtensions } from '../../../types'; import type { Currency } from '../../tokens/currency'; import { BaseCurrency } from '../baseCurrency'; /** * Represents an ERC20 token with a unique address and some metadata native to a given chain. */ export declare class NativeToken extends BaseCurrency { readonly isNative: false; readonly isToken: true; readonly isGlobal: boolean; /** * The contract address on the chain on which this token lives. */ readonly address: string; /** * Token extensions containing bridging info, pricing, and other metadata * Uses the full TokenExtensions type with acrossInfo, bridgeInfo, etc. */ readonly extensions?: TokenExtensions; /** * * @param chainId {@link BaseCurrency#chainId} * @param address The contract address on the chain on which this token lives. * @param decimals {@link BaseCurrency#decimals} * @param symbol {@link BaseCurrency#symbol} * @param name {@link BaseCurrency#name} * @param bypassChecksum If true it only checks for length === 42, startsWith 0x and contains only hex characters. * @param extensions Token extensions containing bridging info, pricing, and other metadata */ constructor(chainId: number, address: string, decimals: number, symbol?: string, name?: string, bypassChecksum?: boolean, extensions?: TokenExtensions); /** * True if token is supported by Across bridge */ get isAcross(): boolean; /** * Get Across bridge info */ get acrossInfo(): AcrossInfo | undefined; /** * Get Across info for a specific chain * @param chainId the target chain ID */ getAcrossChainInfo(chainId: number): AcrossInfo[number] | undefined; /** * Get all chain IDs that have Across bridge support for this token */ getAcrossChainIds(): number[]; /** * Returns true if the two tokens are equivalent, i.e. have the same chainId and address. * @param other other token to compare */ equals(other: Currency): boolean; /** * Returns true if the address of this token sorts before the address of the other token * @param other other token to compare * @throws if the tokens have the same address * @throws if the tokens are on different chains */ sortsBefore(other: NativeToken): boolean; /** * Return this token, which does not need to be wrapped */ get wrapped(): this; }