@ape.swap/bonds-sdk 1.0.248 → 1.0.249
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/components/Bonds/Bonds.js +17 -17
- package/package.json +1 -1
|
@@ -120,28 +120,12 @@ var Bonds = function (_a) {
|
|
|
120
120
|
}); };
|
|
121
121
|
var _d = useState([]), bondData = _d[0], setBondData = _d[1];
|
|
122
122
|
var _e = useState([]), hotBonds = _e[0], setHotBonds = _e[1];
|
|
123
|
-
var _f = useState(bondData), sortedBonds = _f[0], setSortedBonds = _f[1];
|
|
124
|
-
var _g = useState(true), isAscending = _g[0], setIsAscending = _g[1];
|
|
125
123
|
var vestingTime = function (vestingTerm) {
|
|
126
124
|
return getTimePeriods(vestingTerm !== null && vestingTerm !== void 0 ? vestingTerm : 0, true);
|
|
127
125
|
};
|
|
128
126
|
useEffect(function () {
|
|
129
127
|
axios.get('https://realtime-api.ape.bond/bonds').then(function (response) {
|
|
130
128
|
var bonds = response.data.bonds.filter(function (bond) { return !isSoldOut(bond); });
|
|
131
|
-
bonds.sort(function (a, b) {
|
|
132
|
-
var _a, _b;
|
|
133
|
-
var aIsHot = hotBonds.includes(a.billAddress.toLowerCase()) && ((_a = a.discount) !== null && _a !== void 0 ? _a : 0) > 0;
|
|
134
|
-
var bIsHot = hotBonds.includes(b.billAddress.toLowerCase()) && ((_b = b.discount) !== null && _b !== void 0 ? _b : 0) > 0;
|
|
135
|
-
if (aIsHot && !bIsHot) {
|
|
136
|
-
return -1;
|
|
137
|
-
}
|
|
138
|
-
else if (!aIsHot && bIsHot) {
|
|
139
|
-
return 1;
|
|
140
|
-
}
|
|
141
|
-
else {
|
|
142
|
-
return b.discount - a.discount;
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
129
|
setBondData(bonds);
|
|
146
130
|
});
|
|
147
131
|
}, []);
|
|
@@ -166,6 +150,22 @@ var Bonds = function (_a) {
|
|
|
166
150
|
return true;
|
|
167
151
|
return ((_b = new BigNumber(bond.tokensRemaining)) === null || _b === void 0 ? void 0 : _b.lte(thresholdToHide)) || bond.discount === 100;
|
|
168
152
|
}, []);
|
|
153
|
+
var initSortedBonds = bondData.sort(function (a, b) {
|
|
154
|
+
var _a, _b;
|
|
155
|
+
var aIsHot = hotBonds.includes(a.billAddress.toLowerCase()) && ((_a = a.discount) !== null && _a !== void 0 ? _a : 0) > 0;
|
|
156
|
+
var bIsHot = hotBonds.includes(b.billAddress.toLowerCase()) && ((_b = b.discount) !== null && _b !== void 0 ? _b : 0) > 0;
|
|
157
|
+
if (aIsHot && !bIsHot) {
|
|
158
|
+
return -1;
|
|
159
|
+
}
|
|
160
|
+
else if (!aIsHot && bIsHot) {
|
|
161
|
+
return 1;
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
return b.discount - a.discount;
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
var _f = useState(initSortedBonds), sortedBonds = _f[0], setSortedBonds = _f[1];
|
|
168
|
+
var _g = useState(true), isAscending = _g[0], setIsAscending = _g[1];
|
|
169
169
|
var sortBondsByName = function () {
|
|
170
170
|
var sorted = __spreadArray([], sortedBonds, true).sort(function (a, b) {
|
|
171
171
|
if (isAscending) {
|
|
@@ -213,7 +213,7 @@ var Bonds = function (_a) {
|
|
|
213
213
|
setSelectedBond(bond);
|
|
214
214
|
navigate("/bondsingle/".concat(bond.billAddress));
|
|
215
215
|
};
|
|
216
|
-
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: [_jsxs(Flex, __assign({ className: "column column-tokens", onClick: sortBondsByName }, { children: [_jsx(Flex, __assign({ className: "column column-tokenname" }, { children: "Tokens" })), _jsx(Flex, { className: "column column-tokenicons" })] })), _jsxs(Flex, __assign({ className: "column column-bondinfo" }, { children: [_jsx(Flex, __assign({ className: "column column-discount" }, { children: _jsxs(TooltipBubble, __assign({ body: _jsx(Flex, { children: TooltipText.Discount }), width: "230px", placement: "bottomLeft", transformTip: "translate(18%, -4%)" }, { children: ["Discount", _jsx(Flex, __assign({ className: "column header-icon" }, { children: _jsx(Svg, { icon: "questionCircle", width: "12px" }) }))] })) })), _jsx(Flex, __assign({ className: "column column-arr" }, { children: _jsxs(TooltipBubble, __assign({ body: _jsx(Flex, { children: TooltipText.ARR }), width: "230px", placement: "bottomLeft", transformTip: "translate(8%, -5%)" }, { children: ["ARR", _jsx(Flex, __assign({ className: "column header-icon" }, { children: _jsx(Svg, { icon: "questionCircle", width: "12px" }) }))] })) })), _jsx(Flex, __assign({ className: "column column-term" }, { children: _jsxs(TooltipBubble, __assign({ body: _jsx(Flex, { children: TooltipText.Terms }), width: "230px", placement: "bottomRight", transformTip: "translate(11%, -5%)" }, { children: ["Terms", _jsx(Flex, __assign({ className: "column header-icon" }, { children: _jsx(Svg, { icon: "questionCircle", width: "12px" }) }))] })) })), _jsx(Flex, __assign({ className: "column column-tokensremaining" }, { children: _jsxs(TooltipBubble, __assign({ body: _jsx(Flex, { children: TooltipText.TokensRemaining }), width: "230px", placement: "bottomRight", transformTip: "translate(12%, -4%)" }, { children: ["Tokens Remaining", _jsx(Flex, __assign({ className: "column header-icon" }, { children: _jsx(Svg, { icon: "questionCircle", width: "12px" }) }))] })) })), _jsx(Flex, { className: "column column-hotbond" })] }))] })),
|
|
216
|
+
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: [_jsxs(Flex, __assign({ className: "column column-tokens", onClick: sortBondsByName }, { children: [_jsx(Flex, __assign({ className: "column column-tokenname" }, { children: "Tokens" })), _jsx(Flex, { className: "column column-tokenicons" })] })), _jsxs(Flex, __assign({ className: "column column-bondinfo" }, { children: [_jsx(Flex, __assign({ className: "column column-discount" }, { children: _jsxs(TooltipBubble, __assign({ body: _jsx(Flex, { children: TooltipText.Discount }), width: "230px", placement: "bottomLeft", transformTip: "translate(18%, -4%)" }, { children: ["Discount", _jsx(Flex, __assign({ className: "column header-icon" }, { children: _jsx(Svg, { icon: "questionCircle", width: "12px" }) }))] })) })), _jsx(Flex, __assign({ className: "column column-arr" }, { children: _jsxs(TooltipBubble, __assign({ body: _jsx(Flex, { children: TooltipText.ARR }), width: "230px", placement: "bottomLeft", transformTip: "translate(8%, -5%)" }, { children: ["ARR", _jsx(Flex, __assign({ className: "column header-icon" }, { children: _jsx(Svg, { icon: "questionCircle", width: "12px" }) }))] })) })), _jsx(Flex, __assign({ className: "column column-term" }, { children: _jsxs(TooltipBubble, __assign({ body: _jsx(Flex, { children: TooltipText.Terms }), width: "230px", placement: "bottomRight", transformTip: "translate(11%, -5%)" }, { children: ["Terms", _jsx(Flex, __assign({ className: "column header-icon" }, { children: _jsx(Svg, { icon: "questionCircle", width: "12px" }) }))] })) })), _jsx(Flex, __assign({ className: "column column-tokensremaining" }, { children: _jsxs(TooltipBubble, __assign({ body: _jsx(Flex, { children: TooltipText.TokensRemaining }), width: "230px", placement: "bottomRight", transformTip: "translate(12%, -4%)" }, { children: ["Tokens Remaining", _jsx(Flex, __assign({ className: "column header-icon" }, { children: _jsx(Svg, { icon: "questionCircle", width: "12px" }) }))] })) })), _jsx(Flex, { className: "column column-hotbond" })] }))] })), sortedBonds.map(function (bond) {
|
|
217
217
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
218
218
|
return (_jsxs(Flex, __assign({ className: "container bondrow-container", onClick: function () { return rowClick(bond); } }, { children: [_jsxs(Flex, __assign({ className: "column column-tokens" }, { children: [_jsx(Flex, __assign({ className: "column column-tokenname" }, { children: bond.showcaseTokenName })), _jsxs(Flex, __assign({ className: "column column-tokenicons" }, { children: [_jsx(TooltipBubble, __assign({ body: _jsx(Tooltip, { tokenContract: (bond === null || bond === void 0 ? void 0 : bond.payoutToken) || '', secondURL: getBillContractURL(bond), secondURLTitle: 'View Bond Contract', thirdURL: "https://dashboard.ape.bond/bond/".concat((_a = bond === null || bond === void 0 ? void 0 : bond.billAddress) === null || _a === void 0 ? void 0 : _a.toLowerCase()), thirdURLTitle: 'View Insights', twitter: bond === null || bond === void 0 ? void 0 : bond.twitter, projectLink: bond === null || bond === void 0 ? void 0 : bond.projectLink, audit: bond === null || bond === void 0 ? void 0 : bond.audit, chain: (_b = bond.chainId) !== null && _b !== void 0 ? _b : ChainId.BSC }), width: "205px", placement: "bottomRight", transformTip: "translate(11%, 0%)" }, { children: _jsx(Svg, { icon: "infoSolid", width: "12px" }) })), _jsx(Flex, __assign({ className: "column-tokenicons projectinfo", onClick: function () { return iconClick(bond); } }, { children: _jsx(Svg, { icon: "expand", width: "15px", color: "white2" }) }), bond.billAddress)] })), _jsx(Flex, __assign({ className: "column column-tokentags" }, { children: _jsx(ListTag, { text: (_c = bond === null || bond === void 0 ? void 0 : bond.tags) === null || _c === void 0 ? void 0 : _c[0], variant: ((_d = bond === null || bond === void 0 ? void 0 : bond.tags) === null || _d === void 0 ? void 0 : _d[0]) === 'Cex Fund' ? 'cex_fund' : 'liquidity' }) }))] })), _jsxs(Flex, __assign({ className: "column column-bondinfo" }, { children: [_jsx(Flex, __assign({ className: "column column-discount ".concat(getDiscountColor(bond === null || bond === void 0 ? void 0 : bond.discount)) }, { children: "".concat((_e = bond === null || bond === void 0 ? void 0 : bond.discount) === null || _e === void 0 ? void 0 : _e.toFixed(2), "%") })), _jsx(Flex, __assign({ className: "column column-arr" }, { children: "".concat(((((_f = bond === null || bond === void 0 ? void 0 : bond.discount) !== null && _f !== void 0 ? _f : 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: {
|
|
219
219
|
width: '127px',
|