@ape.swap/bonds-sdk 1.0.72 → 1.0.73

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.
@@ -0,0 +1,10 @@
1
+ /** @jsxImportSource theme-ui */
2
+ import React from 'react';
3
+ import '../../scss/bondmodal.scss';
4
+ import { BondsDataResponse } from '../../types/bonds';
5
+ declare const BondModal: ({ isOpen, onClose, bond }: {
6
+ isOpen: boolean;
7
+ onClose: () => void;
8
+ bond: BondsDataResponse | null;
9
+ }) => React.JSX.Element | null;
10
+ export default BondModal;
@@ -0,0 +1,32 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "theme-ui/jsx-runtime";
13
+ import { Flex, ThemeUIProvider } from "theme-ui";
14
+ import { useWeb3React } from "@web3-react/core";
15
+ import { getColumnDiscountStyle } from '../Bonds/styles';
16
+ import { defaultTheme } from '../../theme';
17
+ import '../../scss/bondmodal.scss';
18
+ import getTimePeriods from '../../utils/getTimePeriods';
19
+ var BondModal = function (_a) {
20
+ var _b, _c, _d, _e, _f, _g;
21
+ var isOpen = _a.isOpen, onClose = _a.onClose, bond = _a.bond;
22
+ if (!isOpen)
23
+ return null;
24
+ // make pages for modal and single bond page
25
+ // make button to buy bond
26
+ var _h = useWeb3React(), account = _h.account, isActive = _h.isActive;
27
+ var vestingTime = function (vestingTerm) {
28
+ return getTimePeriods(vestingTerm !== null && vestingTerm !== void 0 ? vestingTerm : 0, true);
29
+ };
30
+ return (_jsxs(ThemeUIProvider, __assign({ theme: defaultTheme }, { children: [_jsxs("div", { children: ["Bond Single Page", _jsx("p", { children: bond === null || bond === void 0 ? void 0 : bond.billAddress })] }), isActive && account && (_jsx("p", { children: account })), _jsxs(Flex, __assign({ className: "container table-container" }, { children: [_jsxs(Flex, __assign({ className: "container header-container" }, { children: [_jsx(Flex, __assign({ className: "column column-header" }, { children: "Token" })), _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" }))] })), _jsxs(Flex, __assign({ className: "container bondrow-container" }, { children: [_jsx(Flex, __assign({ className: "column column-token" }, { children: _jsxs("button", { children: ["Buy ", bond === null || bond === void 0 ? void 0 : bond.showcaseTokenName] }) })), _jsx(Flex, __assign({ className: "column column-discount", sx: getColumnDiscountStyle((_b = bond === null || bond === void 0 ? void 0 : bond.discount) !== null && _b !== void 0 ? _b : 0) }, { children: "".concat((_c = bond === null || bond === void 0 ? void 0 : bond.discount) === null || _c === void 0 ? void 0 : _c.toFixed(2), "%") })), _jsx(Flex, __assign({ className: "column column-arr" }, { children: "".concat("".concat(((((_d = bond === null || bond === void 0 ? void 0 : bond.discount) !== null && _d !== void 0 ? _d : 0) * 365) / vestingTime((_e = bond === null || bond === void 0 ? void 0 : bond.vestingTerm) !== null && _e !== void 0 ? _e : 0).days).toFixed(2), "%")) })), _jsx(Flex, __assign({ className: "column column-term" }, { children: vestingTime((_f = bond === null || bond === void 0 ? void 0 : bond.vestingTerm) !== null && _f !== void 0 ? _f : 0).days ? "".concat(vestingTime((_g = bond === null || bond === void 0 ? void 0 : bond.vestingTerm) !== null && _g !== void 0 ? _g : 0).days, " D") : '-' })), _jsx(Flex, __assign({ className: "column column-tokensremaining" }, { children: bond === null || bond === void 0 ? void 0 : bond.tokensRemaining.split('.')[0] }))] }))] }))] })));
31
+ };
32
+ export default BondModal;
@@ -39,7 +39,7 @@ var BondSingle = function (_a) {
39
39
  }, []);
40
40
  return (_jsxs(ThemeUIProvider, __assign({ theme: defaultTheme }, { children: [_jsxs("div", { children: ["Bond Single Page", _jsx("p", { children: billAddress })] }), isActive && account && (_jsx("p", { children: account })), _jsxs(Flex, __assign({ className: "container table-container" }, { children: [_jsxs(Flex, __assign({ className: "container header-container" }, { children: [_jsx(Flex, __assign({ className: "column column-header" }, { children: "Token" })), _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" }))] })), bondData.map(function (bond) {
41
41
  var _a, _b, _c;
42
- return (_jsxs(Flex, __assign({ className: "container bondrow-container" }, { children: [_jsxs(Flex, __assign({ className: "column column-token" }, { children: [_jsx("button", { children: "Buy Bond" }), 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" }, { children: "".concat("".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" }, { children: vestingTime(bond.vestingTerm).days ? "".concat(vestingTime(bond.vestingTerm).days, " D") : '-' })), _jsx(Flex, __assign({ className: "column column-tokensremaining" }, { children: bond.tokensRemaining.split('.')[0] }))] })));
42
+ return (_jsxs(Flex, __assign({ className: "container bondrow-container" }, { children: [_jsx(Flex, __assign({ className: "column column-token" }, { children: _jsxs("button", { children: ["Buy ", 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" }, { children: "".concat("".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" }, { children: vestingTime(bond.vestingTerm).days ? "".concat(vestingTime(bond.vestingTerm).days, " D") : '-' })), _jsx(Flex, __assign({ className: "column column-tokensremaining" }, { children: bond.tokensRemaining.split('.')[0] }))] })));
43
43
  })] }))] })));
44
44
  };
45
45
  export default BondSingle;
@@ -57,6 +57,7 @@ import getTimePeriods from '../../utils/getTimePeriods';
57
57
  import { defaultTheme } from '../../theme';
58
58
  import Svg from '../uikit/Svg';
59
59
  import '../../scss/bonds.scss';
60
+ import BondModal from '../BondModal/BondModal';
60
61
  var Bonds = function (_a) {
61
62
  var connectionString = _a.connectionString;
62
63
  var _b = useWeb3React(), account = _b.account, isActive = _b.isActive;
@@ -137,9 +138,15 @@ var Bonds = function (_a) {
137
138
  var url = "".concat(window.location.origin, "/bondsingle/").concat(billAddress);
138
139
  window.location.href = url;
139
140
  };
140
- 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) {
141
+ var _e = useState(false), isModalOpen = _e[0], setIsModalOpen = _e[1];
142
+ var _f = useState(null), selectedBond = _f[0], setSelectedBond = _f[1];
143
+ var rowClickModal = function (bond) {
144
+ setSelectedBond(bond);
145
+ setIsModalOpen(true);
146
+ };
147
+ 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" })] })), _jsx(BondModal, { isOpen: isModalOpen, onClose: function () { return setIsModalOpen(false); }, bond: selectedBond }), sortedBonds.map(function (bond) {
141
148
  var _a, _b, _c, _d;
142
- return (_jsxs(Flex, __assign({ className: "container bondrow-container", onClick: function () { return handleRowClick(bond.billAddress); } }, { 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("".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: "icon icon-tooltip" }, { children: hotBonds.includes(bond.billAddress.toLowerCase()) && ((_d = bond.discount) !== null && _d !== void 0 ? _d : 0) > 0 && (_jsx(Svg, { icon: "fire", width: "20px" })) })) }))] })));
149
+ return (_jsxs(Flex, __assign({ className: "container bondrow-container", onClick: function () { return rowClickModal(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("".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: "icon icon-tooltip" }, { children: hotBonds.includes(bond.billAddress.toLowerCase()) && ((_d = bond.discount) !== null && _d !== void 0 ? _d : 0) > 0 && (_jsx(Svg, { icon: "fire", width: "20px" })) })) }))] })));
143
150
  })] }))] })));
144
151
  };
145
152
  export default Bonds;
@@ -0,0 +1,70 @@
1
+
2
+ .container.table-container {
3
+ width: 100%;
4
+ display: flex;
5
+ flex-direction: column;
6
+ padding: 50px;
7
+ }
8
+
9
+ .container.header-container {
10
+ display: flex;
11
+ justify-content: space-around;
12
+ padding: 5px;
13
+ font-size: 12px;
14
+ color: #78787D;
15
+ }
16
+
17
+ .container.bondrow-container {
18
+ display: flex;
19
+ flex-direction: row;
20
+ width: 100%;
21
+ justify-content: space-around;
22
+ background-color:#151320;
23
+ margin-bottom: 10px;
24
+ padding: 20px;
25
+ border-radius: 10px;
26
+ border: 1px solid #4B4B53;
27
+ cursor: pointer;
28
+ }
29
+
30
+ .column.column-token {
31
+ width: 100px;
32
+ flex-direction: column;
33
+ justify-content: center;
34
+ align-items: center;
35
+ }
36
+
37
+ .column.column-discount {
38
+ width: 50px;
39
+ flex-direction: column;
40
+ justify-content: center;
41
+ align-items: center;
42
+ }
43
+
44
+ .column.column-arr {
45
+ width: 50px;
46
+ flex-direction: column;
47
+ justify-content: center;
48
+ align-items: center;
49
+ }
50
+
51
+ .column.column-term {
52
+ width: 50px;
53
+ flex-direction: column;
54
+ justify-content: center;
55
+ align-items: center;
56
+ }
57
+
58
+ .column.column-tokensremaining {
59
+ width: 50px;
60
+ flex-direction: column;
61
+ justify-content: center;
62
+ align-items: center;
63
+ }
64
+
65
+ .column.column-hotbond {
66
+ width: 50px;
67
+ flex-direction: column;
68
+ justify-content: center;
69
+ align-items: center;
70
+ }
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.72",
6
+ "version": "1.0.73",
7
7
  "main": "dist/index.js",
8
8
  "module": "dist/index.es.js",
9
9
  "types": "dist/index.d.ts",