import BigNumber from "bignumber.js"; import { TransactionReceipt } from "web3-eth"; import { Address, ChainId, TransactionOptions } from "../constants"; import { Wallet } from "../wallet/Wallet"; export interface SerializedToken { address: string; decimals: number; name?: string; symbol?: string; chainId: number; imageUri?: string; } /** * Represents an ERC20 token with a unique address and some metadata. */ export declare class Token { decimals: number; symbol?: string; name?: string; imageUri?: string; private contract?; private attemptedLoadContract?; readonly chainId: ChainId; readonly address: string; /** * Constructs an instance of the base class `Currency`. * @param decimals decimals of the currency * @param symbol symbol of the currency * @param name of the currency */ constructor(chainId: ChainId, address: string, decimals?: number, symbol?: string, name?: string, imageUri?: string); loadDetails(): Promise; static isSerializedToken: (obj?: Record) => obj is SerializedToken; static parseJson: ({ chainId, address, name, symbol, imageUri, decimals, }: SerializedToken) => Token; toJSON(): { _type: string; address: string; chainId: ChainId; decimals: number; symbol: string | undefined; name: string | undefined; imageUri: string | undefined; }; /** * Loads the ERC20 contract */ private _loadContract; /** * * @param amount amount, in wei, of the token to send * @param from the wallet where the tokens will be sent from * @param to the address of the recipient of the tokens * @returns transaction receipt of the transfer */ send(amount: BigNumber, from: Wallet, to: Address, opt?: TransactionOptions): Promise; /** * Returns true if the two tokens are equivalent, i.e. have the same chainId and address. * @param other other token to compare */ equals(other: Token): 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: Token): boolean; } /** * Compares two currencies for equality */ export declare function currencyEquals(currencyA: Token, currencyB: Token): boolean;