@ape.swap/bonds-sdk 1.0.174 → 1.0.176

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,12 @@ import { defaultTheme } from '../../theme';
58
58
  import Svg from '../uikit/Svg';
59
59
  import '../../scss/Bonds.scss';
60
60
  import { BigNumber } from 'bignumber.js';
61
- import { ChainId } from '../../config/chains';
61
+ import { ChainId } from '../../enum/chains';
62
62
  import ProgressBarWrapper from '../ProgressBar/ProgressBarWrapper';
63
63
  import ProgressBar from '../ProgressBar/ProgressBar';
64
+ import { formatDollar, formatValue } from '../../utils/formatNumbers';
65
+ import Tooltip from '../Tooltip';
66
+ import { TooltipText } from '../../enum/tooltips';
64
67
  var Bonds = function (_a) {
65
68
  var connectionString = _a.connectionString;
66
69
  var _b = useWeb3React(), account = _b.account, isActive = _b.isActive;
@@ -169,7 +172,16 @@ var Bonds = function (_a) {
169
172
  var remainingTokens = new BigNumber((_b = bond.tokensRemaining) !== null && _b !== void 0 ? _b : '0');
170
173
  return remainingTokens.div(totalMaxPayout).times(100).toNumber();
171
174
  };
172
- return (_jsxs(ThemeUIProvider, __assign({ theme: defaultTheme }, { children: [isActive && account && _jsx("p", { children: account }), isActive && account && _jsx("button", __assign({ onClick: handleApprove }, { children: "Approve USDT" })), _jsxs(Flex, __assign({ className: "container table-container" }, { children: [_jsxs(Flex, __assign({ className: "container header-container" }, { children: [_jsx(Flex, __assign({ className: "column column-token" }, { children: "Tokens" })), _jsx(Flex, __assign({ className: "column column-discount" }, { children: "Discount" })), _jsx(Flex, __assign({ className: "column column-arr" }, { children: "ARR" })), _jsx(Flex, __assign({ className: "column column-term" }, { children: "Terms" })), _jsx(Flex, __assign({ className: "column column-tokensremaining" }, { children: "Tokens Remaining" })), _jsx(Flex, { className: "column column-hotbond" })] })), sortedBonds.map(function (bond) {
175
+ var remainingTokensFormat = function (bond) {
176
+ var _a;
177
+ return formatValue({ num: new BigNumber((_a = bond.tokensRemaining) !== null && _a !== void 0 ? _a : '0') });
178
+ };
179
+ var remainingTokensUsd = function (bond) {
180
+ var _a, _b;
181
+ var tokens = new BigNumber((_a = bond.tokensRemaining) !== null && _a !== void 0 ? _a : '0');
182
+ return tokens.times((_b = bond.payoutTokenPrice) !== null && _b !== void 0 ? _b : 0);
183
+ };
184
+ return (_jsxs(ThemeUIProvider, __assign({ theme: defaultTheme }, { children: [isActive && account && _jsx("p", { children: account }), isActive && account && _jsx("button", __assign({ onClick: handleApprove }, { children: "Approve USDT" })), _jsxs(Flex, __assign({ className: "container table-container" }, { children: [_jsxs(Flex, __assign({ className: "container header-container" }, { children: [_jsx(Flex, __assign({ className: "column column-token" }, { children: "Tokens" })), _jsx(Flex, __assign({ className: "column column-discount" }, { children: _jsxs(Tooltip, __assign({ body: TooltipText.Discount }, { children: ["Discount", _jsx(Flex, __assign({ className: "column header-icon" }, { children: _jsx(Svg, { icon: "questionFill", width: "15px" }) }))] })) })), _jsx(Flex, __assign({ className: "column column-arr" }, { children: _jsxs(Tooltip, __assign({ body: TooltipText.ARR }, { children: ["ARR", _jsx(Flex, __assign({ className: "column header-icon" }, { children: _jsx(Svg, { icon: "questionFill", width: "15px" }) }))] })) })), _jsx(Flex, __assign({ className: "column column-term" }, { children: _jsxs(Tooltip, __assign({ body: TooltipText.Terms }, { children: ["Terms", _jsx(Flex, __assign({ className: "column header-icon" }, { children: _jsx(Svg, { icon: "questionFill", width: "15px" }) }))] })) })), _jsx(Flex, __assign({ className: "column column-tokensremaining" }, { children: _jsxs(Tooltip, __assign({ body: TooltipText.TokensRemaining }, { children: ["Tokens Remaining", _jsx(Flex, __assign({ className: "column header-icon" }, { children: _jsx(Svg, { icon: "questionFill", width: "15px" }) }))] })) })), _jsx(Flex, { className: "column column-hotbond" })] })), sortedBonds.map(function (bond) {
173
185
  var _a, _b, _c;
174
186
  return (_jsxs(Flex, __assign({ className: "container bondrow-container", onClick: function () { return rowClick(bond); } }, { children: [_jsx(Flex, __assign({ className: "column column-token" }, { children: bond.showcaseTokenName })), _jsx(Flex, __assign({ className: "column column-discount ".concat(getDiscountColor(bond === null || bond === void 0 ? void 0 : bond.discount)) }, { children: "".concat((_a = bond === null || bond === void 0 ? void 0 : bond.discount) === null || _a === void 0 ? void 0 : _a.toFixed(2), "%") })), _jsx(Flex, __assign({ className: "column column-arr" }, { children: "".concat(((((_b = bond === null || bond === void 0 ? void 0 : bond.discount) !== null && _b !== void 0 ? _b : 0) * 365) / vestingTime(bond.vestingTerm).days).toFixed(2), "%") })), _jsx(Flex, __assign({ className: "column column-term" }, { children: vestingTime(bond.vestingTerm).days ? "".concat(vestingTime(bond.vestingTerm).days, " D") : '-' })), _jsx(Flex, __assign({ className: "column column-tokensremaining" }, { children: _jsx(ProgressBarWrapper, { title: '', value: _jsx(ProgressBar, { value: remainingPercentage(bond) }), style: {
175
187
  width: '127px',
@@ -177,7 +189,10 @@ var Bonds = function (_a) {
177
189
  flexDirection: 'column',
178
190
  justifyContent: 'center',
179
191
  display: ['none', 'none', 'none', 'flex'],
180
- }, showTooltip: false }) })), _jsx(Flex, __assign({ className: "column column-hotbond" }, { children: _jsx(Flex, __assign({ className: "column column-icon" }, { children: hotBonds.includes(bond.billAddress.toLowerCase()) && ((_c = bond.discount) !== null && _c !== void 0 ? _c : 0) > 0 && (_jsx(Svg, { icon: "fire", width: "20px" })) })) }))] }), bond.billAddress));
192
+ }, showTooltip: true, toolTip: "".concat(remainingTokensFormat(bond), " ").concat(bond.payoutTokenName, " (").concat(formatDollar({
193
+ num: remainingTokensUsd(bond).toNumber(),
194
+ isPrice: true,
195
+ }), ")") }) })), _jsx(Flex, __assign({ className: "column column-hotbond" }, { children: _jsx(Flex, __assign({ className: "column column-icon" }, { children: hotBonds.includes(bond.billAddress.toLowerCase()) && ((_c = bond.discount) !== null && _c !== void 0 ? _c : 0) > 0 && (_jsx(Svg, { icon: "fire", width: "20px" })) })) }))] }), bond.billAddress));
181
196
  })] }))] })));
182
197
  };
183
198
  export default Bonds;
@@ -0,0 +1,6 @@
1
+ export declare enum TooltipText {
2
+ Discount = "This is the percentage discount relative to the token's current market price.",
3
+ ARR = "This is the Annualized Rate of Return you would receive considering the current discount, adjusted for APR.",
4
+ Terms = "This is the amount of days it will take for all tokens in the Bond to fully vest.",
5
+ TokensRemaining = "This is the amount of remaining tokens for sale in this Bond."
6
+ }
@@ -0,0 +1,7 @@
1
+ export var TooltipText;
2
+ (function (TooltipText) {
3
+ TooltipText["Discount"] = "This is the percentage discount relative to the token's current market price.";
4
+ TooltipText["ARR"] = "This is the Annualized Rate of Return you would receive considering the current discount, adjusted for APR.";
5
+ TooltipText["Terms"] = "This is the amount of days it will take for all tokens in the Bond to fully vest.";
6
+ TooltipText["TokensRemaining"] = "This is the amount of remaining tokens for sale in this Bond.";
7
+ })(TooltipText || (TooltipText = {}));
@@ -44,6 +44,7 @@
44
44
  flex: 1;
45
45
  min-width: 150px;
46
46
  text-align: center;
47
+ cursor: pointer;
47
48
  }
48
49
 
49
50
  .column.column-token {
@@ -90,4 +91,10 @@
90
91
  flex-direction: column;
91
92
  justify-content: center;
92
93
  align-items: center;
94
+ }
95
+
96
+ .column.header-icon {
97
+ padding-left: 5px;
98
+ align-items: start;
99
+ cursor: pointer;
93
100
  }
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.174",
6
+ "version": "1.0.176",
7
7
  "main": "dist/index.js",
8
8
  "module": "dist/index.es.js",
9
9
  "types": "dist/index.d.ts",
File without changes
File without changes