@ape.swap/bonds-sdk 1.0.303 → 1.0.305

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.
@@ -67,7 +67,8 @@ import billAbi from '../../config/abi/bond.json';
67
67
  import { getBalanceNumber } from '../../utils/getBalanceNumber';
68
68
  import { getFirstNonZeroDigits } from '../../utils/roundNumber';
69
69
  import { formatNumberSI } from '../../utils/formatNumber';
70
- import useCurrentTime from '../../utils/useTimer';
70
+ import useCurrentTime from '../../hooks/useTimer';
71
+ import { getPendingVesting } from '../../hooks/usePendingVesting';
71
72
  var YourBonds = function (_a) {
72
73
  var connectionString = _a.connectionString;
73
74
  var _b = useWeb3React(), account = _b.account, isActive = _b.isActive;
@@ -317,8 +318,10 @@ var YourBonds = function (_a) {
317
318
  var totalPending = function (userBill) {
318
319
  var _a, _b, _c, _d, _e, _f;
319
320
  console.log(userBill);
321
+ console.log('CHAINID)');
320
322
  console.log((_b = (_a = userBill.bond.earnToken) === null || _a === void 0 ? void 0 : _a.decimals) === null || _b === void 0 ? void 0 : _b[chainId]);
321
- return getBalanceNumber(new BigNumber((_c = userBill === null || userBill === void 0 ? void 0 : userBill.totalPayout) !== null && _c !== void 0 ? _c : 0), (_f = (_e = (_d = userBill.bond.earnToken) === null || _d === void 0 ? void 0 : _d.decimals) === null || _e === void 0 ? void 0 : _e[chainId]) !== null && _f !== void 0 ? _f : 18);
323
+ console.log(userBill.payout);
324
+ return getBalanceNumber(new BigNumber((_c = userBill === null || userBill === void 0 ? void 0 : userBill.payout) !== null && _c !== void 0 ? _c : 0), (_f = (_e = (_d = userBill.bond.earnToken) === null || _d === void 0 ? void 0 : _d.decimals) === null || _e === void 0 ? void 0 : _e[chainId]) !== null && _f !== void 0 ? _f : 18);
322
325
  };
323
326
  var claimable = function (userBill) {
324
327
  var _a, _b, _c;
@@ -337,7 +340,7 @@ var YourBonds = function (_a) {
337
340
  } }, { children: "Claim All" })) }))] }))] })), userOwnedBillsData.flat().map(function (data) {
338
341
  return data.userOwnedBills.map(function (bill) {
339
342
  var _a, _b;
340
- return (_jsxs(Flex, __assign({ className: "container bondrow-container", onClick: function () { return rowClick(bill.bond); } }, { children: [_jsx(Flex, __assign({ className: "column column-tokens" }, { children: _jsx(Flex, __assign({ className: "column column-tokeninfoname" }, { children: _jsx(TokenInfoAndName, { bill: bill.bond }) })) })), _jsxs(Flex, __assign({ className: "column column-bondinfo" }, { children: [_jsxs(Flex, __assign({ className: "column column-claimable" }, { children: [formatNumberSI(parseFloat(claimable(bill).toFixed(3)), 0), "($".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), "($".concat((totalPending(bill) * ((_b = parseFloat(earnTokenPrice(bill.bond))) !== null && _b !== void 0 ? _b : 0)).toFixed(2), ")")] })), _jsx(Flex, __assign({ className: "column column-term" }, { 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(Flex, __assign({ className: "column-claimall button" }, { children: _jsx(Button, __assign({ disabled: !account, sx: {
343
+ return (_jsxs(Flex, __assign({ className: "container bondrow-container", onClick: function () { return rowClick(bill.bond); } }, { 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), "($".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), "($".concat((totalPending(bill) * ((_b = parseFloat(earnTokenPrice(bill.bond))) !== null && _b !== void 0 ? _b : 0)).toFixed(2), ")")] })), _jsx(Flex, __assign({ className: "column column-term" }, { 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(Flex, __assign({ className: "column-claimall button" }, { children: _jsx(Button, __assign({ disabled: !account, sx: {
341
344
  height: ['36px', '36px', '36px', '26px'],
342
345
  lineHeight: '12px',
343
346
  fontSize: '14px',
@@ -0,0 +1,5 @@
1
+ export declare const usePendingVesting: ({ lastBlockTimestamp, vesting }: {
2
+ lastBlockTimestamp: string;
3
+ vesting: string;
4
+ }) => string;
5
+ export declare const getPendingVesting: (lastBlockTimestamp: string, vesting: string) => string;
@@ -0,0 +1,13 @@
1
+ import getTimePeriods from '../utils/getTimePeriods';
2
+ import useCurrentTime from './useTimer';
3
+ export var usePendingVesting = function (_a) {
4
+ var lastBlockTimestamp = _a.lastBlockTimestamp, vesting = _a.vesting;
5
+ var currentTime = useCurrentTime() / 1000;
6
+ var vestingTime = getTimePeriods(parseInt(lastBlockTimestamp) + parseInt(vesting) - currentTime, true);
7
+ return "".concat(vestingTime.days, "d, ").concat(vestingTime.hours, "h, ").concat(vestingTime.minutes, "m");
8
+ };
9
+ export var getPendingVesting = function (lastBlockTimestamp, vesting) {
10
+ var currentTime = new Date().getTime() / 1000;
11
+ var vestingTime = getTimePeriods(parseInt(lastBlockTimestamp) + parseInt(vesting) - currentTime, true);
12
+ return "".concat(vestingTime.days, "d, ").concat(vestingTime.hours, "h, ").concat(vestingTime.minutes, "m");
13
+ };
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.303",
6
+ "version": "1.0.305",
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