@ape.swap/bonds-sdk 1.0.207 → 1.0.209

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.
@@ -63,7 +63,6 @@ import ProgressBar from '../ProgressBar/ProgressBar';
63
63
  import { formatDollar, formatValue } from '../../utils/formatNumbers';
64
64
  import { TooltipText } from '../../enum/tooltips';
65
65
  import { TooltipBubble, Svg } from '../uikit-sdk';
66
- import Tooltip from '../Tooltip/Tooltip';
67
66
  import { BLOCK_EXPLORER } from '../../config/constants/chains';
68
67
  var Bonds = function (_a) {
69
68
  var connectionString = _a.connectionString;
@@ -187,8 +186,8 @@ var Bonds = function (_a) {
187
186
  return "".concat(explorerLink, "/address/").concat(bond === null || bond === void 0 ? void 0 : bond.billAddress);
188
187
  };
189
188
  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-token" }, { children: "Tokens" })), _jsx(Flex, __assign({ className: "column column-discount" }, { children: _jsxs(TooltipBubble, __assign({ body: _jsx(Flex, { children: TooltipText.Discount }), width: "230px", placement: "bottomLeft", transformTip: "translate(18%, -4%)" }, { children: ["Discount", _jsx(Flex, __assign({ className: "column header-icon" }, { children: _jsx(Svg, { icon: "questionCircle", width: "12px" }) }))] })) })), _jsx(Flex, __assign({ className: "column column-arr" }, { children: _jsxs(TooltipBubble, __assign({ body: _jsx(Flex, { children: TooltipText.ARR }), width: "230px", placement: "bottomLeft", transformTip: "translate(8%, -5%)" }, { children: ["ARR", _jsx(Flex, __assign({ className: "column header-icon" }, { children: _jsx(Svg, { icon: "questionCircle", width: "12px" }) }))] })) })), _jsx(Flex, __assign({ className: "column column-term" }, { children: _jsxs(TooltipBubble, __assign({ body: _jsx(Flex, { children: TooltipText.Terms }), width: "230px", placement: "bottomRight", transformTip: "translate(11%, -5%)" }, { children: ["Terms", _jsx(Flex, __assign({ className: "column header-icon" }, { children: _jsx(Svg, { icon: "questionCircle", width: "12px" }) }))] })) })), _jsx(Flex, __assign({ className: "column column-tokensremaining" }, { children: _jsxs(TooltipBubble, __assign({ body: _jsx(Flex, { children: TooltipText.TokensRemaining }), width: "230px", placement: "bottomRight", transformTip: "translate(12%, -4%)" }, { children: ["Tokens Remaining", _jsx(Flex, __assign({ className: "column header-icon" }, { children: _jsx(Svg, { icon: "questionCircle", width: "12px" }) }))] })) })), _jsx(Flex, { className: "column column-hotbond" })] })), sortedBonds.map(function (bond) {
190
- var _a, _b, _c, _d, _e;
191
- return (_jsxs(Flex, __assign({ className: "container bondrow-container", onClick: function () { return rowClick(bond); } }, { children: [_jsxs(Flex, __assign({ className: "column column-token" }, { children: [bond.showcaseTokenName, _jsx(Tooltip, { tokenContract: (bond === null || bond === void 0 ? void 0 : bond.payoutToken) || '', secondURL: getBillContractURL(bond), secondURLTitle: 'View Bond Contract', thirdURL: "https://dashboard.ape.bond/bond/".concat((_a = bond === null || bond === void 0 ? void 0 : bond.billAddress) === null || _a === void 0 ? void 0 : _a.toLowerCase()), thirdURLTitle: 'View Insights', twitter: bond === null || bond === void 0 ? void 0 : bond.twitter, projectLink: bond === null || bond === void 0 ? void 0 : bond.projectLink, audit: bond === null || bond === void 0 ? void 0 : bond.audit, chain: (_b = bond.chainId) !== null && _b !== void 0 ? _b : ChainId.BSC })] })), _jsx(Flex, __assign({ className: "column column-discount ".concat(getDiscountColor(bond === null || bond === void 0 ? void 0 : bond.discount)) }, { 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(((((_d = bond === null || bond === void 0 ? void 0 : bond.discount) !== null && _d !== void 0 ? _d : 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: _jsx(ProgressBarWrapper, { title: '', value: _jsx(ProgressBar, { value: remainingPercentage(bond) }), style: {
189
+ var _a, _b, _c;
190
+ return (_jsxs(Flex, __assign({ className: "container bondrow-container", onClick: function () { return rowClick(bond); } }, { children: [_jsx(Flex, __assign({ className: "column column-token" }, { children: bond.showcaseTokenName })), _jsx(Flex, __assign({ className: "column column-discount ".concat(getDiscountColor(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: _jsx(ProgressBarWrapper, { title: '', value: _jsx(ProgressBar, { value: remainingPercentage(bond) }), style: {
192
191
  width: '127px',
193
192
  height: '25px',
194
193
  flexDirection: 'column',
@@ -197,7 +196,7 @@ var Bonds = function (_a) {
197
196
  }, showTooltip: true, toolTip: "".concat(remainingTokensFormat(bond), " ").concat(bond.payoutTokenName, " (").concat(formatDollar({
198
197
  num: remainingTokensUsd(bond).toNumber(),
199
198
  isPrice: true,
200
- }), ")") }) })), _jsx(Flex, __assign({ className: "column column-hotbond" }, { children: _jsx(Flex, __assign({ className: "column column-icon" }, { children: hotBonds.includes(bond.billAddress.toLowerCase()) && ((_e = bond.discount) !== null && _e !== void 0 ? _e : 0) > 0 && (_jsx(Svg, { icon: "hot", width: "20px" })) })) }))] }), bond.billAddress));
199
+ }), ")") }) })), _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: "hot", width: "20px" })) })) }))] }), bond.billAddress));
201
200
  })] }))] })));
202
201
  };
203
202
  export default Bonds;
@@ -22,7 +22,9 @@ var __rest = (this && this.__rest) || function (s, e) {
22
22
  };
23
23
  import { jsx as _jsx, jsxs as _jsxs } from "theme-ui/jsx-runtime";
24
24
  import { Input as ThemeInput, Spinner } from 'theme-ui';
25
- import { Text, Flex, Svg } from '../../uikit';
25
+ import { Text } from '../../uikit';
26
+ import Flex from '../Flex';
27
+ import Svg from '../Svg';
26
28
  var colorScheme = {
27
29
  default: 'gray',
28
30
  error: 'red',
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ type inputStatus = 'default' | 'error' | 'success';
3
+ declare const Input: ({ variant, width, status, isLoading, ...props }: any) => import("react").JSX.Element;
4
+ export default Input;
@@ -0,0 +1,70 @@
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
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ import { jsx as _jsx, jsxs as _jsxs } from "theme-ui/jsx-runtime";
24
+ import { Input as ThemeInput, Spinner } from 'theme-ui';
25
+ import { Text, Flex, Svg } from '../../uikit-sdk';
26
+ var colorScheme = {
27
+ default: 'gray',
28
+ error: 'red',
29
+ success: 'green',
30
+ };
31
+ var Input = function (_a) {
32
+ var variant = _a.variant, width = _a.width, status = _a.status, isLoading = _a.isLoading, props = __rest(_a, ["variant", "width", "status", "isLoading"]);
33
+ switch (variant) {
34
+ case 'search':
35
+ return (_jsxs(Flex, __assign({ sx: { position: 'relative', width: width ? width : 'unset' } }, { children: [_jsx(ThemeInput, __assign({}, props, { sx: {
36
+ background: 'white3',
37
+ border: 'none',
38
+ pl: '10px',
39
+ borderRadius: '10px',
40
+ ':focus': { outline: 'none' },
41
+ } })), _jsx(Flex, __assign({ sx: { position: 'absolute', right: 5, justifyContent: 'center', height: '100%' } }, { children: _jsx(Svg, { icon: "search" }) }))] })));
42
+ case 'password':
43
+ var statusColor = colorScheme[status];
44
+ return (_jsxs(Flex, __assign({ sx: {
45
+ width: width ? width : '100%',
46
+ flexDirection: 'column',
47
+ alignItems: 'center',
48
+ gap: '5px',
49
+ position: 'relative',
50
+ } }, { children: [_jsx(ThemeInput, __assign({}, props, { type: "password", sx: {
51
+ position: 'relative',
52
+ background: 'white3',
53
+ border: 'none',
54
+ borderBottom: "2px solid ".concat(statusColor),
55
+ color: statusColor,
56
+ pl: '10px',
57
+ borderRadius: '10px',
58
+ ':focus': { outline: 'none' },
59
+ } })), isLoading && (_jsx(Flex, __assign({ sx: { position: 'absolute', top: '5px', right: '5px', justifyContent: 'center', height: '100%' } }, { children: _jsx(Spinner, { width: "20px", height: "20px" }) }))), _jsx(Text, __assign({ sx: { fontSize: '10px', color: statusColor, visibility: status === 'default' ? 'hidden' : 'visible' } }, { children: status === 'error' ? 'Wrong Password' : 'Correct Password' }))] })));
60
+ default:
61
+ return (_jsx(ThemeInput, __assign({}, props, { sx: {
62
+ background: 'white3',
63
+ border: 'none',
64
+ pl: '10px',
65
+ borderRadius: '10px',
66
+ ':focus': { outline: 'none' },
67
+ } })));
68
+ }
69
+ };
70
+ export default Input;
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import { ThemeUIStyleObject } from 'theme-ui';
3
+ declare const NumericInput: ({ onUserInput, value, disabled, style, placeholder, }: {
4
+ onUserInput?: ((input: string) => void) | undefined;
5
+ value: string;
6
+ disabled?: boolean | undefined;
7
+ style?: ThemeUIStyleObject<import("@theme-ui/css").Theme<{}>> | undefined;
8
+ placeholder?: string | undefined;
9
+ }) => import("react").JSX.Element;
10
+ export default NumericInput;
@@ -0,0 +1,35 @@
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 } from "theme-ui/jsx-runtime";
13
+ import { isNumber } from '../../../utils/numbers';
14
+ import Input from './Input';
15
+ var NumericInput = function (_a) {
16
+ var onUserInput = _a.onUserInput, value = _a.value, disabled = _a.disabled, style = _a.style, _b = _a.placeholder, placeholder = _b === void 0 ? '0.0' : _b;
17
+ return (_jsx(Input, { sx: __assign({ border: 'none', padding: '0px 0px', position: 'relative', width: '100%', display: 'inline-block', fontSize: ['19px', '19px', '22px', '22px'], ':focus': { outline: 'none' } }, style), disabled: disabled, value: value, onChange: function (e) {
18
+ onUserInput && onUserInput(e.target.value);
19
+ }, placeholder: placeholder, pattern: "^[0-9]*[.,]?[0-9]*$", onInput: function (v) {
20
+ if (v.currentTarget.value.includes(',')) {
21
+ v.currentTarget.value = v.currentTarget.value.replace(/,/g, '.');
22
+ }
23
+ if (v.currentTarget.value.includes('%')) {
24
+ v.currentTarget.value = v.currentTarget.value.replace(/[^0-9]/g, '');
25
+ }
26
+ if (v.currentTarget.value === '.') {
27
+ v.currentTarget.value = '0.';
28
+ }
29
+ v.currentTarget.value =
30
+ !!v.currentTarget.value && isNumber(v.currentTarget.value) && parseFloat(v.currentTarget.value) >= 0
31
+ ? v.currentTarget.value
32
+ : v.currentTarget.value.slice(0, v.currentTarget.value.length - 1);
33
+ } }));
34
+ };
35
+ export default NumericInput;
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ export interface InputProps {
3
+ endAdornment?: React.ReactNode;
4
+ onChange: (e: React.FormEvent<HTMLInputElement>) => void;
5
+ placeholder?: string;
6
+ startAdornment?: React.ReactNode;
7
+ value: string;
8
+ height?: string;
9
+ }
10
+ declare const StyledInput: React.FC<InputProps>;
11
+ export default StyledInput;
@@ -0,0 +1,37 @@
1
+ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
2
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
3
+ return cooked;
4
+ };
5
+ var __assign = (this && this.__assign) || function () {
6
+ __assign = Object.assign || function(t) {
7
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
8
+ s = arguments[i];
9
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
10
+ t[p] = s[p];
11
+ }
12
+ return t;
13
+ };
14
+ return __assign.apply(this, arguments);
15
+ };
16
+ import { jsx as _jsx, jsxs as _jsxs } from "theme-ui/jsx-runtime";
17
+ //@ts-nocheck
18
+ import styled from '@emotion/styled';
19
+ import Flex from '../Flex';
20
+ import Input from './Input';
21
+ var StyledInputWrapper = styled(Flex)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n align-items: center;\n background: ", ";\n border-radius: 10px;\n height: 72px;\n padding: 0px 16px;\n"], ["\n align-items: center;\n background: ", ";\n border-radius: 10px;\n height: 72px;\n padding: 0px 16px;\n"])), function (_a) {
22
+ var theme = _a.theme;
23
+ return theme.colors.white4;
24
+ });
25
+ var StyledInputComponent = styled(Input)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n width: 100%;\n background: none;\n border: 0;\n color: ", ";\n flex: 1;\n height: 56px;\n margin: 0;\n padding: 0;\n outline: none;\n font-weight: 800;\n font-size: 22px;\n\n &::placeholder {\n color: ", ";\n }\n"], ["\n width: 100%;\n background: none;\n border: 0;\n color: ", ";\n flex: 1;\n height: 56px;\n margin: 0;\n padding: 0;\n outline: none;\n font-weight: 800;\n font-size: 22px;\n\n &::placeholder {\n color: ", ";\n }\n"])), function (_a) {
26
+ var theme = _a.theme;
27
+ return (theme.isDark ? theme.colors.primaryBright : theme.colors.primary);
28
+ }, function (_a) {
29
+ var theme = _a.theme;
30
+ return !theme.isDark && theme.colors.gray;
31
+ });
32
+ var StyledInput = function (_a) {
33
+ var endAdornment = _a.endAdornment, onChange = _a.onChange, placeholder = _a.placeholder, startAdornment = _a.startAdornment, value = _a.value, height = _a.height;
34
+ return (_jsxs(StyledInputWrapper, __assign({ sx: { height: height !== null && height !== void 0 ? height : null } }, { children: [!!startAdornment && startAdornment, _jsx(StyledInputComponent, { placeholder: placeholder, value: value, onChange: onChange }), !!endAdornment && endAdornment] })));
35
+ };
36
+ export default StyledInput;
37
+ var templateObject_1, templateObject_2;
@@ -0,0 +1,3 @@
1
+ export { default as NumericInput } from './NumericInput';
2
+ export { default as Input } from './Input';
3
+ export { default as StyledInput } from './StyledInput';
@@ -0,0 +1,3 @@
1
+ export { default as NumericInput } from './NumericInput';
2
+ export { default as Input } from './Input';
3
+ export { default as StyledInput } from './StyledInput';
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.207",
6
+ "version": "1.0.209",
7
7
  "main": "dist/index.js",
8
8
  "module": "dist/index.es.js",
9
9
  "types": "dist/index.d.ts",