@aurigami/sdk 1.8.4 → 1.8.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/entities/tokenAmount.d.ts +3 -2
- package/dist/sdk.cjs.development.js +7 -3
- package/dist/sdk.cjs.development.js.map +1 -1
- package/dist/sdk.cjs.production.min.js +1 -1
- package/dist/sdk.cjs.production.min.js.map +1 -1
- package/dist/sdk.esm.js +7 -3
- package/dist/sdk.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/entities/tokenAmount.ts +9 -3
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
import BigNumber from 'bignumber.js';
|
|
1
2
|
import { Address } from '../types';
|
|
2
3
|
import { Token } from './token';
|
|
3
4
|
export declare class TokenAmount {
|
|
4
5
|
readonly token: Token;
|
|
5
6
|
private rawAmnt;
|
|
6
7
|
constructor(token: Token, amount: string, isRaw?: boolean);
|
|
7
|
-
formattedAmount(): string;
|
|
8
|
-
formattedAmountWithSymbol(): string;
|
|
8
|
+
formattedAmount(decimal?: number, fmt?: BigNumber.Format): string;
|
|
9
|
+
formattedAmountWithSymbol(decimal?: number, fmt?: BigNumber.Format): string;
|
|
9
10
|
rawAmount(): string;
|
|
10
11
|
compare(other: TokenAmount): number;
|
|
11
12
|
static fromAddressAndAmount(tokenAddress: Address, amount: string, isRaw?: boolean): TokenAmount;
|
|
@@ -1646,12 +1646,16 @@ var TokenAmount = /*#__PURE__*/function () {
|
|
|
1646
1646
|
|
|
1647
1647
|
var _proto = TokenAmount.prototype;
|
|
1648
1648
|
|
|
1649
|
-
_proto.formattedAmount = function formattedAmount() {
|
|
1649
|
+
_proto.formattedAmount = function formattedAmount(decimal, fmt) {
|
|
1650
|
+
if (decimal !== undefined && fmt !== undefined) {
|
|
1651
|
+
return new BigNumber(this.rawAmnt).div(decimalFactor(this.token.decimals)).toFormat(decimal, fmt);
|
|
1652
|
+
}
|
|
1653
|
+
|
|
1650
1654
|
return new BigNumber(this.rawAmnt).div(decimalFactor(this.token.decimals)).toString();
|
|
1651
1655
|
};
|
|
1652
1656
|
|
|
1653
|
-
_proto.formattedAmountWithSymbol = function formattedAmountWithSymbol() {
|
|
1654
|
-
return this.formattedAmount() + " " + getSymbol(this.token.address);
|
|
1657
|
+
_proto.formattedAmountWithSymbol = function formattedAmountWithSymbol(decimal, fmt) {
|
|
1658
|
+
return this.formattedAmount(decimal, fmt) + " " + getSymbol(this.token.address);
|
|
1655
1659
|
};
|
|
1656
1660
|
|
|
1657
1661
|
_proto.rawAmount = function rawAmount() {
|