@ape.swap/bonds-sdk 1.0.114 → 1.0.115
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.
|
@@ -58,9 +58,17 @@ var BondModal = function (_a) {
|
|
|
58
58
|
var singlePurchaseLimit = new BigNumber((_c = bond === null || bond === void 0 ? void 0 : bond.maxPayout) !== null && _c !== void 0 ? _c : 0).div(new BigNumber(10).pow((_d = bond === null || bond === void 0 ? void 0 : bond.payoutTokenDecimals) !== null && _d !== void 0 ? _d : 18));
|
|
59
59
|
return !available ? 0 : (singlePurchaseLimit.lt(safeAvailable) ? singlePurchaseLimit : safeAvailable);
|
|
60
60
|
};
|
|
61
|
+
var _d = useState(''), inputValue = _d[0], setInputValue = _d[1];
|
|
62
|
+
var handleInputChange = function (event) {
|
|
63
|
+
setInputValue(event.target.value);
|
|
64
|
+
};
|
|
65
|
+
var calculateResult = function () {
|
|
66
|
+
var result = Number(inputValue) * 2;
|
|
67
|
+
return result.toFixed(2);
|
|
68
|
+
};
|
|
61
69
|
return (_jsx(ThemeUIProvider, __assign({ theme: defaultTheme }, { children: bondData.map(function (bond) {
|
|
62
70
|
var _a, _b, _c, _d, _e, _f;
|
|
63
|
-
return (_jsx(React.Fragment, { children: _jsx(Flex, __assign({ className: "modal modal-backdrop" }, { children: _jsxs(Flex, __assign({ className: "modal modal-content" }, { children: [isActive && account && (_jsxs("p", { children: ["Wallet Address: ", account] })), _jsxs(Flex, __assign({ className: "modal modal-header" }, { children: [_jsx(Flex, __assign({ className: "new" }, { children: "NEW" })), _jsxs(Flex, __assign({ className: "project-info" }, { children: ["Project Info", _jsx(Flex, __assign({ className: "project-info icon" }, { children: _jsx(Svg, { icon: "expand" }) }))] })), _jsx(Flex, __assign({ className: "svg-close", onClick: onClose }, { children: _jsx(Svg, { icon: "close" }) }))] })), _jsxs(Flex, __assign({ className: "modal-container table-container" }, { children: [_jsxs(Flex, __assign({ className: "modal-container title-container" }, { children: [_jsx(Flex, __assign({ className: "title-container bond" }, { children: bond === null || bond === void 0 ? void 0 : bond.showcaseTokenName })), _jsxs(Flex, __assign({ className: "title-container bond-price" }, { children: [_jsxs(Flex, __assign({ className: "bond-price price" }, { children: ["$", earnTokenPrice(bond)] })), _jsxs(Flex, __assign({ className: "bond-price discounted" }, { children: ["$", discountEarnTokenPrice(bond)] }))] }))] })), _jsx(Flex, __assign({ className: "modal-container description-container" }, { children: bond === null || bond === void 0 ? void 0 : bond.shortDescription })), _jsxs(Flex, __assign({ className: "modal-container blocks-container" }, { children: [_jsxs(Flex, __assign({ className: "modal-block column-discount ".concat(getDiscountColor(bond === null || bond === void 0 ? void 0 : bond.discount)) }, { children: [_jsxs(Flex, __assign({ className: "block-header header" }, { children: ["Discount", _jsx(Flex, __assign({ className: "block-header icon" }, { children: _jsx(Svg, { icon: "questionFill", width: "15px" }) }))] })), "".concat((_a = bond === null || bond === void 0 ? void 0 : bond.discount) === null || _a === void 0 ? void 0 : _a.toFixed(2), "%")] })), _jsxs(Flex, __assign({ className: "modal-block column-arr" }, { children: [_jsxs(Flex, __assign({ className: "block-header header" }, { children: ["ARR", _jsx(Flex, __assign({ className: "block-header icon" }, { children: _jsx(Svg, { icon: "questionFill", width: "15px" }) }))] })), "".concat(((((_b = bond === null || bond === void 0 ? void 0 : bond.discount) !== null && _b !== void 0 ? _b : 0) * 365) / vestingTime((_c = bond === null || bond === void 0 ? void 0 : bond.vestingTerm) !== null && _c !== void 0 ? _c : 0).days).toFixed(2), "%")] })), _jsxs(Flex, __assign({ className: "modal-block column-term" }, { children: [_jsxs(Flex, __assign({ className: "block-header header" }, { children: ["Terms", _jsx(Flex, __assign({ className: "block-header icon" }, { children: _jsx(Svg, { icon: "questionFill", width: "15px" }) }))] })), vestingTime((_d = bond === null || bond === void 0 ? void 0 : bond.vestingTerm) !== null && _d !== void 0 ? _d : 0).days ? "".concat(vestingTime((_e = bond === null || bond === void 0 ? void 0 : bond.vestingTerm) !== null && _e !== void 0 ? _e : 0).days, " D") : '-'] })), _jsxs(Flex, __assign({ className: "modal-block column-maxbuy" }, { children: [_jsxs(Flex, __assign({ className: "block-header header" }, { children: ["Max Buy", _jsx(Flex, __assign({ className: "block-header icon" }, { children: _jsx(Svg, { icon: "questionFill", width: "15px" }) }))] })), (_f = parseFloat(maxBuy(bond).toFixed(0))) === null || _f === void 0 ? void 0 : _f.toLocaleString('en-US')] }))] })), _jsxs(Flex, __assign({ className: "modal-container text-container" }, { children: [_jsxs(Flex, __assign({ className: "text-container row" }, { children: [_jsx("div", { children: "You spend:" }), _jsxs("div", { children: ["0 ", bond === null || bond === void 0 ? void 0 : bond.principalTokenName, " = $ 0"] })] })), _jsxs(Flex, __assign({ className: "text-container row" }, { children: [_jsxs("div", { children: ["Premium: ", _jsx(Svg, { icon: "questionFill", width: "15px" })] }), _jsx("div", { children: "$ 0" })] })), _jsxs(Flex, __assign({ className: "text-container row" }, { children: [_jsx("div", { children: "You get (over 90 days):" }), _jsxs("div", { children: ["0 ", bond === null || bond === void 0 ? void 0 : bond.showcaseTokenName, " = $ 0"] })] }))] })), _jsxs(Flex, __assign({ className: "modal-container input-container" }, { children: [_jsx(Flex, __assign({ className: "input-container input" }, { children: _jsx(Input, { type: "number", className: "number-input", placeholder: "0.0" }) })),
|
|
71
|
+
return (_jsx(React.Fragment, { children: _jsx(Flex, __assign({ className: "modal modal-backdrop" }, { children: _jsxs(Flex, __assign({ className: "modal modal-content" }, { children: [isActive && account && (_jsxs("p", { children: ["Wallet Address: ", account] })), _jsxs(Flex, __assign({ className: "modal modal-header" }, { children: [_jsx(Flex, __assign({ className: "new" }, { children: "NEW" })), _jsxs(Flex, __assign({ className: "project-info" }, { children: ["Project Info", _jsx(Flex, __assign({ className: "project-info icon" }, { children: _jsx(Svg, { icon: "expand" }) }))] })), _jsx(Flex, __assign({ className: "svg-close", onClick: onClose }, { children: _jsx(Svg, { icon: "close" }) }))] })), _jsxs(Flex, __assign({ className: "modal-container table-container" }, { children: [_jsxs(Flex, __assign({ className: "modal-container title-container" }, { children: [_jsx(Flex, __assign({ className: "title-container bond" }, { children: bond === null || bond === void 0 ? void 0 : bond.showcaseTokenName })), _jsxs(Flex, __assign({ className: "title-container bond-price" }, { children: [_jsxs(Flex, __assign({ className: "bond-price price" }, { children: ["$", earnTokenPrice(bond)] })), _jsxs(Flex, __assign({ className: "bond-price discounted" }, { children: ["$", discountEarnTokenPrice(bond)] }))] }))] })), _jsx(Flex, __assign({ className: "modal-container description-container" }, { children: bond === null || bond === void 0 ? void 0 : bond.shortDescription })), _jsxs(Flex, __assign({ className: "modal-container blocks-container" }, { children: [_jsxs(Flex, __assign({ className: "modal-block column-discount ".concat(getDiscountColor(bond === null || bond === void 0 ? void 0 : bond.discount)) }, { children: [_jsxs(Flex, __assign({ className: "block-header header" }, { children: ["Discount", _jsx(Flex, __assign({ className: "block-header icon" }, { children: _jsx(Svg, { icon: "questionFill", width: "15px" }) }))] })), "".concat((_a = bond === null || bond === void 0 ? void 0 : bond.discount) === null || _a === void 0 ? void 0 : _a.toFixed(2), "%")] })), _jsxs(Flex, __assign({ className: "modal-block column-arr" }, { children: [_jsxs(Flex, __assign({ className: "block-header header" }, { children: ["ARR", _jsx(Flex, __assign({ className: "block-header icon" }, { children: _jsx(Svg, { icon: "questionFill", width: "15px" }) }))] })), "".concat(((((_b = bond === null || bond === void 0 ? void 0 : bond.discount) !== null && _b !== void 0 ? _b : 0) * 365) / vestingTime((_c = bond === null || bond === void 0 ? void 0 : bond.vestingTerm) !== null && _c !== void 0 ? _c : 0).days).toFixed(2), "%")] })), _jsxs(Flex, __assign({ className: "modal-block column-term" }, { children: [_jsxs(Flex, __assign({ className: "block-header header" }, { children: ["Terms", _jsx(Flex, __assign({ className: "block-header icon" }, { children: _jsx(Svg, { icon: "questionFill", width: "15px" }) }))] })), vestingTime((_d = bond === null || bond === void 0 ? void 0 : bond.vestingTerm) !== null && _d !== void 0 ? _d : 0).days ? "".concat(vestingTime((_e = bond === null || bond === void 0 ? void 0 : bond.vestingTerm) !== null && _e !== void 0 ? _e : 0).days, " D") : '-'] })), _jsxs(Flex, __assign({ className: "modal-block column-maxbuy" }, { children: [_jsxs(Flex, __assign({ className: "block-header header" }, { children: ["Max Buy", _jsx(Flex, __assign({ className: "block-header icon" }, { children: _jsx(Svg, { icon: "questionFill", width: "15px" }) }))] })), (_f = parseFloat(maxBuy(bond).toFixed(0))) === null || _f === void 0 ? void 0 : _f.toLocaleString('en-US')] }))] })), _jsxs(Flex, __assign({ className: "modal-container text-container" }, { children: [_jsxs(Flex, __assign({ className: "text-container row" }, { children: [_jsx("div", { children: "You spend:" }), _jsxs("div", { children: ["0 ", bond === null || bond === void 0 ? void 0 : bond.principalTokenName, " = $ 0"] })] })), _jsxs(Flex, __assign({ className: "text-container row" }, { children: [_jsxs("div", { children: ["Premium: ", _jsx(Svg, { icon: "questionFill", width: "15px" })] }), _jsx("div", { children: "$ 0" })] })), _jsxs(Flex, __assign({ className: "text-container row" }, { children: [_jsx("div", { children: "You get (over 90 days):" }), _jsxs("div", { children: ["0 ", bond === null || bond === void 0 ? void 0 : bond.showcaseTokenName, " = $ 0"] })] }))] })), _jsxs(Flex, __assign({ className: "modal-container input-container" }, { children: [_jsx(Flex, __assign({ className: "input-container input" }, { children: _jsx(Input, { type: "number", className: "number-input", placeholder: "0.0", value: inputValue, onChange: handleInputChange }) })), _jsxs(Flex, __assign({ className: "input-container token" }, { children: [bond === null || bond === void 0 ? void 0 : bond.principalTokenName, " ", calculateResult()] }))] })), _jsxs(Flex, __assign({ className: "modal-container button-container" }, { children: [_jsx(Flex, __assign({ className: "button-container get" }, { children: _jsxs(Button, { children: ["Get ", bond === null || bond === void 0 ? void 0 : bond.principalTokenName] }) })), _jsx(Flex, __assign({ className: "button-container buy" }, { children: _jsxs(Button, { children: ["Buy ", bond === null || bond === void 0 ? void 0 : bond.showcaseTokenName] }) }))] }))] }))] })) })) }, bond.billAddress));
|
|
64
72
|
}) })));
|
|
65
73
|
};
|
|
66
74
|
export default BondModal;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export var formatNumber = function (number, minPrecision, maxPrecision) {
|
|
2
|
+
if (minPrecision === void 0) { minPrecision = 2; }
|
|
3
|
+
if (maxPrecision === void 0) { maxPrecision = 2; }
|
|
4
|
+
var options = {
|
|
5
|
+
minimumFractionDigits: minPrecision,
|
|
6
|
+
maximumFractionDigits: maxPrecision,
|
|
7
|
+
};
|
|
8
|
+
return number.toLocaleString('en-US', options);
|
|
9
|
+
};
|
|
10
|
+
// Formats a number with SI (International System of Units) sufixes
|
|
11
|
+
export var formatNumberSI = function (number, digits) {
|
|
12
|
+
if (digits === void 0) { digits = 2; }
|
|
13
|
+
var lookupSI = [
|
|
14
|
+
{ value: 1, symbol: '' },
|
|
15
|
+
{ value: 1e6, symbol: 'M' },
|
|
16
|
+
{ value: 1e9, symbol: 'B' },
|
|
17
|
+
{ value: 1e12, symbol: 'T' },
|
|
18
|
+
];
|
|
19
|
+
var regEx = /\.0+$|(\.[0-9]*[1-9])0+$/;
|
|
20
|
+
var formatted;
|
|
21
|
+
if (number >= 1e18) {
|
|
22
|
+
formatted = '∞';
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
var i = void 0;
|
|
26
|
+
for (i = lookupSI.length - 1; i > 0; i--) {
|
|
27
|
+
if (number >= lookupSI[i].value) {
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
formatted = formatNumber(number / lookupSI[i].value, digits, digits).replace(regEx, '$1') + lookupSI[i].symbol;
|
|
32
|
+
}
|
|
33
|
+
return formatted;
|
|
34
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Currency, CurrencyAmount, Price } from '@ape.swap/sdk-core';
|
|
2
|
+
export declare const currencyAmountToPreciseFloat: (currencyAmount: CurrencyAmount<Currency> | undefined) => number | undefined;
|
|
3
|
+
export declare const priceToPreciseFloat: (price: Price<Currency, Currency> | undefined) => number | undefined;
|
|
4
|
+
interface FormatDollarArgs {
|
|
5
|
+
num: number | undefined | null;
|
|
6
|
+
isPrice?: boolean;
|
|
7
|
+
lessPreciseStablecoinValues?: boolean;
|
|
8
|
+
digits?: number;
|
|
9
|
+
round?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Returns a USD dollar or equivalent denominated numerical value formatted
|
|
13
|
+
* in human readable string for use in template.
|
|
14
|
+
*
|
|
15
|
+
* Adheres to guidelines for prices and other numbers defined here:
|
|
16
|
+
* https://www.notion.so/uniswaplabs/Number-standards-fbb9f533f10e4e22820722c2f66d23c0
|
|
17
|
+
* @param num numerical value denominated in USD or USD equivalent
|
|
18
|
+
* @param isPrice whether the amount represents a price or not
|
|
19
|
+
* @param lessPreciseStablecoinValues whether or not we should show less precise values for
|
|
20
|
+
* stablecoins (around 1$ in value always) for the sake of readability
|
|
21
|
+
* @param digits number of digits after the decimal for non-price amounts
|
|
22
|
+
* @param round whether or not to round up non-price amounts
|
|
23
|
+
*/
|
|
24
|
+
export declare const formatDollar: ({ num, isPrice, lessPreciseStablecoinValues, digits, round, }: FormatDollarArgs) => string;
|
|
25
|
+
export declare const formatValue: ({ num, digits, round }: any) => string;
|
|
26
|
+
/**
|
|
27
|
+
* Returns a numerical amount of any token formatted in human readable string for use in template.
|
|
28
|
+
*
|
|
29
|
+
* For transaction review numbers, such as token quantities, NFT price (token-denominated),
|
|
30
|
+
* network fees, transaction history items. Adheres to guidelines defined here:
|
|
31
|
+
* https://www.notion.so/uniswaplabs/Number-standards-fbb9f533f10e4e22820722c2f66d23c0
|
|
32
|
+
* @param num numerical value denominated in any token
|
|
33
|
+
* @param maxDigits the maximum number of digits that should be shown for the quantity
|
|
34
|
+
*/
|
|
35
|
+
export declare const formatTransactionAmount: (num: number | undefined | null, maxDigits?: number) => string;
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import numbro from 'numbro';
|
|
2
|
+
// Convert [CurrencyAmount] to number with necessary precision for price formatting.
|
|
3
|
+
export var currencyAmountToPreciseFloat = function (currencyAmount) {
|
|
4
|
+
if (!currencyAmount)
|
|
5
|
+
return undefined;
|
|
6
|
+
var floatForLargerNumbers = parseFloat(currencyAmount.toExact());
|
|
7
|
+
if (floatForLargerNumbers < 0.1) {
|
|
8
|
+
return parseFloat(currencyAmount.toSignificant(6));
|
|
9
|
+
}
|
|
10
|
+
return floatForLargerNumbers;
|
|
11
|
+
};
|
|
12
|
+
// Convert [Price] to number with necessary precision for price formatting.
|
|
13
|
+
export var priceToPreciseFloat = function (price) {
|
|
14
|
+
if (!price)
|
|
15
|
+
return undefined;
|
|
16
|
+
var floatForLargerNumbers = parseFloat(price.toFixed(9));
|
|
17
|
+
if (floatForLargerNumbers < 0.1) {
|
|
18
|
+
return parseFloat(price.toSignificant(6));
|
|
19
|
+
}
|
|
20
|
+
return floatForLargerNumbers;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Returns a USD dollar or equivalent denominated numerical value formatted
|
|
24
|
+
* in human readable string for use in template.
|
|
25
|
+
*
|
|
26
|
+
* Adheres to guidelines for prices and other numbers defined here:
|
|
27
|
+
* https://www.notion.so/uniswaplabs/Number-standards-fbb9f533f10e4e22820722c2f66d23c0
|
|
28
|
+
* @param num numerical value denominated in USD or USD equivalent
|
|
29
|
+
* @param isPrice whether the amount represents a price or not
|
|
30
|
+
* @param lessPreciseStablecoinValues whether or not we should show less precise values for
|
|
31
|
+
* stablecoins (around 1$ in value always) for the sake of readability
|
|
32
|
+
* @param digits number of digits after the decimal for non-price amounts
|
|
33
|
+
* @param round whether or not to round up non-price amounts
|
|
34
|
+
*/
|
|
35
|
+
export var formatDollar = function (_a) {
|
|
36
|
+
var num = _a.num, _b = _a.isPrice, isPrice = _b === void 0 ? false : _b, _c = _a.lessPreciseStablecoinValues, lessPreciseStablecoinValues = _c === void 0 ? false : _c, _d = _a.digits, digits = _d === void 0 ? 2 : _d, _e = _a.round, round = _e === void 0 ? true : _e;
|
|
37
|
+
// For USD dollar denominated prices.
|
|
38
|
+
if (isPrice) {
|
|
39
|
+
if (num === 0)
|
|
40
|
+
return '$0.00';
|
|
41
|
+
if (!num)
|
|
42
|
+
return '-';
|
|
43
|
+
if (num < 0.000001) {
|
|
44
|
+
return "$".concat(num.toExponential(2));
|
|
45
|
+
}
|
|
46
|
+
if ((num >= 0.000001 && num < 0.1) || num > 1000000) {
|
|
47
|
+
return "$".concat(Number(num).toPrecision(3));
|
|
48
|
+
}
|
|
49
|
+
// We only show 2 decimal places in explore table for stablecoin value ranges
|
|
50
|
+
// for the sake of readability (as opposed to the usual 3 elsewhere).
|
|
51
|
+
if (num >= 0.1 && num < (lessPreciseStablecoinValues ? 0.9995 : 1.05)) {
|
|
52
|
+
return "$".concat(num.toFixed(3));
|
|
53
|
+
}
|
|
54
|
+
return "$".concat(Number(num.toFixed(2)).toLocaleString('en-US', { minimumFractionDigits: 2 }));
|
|
55
|
+
}
|
|
56
|
+
// For volume dollar amounts, like market cap, total value locked, etc.
|
|
57
|
+
else {
|
|
58
|
+
if (num === 0)
|
|
59
|
+
return '$0.00';
|
|
60
|
+
if (!num)
|
|
61
|
+
return '-';
|
|
62
|
+
if (num < 0.000001) {
|
|
63
|
+
return '$<0.000001';
|
|
64
|
+
}
|
|
65
|
+
if (num >= 0.000001 && num < 0.1) {
|
|
66
|
+
return "$".concat(Number(num).toPrecision(3));
|
|
67
|
+
}
|
|
68
|
+
if (num >= 0.1 && num < 1.05) {
|
|
69
|
+
return "$".concat(num.toFixed(3));
|
|
70
|
+
}
|
|
71
|
+
return numbro(num)
|
|
72
|
+
.formatCurrency({
|
|
73
|
+
average: round,
|
|
74
|
+
mantissa: num > 1000 ? 2 : digits,
|
|
75
|
+
abbreviations: {
|
|
76
|
+
million: 'M',
|
|
77
|
+
billion: 'B',
|
|
78
|
+
},
|
|
79
|
+
})
|
|
80
|
+
.toUpperCase();
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
export var formatValue = function (_a) {
|
|
84
|
+
var num = _a.num, _b = _a.digits, digits = _b === void 0 ? 2 : _b, _c = _a.round, round = _c === void 0 ? true : _c;
|
|
85
|
+
if (num === 0)
|
|
86
|
+
return '0.00';
|
|
87
|
+
if (!num)
|
|
88
|
+
return '-';
|
|
89
|
+
if (num < 0.000001) {
|
|
90
|
+
return '<0.000001';
|
|
91
|
+
}
|
|
92
|
+
if (num >= 0.000001 && num < 0.1) {
|
|
93
|
+
return "".concat(Number(num).toPrecision(3));
|
|
94
|
+
}
|
|
95
|
+
if (num >= 0.1 && num < 1.05) {
|
|
96
|
+
return "".concat(num.toFixed(3));
|
|
97
|
+
}
|
|
98
|
+
return numbro(num)
|
|
99
|
+
.format({
|
|
100
|
+
average: round,
|
|
101
|
+
mantissa: num > 1000 ? 2 : digits,
|
|
102
|
+
abbreviations: {
|
|
103
|
+
million: 'M',
|
|
104
|
+
billion: 'B',
|
|
105
|
+
},
|
|
106
|
+
})
|
|
107
|
+
.toUpperCase();
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* Returns a numerical amount of any token formatted in human readable string for use in template.
|
|
111
|
+
*
|
|
112
|
+
* For transaction review numbers, such as token quantities, NFT price (token-denominated),
|
|
113
|
+
* network fees, transaction history items. Adheres to guidelines defined here:
|
|
114
|
+
* https://www.notion.so/uniswaplabs/Number-standards-fbb9f533f10e4e22820722c2f66d23c0
|
|
115
|
+
* @param num numerical value denominated in any token
|
|
116
|
+
* @param maxDigits the maximum number of digits that should be shown for the quantity
|
|
117
|
+
*/
|
|
118
|
+
export var formatTransactionAmount = function (num, maxDigits) {
|
|
119
|
+
if (maxDigits === void 0) { maxDigits = 9; }
|
|
120
|
+
if (num === 0)
|
|
121
|
+
return '0.00';
|
|
122
|
+
if (!num)
|
|
123
|
+
return '';
|
|
124
|
+
if (num < 0.00001) {
|
|
125
|
+
return '<0.00001';
|
|
126
|
+
}
|
|
127
|
+
if (num >= 0.00001 && num < 1) {
|
|
128
|
+
return "".concat(Number(num.toFixed(5)).toLocaleString('en-US', {
|
|
129
|
+
minimumFractionDigits: 2,
|
|
130
|
+
maximumFractionDigits: 5,
|
|
131
|
+
}));
|
|
132
|
+
}
|
|
133
|
+
if (num >= 1 && num < 10000) {
|
|
134
|
+
return "".concat(Number(num.toPrecision(6)).toLocaleString('en-US', {
|
|
135
|
+
minimumFractionDigits: 2,
|
|
136
|
+
maximumFractionDigits: 6,
|
|
137
|
+
}));
|
|
138
|
+
}
|
|
139
|
+
if (num >= 10000 && num < 1000000) {
|
|
140
|
+
return "".concat(Number(num.toFixed(2)).toLocaleString('en-US', { minimumFractionDigits: 2 }));
|
|
141
|
+
}
|
|
142
|
+
// For very large numbers, switch to scientific notation and show as much precision
|
|
143
|
+
// as permissible by maxDigits param.
|
|
144
|
+
if (num >= Math.pow(10, maxDigits - 1)) {
|
|
145
|
+
return "".concat(num.toExponential(maxDigits - 3));
|
|
146
|
+
}
|
|
147
|
+
return "".concat(Number(num.toFixed(2)).toLocaleString('en-US', { minimumFractionDigits: 2 }));
|
|
148
|
+
};
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Ape Bond SDK",
|
|
4
4
|
"author": "Ape Bond",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"version": "1.0.
|
|
6
|
+
"version": "1.0.115",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"module": "dist/index.es.js",
|
|
9
9
|
"types": "dist/index.d.ts",
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@ape.swap/apeswap-lists": "^2.0.9",
|
|
53
|
+
"@ape.swap/sdk-core": "^1.0.2",
|
|
53
54
|
"@emotion/react": "^11.11.4",
|
|
54
55
|
"@emotion/styled": "^11.11.5",
|
|
55
56
|
"@types/node": "^20.14.10",
|