@ape.swap/bonds-sdk 1.0.304 → 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;
@@ -339,7 +340,7 @@ var YourBonds = function (_a) {
339
340
  } }, { children: "Claim All" })) }))] }))] })), userOwnedBillsData.flat().map(function (data) {
340
341
  return data.userOwnedBills.map(function (bill) {
341
342
  var _a, _b;
342
- 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: {
343
344
  height: ['36px', '36px', '36px', '26px'],
344
345
  lineHeight: '12px',
345
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.304",
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