Skip to main content

CurrencyAmount

@pegasys-fi/sdk-core / Exports / CurrencyAmount

Class: CurrencyAmount<T>

Type parameters

NameType
Textends Currency

Hierarchy

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

Protected new CurrencyAmount<T>(currency, numerator, denominator?)

Type parameters

NameType
Textends Currency

Parameters

NameType
currencyT
numeratorBigintIsh
denominator?BigintIsh

Overrides

Fraction.constructor

Defined in

entities/fractions/currencyAmount.ts:40

Properties

currency

Readonly currency: T

Defined in

entities/fractions/currencyAmount.ts:14


decimalScale

Readonly decimalScale: default

Defined in

entities/fractions/currencyAmount.ts:15


denominator

Readonly denominator: default

Inherited from

Fraction.denominator

Defined in

entities/fractions/fraction.ts:26


numerator

Readonly numerator: default

Inherited from

Fraction.numerator

Defined in

entities/fractions/fraction.ts:25

Accessors

asFraction

get asFraction(): Fraction

Helper method for converting any super class back to a fraction

Returns

Fraction

Inherited from

Fraction.asFraction

Defined in

entities/fractions/fraction.ts:154


quotient

get quotient(): default

Returns

default

Inherited from

Fraction.quotient

Defined in

entities/fractions/fraction.ts:42


remainder

get remainder(): Fraction

Returns

Fraction

Inherited from

Fraction.remainder

Defined in

entities/fractions/fraction.ts:47


wrapped

get wrapped(): CurrencyAmount<Token>

Returns

CurrencyAmount<Token>

Defined in

entities/fractions/currencyAmount.ts:91

Methods

add

add(other): CurrencyAmount<T>

Parameters

NameType
otherCurrencyAmount<T>

Returns

CurrencyAmount<T>

Overrides

Fraction.add

Defined in

entities/fractions/currencyAmount.ts:47


divide

divide(other): CurrencyAmount<T>

Parameters

NameType
otherBigintIsh | Fraction

Returns

CurrencyAmount<T>

Overrides

Fraction.divide

Defined in

entities/fractions/currencyAmount.ts:64


equalTo

equalTo(other): boolean

Parameters

NameType
otherBigintIsh | Fraction

Returns

boolean

Inherited from

Fraction.equalTo

Defined in

entities/fractions/fraction.ts:91


greaterThan

greaterThan(other): boolean

Parameters

NameType
otherBigintIsh | Fraction

Returns

boolean

Inherited from

Fraction.greaterThan

Defined in

entities/fractions/fraction.ts:99


invert

invert(): Fraction

Returns

Fraction

Inherited from

Fraction.invert

Defined in

entities/fractions/fraction.ts:51


lessThan

lessThan(other): boolean

Parameters

NameType
otherBigintIsh | Fraction

Returns

boolean

Inherited from

Fraction.lessThan

Defined in

entities/fractions/fraction.ts:83


multiply

multiply(other): CurrencyAmount<T>

Parameters

NameType
otherBigintIsh | Fraction

Returns

CurrencyAmount<T>

Overrides

Fraction.multiply

Defined in

entities/fractions/currencyAmount.ts:59


subtract

subtract(other): CurrencyAmount<T>

Parameters

NameType
otherCurrencyAmount<T>

Returns

CurrencyAmount<T>

Overrides

Fraction.subtract

Defined in

entities/fractions/currencyAmount.ts:53


toExact

toExact(format?): string

Parameters

NameType
formatobject

Returns

string

Defined in

entities/fractions/currencyAmount.ts:86


toFixed

toFixed(decimalPlaces?, format?, rounding?): string

Parameters

NameTypeDefault value
decimalPlacesnumberundefined
format?objectundefined
roundingRoundingRounding.ROUND_DOWN

Returns

string

Overrides

Fraction.toFixed

Defined in

entities/fractions/currencyAmount.ts:77


toSignificant

toSignificant(significantDigits?, format?, rounding?): string

Parameters

NameTypeDefault value
significantDigitsnumber6
format?objectundefined
roundingRoundingRounding.ROUND_DOWN

Returns

string

Overrides

Fraction.toSignificant

Defined in

entities/fractions/currencyAmount.ts:69


fromFractionalAmount

Static fromFractionalAmount<T>(currency, numerator, denominator): CurrencyAmount<T>

Construct a currency amount with a denominator that is not equal to 1

Type parameters

NameType
Textends Currency

Parameters

NameTypeDescription
currencyTthe currency
numeratorBigintIshthe numerator of the fractional token amount
denominatorBigintIshthe denominator of the fractional token amount

Returns

CurrencyAmount<T>

Defined in

entities/fractions/currencyAmount.ts:32


fromRawAmount

Static fromRawAmount<T>(currency, rawAmount): CurrencyAmount<T>

Returns a new currency amount instance from the unitless amount of token, i.e. the raw amount

Type parameters

NameType
Textends Currency

Parameters

NameTypeDescription
currencyTthe currency in the amount
rawAmountBigintIshthe raw token or ether amount

Returns

CurrencyAmount<T>

Defined in

entities/fractions/currencyAmount.ts:22