@ape.swap/bonds-sdk 1.0.66 → 1.0.68

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.
@@ -1,5 +1,5 @@
1
1
  /** @jsxImportSource theme-ui */
2
2
  import React from 'react';
3
- import '../../scss/bonds.scss';
3
+ import '../../scss/bondsingle.scss';
4
4
  declare const BondSingle: React.FC;
5
5
  export default BondSingle;
@@ -1,8 +1,45 @@
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
+ };
1
12
  import { jsx as _jsx, jsxs as _jsxs } from "theme-ui/jsx-runtime";
2
- import '../../scss/bonds.scss';
13
+ /** @jsxImportSource theme-ui */
14
+ import { useEffect, useState } from 'react';
15
+ import { Flex, ThemeUIProvider } from "theme-ui";
16
+ import axios from "axios";
17
+ import { useWeb3React } from "@web3-react/core";
18
+ import { getColumnDiscountStyle } from '../Bonds/styles';
19
+ import { defaultTheme } from '../../theme';
20
+ import '../../scss/bondsingle.scss';
3
21
  import { useParams } from 'react-router-dom';
22
+ import getTimePeriods from '../../utils/getTimePeriods';
4
23
  var BondSingle = function (_a) {
24
+ // make pages for modal and single bond page
25
+ // make button to buy bond
5
26
  var billAddress = useParams().billAddress;
6
- return (_jsxs("div", { children: ["Bond Clicked", _jsx("p", { children: billAddress })] }));
27
+ var _b = useWeb3React(), account = _b.account, isActive = _b.isActive;
28
+ var _c = useState([]), bondData = _c[0], setBondData = _c[1];
29
+ var vestingTime = function (vestingTerm) {
30
+ return getTimePeriods(vestingTerm !== null && vestingTerm !== void 0 ? vestingTerm : 0, true);
31
+ };
32
+ useEffect(function () {
33
+ axios.get('https://realtime-api.ape.bond/bonds').then(function (response) {
34
+ var bond = response.data.bonds.filter(function (x) {
35
+ return x.billAddress.toLowerCase() === (billAddress === null || billAddress === void 0 ? void 0 : billAddress.toLowerCase());
36
+ });
37
+ setBondData(bond);
38
+ });
39
+ }, []);
40
+ return (_jsxs(ThemeUIProvider, __assign({ theme: defaultTheme }, { children: [_jsxs("div", { children: ["Bond Single Page", _jsx("p", { children: billAddress }), _jsx("button", { children: "Buy Bond" })] }), 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
+ var _a, _b, _c;
42
+ return (_jsxs(Flex, __assign({ className: "container bondrow-container" }, { children: [_jsx(Flex, __assign({ className: "column column-token" }, { 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" }, { 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
+ })] }))] })));
7
44
  };
8
45
  export default BondSingle;
@@ -137,9 +137,9 @@ var Bonds = function (_a) {
137
137
  var url = "".concat(window.location.origin, "/bondsingle/").concat(billAddress);
138
138
  window.open(url, '_blank');
139
139
  };
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", sx: styles.tableContainer }, { children: [_jsxs(Flex, __assign({ className: "container header-container", sx: styles.headerContainer }, { 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) {
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
141
  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", sx: styles.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" })) })) }))] })));
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" })) })) }))] })));
143
143
  })] }))] })));
144
144
  };
145
145
  export default Bonds;
@@ -25,4 +25,46 @@
25
25
  border-radius: 10px;
26
26
  border: 1px solid #4B4B53;
27
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;
28
70
  }
@@ -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.66",
6
+ "version": "1.0.68",
7
7
  "main": "dist/index.js",
8
8
  "module": "dist/index.es.js",
9
9
  "types": "dist/index.d.ts",