@ape.swap/bonds-sdk 1.0.253 → 1.0.254
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.
|
@@ -65,6 +65,7 @@ import { TooltipText } from '../../enum/tooltips';
|
|
|
65
65
|
import { TooltipBubble, Svg, ListTag } from '../uikit-sdk';
|
|
66
66
|
import Tooltip from '../Tooltip/Tooltip';
|
|
67
67
|
import { BLOCK_EXPLORER } from '../../config/constants/chains';
|
|
68
|
+
import OmniTokenImageFromString from '../OmniChainTokenImageFromString';
|
|
68
69
|
var Bonds = function (_a) {
|
|
69
70
|
var connectionString = _a.connectionString;
|
|
70
71
|
var _b = useWeb3React(), account = _b.account, isActive = _b.isActive;
|
|
@@ -188,7 +189,7 @@ var Bonds = function (_a) {
|
|
|
188
189
|
};
|
|
189
190
|
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: [_jsxs(Flex, __assign({ className: "column column-tokens" }, { children: [_jsx(Flex, __assign({ className: "column column-tokenname" }, { children: "Tokens" })), _jsx(Flex, { className: "column column-tokenicons" })] })), _jsxs(Flex, __assign({ className: "column column-bondinfo" }, { children: [_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
191
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
191
|
-
return (_jsxs(Flex, __assign({ className: "container bondrow-container", onClick: function () { return rowClick(bond); } }, { children: [_jsxs(Flex, __assign({ className: "column column-tokens" }, { children: [
|
|
192
|
+
return (_jsxs(Flex, __assign({ className: "container bondrow-container", onClick: function () { return rowClick(bond); } }, { children: [_jsxs(Flex, __assign({ className: "column column-tokens" }, { children: [_jsxs(Flex, __assign({ className: "column column-tokenname" }, { children: [_jsx(OmniTokenImageFromString, { bond: bond, size: 25 }), bond.showcaseTokenName] })), _jsx(Flex, __assign({ className: "column column-tokenicons" }, { children: _jsx(TooltipBubble, __assign({ body: _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 }), width: "205px", placement: "bottomRight", transformTip: "translate(11%, 0%)" }, { children: _jsx(Svg, { icon: "more", width: "20px" }) })) })), _jsx(Flex, __assign({ className: "column column-tokentags" }, { children: _jsx(ListTag, { text: (_c = bond === null || bond === void 0 ? void 0 : bond.tags) === null || _c === void 0 ? void 0 : _c[0].toLocaleUpperCase(), variant: ((_d = bond === null || bond === void 0 ? void 0 : bond.tags) === null || _d === void 0 ? void 0 : _d[0]) === 'Cex Fund' ? 'cex_fund' : 'liquidity' }) }))] })), _jsxs(Flex, __assign({ className: "column column-bondinfo" }, { children: [_jsx(Flex, __assign({ className: "column column-discount ".concat(getDiscountColor(bond === null || bond === void 0 ? void 0 : bond.discount)) }, { children: "".concat((_e = bond === null || bond === void 0 ? void 0 : bond.discount) === null || _e === void 0 ? void 0 : _e.toFixed(2), "%") })), _jsx(Flex, __assign({ className: "column column-arr" }, { children: "".concat(((((_f = bond === null || bond === void 0 ? void 0 : bond.discount) !== null && _f !== void 0 ? _f : 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
193
|
width: '127px',
|
|
193
194
|
height: '25px',
|
|
194
195
|
flexDirection: 'column',
|
|
@@ -0,0 +1,62 @@
|
|
|
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, Fragment as _Fragment } from "theme-ui/jsx-runtime";
|
|
13
|
+
import { useState } from 'react';
|
|
14
|
+
import { Flex, Svg } from '../../components/uikit-sdk';
|
|
15
|
+
import { CHAIN_PARAMS, NETWORK_ICONS } from '../../config/constants/chains';
|
|
16
|
+
import { Box } from 'theme-ui';
|
|
17
|
+
// The purpose of this component is to load token images of unknown sources and to use a custom image if load fails
|
|
18
|
+
var OmniTokenImageFromString = function (_a) {
|
|
19
|
+
//const currency = useCurrency(tokenAddress, chain)
|
|
20
|
+
var _b, _c, _d, _e;
|
|
21
|
+
var bond = _a.bond, size = _a.size;
|
|
22
|
+
var _f = useState(false), error = _f[0], setError = _f[1];
|
|
23
|
+
var chainSize = size / 2.2 > 20 ? 20 : size / 2.2;
|
|
24
|
+
return (_jsx(_Fragment, { children: !error
|
|
25
|
+
// && currency && ((currency as TokenInfo)?.logoURI || currency.isNative)
|
|
26
|
+
? (_jsxs(Flex, __assign({ sx: {
|
|
27
|
+
minWidth: "".concat(size + 2, "px"),
|
|
28
|
+
height: "".concat(size + 2, "px"),
|
|
29
|
+
// background:
|
|
30
|
+
// currency.isToken &&
|
|
31
|
+
// (currency.address.toLowerCase() === '0x0477e37B8ACA55C133e05403a30b554498c451b4'.toLowerCase() ||
|
|
32
|
+
// currency.address.toLowerCase() === '0x6fD323Bdf290Eba58EaaA8E02e70a2a6f1DE0CfC'.toLowerCase())
|
|
33
|
+
// ? 'transparent'
|
|
34
|
+
// : '#fff',
|
|
35
|
+
borderRadius: "".concat(size, "px"),
|
|
36
|
+
alignItems: 'center',
|
|
37
|
+
justifyContent: 'center',
|
|
38
|
+
position: 'relative',
|
|
39
|
+
} }, { children: [
|
|
40
|
+
// currency?.isNative || currency.equals(WRAPPED_NATIVE_CURRENCY[currency?.chainId] as Currency) ? (
|
|
41
|
+
_jsx("img", { width: size, height: size, src: (_c = (_b = CHAIN_PARAMS === null || CHAIN_PARAMS === void 0 ? void 0 : CHAIN_PARAMS[bond === null || bond === void 0 ? void 0 : bond.chainId]) === null || _b === void 0 ? void 0 : _b.nativeCurrency.logo) !== null && _c !== void 0 ? _c : 'question', style: { borderRadius: "".concat(size, "px") }, onError: function () { return setError(true); }, alt: "token-img" })
|
|
42
|
+
// ) : (
|
|
43
|
+
// <img
|
|
44
|
+
// src={`${(currency as TokenInfo).logoURI}`}
|
|
45
|
+
// alt={'token img'}
|
|
46
|
+
// width={size}
|
|
47
|
+
// height={size}
|
|
48
|
+
// style={{ borderRadius: `${size}px` }}
|
|
49
|
+
// onError={() => setError(true)}
|
|
50
|
+
// />
|
|
51
|
+
// )
|
|
52
|
+
, _jsx(Box, __assign({ sx: { borderRadius: "".concat(size, "px"), position: 'absolute', top: -1, right: -1, lineHeight: '5px' } }, { children: _jsx(Svg, { width: chainSize, height: chainSize, icon: (_d = NETWORK_ICONS === null || NETWORK_ICONS === void 0 ? void 0 : NETWORK_ICONS[bond === null || bond === void 0 ? void 0 : bond.chainId]) !== null && _d !== void 0 ? _d : 'question' }) }))] }))) : (_jsxs(Flex, __assign({ sx: {
|
|
53
|
+
minWidth: "".concat(size + 2, "px"),
|
|
54
|
+
height: "".concat(size + 2, "px"),
|
|
55
|
+
background: '#fff',
|
|
56
|
+
borderRadius: '25px',
|
|
57
|
+
alignItems: 'center',
|
|
58
|
+
justifyContent: 'center',
|
|
59
|
+
position: 'relative',
|
|
60
|
+
} }, { children: [_jsxs("svg", __assign({ width: size + 2, height: size + 2, viewBox: "0 0 30 30", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: [_jsxs("g", __assign({ clipPath: "url(#clip0_1608_28082)" }, { children: [_jsx("path", { d: "M25.6069 25.6066C31.4648 19.7487 31.4648 10.2513 25.6069 4.3934C19.749 -1.46447 10.2516 -1.46447 4.39371 4.3934C-1.46415 10.2513 -1.46415 19.7487 4.39371 25.6066C10.2516 31.4645 19.749 31.4645 25.6069 25.6066Z", fill: "var(--theme-ui-colors-brown)", fillOpacity: "0.2" }), _jsx("path", { opacity: "0.3", d: "M24.5633 11.3573C23.8989 11.102 23.3778 11.1944 22.9747 11.3971C22.0431 8.70656 19.829 6.36891 17.2163 5.47981L17.1812 4.35342L15.7852 5.19821C15.6105 5.16292 15.4709 5.16292 15.297 5.16292C15.2619 4.95191 15.088 4.1777 15.0529 4.00123C13.7966 3.93064 12.8545 5.26805 12.8194 5.51435C10.1835 6.40195 7.97239 8.72758 7.03553 11.4062C6.65333 11.2079 6.11062 11.0855 5.43728 11.3573C3.90174 11.9558 3.48296 14.4895 4.73931 16.0732C5.1999 16.6702 5.69109 17.0164 6.18378 17.2018C6.08375 17.6599 6.01507 18.1165 6.01507 18.6068C5.94565 22.9006 10.656 26.1026 14.9126 25.9975C20.3911 26.0681 24.8574 22.0911 23.8802 17.3047C23.8743 17.2627 23.866 17.2229 23.8586 17.1823C24.3139 16.9923 24.8163 16.6499 25.2612 16.0732C26.5176 14.4895 26.0988 11.9558 24.5633 11.3573Z", fill: "var(--theme-ui-colors-brown)" }), _jsx("path", { d: "M15.3272 10C16.5283 10 17.488 10.324 18.2064 10.972C18.936 11.6199 19.3008 12.534 19.3008 13.7143C19.3008 14.802 18.9528 15.6524 18.2569 16.2657C17.5722 16.8674 16.663 17.174 15.5292 17.1856L15.4451 18.4873H12.9195L12.8353 15.259H13.8455C14.7098 15.259 15.3665 15.1491 15.8155 14.9292C16.2757 14.7094 16.5058 14.3102 16.5058 13.7316C16.5058 13.3267 16.3992 13.0085 16.1859 12.777C15.9726 12.5456 15.6752 12.4299 15.2935 12.4299C14.8894 12.4299 14.5751 12.5514 14.3506 12.7944C14.1261 13.0258 14.0139 13.344 14.0139 13.749H11.3031C11.2807 13.0432 11.421 12.4068 11.724 11.8398C12.0383 11.2728 12.4985 10.8273 13.1047 10.5033C13.7221 10.1678 14.4629 10 15.3272 10ZM14.2159 23C13.7108 23 13.2955 22.8496 12.97 22.5487C12.6557 22.2363 12.4985 21.8545 12.4985 21.4032C12.4985 20.9404 12.6557 20.5527 12.97 20.2403C13.2955 19.9279 13.7108 19.7717 14.2159 19.7717C14.7098 19.7717 15.1139 19.9279 15.4282 20.2403C15.7537 20.5527 15.9165 20.9404 15.9165 21.4032C15.9165 21.8545 15.7537 22.2363 15.4282 22.5487C15.1139 22.8496 14.7098 23 14.2159 23Z", fill: "var(--theme-ui-colors-text)" })] })), _jsx("defs", { children: _jsx("clipPath", __assign({ id: "clip0_1608_28082" }, { children: _jsx("rect", { width: "30", height: "30", fill: "white" }) })) })] })), _jsx(Box, __assign({ sx: { borderRadius: "".concat(size, "px"), position: 'absolute', top: -1, right: -1, lineHeight: '5px' }, className: "mitokenicon" }, { children: _jsx(Svg, { width: chainSize, height: chainSize, icon: (_e = NETWORK_ICONS === null || NETWORK_ICONS === void 0 ? void 0 : NETWORK_ICONS[bond === null || bond === void 0 ? void 0 : bond.chainId]) !== null && _e !== void 0 ? _e : 'question' }) }))] }))) }));
|
|
61
|
+
};
|
|
62
|
+
export default OmniTokenImageFromString;
|