CurrencyAmount
@pegasys-fi/sdk-core / Exports / CurrencyAmount
Class: CurrencyAmount<T>
Type parameters
Name | Type |
---|---|
T | extends Currency |
Hierarchy
↳
CurrencyAmount
Table of contents
Constructors
Properties
Accessors
Methods
- add
- divide
- equalTo
- greaterThan
- invert
- lessThan
- multiply
- subtract
- toExact
- toFixed
- toSignificant
- fromFractionalAmount
- fromRawAmount
Constructors
constructor
• Protected
new CurrencyAmount<T
>(currency
, numerator
, denominator?
)
Type parameters
Name | Type |
---|---|
T | extends Currency |
Parameters
Name | Type |
---|---|
currency | T |
numerator | BigintIsh |
denominator? | BigintIsh |
Overrides
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
Defined in
entities/fractions/fraction.ts:26
numerator
• Readonly
numerator: default
Inherited from
Defined in
entities/fractions/fraction.ts:25
Accessors
asFraction
• get
asFraction(): Fraction
Helper method for converting any super class back to a fraction
Returns
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
Inherited from
Fraction.remainder
Defined in
entities/fractions/fraction.ts:47
wrapped
• get
wrapped(): CurrencyAmount
<Token
>
Returns
Defined in
entities/fractions/currencyAmount.ts:91
Methods
add
▸ add(other
): CurrencyAmount
<T
>
Parameters
Name | Type |
---|---|
other | CurrencyAmount <T > |
Returns
Overrides
Defined in
entities/fractions/currencyAmount.ts:47
divide
▸ divide(other
): CurrencyAmount
<T
>
Parameters
Name | Type |
---|---|
other | BigintIsh | Fraction |
Returns
Overrides
Defined in
entities/fractions/currencyAmount.ts:64
equalTo
▸ equalTo(other
): boolean
Parameters
Name | Type |
---|---|
other | BigintIsh | Fraction |
Returns
boolean
Inherited from
Defined in
entities/fractions/fraction.ts:91
greaterThan
▸ greaterThan(other
): boolean
Parameters
Name | Type |
---|---|
other | BigintIsh | Fraction |
Returns
boolean
Inherited from
Defined in
entities/fractions/fraction.ts:99
invert
▸ invert(): Fraction
Returns
Inherited from
Defined in
entities/fractions/fraction.ts:51
lessThan
▸ lessThan(other
): boolean
Parameters
Name | Type |
---|---|
other | BigintIsh | Fraction |
Returns
boolean
Inherited from
Defined in
entities/fractions/fraction.ts:83
multiply
▸ multiply(other
): CurrencyAmount
<T
>
Parameters
Name | Type |
---|---|
other | BigintIsh | Fraction |
Returns
Overrides
Defined in
entities/fractions/currencyAmount.ts:59
subtract
▸ subtract(other
): CurrencyAmount
<T
>
Parameters
Name | Type |
---|---|
other | CurrencyAmount <T > |
Returns
Overrides
Defined in
entities/fractions/currencyAmount.ts:53
toExact
▸ toExact(format?
): string
Parameters
Name | Type |
---|---|
format | object |
Returns
string
Defined in
entities/fractions/currencyAmount.ts:86
toFixed
▸ toFixed(decimalPlaces?
, format?
, rounding?
): string
Parameters
Name | Type | Default value |
---|---|---|
decimalPlaces | number | undefined |
format? | object | undefined |
rounding | Rounding | Rounding.ROUND_DOWN |
Returns
string
Overrides
Defined in
entities/fractions/currencyAmount.ts:77
toSignificant
▸ toSignificant(significantDigits?
, format?
, rounding?
): string
Parameters
Name | Type | Default value |
---|---|---|
significantDigits | number | 6 |
format? | object | undefined |
rounding | Rounding | Rounding.ROUND_DOWN |
Returns
string
Overrides
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
Name | Type |
---|---|
T | extends Currency |
Parameters
Name | Type | Description |
---|---|---|
currency | T | the currency |
numerator | BigintIsh | the numerator of the fractional token amount |
denominator | BigintIsh | the denominator of the fractional token amount |
Returns
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
Name | Type |
---|---|
T | extends Currency |
Parameters
Name | Type | Description |
---|---|---|
currency | T | the currency in the amount |
rawAmount | BigintIsh | the raw token or ether amount |