@ape.swap/bonds-sdk 1.0.290 → 1.0.292

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.
@@ -58,10 +58,8 @@ import { defaultTheme } from '../../theme';
58
58
  import '../../scss/YourBonds.scss';
59
59
  import { BigNumber } from 'bignumber.js';
60
60
  import { BillVersion, ChainId } from '../../enum/apeswaplists';
61
- import ProgressBarWrapper from '../ProgressBar/ProgressBarWrapper';
62
- import ProgressBar from '../ProgressBar/ProgressBar';
63
- import { formatDollar, formatValue } from '../../utils/formatNumbers';
64
- import { Svg, Text, Button } from '../uikit-sdk';
61
+ import { formatValue } from '../../utils/formatNumbers';
62
+ import { Text, Button } from '../uikit-sdk';
65
63
  import { BLOCK_EXPLORER, MAINNET_CHAINS } from '../../config/constants/chains';
66
64
  import TokenInfoAndName from '../TokenInfoAndName';
67
65
  import { ACF_TO_ABOND } from '../../config/constants/addresses';
@@ -69,6 +67,7 @@ import multicall from '../../utils/multicall';
69
67
  import billAbi from '../../config/abi/bond.json';
70
68
  import { getBalanceNumber } from '../../utils/getBalanceNumber';
71
69
  import { getFirstNonZeroDigits } from '../../utils/roundNumber';
70
+ import { formatNumberSI } from '../../utils/formatNumber';
72
71
  var YourBonds = function (_a) {
73
72
  var connectionString = _a.connectionString;
74
73
  var _b = useWeb3React(), account = _b.account, isActive = _b.isActive;
@@ -347,19 +346,22 @@ var YourBonds = function (_a) {
347
346
  var _a;
348
347
  return getFirstNonZeroDigits(parseFloat((_a = bond === null || bond === void 0 ? void 0 : bond.payoutTokenPrice) !== null && _a !== void 0 ? _a : '0'));
349
348
  };
350
- 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: [_jsxs(Flex, __assign({ className: "container header-container" }, { children: [_jsxs(Flex, __assign({ className: "column column-tokens" }, { children: [_jsx(Flex, { className: "column column-tokenname" }), _jsx(Flex, { className: "column column-tokenicons" })] })), _jsxs(Flex, __assign({ className: "column column-bondinfo" }, { children: [_jsx(Flex, __assign({ className: "column column-discount" }, { children: _jsx(Text, { children: "Claimable" }) })), _jsx(Flex, __assign({ className: "column column-arr" }, { children: _jsx(Text, { children: "Pending" }) })), _jsx(Flex, __assign({ className: "column column-term" }, { children: _jsx(Text, { children: "Terms" }) })), _jsx(Flex, __assign({ className: "column column-tokensremaining" }, { children: _jsx(Flex, __assign({ className: "button-container get" }, { children: _jsx(Button, { children: "CLAIM ALL" }) })) }))] }))] })), userOwnedBillsData.flat().map(function (data) {
349
+ 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: [_jsxs(Flex, __assign({ className: "container header-container" }, { children: [_jsxs(Flex, __assign({ className: "column column-tokens" }, { children: [_jsx(Flex, { className: "column column-tokenname" }), _jsx(Flex, { className: "column column-tokenicons" })] })), _jsxs(Flex, __assign({ className: "column column-bondinfo" }, { children: [_jsx(Flex, __assign({ className: "column column-claimable" }, { children: _jsx(Text, { children: "Claimable" }) })), _jsx(Flex, __assign({ className: "column column-pending" }, { children: _jsx(Text, { children: "Pending" }) })), _jsx(Flex, __assign({ className: "column column-term" }, { children: _jsx(Text, { children: "Terms" }) })), _jsx(Flex, __assign({ className: "column column-claimall" }, { children: _jsx(Button, __assign({ disabled: !account, sx: {
350
+ height: ['36px', '36px', '36px', '26px'],
351
+ lineHeight: '12px',
352
+ fontSize: '14px',
353
+ fontWeight: 600,
354
+ width: '100%',
355
+ } }, { children: "Claim All" })) }))] }))] })), userOwnedBillsData.flat().map(function (data) {
351
356
  return data.userOwnedBills.map(function (bill) {
352
- var _a, _b, _c, _d;
353
- return (_jsxs(Flex, __assign({ className: "container bondrow-container", onClick: function () { return rowClick(bill.bond); } }, { children: [_jsxs(Flex, __assign({ className: "column column-tokens" }, { children: [_jsx(Flex, __assign({ className: "column column-tokeninfoname" }, { children: _jsx(TokenInfoAndName, { bond: bill.bond }) })), _jsx(Flex, { className: "column column-tokenicons" })] })), _jsxs(Flex, __assign({ className: "column column-bondinfo" }, { children: [_jsx(Flex, __assign({ className: "column column-discount" }, { children: "($".concat((claimable(bill) * ((_a = parseFloat(earnTokenPrice(bill.bond))) !== null && _a !== void 0 ? _a : 0)).toFixed(2), ")") })), _jsx(Flex, __assign({ className: "column column-arr" }, { children: "".concat(((((_c = (_b = bill.bond) === null || _b === void 0 ? void 0 : _b.discount) !== null && _c !== void 0 ? _c : 0) * 365) / vestingTime(bill.bond.vestingTerm).days).toFixed(2), "%") })), _jsx(Flex, __assign({ className: "column column-term" }, { children: vestingTime(bill.bond.vestingTerm).days ? "".concat(vestingTime(bill.bond.vestingTerm).days, " D") : '-' })), _jsx(Flex, __assign({ className: "column column-tokensremaining" }, { children: _jsx(ProgressBarWrapper, { title: '', value: _jsx(ProgressBar, { value: remainingPercentage(bill.bond) }), style: {
354
- width: '127px',
355
- height: '25px',
356
- flexDirection: 'column',
357
- justifyContent: 'center',
358
- display: ['none', 'none', 'none', 'flex'],
359
- }, showTooltip: true, toolTip: "".concat(remainingTokensFormat(bill.bond), " ").concat(bill.bond.payoutTokenName, " (").concat(formatDollar({
360
- num: remainingTokensUsd(bill.bond).toNumber(),
361
- isPrice: true,
362
- }), ")") }) })), _jsx(Flex, __assign({ className: "column column-hotbond" }, { children: _jsx(Flex, __assign({ className: "column column-icon" }, { children: hotBonds.includes(bill.bond.billAddress.toLowerCase()) && ((_d = bill.bond.discount) !== null && _d !== void 0 ? _d : 0) > 0 && (_jsx(Svg, { icon: "hot", width: "20px" })) })) }))] }))] }), bill.bond.billAddress));
357
+ var _a, _b, _c;
358
+ return (_jsxs(Flex, __assign({ className: "container bondrow-container", onClick: function () { return rowClick(bill.bond); } }, { children: [_jsxs(Flex, __assign({ className: "column column-tokens" }, { children: [_jsx(Flex, __assign({ className: "column column-tokeninfoname" }, { children: _jsx(TokenInfoAndName, { bond: bill.bond }) })), _jsx(Flex, { className: "column column-tokenicons" })] })), _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), ")")] })), _jsx(Flex, __assign({ className: "column column-pending" }, { children: "".concat(((((_c = (_b = bill.bond) === null || _b === void 0 ? void 0 : _b.discount) !== null && _c !== void 0 ? _c : 0) * 365) / vestingTime(bill.bond.vestingTerm).days).toFixed(2), "%") })), _jsx(Flex, __assign({ className: "column column-term" }, { children: vestingTime(bill.bond.vestingTerm).days ? "".concat(vestingTime(bill.bond.vestingTerm).days, " D") : '-' })), _jsx(Flex, __assign({ className: "column column-claimall" }, { children: _jsx(Button, __assign({ disabled: !account, sx: {
359
+ height: ['36px', '36px', '36px', '26px'],
360
+ lineHeight: '12px',
361
+ fontSize: '14px',
362
+ fontWeight: 600,
363
+ width: '100%',
364
+ } }, { children: "Claim" })) }))] }))] }), bill.bond.billAddress));
363
365
  });
364
366
  })] }))] })));
365
367
  };
@@ -80,24 +80,14 @@
80
80
  width: 60%;
81
81
  }
82
82
 
83
- .column.column-discount {
83
+ .column.column-claimable {
84
84
  flex-direction: column;
85
85
  justify-content: center;
86
86
  align-items: center;
87
87
  width: 20%;
88
88
  }
89
89
 
90
- .discount-positive {
91
- color: #38A611;
92
- width: 20%;
93
- }
94
-
95
- .discount-negative {
96
- color: #DF4141;
97
- width: 20%;
98
- }
99
-
100
- .column.column-arr {
90
+ .column.column-pending {
101
91
  flex-direction: column;
102
92
  justify-content: center;
103
93
  align-items: center;
@@ -111,23 +101,9 @@
111
101
  width: 20%;
112
102
  }
113
103
 
114
- .column.column-tokensremaining {
104
+ .column.column-claimall {
115
105
  flex-direction: column;
116
106
  justify-content: center;
117
107
  align-items: center;
118
108
  width: 20%;
119
- }
120
-
121
- .column.column-hotbond {
122
- flex-direction: column;
123
- justify-content: center;
124
- align-items: center;
125
- width: 10%;
126
- }
127
-
128
- .column.header-icon {
129
- padding-left: 5px;
130
- align-items: start;
131
- cursor: pointer;
132
- opacity: 0.6;
133
109
  }
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.290",
6
+ "version": "1.0.292",
7
7
  "main": "dist/index.js",
8
8
  "module": "dist/index.es.js",
9
9
  "types": "dist/index.d.ts",