@ape.swap/bonds-sdk 1.0.104 → 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';
@@ -142,9 +142,12 @@ var Bonds = function (_a) {
142
142
  setIsModalOpen(true);
143
143
  navigate("/?bondAddress=".concat(bond.billAddress, "&bondChain=").concat(bond.chainId), { replace: true });
144
144
  };
145
+ var getDiscountColorStyle = function (discount) {
146
+ return discount < 0 ? 'discount-negative' : 'discount-positive';
147
+ };
145
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) {
146
- var _a, _b, _c, _d;
147
- 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));
148
151
  })] }))] })));
149
152
  };
150
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.104",
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",