@ape.swap/bonds-sdk 1.0.103 → 1.0.105

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.
@@ -53,7 +53,7 @@ import axios from 'axios';
53
53
  import { ethers } from 'ethers';
54
54
  import { useWeb3React } from '@web3-react/core';
55
55
  import { useSearchParams, useNavigate } from 'react-router-dom';
56
- import styles, { getColumnDiscountStyle } from './styles';
56
+ import styles from './styles';
57
57
  import getTimePeriods from '../../utils/getTimePeriods';
58
58
  import { defaultTheme } from '../../theme';
59
59
  import Svg from '../uikit/Svg';
@@ -137,25 +137,17 @@ var Bonds = function (_a) {
137
137
  });
138
138
  var _f = useState(false), isModalOpen = _f[0], setIsModalOpen = _f[1];
139
139
  var _g = useState(null), selectedBond = _g[0], setSelectedBond = _g[1];
140
- // const rowClick = (bond: BondsDataResponse) => {
141
- // const url = `${window.location.origin}?bondAddress=${bond.billAddress}&bondChain=${bond.chainId}`;
142
- // window.location.href = url;
143
- // // setSelectedBond(bond);
144
- // // setIsModalOpen(true);
145
- // };
146
140
  var rowClick = function (bond) {
147
141
  setSelectedBond(bond);
148
142
  setIsModalOpen(true);
149
143
  navigate("/?bondAddress=".concat(bond.billAddress, "&bondChain=").concat(bond.chainId), { replace: true });
150
144
  };
151
- var handleCloseModal = function () {
152
- setIsModalOpen(false);
153
- setSelectedBond(null);
154
- navigate('/', { replace: true });
145
+ var getDiscountColorStyle = function (discount) {
146
+ return discount < 0 ? 'discount-negative' : 'discount-positive';
155
147
  };
156
148
  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: [_jsx(Flex, __assign({ className: "column column-header" }, { children: "Tokens" })), _jsx(Flex, __assign({ className: "column column-header" }, { children: "Discount" })), _jsx(Flex, __assign({ className: "column column-header" }, { children: "ARR" })), _jsx(Flex, __assign({ className: "column column-header" }, { children: "Terms" })), _jsx(Flex, __assign({ className: "column column-header" }, { children: "Tokens Remaining" })), _jsx(Flex, { className: "column column-header" })] })), sortedBonds.map(function (bond) {
157
- var _a, _b, _c, _d;
158
- return (_jsxs(Flex, __assign({ className: "container bondrow-container", onClick: function () { return rowClick(bond); } }, { children: [_jsx(Flex, __assign({ className: "column column-token", sx: styles.columnToken }, { children: bond.showcaseTokenName })), _jsx(Flex, __assign({ className: "column column-discount", sx: getColumnDiscountStyle((_a = bond === null || bond === void 0 ? void 0 : bond.discount) !== null && _a !== void 0 ? _a : 0) }, { children: "".concat((_b = bond === null || bond === void 0 ? void 0 : bond.discount) === null || _b === void 0 ? void 0 : _b.toFixed(2), "%") })), _jsx(Flex, __assign({ className: "column column-arr", sx: styles.columnArr }, { children: "".concat(((((_c = bond === null || bond === void 0 ? void 0 : bond.discount) !== null && _c !== void 0 ? _c : 0) * 365) / vestingTime(bond.vestingTerm).days).toFixed(2), "%") })), _jsx(Flex, __assign({ className: "column column-term", sx: styles.columnTerm }, { children: vestingTime(bond.vestingTerm).days ? "".concat(vestingTime(bond.vestingTerm).days, " D") : '-' })), _jsx(Flex, __assign({ className: "column column-tokensremaining", sx: styles.columnTokensRemaining }, { children: bond.tokensRemaining.split('.')[0] })), _jsx(Flex, __assign({ className: "column column-hotbond" }, { children: _jsx(Flex, __assign({ className: "column column-icon" }, { children: hotBonds.includes(bond.billAddress.toLowerCase()) && ((_d = bond.discount) !== null && _d !== void 0 ? _d : 0) > 0 && (_jsx(Svg, { icon: "fire", width: "20px" })) })) }))] }), bond.billAddress));
149
+ var _a, _b, _c;
150
+ return (_jsxs(Flex, __assign({ className: "container bondrow-container", onClick: function () { return rowClick(bond); } }, { children: [_jsx(Flex, __assign({ className: "column column-token", sx: styles.columnToken }, { children: bond.showcaseTokenName })), _jsx(Flex, __assign({ className: "column column-discount ".concat(getDiscountColorStyle(bond === null || bond === void 0 ? void 0 : bond.discount)) }, { children: "".concat((_a = bond === null || bond === void 0 ? void 0 : bond.discount) === null || _a === void 0 ? void 0 : _a.toFixed(2), "%") })), _jsx(Flex, __assign({ className: "column column-arr" }, { children: "".concat(((((_b = bond === null || bond === void 0 ? void 0 : bond.discount) !== null && _b !== void 0 ? _b : 0) * 365) / vestingTime(bond.vestingTerm).days).toFixed(2), "%") })), _jsx(Flex, __assign({ className: "column column-term" }, { children: vestingTime(bond.vestingTerm).days ? "".concat(vestingTime(bond.vestingTerm).days, " D") : '-' })), _jsx(Flex, __assign({ className: "column column-tokensremaining" }, { children: bond.tokensRemaining.split('.')[0] })), _jsx(Flex, __assign({ className: "column column-hotbond" }, { children: _jsx(Flex, __assign({ className: "column column-icon" }, { children: hotBonds.includes(bond.billAddress.toLowerCase()) && ((_c = bond.discount) !== null && _c !== void 0 ? _c : 0) > 0 && (_jsx(Svg, { icon: "fire", width: "20px" })) })) }))] }), bond.billAddress));
159
151
  })] }))] })));
160
152
  };
161
153
  export default Bonds;
@@ -52,6 +52,14 @@
52
52
  align-items: center;
53
53
  }
54
54
 
55
+ .discount-positive {
56
+ color: #38A611;
57
+ }
58
+
59
+ .discount-negative {
60
+ color: #DF4141;
61
+ }
62
+
55
63
  .column.column-term {
56
64
  width: 50px;
57
65
  flex-direction: column;
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.103",
6
+ "version": "1.0.105",
7
7
  "main": "dist/index.js",
8
8
  "module": "dist/index.es.js",
9
9
  "types": "dist/index.d.ts",