@array.inc/sdk
Version:
🛠An SDK for building applications on top of Array.
39 lines (38 loc) • 1.97 kB
TypeScript
import { BigintIsh } from '../types';
import { Currency } from './Currency';
import { Fraction } from './Fraction';
import JSBI from 'jsbi';
import { Rounding } from '../enums';
import { Token } from './Token';
export declare class CurrencyAmount<T extends Currency> extends Fraction {
readonly currency: T;
readonly decimalScale: JSBI;
/**
* Returns a new currency amount instance from the unitless amount of token, i.e. the raw amount
* @param currency the currency in the amount
* @param rawAmount the raw token or ether amount
*/
static fromRawAmount<T extends Currency>(currency: T, rawAmount: BigintIsh): CurrencyAmount<T>;
/**
* Construct a currency amount with a denominator that is not equal to 1
* @param currency the currency
* @param numerator the numerator of the fractional token amount
* @param denominator the denominator of the fractional token amount
*/
static fromFractionalAmount<T extends Currency>(currency: T, numerator: BigintIsh, denominator: BigintIsh): CurrencyAmount<T>;
protected constructor(currency: T, numerator: BigintIsh, denominator?: BigintIsh);
add(other: CurrencyAmount<T>): CurrencyAmount<T>;
subtract(other: CurrencyAmount<T>): CurrencyAmount<T>;
multiply(other: Fraction | BigintIsh): CurrencyAmount<T>;
divide(other: Fraction | BigintIsh): CurrencyAmount<T>;
toSignificant(significantDigits?: number, format?: object, rounding?: Rounding): string;
toFixed(decimalPlaces?: number, format?: object, rounding?: Rounding): string;
toExact(format?: object): string;
get wrapped(): CurrencyAmount<Token>;
/**
* Returns a string representation of the address and currency amount.
* Useful in cases where a dependency is needed to detect changes (e.g. useEffect).
* @return string [0x6B3595068778DD592e39A122f4f5a5cF09C90fE2 - 1323.94]
*/
serialize(): string;
}