@ape.swap/bonds-sdk 1.0.95 → 1.0.96
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,10 +1,9 @@
|
|
|
1
1
|
/** @jsxImportSource theme-ui */
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import '../../scss/bondmodal.scss';
|
|
4
|
-
|
|
5
|
-
declare const BondModal: ({ isOpen, onClose, bond }: {
|
|
4
|
+
declare const BondModal: ({ isOpen, onClose, bondAddress }: {
|
|
6
5
|
isOpen: boolean;
|
|
7
6
|
onClose: () => void;
|
|
8
|
-
|
|
9
|
-
}) => React.JSX.Element | null;
|
|
7
|
+
bondAddress: string | null;
|
|
8
|
+
}) => React.JSX.Element[] | null;
|
|
10
9
|
export default BondModal;
|
|
@@ -10,6 +10,8 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import { jsxs as _jsxs, jsx as _jsx } from "theme-ui/jsx-runtime";
|
|
13
|
+
/** @jsxImportSource theme-ui */
|
|
14
|
+
import { useEffect, useState } from 'react';
|
|
13
15
|
import { Flex, ThemeUIProvider, Input } from "theme-ui";
|
|
14
16
|
import { useWeb3React } from "@web3-react/core";
|
|
15
17
|
import { getColumnDiscountStyle } from '../Bonds/styles';
|
|
@@ -18,15 +20,27 @@ import '../../scss/bondmodal.scss';
|
|
|
18
20
|
import getTimePeriods from '../../utils/getTimePeriods';
|
|
19
21
|
import { Button } from '../uikit/Button';
|
|
20
22
|
import Svg from '../uikit/Svg';
|
|
23
|
+
import axios from 'axios';
|
|
21
24
|
var BondModal = function (_a) {
|
|
22
|
-
var
|
|
23
|
-
var isOpen = _a.isOpen, onClose = _a.onClose, bond = _a.bond;
|
|
25
|
+
var isOpen = _a.isOpen, onClose = _a.onClose, bondAddress = _a.bondAddress;
|
|
24
26
|
if (!isOpen)
|
|
25
27
|
return null;
|
|
26
|
-
var
|
|
28
|
+
var _b = useWeb3React(), account = _b.account, isActive = _b.isActive;
|
|
27
29
|
var vestingTime = function (vestingTerm) {
|
|
28
30
|
return getTimePeriods(vestingTerm !== null && vestingTerm !== void 0 ? vestingTerm : 0, true);
|
|
29
31
|
};
|
|
30
|
-
|
|
32
|
+
var _c = useState([]), bondData = _c[0], setBondData = _c[1];
|
|
33
|
+
useEffect(function () {
|
|
34
|
+
axios.get('https://realtime-api.ape.bond/bonds').then(function (response) {
|
|
35
|
+
var bond = response.data.bonds.filter(function (x) {
|
|
36
|
+
return x.billAddress.toLowerCase() === (bondAddress === null || bondAddress === void 0 ? void 0 : bondAddress.toLowerCase());
|
|
37
|
+
});
|
|
38
|
+
setBondData(bond);
|
|
39
|
+
});
|
|
40
|
+
}, []);
|
|
41
|
+
return (bondData.map(function (bond) {
|
|
42
|
+
var _a, _b, _c, _d, _e, _f;
|
|
43
|
+
return (_jsx(ThemeUIProvider, __assign({ theme: defaultTheme }, { children: _jsx(Flex, __assign({ className: "modal modal-backdrop" }, { children: _jsxs(Flex, __assign({ className: "modal modal-content" }, { children: [isActive && account && (_jsxs("p", { children: ["Wallet Address: ", account] })), _jsxs(Flex, __assign({ className: "modal modal-header" }, { children: [_jsx(Flex, __assign({ className: "new" }, { children: "NEW" })), _jsxs(Flex, __assign({ className: "project-info" }, { children: ["Project Info", _jsx(Flex, __assign({ className: "project-info icon" }, { children: _jsx(Svg, { icon: "expand" }) }))] })), _jsx(Flex, __assign({ className: "svg-close", onClick: onClose }, { children: _jsx(Svg, { icon: "close" }) }))] })), _jsxs(Flex, __assign({ className: "modal-container table-container" }, { children: [_jsxs(Flex, __assign({ className: "modal-container title-container" }, { children: [_jsx(Flex, __assign({ className: "title-container bond" }, { children: bond === null || bond === void 0 ? void 0 : bond.showcaseTokenName })), _jsxs(Flex, __assign({ className: "title-container bond-price" }, { children: [_jsx(Flex, __assign({ className: "bond-price price" }, { children: "$0.0111" })), _jsx(Flex, __assign({ className: "bond-price discounted" }, { children: "$0.0101" }))] }))] })), _jsx(Flex, __assign({ className: "modal-container description-container" }, { children: bond === null || bond === void 0 ? void 0 : bond.shortDescription })), _jsxs(Flex, __assign({ className: "modal-container blocks-container" }, { children: [_jsxs(Flex, __assign({ className: "modal-block column-discount", sx: getColumnDiscountStyle((_a = bond === null || bond === void 0 ? void 0 : bond.discount) !== null && _a !== void 0 ? _a : 0) }, { children: [_jsxs(Flex, __assign({ className: "block-header header" }, { children: ["Discount", _jsx(Flex, __assign({ className: "block-header icon" }, { children: _jsx(Svg, { icon: "questionFill", width: "15px" }) }))] })), "".concat((_b = bond === null || bond === void 0 ? void 0 : bond.discount) === null || _b === void 0 ? void 0 : _b.toFixed(2), "%")] })), _jsxs(Flex, __assign({ className: "modal-block column-arr" }, { children: [_jsxs(Flex, __assign({ className: "block-header header" }, { children: ["ARR", _jsx(Flex, __assign({ className: "block-header icon" }, { children: _jsx(Svg, { icon: "questionFill", width: "15px" }) }))] })), "".concat("".concat(((((_c = bond === null || bond === void 0 ? void 0 : bond.discount) !== null && _c !== void 0 ? _c : 0) * 365) / vestingTime((_d = bond === null || bond === void 0 ? void 0 : bond.vestingTerm) !== null && _d !== void 0 ? _d : 0).days).toFixed(2), "%"))] })), _jsxs(Flex, __assign({ className: "modal-block column-term" }, { children: [_jsxs(Flex, __assign({ className: "block-header header" }, { children: ["Terms", _jsx(Flex, __assign({ className: "block-header icon" }, { children: _jsx(Svg, { icon: "questionFill", width: "15px" }) }))] })), vestingTime((_e = bond === null || bond === void 0 ? void 0 : bond.vestingTerm) !== null && _e !== void 0 ? _e : 0).days ? "".concat(vestingTime((_f = bond === null || bond === void 0 ? void 0 : bond.vestingTerm) !== null && _f !== void 0 ? _f : 0).days, " D") : '-'] })), _jsxs(Flex, __assign({ className: "modal-block column-maxbuy" }, { children: [_jsxs(Flex, __assign({ className: "block-header header" }, { children: ["Max Buy", _jsx(Flex, __assign({ className: "block-header icon" }, { children: _jsx(Svg, { icon: "questionFill", width: "15px" }) }))] })), "1,000,000"] }))] })), _jsxs(Flex, __assign({ className: "modal-container text-container" }, { children: [_jsxs(Flex, __assign({ className: "text-container row" }, { children: [_jsx("div", { children: "You spend:" }), _jsxs("div", { children: ["0 ", bond === null || bond === void 0 ? void 0 : bond.principalTokenName, " = $ 0"] })] })), _jsxs(Flex, __assign({ className: "text-container row" }, { children: [_jsxs("div", { children: ["Premium: ", _jsx(Svg, { icon: "questionFill", width: "15px" })] }), _jsx("div", { children: "$ 0" })] })), _jsxs(Flex, __assign({ className: "text-container row" }, { children: [_jsx("div", { children: "You get (over 90 days):" }), _jsxs("div", { children: ["0 ", bond === null || bond === void 0 ? void 0 : bond.showcaseTokenName, " = $ 0"] })] }))] })), _jsxs(Flex, __assign({ className: "modal-container input-container" }, { children: [_jsx(Flex, __assign({ className: "input-container input" }, { children: _jsx(Input, { type: "number", className: "number-input", placeholder: "0.0" }) })), _jsx(Flex, __assign({ className: "input-container token" }, { children: bond === null || bond === void 0 ? void 0 : bond.principalTokenName }))] })), _jsxs(Flex, __assign({ className: "modal-container button-container" }, { children: [_jsx(Flex, __assign({ className: "button-container get" }, { children: _jsxs(Button, { children: ["Get ", bond === null || bond === void 0 ? void 0 : bond.principalTokenName] }) })), _jsx(Flex, __assign({ className: "button-container buy" }, { children: _jsxs(Button, { children: ["Buy ", bond === null || bond === void 0 ? void 0 : bond.showcaseTokenName] }) }))] }))] }))] })) })) })));
|
|
44
|
+
}));
|
|
31
45
|
};
|
|
32
46
|
export default BondModal;
|
|
@@ -57,7 +57,6 @@ 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';
|
|
61
60
|
var Bonds = function (_a) {
|
|
62
61
|
var connectionString = _a.connectionString;
|
|
63
62
|
var _b = useWeb3React(), account = _b.account, isActive = _b.isActive;
|
|
@@ -147,7 +146,7 @@ var Bonds = function (_a) {
|
|
|
147
146
|
// setSelectedBond(bond);
|
|
148
147
|
// setIsModalOpen(true);
|
|
149
148
|
};
|
|
150
|
-
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" })] })),
|
|
149
|
+
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) {
|
|
151
150
|
var _a, _b, _c, _d;
|
|
152
151
|
return (
|
|
153
152
|
// <Flex className="container bondrow-container" onClick={() => handleRowClick(bond.billAddress)}>
|