import Big from 'big.js'; import {BigSource} from 'big.js'; export interface Currency { decimals: number; name: string; } export declare enum BTCUnit { Btc = 0, MSatoshi = 5, Satoshi = 8 } export declare enum ETHUnit { Ether = 0, GWei = 9, Wei = 18 } export declare class Bitcoin implements Currency { get decimals(): number; get name(): string; } export declare class Ethereum implements Currency { get decimals(): number; get name(): string; } export declare class ERC20 implements Currency { readonly name: string; readonly address: string; readonly decimals: number; constructor(name: string, address: string, decimals?: number); } export declare class Tether extends ERC20 implements Currency { constructor(address: string); } export declare const BTC: Bitcoin; export declare const ETH: Ethereum; export declare class MonetaryAmount { readonly currency: C; protected _amount: Big; constructor(currency: C, amount: BigSource, decimals?: number); toString(humanFriendly?: boolean): string; toBig(decimals?: number): Big; add(amount: this): this; sub(amount: this): this; protected isSameCurrency(amount: this): boolean; mul(multiplier: BigSource): this; div(divisor: BigSource): this; withAmount(amount: BigSource): this; } export declare class BTCAmount extends MonetaryAmount { constructor(amount: BigSource, decimals?: number); withAmount(amount: BigSource): this; static fromSatoshi(amount: BigSource): BTCAmount; static fromMSatoshi(amount: BigSource): BTCAmount; static fromBTC(amount: BigSource): BTCAmount; toSatoshi(): Big; toMSatoshi(): Big; toBTC(): Big; } export declare class ETHAmount extends MonetaryAmount { constructor(amount: BigSource, decimals?: number); withAmount(amount: BigSource): this; static fromWei(amount: BigSource): ETHAmount; static fromGWei(amount: BigSource): ETHAmount; static fromEther(amount: BigSource): ETHAmount; toWei(): Big; toGWei(): Big; toEther(): Big; } export declare class ERC20Amount extends MonetaryAmount {} export declare class ExchangeRate< Base extends Currency, Counter extends Currency > { readonly base: Base; readonly counter: Counter; readonly rate: Big; /** * * @param base Base currency, BTC in BTC/USDT * @param counter Counter currency, USDT in BTC/USDT * @param rate Exchange rate: amount of `counter` needed per unit of `base` * The amount is expressed with the same number of decimals as `counter` */ constructor(base: Base, counter: Counter, rate: Big); toBase(amount: MonetaryAmount): MonetaryAmount; toCounter(amount: MonetaryAmount): MonetaryAmount; format(decimals?: number, precision?: number): string; formatHuman(precision?: number): string; }