@ape.swap/bonds-sdk 1.0.425 → 1.0.426

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.
@@ -224,6 +224,14 @@ var YourBonds = function (_a) {
224
224
  var _a, _b, _c;
225
225
  return getBalanceNumber(new BigNumber(userBill.pendingRewards), (_c = (_b = (_a = userBill.bond.earnToken) === null || _a === void 0 ? void 0 : _a.decimals) === null || _b === void 0 ? void 0 : _b[chainId]) !== null && _c !== void 0 ? _c : 18);
226
226
  };
227
+ var claimableNumber = function (userBill) {
228
+ var _a;
229
+ var val = (claimable(userBill) * ((_a = parseFloat(earnTokenPrice(userBill.bond))) !== null && _a !== void 0 ? _a : 0));
230
+ return val !== null && val !== void 0 ? val : 0;
231
+ };
232
+ var hasPendingRewards = function (bills) {
233
+ return bills.some(function (bill) { return parseFloat(bill.pendingRewards) > 0; });
234
+ };
227
235
  var earnTokenPrice = function (bond) {
228
236
  var _a;
229
237
  return getFirstNonZeroDigits(parseFloat((_a = bond === null || bond === void 0 ? void 0 : bond.payoutTokenPrice) !== null && _a !== void 0 ? _a : '0'));
@@ -259,7 +267,7 @@ var YourBonds = function (_a) {
259
267
  setBondsRendered(true);
260
268
  }
261
269
  }, [filteredBonds]);
262
- return (_jsxs(ThemeUIProvider, __assign({ theme: defaultTheme }, { children: [isActive && account && _jsx("p", { children: account }), isActive && account && _jsx("button", __assign({ onClick: handleApprove }, { children: "Approve USDT" })), bondsRendered && (_jsxs(Flex, __assign({ className: "container table-container" }, { children: [_jsxs(Flex, __assign({ className: "container header-container" }, { children: [_jsx(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: handleInputChange, variant: "search", sx: { fontWeight: 400, background: 'white2', height: '30px', fontSize: '14px' }, width: '100%', placeholder: 'Search...' }) })) })), _jsxs(Flex, __assign({ className: "column column-bondinfo" }, { children: [_jsxs(Flex, __assign({ className: "column header-claimable" }, { children: [_jsx(Text, __assign({ sx: { opacity: '0.6', fontSize: '12px' } }, { children: "Claimable" })), _jsx(Flex, __assign({ className: "column header-icon", sx: { opacity: '0.6' }, onClick: function () { return handleSort('claimable'); } }, { children: _jsx(Svg, { icon: "sort", width: "12px" }) }))] })), _jsxs(Flex, __assign({ className: "column header-pending" }, { children: [_jsx(Text, __assign({ sx: { opacity: '0.6', fontSize: '12px' } }, { children: "Pending" })), _jsx(Flex, __assign({ className: "column header-icon", sx: { opacity: '0.6' }, onClick: function () { return handleSort('pending'); } }, { children: _jsx(Svg, { icon: "sort", width: "12px" }) }))] })), _jsxs(Flex, __assign({ className: "column header-terms" }, { children: [_jsx(Text, __assign({ sx: { opacity: '0.6', fontSize: '12px' } }, { children: "Terms" })), _jsx(Flex, __assign({ className: "column header-icon", sx: { opacity: '0.6' }, onClick: function () { return handleSort('terms'); } }, { children: _jsx(Svg, { icon: "sort", width: "12px" }) }))] })), _jsx(Flex, __assign({ className: "column header-claimall" }, { children: _jsx(Button, __assign({ disabled: !account, sx: {
270
+ return (_jsxs(ThemeUIProvider, __assign({ theme: defaultTheme }, { children: [isActive && account && _jsx("p", { children: account }), isActive && account && _jsx("button", __assign({ onClick: handleApprove }, { children: "Approve USDT" })), bondsRendered && (_jsxs(Flex, __assign({ className: "container table-container" }, { children: [_jsxs(Flex, __assign({ className: "container header-container" }, { children: [_jsx(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: handleInputChange, variant: "search", sx: { fontWeight: 400, background: 'white2', height: '30px', fontSize: '14px' }, width: '100%', placeholder: 'Search...' }) })) })), _jsxs(Flex, __assign({ className: "column column-bondinfo" }, { children: [_jsxs(Flex, __assign({ className: "column header-claimable" }, { children: [_jsx(Text, __assign({ sx: { opacity: '0.6', fontSize: '12px' } }, { children: "Claimable" })), _jsx(Flex, __assign({ className: "column header-icon", sx: { opacity: '0.6' }, onClick: function () { return handleSort('claimable'); } }, { children: _jsx(Svg, { icon: "sort", width: "12px" }) }))] })), _jsxs(Flex, __assign({ className: "column header-pending" }, { children: [_jsx(Text, __assign({ sx: { opacity: '0.6', fontSize: '12px' } }, { children: "Pending" })), _jsx(Flex, __assign({ className: "column header-icon", sx: { opacity: '0.6' }, onClick: function () { return handleSort('pending'); } }, { children: _jsx(Svg, { icon: "sort", width: "12px" }) }))] })), _jsxs(Flex, __assign({ className: "column header-terms" }, { children: [_jsx(Text, __assign({ sx: { opacity: '0.6', fontSize: '12px' } }, { children: "Terms" })), _jsx(Flex, __assign({ className: "column header-icon", sx: { opacity: '0.6' }, onClick: function () { return handleSort('terms'); } }, { children: _jsx(Svg, { icon: "sort", width: "12px" }) }))] })), _jsx(Flex, __assign({ className: "column header-claimall" }, { children: _jsx(Button, __assign({ disabled: !account && !hasPendingRewards(filteredBonds), sx: {
263
271
  height: ['36px', '36px', '36px', '26px'],
264
272
  lineHeight: '12px',
265
273
  fontSize: '14px',
@@ -267,7 +275,7 @@ var YourBonds = function (_a) {
267
275
  width: '100%',
268
276
  } }, { children: "CLAIM ALL" })) }))] }))] })), filteredBonds.map(function (bill) {
269
277
  var _a, _b;
270
- return (_jsxs(Flex, __assign({ className: "container bondrow-container", onClick: function () { return rowClick(bill); } }, { children: [_jsx(Flex, __assign({ className: "column column-tokens" }, { children: _jsx(Flex, __assign({ className: "column column-tokeninfoname" }, { children: _jsx(TokenInfoAndName, { bill: bill.bond, vestEnds: "Ends in ".concat(getPendingVesting(bill.lastBlockTimestamp, bill.vesting)) }) })) })), _jsxs(Flex, __assign({ className: "column column-bondinfo" }, { children: [_jsxs(Flex, __assign({ className: "column column-claimable" }, { children: [formatNumberSI(parseFloat(claimable(bill).toFixed(3)), 0), _jsx(Text, __assign({ 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, __assign({ className: "column column-pending" }, { children: [formatNumberSI(parseFloat(totalPending(bill).toFixed(0)), 0), _jsx(Text, __assign({ 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, __assign({ className: "column column-terms" }, { children: "".concat(vestingTimeRemaining(bill).days, "d, ").concat(vestingTimeRemaining(bill).hours, "h, ").concat(vestingTimeRemaining(bill).minutes, "m") })), _jsx(Flex, __assign({ className: "column column-claimall" }, { children: _jsx(Button, __assign({ disabled: !account, onClick: function (event) {
278
+ return (_jsxs(Flex, __assign({ className: "container bondrow-container", onClick: function () { return rowClick(bill); } }, { children: [_jsx(Flex, __assign({ className: "column column-tokens" }, { children: _jsx(Flex, __assign({ className: "column column-tokeninfoname" }, { children: _jsx(TokenInfoAndName, { bill: bill.bond, vestEnds: "Ends in ".concat(getPendingVesting(bill.lastBlockTimestamp, bill.vesting)) }) })) })), _jsxs(Flex, __assign({ className: "column column-bondinfo" }, { children: [_jsxs(Flex, __assign({ className: "column column-claimable" }, { children: [formatNumberSI(parseFloat(claimable(bill).toFixed(3)), 0), _jsx(Text, __assign({ 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, __assign({ className: "column column-pending" }, { children: [formatNumberSI(parseFloat(totalPending(bill).toFixed(0)), 0), _jsx(Text, __assign({ 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, __assign({ className: "column column-terms" }, { children: "".concat(vestingTimeRemaining(bill).days, "d, ").concat(vestingTimeRemaining(bill).hours, "h, ").concat(vestingTimeRemaining(bill).minutes, "m") })), _jsx(Flex, __assign({ className: "column column-claimall" }, { children: _jsx(Button, __assign({ disabled: !account && (claimableNumber(bill) === 0), onClick: function (event) {
271
279
  event.stopPropagation();
272
280
  // Add your claim logic here
273
281
  }, sx: {
@@ -89,6 +89,7 @@
89
89
  align-items: center;
90
90
  width: 30%;
91
91
  padding-right: 20px;
92
+ padding-bottom: 15px;
92
93
  }
93
94
 
94
95
  .column.column-claimable {
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.425",
6
+ "version": "1.0.426",
7
7
  "main": "dist/index.js",
8
8
  "module": "dist/index.es.js",
9
9
  "types": "dist/index.d.ts",