@ape.swap/bonds-sdk 1.0.689 → 1.0.691

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.
@@ -6,7 +6,7 @@ import '../../scss/BondRowsByChain.scss';
6
6
  var BondRowsByChain = function (_a) {
7
7
  var bonds = _a.bonds, hotBonds = _a.hotBonds, hideTitles = _a.hideTitles, rowClick = _a.rowClick, chains = _a.chains;
8
8
  return (_jsx(Flex, { className: "bondrowsbychain", children: (MAINNET_CHAINS.map(function (chain, index) {
9
- return ((chains === null || chains === void 0 ? void 0 : chains.length) === 0 || (chains === null || chains === void 0 ? void 0 : chains.includes(chain)) &&
9
+ return ((!chains || chains.length === 0 || chains.includes(chain)) &&
10
10
  _jsx(BondRowsWithTitle, { chain: chain, bonds: bonds, hotBonds: hotBonds, hideTitles: hideTitles, rowClick: rowClick }, chain));
11
11
  })) }));
12
12
  };
@@ -23,10 +23,10 @@ import { useTopTags } from '../../hooks/useTopThreeTags';
23
23
  import useChainFilterOption from '../../components/BondMenu/useChainFilterOption';
24
24
  var Bonds = function (_a) {
25
25
  // const navigate = useNavigate();
26
- var account = _a.account, accountChainId = _a.accountChainId, isActive = _a.isActive, chains = _a.chains;
26
+ var account = _a.account, accountChainId = _a.accountChainId, isActive = _a.isActive, _b = _a.chains, chains = _b === void 0 ? [] : _b;
27
27
  // Fetch data
28
- var _b = useState([]), bondData = _b[0], setBondData = _b[1];
29
- var _c = useState([]), hotBonds = _c[0], setHotBonds = _c[1];
28
+ var _c = useState([]), bondData = _c[0], setBondData = _c[1];
29
+ var _d = useState([]), hotBonds = _d[0], setHotBonds = _d[1];
30
30
  var isSoldOut = useCallback(function (bond) {
31
31
  var _a, _b;
32
32
  var thresholdToHide = new BigNumber(100).div((_a = bond.payoutTokenPrice) !== null && _a !== void 0 ? _a : 0);
@@ -69,8 +69,8 @@ var Bonds = function (_a) {
69
69
  return b.discount - a.discount;
70
70
  }
71
71
  });
72
- var _d = useState(null), sortConfig = _d[0], setSortConfig = _d[1];
73
- var _e = useState(sortedHotBonds), sortedBonds = _e[0], setSortedBonds = _e[1];
72
+ var _e = useState(null), sortConfig = _e[0], setSortConfig = _e[1];
73
+ var _f = useState(sortedHotBonds), sortedBonds = _f[0], setSortedBonds = _f[1];
74
74
  var handleSort = function (key) {
75
75
  var direction = 'asc';
76
76
  if ((sortConfig === null || sortConfig === void 0 ? void 0 : sortConfig.key) === key && (sortConfig === null || sortConfig === void 0 ? void 0 : sortConfig.direction) === 'asc') {
@@ -112,8 +112,8 @@ var Bonds = function (_a) {
112
112
  setSortedBonds(sorted);
113
113
  }, [sortConfig, bondData]);
114
114
  // Modal
115
- var _f = useState(false), isModalOpen = _f[0], setIsModalOpen = _f[1];
116
- var _g = useState(null), selectedBond = _g[0], setSelectedBond = _g[1];
115
+ var _g = useState(false), isModalOpen = _g[0], setIsModalOpen = _g[1];
116
+ var _h = useState(null), selectedBond = _h[0], setSelectedBond = _h[1];
117
117
  var rowClick = function (bond) {
118
118
  setSelectedBond(bond);
119
119
  setIsModalOpen(true);
@@ -139,11 +139,11 @@ var Bonds = function (_a) {
139
139
  return parseFloat((((discount * 365) / vestingDays).toFixed(2)));
140
140
  };
141
141
  // Search logic
142
- var _h = useState(''), inputValue = _h[0], setInputValue = _h[1];
142
+ var _j = useState(''), inputValue = _j[0], setInputValue = _j[1];
143
143
  var topTags = useTopTags(sortedBonds);
144
144
  var filterOptions = __spreadArray(__spreadArray(['ALL'], topTags, true), ['SOLD OUT'], false);
145
- var _j = useState(filterOptions[0]), filterOption = _j[0], setFilterOption = _j[1];
146
- var _k = useChainFilterOption(), chainFilterOption = _k.data, setChainFilterOption = _k.setChainFilterOption;
145
+ var _k = useState(filterOptions[0]), filterOption = _k[0], setFilterOption = _k[1];
146
+ var _l = useChainFilterOption(), chainFilterOption = _l.data, setChainFilterOption = _l.setChainFilterOption;
147
147
  var billstoRender = useMemo(function () {
148
148
  var billsToReturn = sortedBonds !== null && sortedBonds !== void 0 ? sortedBonds : [];
149
149
  if (inputValue) {
@@ -173,7 +173,7 @@ var Bonds = function (_a) {
173
173
  setInputValue(event.target.value);
174
174
  };
175
175
  // Page render logic
176
- var _l = useState(false), bondsRendered = _l[0], setBondsRendered = _l[1];
176
+ var _m = useState(false), bondsRendered = _m[0], setBondsRendered = _m[1];
177
177
  useEffect(function () {
178
178
  if (billstoRender.length > 0) {
179
179
  setBondsRendered(true);
@@ -255,9 +255,9 @@ var YourBonds = function (_a) {
255
255
  setIsModalOpen(false);
256
256
  };
257
257
  return (_jsxs(ThemeUIProvider, { theme: defaultTheme, children: [isModalOpen &&
258
- _jsx(YourBondsModal, { isOpen: true, onClose: closeModal, userBill: selectedBill }), toastMessage && (_jsx(Flex, { className: "toast", children: toastMessage })), bondsRendered && (_jsxs(Flex, { className: "container table-container", children: [_jsxs(Flex, { className: "container header-container", children: [_jsx(Flex, { className: "column column-tokens", children: _jsx(Flex, { className: "column column-search", sx: { width: '100%', maxWidth: ['200px', '200px', '200px', '340px'] }, children: _jsx(Input, { value: inputValue, onChange: handleInputChange, variant: "search", sx: { fontWeight: 400, background: 'white2', height: '30px', fontSize: '14px', color: 'white' }, width: '100%', placeholder: 'Search...' }) }) }), _jsxs(Flex, { className: "column column-bondinfo", children: [_jsxs(Flex, { className: "column header-claimable", children: [_jsx(Text, { sx: { fontSize: '11px', color: 'textDisabledButton' }, children: "CLAIMABLE" }), _jsx(Flex, { className: "column header-icon", onClick: function () { return handleSort('claimable'); }, children: _jsx(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) })] }), _jsxs(Flex, { className: "column header-pending", children: [_jsx(Text, { sx: { fontSize: '11px', color: 'textDisabledButton' }, children: "PENDING" }), _jsx(Flex, { className: "column header-icon", onClick: function () { return handleSort('pending'); }, children: _jsx(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) })] }), _jsxs(Flex, { className: "column header-terms", children: [_jsx(Text, { sx: { fontSize: '11px', color: 'textDisabledButton' }, children: "TERMS" }), _jsx(Flex, { className: "column header-icon", onClick: function () { return handleSort('terms'); }, children: _jsx(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) })] }), _jsx(Flex, { className: "column header-claimall" })] })] }), filteredBonds.map(function (bill) {
258
+ _jsx(YourBondsModal, { isOpen: true, onClose: closeModal, userBill: selectedBill }), toastMessage && (_jsx(Flex, { className: "toast", children: toastMessage })), bondsRendered && (_jsxs(Flex, { className: "yourbonds table-container", children: [_jsxs(Flex, { className: "yourbonds header-container", children: [_jsx(Flex, { className: "column column-tokens", children: _jsx(Flex, { className: "column column-search", sx: { width: '100%', maxWidth: ['200px', '200px', '200px', '340px'] }, children: _jsx(Input, { value: inputValue, onChange: handleInputChange, variant: "search", sx: { fontWeight: 400, background: 'white2', height: '30px', fontSize: '14px', color: 'white' }, width: '100%', placeholder: 'Search...' }) }) }), _jsxs(Flex, { className: "column column-bondinfo", children: [_jsxs(Flex, { className: "column header-claimable", children: [_jsx(Text, { sx: { fontSize: '11px', color: 'textDisabledButton' }, children: "CLAIMABLE" }), _jsx(Flex, { className: "column header-icon", onClick: function () { return handleSort('claimable'); }, children: _jsx(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) })] }), _jsxs(Flex, { className: "column header-pending", children: [_jsx(Text, { sx: { fontSize: '11px', color: 'textDisabledButton' }, children: "PENDING" }), _jsx(Flex, { className: "column header-icon", onClick: function () { return handleSort('pending'); }, children: _jsx(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) })] }), _jsxs(Flex, { className: "column header-terms", children: [_jsx(Text, { sx: { fontSize: '11px', color: 'textDisabledButton' }, children: "TERMS" }), _jsx(Flex, { className: "column header-icon", onClick: function () { return handleSort('terms'); }, children: _jsx(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) })] }), _jsx(Flex, { className: "column header-claimall" })] })] }), filteredBonds.map(function (bill) {
259
259
  var _a, _b;
260
- return (_jsxs(Flex, { className: "container bondrow-container", onClick: function () { return rowClick(bill); }, children: [_jsx(Flex, { className: "column column-tokens", children: _jsx(Flex, { className: "column column-tokeninfoname", children: _jsx(TokenInfoAndName, { bill: bill.bond, vestEnds: "Ends in ".concat(getPendingVesting(bill.lastBlockTimestamp, bill.vesting)) }) }) }), _jsxs(Flex, { className: "column column-bondinfo", children: [_jsxs(Flex, { className: "column column-claimable", children: [formatNumberSI(parseFloat(claimable(bill).toFixed(4)), 4), _jsx(Text, { sx: { opacity: '0.6', fontSize: '12px', paddingLeft: '5px' }, children: "($".concat((claimable(bill) * ((_a = parseFloat(earnTokenPrice(bill.bond))) !== null && _a !== void 0 ? _a : 0)).toFixed(2), ")") })] }), _jsxs(Flex, { className: "column column-pending", children: [formatNumberSI(parseFloat(totalPending(bill).toFixed(0)), 0), _jsx(Text, { sx: { opacity: '0.6', fontSize: '12px', paddingLeft: '5px' }, children: "($".concat((totalPending(bill) * ((_b = parseFloat(earnTokenPrice(bill.bond))) !== null && _b !== void 0 ? _b : 0)).toFixed(2), ")") })] }), _jsx(Flex, { className: "column column-terms", children: "".concat(vestingTimeRemaining(bill).days, "d, ").concat(vestingTimeRemaining(bill).hours, "h, ").concat(vestingTimeRemaining(bill).minutes, "m") }), _jsx(Flex, { className: "column column-claimall", children: _jsx(Button, { className: "claim-button", disabled: claimable(bill) === 0 || isPending, onClick: function (event) {
260
+ return (_jsxs(Flex, { className: "yourbonds bondrow-container", onClick: function () { return rowClick(bill); }, children: [_jsx(Flex, { className: "column column-tokens", children: _jsx(Flex, { className: "column column-tokeninfoname", children: _jsx(TokenInfoAndName, { bill: bill.bond, vestEnds: "Ends in ".concat(getPendingVesting(bill.lastBlockTimestamp, bill.vesting)) }) }) }), _jsxs(Flex, { className: "column column-bondinfo", children: [_jsxs(Flex, { className: "column column-claimable", children: [formatNumberSI(parseFloat(claimable(bill).toFixed(4)), 4), _jsx(Text, { sx: { opacity: '0.6', fontSize: '12px', paddingLeft: '5px' }, children: "($".concat((claimable(bill) * ((_a = parseFloat(earnTokenPrice(bill.bond))) !== null && _a !== void 0 ? _a : 0)).toFixed(2), ")") })] }), _jsxs(Flex, { className: "column column-pending", children: [formatNumberSI(parseFloat(totalPending(bill).toFixed(0)), 0), _jsx(Text, { sx: { opacity: '0.6', fontSize: '12px', paddingLeft: '5px' }, children: "($".concat((totalPending(bill) * ((_b = parseFloat(earnTokenPrice(bill.bond))) !== null && _b !== void 0 ? _b : 0)).toFixed(2), ")") })] }), _jsx(Flex, { className: "column column-terms", children: "".concat(vestingTimeRemaining(bill).days, "d, ").concat(vestingTimeRemaining(bill).hours, "h, ").concat(vestingTimeRemaining(bill).minutes, "m") }), _jsx(Flex, { className: "column column-claimall", children: _jsx(Button, { className: "claim-button", disabled: claimable(bill) === 0 || isPending, onClick: function (event) {
261
261
  event.stopPropagation();
262
262
  // Add your claim logic here
263
263
  handleClaim(bill.id, bill.address);
@@ -1,5 +1,5 @@
1
1
 
2
- .container.table-container {
2
+ .yourbonds.table-container {
3
3
  width: 100%;
4
4
  display: flex;
5
5
  flex-direction: column;
@@ -9,7 +9,7 @@
9
9
  padding-bottom: 50px;
10
10
  }
11
11
 
12
- .container.header-container {
12
+ .yourbonds.header-container {
13
13
  display: flex;
14
14
  flex-direction: row;
15
15
  width: 100%;
@@ -22,7 +22,7 @@
22
22
  color: #73728E;
23
23
  }
24
24
 
25
- .container.bondrow-container {
25
+ .yourbonds.bondrow-container {
26
26
  display: flex;
27
27
  flex-direction: row;
28
28
  width: 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.689",
6
+ "version": "1.0.691",
7
7
  "main": "dist/index.js",
8
8
  "module": "dist/index.es.js",
9
9
  "types": "dist/index.d.ts",