UNPKG

@starkdefi/core-sdk

Version:

SDK for building StarkDefi applications

31 lines (30 loc) • 1.5 kB
import { Token } from '../token'; import { Fraction } from './fraction'; import { BigNumberish } from '../../constants'; import { Currency } from '../currency'; export declare class TokenAmount<T extends Currency> extends Fraction { readonly token: T; readonly decimalScale: bigint; /** * Returns a new token amount instance from the unitless amount of token, i.e. the raw amount * @param token the token in the amount * @param rawAmount the raw token or ether amount */ static fromRawAmount<T extends Currency>(token: T, rawAmount: BigNumberish): TokenAmount<T>; /** * Construct a token amount with a denominator that is not equal to 1 * @param token the token * @param numerator the numerator of the fractional token amount * @param denominator the denominator of the fractional token amount */ static fromFractionalAmount<T extends Currency>(token: T, numerator: BigNumberish, denominator: BigNumberish): TokenAmount<T>; protected constructor(token: T, numerator: BigNumberish, denominator?: BigNumberish); add(other: TokenAmount<T>): TokenAmount<T>; subtract(other: TokenAmount<T>): TokenAmount<T>; multiply(other: Fraction | BigNumberish): TokenAmount<T>; divide(other: Fraction | BigNumberish): TokenAmount<T>; toSignificant(significantDigits?: number): string; toFixed(decimalPlaces?: number): string; toExact(): string; get wrapped(): TokenAmount<Token>; }