@ape.swap/bonds-sdk 1.0.482 → 1.0.484
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.
|
@@ -31,6 +31,6 @@ var BondRowHeader = function (_a) {
|
|
|
31
31
|
//setChainFilterOption(['All Chains'])
|
|
32
32
|
setFilterOption(newOption);
|
|
33
33
|
}, [setFilterOption]);
|
|
34
|
-
return (_jsxs(Flex, __assign({ className: "container header-container" }, { children: [_jsx(Flex, __assign({ sx: { display: ['none', 'none', 'none', 'flex'], mr: '20px' } }, { children: _jsx(RecommendationSelector, { options: filterOptions, activeOption: filterOption, setActiveOption: handleFilterSelection }) })), _jsx(Flex, __assign({ sx: { display: ['flex', 'flex', 'flex', 'none'], width: '100%' } }, { children: _jsx(MenuSelect, { selectedOption: filterOption, setOption: setFilterOption, options: mappedFilters, sx: { background: 'white2' } }) })), _jsxs(Flex, __assign({ className: "column column-tokens" }, { children: [_jsx(Flex, __assign({ className: "column column-search", sx: { width: '100%', maxWidth: ['200px', '200px', '200px', '340px'] } }, { children: _jsx(Input, { value: inputValue, onChange: onInputChange, variant: "search", sx: { fontWeight: 400, background: 'white2', height: '30px', fontSize: '14px', color: 'white' }, width: '100%', placeholder: 'Search...' }) })), _jsx(Flex, { className: "column column-tokenicons" })] })), _jsxs(Flex, __assign({ className: "column column-bondinfo" }, { children: [_jsxs(Flex, __assign({ className: "column column-discount" }, { children: [_jsx(Flex, __assign({ className: "column tooltip" }, { 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", color: "textDisabledButton" }) }))] })) })), _jsx(Flex, __assign({ className: "column header-icon", onClick: function () { return onSort('discount'); } }, { children: _jsx(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) }))] })), _jsxs(Flex, __assign({ className: "column column-arr" }, { children: [_jsx(Flex, __assign({ className: "column tooltip" }, { 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", color: "textDisabledButton" }) }))] })) })), _jsx(Flex, __assign({ className: "column header-icon", onClick: function () { return onSort('arr'); } }, { children: _jsx(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) }))] })), _jsxs(Flex, __assign({ className: "column column-terms" }, { children: [_jsx(Flex, __assign({ className: "column tooltip" }, { 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", color: "textDisabledButton" }) }))] })) })), _jsx(Flex, __assign({ className: "column header-icon", onClick: function () { return onSort('terms'); } }, { children: _jsx(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) }))] })), _jsxs(Flex, __assign({ className: "column column-tokensremaining" }, { children: [_jsx(Flex, __assign({ className: "column tooltip" }, { 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", color: "textDisabledButton" }) }))] })) })), _jsx(Flex, __assign({ className: "column header-icon", onClick: function () { return onSort('tokensRemaining'); } }, { children: _jsx(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) }))] })), _jsx(Flex, { className: "column column-hotbond" })] }))] })));
|
|
34
|
+
return (_jsxs(Flex, __assign({ className: "container header-container" }, { children: [_jsxs(Flex, __assign({ className: "header-container filters" }, { children: [_jsx(Flex, __assign({ sx: { display: ['none', 'none', 'none', 'flex'], mr: '20px' } }, { children: _jsx(RecommendationSelector, { options: filterOptions, activeOption: filterOption, setActiveOption: handleFilterSelection }) })), _jsx(Flex, __assign({ sx: { display: ['flex', 'flex', 'flex', 'none'], width: '100%' } }, { children: _jsx(MenuSelect, { selectedOption: filterOption, setOption: setFilterOption, options: mappedFilters, sx: { background: 'white2' } }) }))] })), _jsxs(Flex, __assign({ className: "header-container rows" }, { children: [_jsxs(Flex, __assign({ className: "column column-tokens" }, { children: [_jsx(Flex, __assign({ className: "column column-search", sx: { width: '100%', maxWidth: ['200px', '200px', '200px', '340px'] } }, { children: _jsx(Input, { value: inputValue, onChange: onInputChange, variant: "search", sx: { fontWeight: 400, background: 'white2', height: '30px', fontSize: '14px', color: 'white' }, width: '100%', placeholder: 'Search...' }) })), _jsx(Flex, { className: "column column-tokenicons" })] })), _jsxs(Flex, __assign({ className: "column column-bondinfo" }, { children: [_jsxs(Flex, __assign({ className: "column column-discount" }, { children: [_jsx(Flex, __assign({ className: "column tooltip" }, { 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", color: "textDisabledButton" }) }))] })) })), _jsx(Flex, __assign({ className: "column header-icon", onClick: function () { return onSort('discount'); } }, { children: _jsx(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) }))] })), _jsxs(Flex, __assign({ className: "column column-arr" }, { children: [_jsx(Flex, __assign({ className: "column tooltip" }, { 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", color: "textDisabledButton" }) }))] })) })), _jsx(Flex, __assign({ className: "column header-icon", onClick: function () { return onSort('arr'); } }, { children: _jsx(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) }))] })), _jsxs(Flex, __assign({ className: "column column-terms" }, { children: [_jsx(Flex, __assign({ className: "column tooltip" }, { 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", color: "textDisabledButton" }) }))] })) })), _jsx(Flex, __assign({ className: "column header-icon", onClick: function () { return onSort('terms'); } }, { children: _jsx(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) }))] })), _jsxs(Flex, __assign({ className: "column column-tokensremaining" }, { children: [_jsx(Flex, __assign({ className: "column tooltip" }, { 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", color: "textDisabledButton" }) }))] })) })), _jsx(Flex, __assign({ className: "column header-icon", onClick: function () { return onSort('tokensRemaining'); } }, { children: _jsx(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) }))] })), _jsx(Flex, { className: "column column-hotbond" })] }))] }))] })));
|
|
35
35
|
};
|
|
36
36
|
export default BondRowHeader;
|
|
@@ -65,8 +65,6 @@ import getTimePeriods from '../../utils/getTimePeriods';
|
|
|
65
65
|
import { defaultTheme } from '../../theme';
|
|
66
66
|
import { BigNumber } from 'bignumber.js';
|
|
67
67
|
import { ChainId } from '../../enum/apeswaplists';
|
|
68
|
-
import { formatValue } from '../../utils/formatNumbers';
|
|
69
|
-
import { BLOCK_EXPLORER } from '../../config/constants/chains';
|
|
70
68
|
import '../../scss/Bonds.scss';
|
|
71
69
|
import BondRowHeader from '../../components/BondRows/BondRowHeader';
|
|
72
70
|
import BondRowsByChain from '../../components/BondRows/BondRowsByChain';
|
|
@@ -214,30 +212,12 @@ var Bonds = function (_a) {
|
|
|
214
212
|
var vestingTime = function (vestingTerm) {
|
|
215
213
|
return getTimePeriods(vestingTerm !== null && vestingTerm !== void 0 ? vestingTerm : 0, true);
|
|
216
214
|
};
|
|
217
|
-
var getDiscountColor = function (discount) {
|
|
218
|
-
return discount < 0 ? 'discount-negative' : 'discount-positive';
|
|
219
|
-
};
|
|
220
215
|
var remainingPercentage = function (bond) {
|
|
221
216
|
var _a, _b;
|
|
222
217
|
var totalMaxPayout = new BigNumber((_a = bond.maxTotalPayout) !== null && _a !== void 0 ? _a : '0').div(new BigNumber(10).pow(bond.payoutTokenDecimals));
|
|
223
218
|
var remainingTokens = new BigNumber((_b = bond.tokensRemaining) !== null && _b !== void 0 ? _b : '0');
|
|
224
219
|
return remainingTokens.div(totalMaxPayout).times(100).toNumber();
|
|
225
220
|
};
|
|
226
|
-
var remainingTokensFormat = function (bond) {
|
|
227
|
-
var _a;
|
|
228
|
-
return formatValue({ num: new BigNumber((_a = bond.tokensRemaining) !== null && _a !== void 0 ? _a : '0') });
|
|
229
|
-
};
|
|
230
|
-
var remainingTokensUsd = function (bond) {
|
|
231
|
-
var _a, _b;
|
|
232
|
-
var tokens = new BigNumber((_a = bond.tokensRemaining) !== null && _a !== void 0 ? _a : '0');
|
|
233
|
-
return tokens.times((_b = bond.payoutTokenPrice) !== null && _b !== void 0 ? _b : 0);
|
|
234
|
-
};
|
|
235
|
-
var getBillContractURL = function (bond) {
|
|
236
|
-
var _a;
|
|
237
|
-
var selectedChain = (_a = bond.chainId) !== null && _a !== void 0 ? _a : ChainId.BSC;
|
|
238
|
-
var explorerLink = BLOCK_EXPLORER[selectedChain];
|
|
239
|
-
return "".concat(explorerLink, "/address/").concat(bond === null || bond === void 0 ? void 0 : bond.billAddress);
|
|
240
|
-
};
|
|
241
221
|
var calculateARR = function (bond) {
|
|
242
222
|
var _a;
|
|
243
223
|
var discount = (_a = bond === null || bond === void 0 ? void 0 : bond.discount) !== null && _a !== void 0 ? _a : 0;
|
|
@@ -247,31 +227,27 @@ var Bonds = function (_a) {
|
|
|
247
227
|
// Search logic
|
|
248
228
|
var _j = useState(''), inputValue = _j[0], setInputValue = _j[1];
|
|
249
229
|
var _k = useState(sortedBonds), filteredBonds = _k[0], setFilteredBonds = _k[1];
|
|
250
|
-
useEffect(
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
}, [inputValue, sortedBonds]);
|
|
230
|
+
// useEffect(() => {
|
|
231
|
+
// if (inputValue === '') {
|
|
232
|
+
// setFilteredBonds(sortedBonds);
|
|
233
|
+
// } else {
|
|
234
|
+
// setFilteredBonds(
|
|
235
|
+
// sortedBonds.filter(bond =>
|
|
236
|
+
// bond.showcaseTokenName.toLowerCase().includes(inputValue.toLowerCase())
|
|
237
|
+
// ));
|
|
238
|
+
// }
|
|
239
|
+
// }, [inputValue, sortedBonds]);
|
|
260
240
|
var handleInputChange = function (event) {
|
|
261
241
|
setInputValue(event.target.value);
|
|
262
242
|
};
|
|
263
243
|
var topTags = useTopTags(filteredBonds);
|
|
264
|
-
var filterOptions = __spreadArray(__spreadArray(['ALL'
|
|
244
|
+
var filterOptions = __spreadArray(__spreadArray(['ALL'], topTags, true), ['SOLD OUT'], false);
|
|
265
245
|
var _l = useState(filterOptions[0]), filterOption = _l[0], setFilterOption = _l[1];
|
|
266
246
|
var handleChangeFilterOption = useCallback(function (newOption) {
|
|
267
247
|
setFilterOption(newOption);
|
|
268
248
|
}, []);
|
|
269
|
-
var handleFilterSelection = useCallback(function (newOption) {
|
|
270
|
-
//setChainFilterOption(['All Chains'])
|
|
271
|
-
setFilterOption(newOption);
|
|
272
|
-
}, [setFilterOption]);
|
|
273
249
|
var billstoRender = useMemo(function () {
|
|
274
|
-
var billsToReturn =
|
|
250
|
+
var billsToReturn = sortedBonds !== null && sortedBonds !== void 0 ? sortedBonds : [];
|
|
275
251
|
if (inputValue) {
|
|
276
252
|
billsToReturn = billsToReturn === null || billsToReturn === void 0 ? void 0 : billsToReturn.filter(function (bill) {
|
|
277
253
|
var _a;
|
|
@@ -290,10 +266,10 @@ var Bonds = function (_a) {
|
|
|
290
266
|
// Page render logic
|
|
291
267
|
var _m = useState(false), bondsRendered = _m[0], setBondsRendered = _m[1];
|
|
292
268
|
useEffect(function () {
|
|
293
|
-
if (
|
|
269
|
+
if (billstoRender.length > 0) {
|
|
294
270
|
setBondsRendered(true);
|
|
295
271
|
}
|
|
296
272
|
}, [filteredBonds]);
|
|
297
|
-
return (_jsxs(ThemeUIProvider, __assign({ theme: defaultTheme }, { children: [isActive && account && _jsx("p", { children: account }), isActive && account && _jsx("button", __assign({ onClick: handleApprove }, { children: "Approve USDT" })),
|
|
273
|
+
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: [_jsx(BondRowHeader, { inputValue: inputValue, filterOptions: filterOptions, filterOption: filterOption, setFilterOption: handleChangeFilterOption, onInputChange: handleInputChange, onSort: handleSort }), bondsRendered && (_jsx(BondRowsByChain, { bonds: billstoRender, hotBonds: hotBonds, hideTitles: inputValue !== '', rowClick: rowClick }))] }))] })));
|
|
298
274
|
};
|
|
299
275
|
export default Bonds;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
display: flex;
|
|
3
3
|
justify-content: space-around;
|
|
4
4
|
align-items: center;
|
|
5
|
-
flex-direction:
|
|
5
|
+
flex-direction: column;
|
|
6
6
|
width: 100%;
|
|
7
7
|
padding-top: 5px;
|
|
8
8
|
padding-left: 15px;
|
|
@@ -12,6 +12,20 @@
|
|
|
12
12
|
color: #73728E;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
.header-container.filters {
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-direction: row;
|
|
18
|
+
align-items: center;
|
|
19
|
+
width: 100%;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.header-container.rows {
|
|
23
|
+
display: flex;
|
|
24
|
+
flex-direction: row;
|
|
25
|
+
align-items: center;
|
|
26
|
+
width: 100%;
|
|
27
|
+
}
|
|
28
|
+
|
|
15
29
|
.column.column-tokens {
|
|
16
30
|
display: flex;
|
|
17
31
|
align-items: center;
|