@ape.swap/bonds-sdk 1.0.430 → 1.0.431
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.
- package/dist/components/Bonds/BondRow/BondRow.d.ts +1 -1
- package/dist/components/Bonds/BondRow/BondRow.js +1 -1
- package/dist/components/Bonds/BondRow/BondRowsByChain.d.ts +8 -0
- package/dist/components/Bonds/BondRow/BondRowsByChain.js +53 -0
- package/dist/components/Bonds/BondRow/BondRowsWithTitle.d.ts +9 -0
- package/dist/components/Bonds/BondRow/BondRowsWithTitle.js +28 -0
- package/dist/components/Bonds/BondRow/ChainTitle.d.ts +6 -0
- package/dist/components/Bonds/BondRow/ChainTitle.js +29 -0
- package/dist/components/Bonds/Bonds.js +36 -9
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ import { BondsDataResponse } from "../../../types/bonds";
|
|
|
3
3
|
interface BondRowProps {
|
|
4
4
|
key: string;
|
|
5
5
|
bond: BondsDataResponse;
|
|
6
|
-
hotBonds
|
|
6
|
+
hotBonds?: string[];
|
|
7
7
|
rowClick: (bond: BondsDataResponse) => void;
|
|
8
8
|
}
|
|
9
9
|
declare const BondRow: React.FC<BondRowProps>;
|
|
@@ -77,6 +77,6 @@ var BondRow = function (_a) {
|
|
|
77
77
|
}, showTooltip: true, toolTip: "".concat(remainingTokensFormat(bond), " ").concat(bond.payoutTokenName, " (").concat(formatDollar({
|
|
78
78
|
num: remainingTokensUsd(bond).toNumber(),
|
|
79
79
|
isPrice: true,
|
|
80
|
-
}), ")") }) })), _jsx(Flex, __assign({ className: "column column-hotbond" }, { children: _jsx(Flex, __assign({ className: "column column-icon" }, { children: hotBonds.includes(bond.billAddress.toLowerCase()) && ((_d = bond.discount) !== null && _d !== void 0 ? _d : 0) > 0 && (_jsx(Svg, { icon: "hot", width: "20px" })) })) }))] }))] }), bond.billAddress));
|
|
80
|
+
}), ")") }) })), _jsx(Flex, __assign({ className: "column column-hotbond" }, { children: _jsx(Flex, __assign({ className: "column column-icon" }, { children: (hotBonds === null || hotBonds === void 0 ? void 0 : hotBonds.includes(bond.billAddress.toLowerCase())) && ((_d = bond.discount) !== null && _d !== void 0 ? _d : 0) > 0 && (_jsx(Svg, { icon: "hot", width: "20px" })) })) }))] }))] }), bond.billAddress));
|
|
81
81
|
};
|
|
82
82
|
export default BondRow;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BondsDataResponse } from '../../../types/bonds';
|
|
3
|
+
declare const BondRowsByChain: ({ bonds, hotBonds, rowClick }: {
|
|
4
|
+
bonds: BondsDataResponse[];
|
|
5
|
+
hotBonds?: string[] | undefined;
|
|
6
|
+
rowClick: (bond: BondsDataResponse) => void;
|
|
7
|
+
}) => React.JSX.Element;
|
|
8
|
+
export default BondRowsByChain;
|
|
@@ -0,0 +1,53 @@
|
|
|
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 { useEffect, useRef, useState } from 'react';
|
|
14
|
+
import { Flex } from '../../../components/uikit-sdk';
|
|
15
|
+
import { ChainId, MAINNET_CHAINS } from '../../../config/constants/chains';
|
|
16
|
+
import BondRowsWithTitle from './BondRowsWithTitle';
|
|
17
|
+
var BondRowsByChain = function (_a) {
|
|
18
|
+
var bonds = _a.bonds, hotBonds = _a.hotBonds, rowClick = _a.rowClick;
|
|
19
|
+
//used to render list only on client
|
|
20
|
+
var _b = useState(false), show = _b[0], setShow = _b[1];
|
|
21
|
+
var observerRef = useRef(null);
|
|
22
|
+
useEffect(function () {
|
|
23
|
+
var observer;
|
|
24
|
+
observer = new IntersectionObserver(function (_a) {
|
|
25
|
+
var entry = _a[0];
|
|
26
|
+
if (entry.isIntersecting) {
|
|
27
|
+
setShow(true);
|
|
28
|
+
if (observer) {
|
|
29
|
+
observer.disconnect();
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}, {
|
|
33
|
+
rootMargin: '0px',
|
|
34
|
+
threshold: 1,
|
|
35
|
+
});
|
|
36
|
+
if (observerRef.current) {
|
|
37
|
+
observer.observe(observerRef.current);
|
|
38
|
+
}
|
|
39
|
+
return function () {
|
|
40
|
+
if (observer) {
|
|
41
|
+
observer.disconnect();
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}, []);
|
|
45
|
+
return (_jsxs(Flex, __assign({ sx: { width: '100%', flexDirection: 'column', mt: '5px' } }, { children: [[ChainId.MAINNET].map(function (chain, index) {
|
|
46
|
+
return (_jsx(BondRowsWithTitle, { chain: chain, bonds: bonds, hotBonds: hotBonds, rowClick: rowClick }, chain));
|
|
47
|
+
}), [ChainId.BSC].map(function (chain, index) {
|
|
48
|
+
return (_jsx(BondRowsWithTitle, { chain: chain, bonds: bonds, hotBonds: hotBonds, rowClick: rowClick }, chain));
|
|
49
|
+
}), (MAINNET_CHAINS.slice(2, MAINNET_CHAINS.length).map(function (chain, index) {
|
|
50
|
+
return (_jsx(BondRowsWithTitle, { chain: chain, bonds: bonds, rowClick: rowClick }, chain));
|
|
51
|
+
}))] })));
|
|
52
|
+
};
|
|
53
|
+
export default BondRowsByChain;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { BondsDataResponse } from "../../../types/bonds";
|
|
3
|
+
declare const BondRowsWithTitle: ({ chain, bonds, hotBonds, rowClick, }: {
|
|
4
|
+
chain: number;
|
|
5
|
+
bonds: BondsDataResponse[];
|
|
6
|
+
hotBonds?: string[] | undefined;
|
|
7
|
+
rowClick: (bond: BondsDataResponse) => void;
|
|
8
|
+
}) => import("react").JSX.Element;
|
|
9
|
+
export default BondRowsWithTitle;
|
|
@@ -0,0 +1,28 @@
|
|
|
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 } from "../../uikit-sdk";
|
|
14
|
+
import { AnimatePresence, motion } from "framer-motion";
|
|
15
|
+
import ChainTitle from "./ChainTitle";
|
|
16
|
+
import BondRow from "./BondRow";
|
|
17
|
+
var BondRowsWithTitle = function (_a) {
|
|
18
|
+
var chain = _a.chain, bonds = _a.bonds, hotBonds = _a.hotBonds, rowClick = _a.rowClick;
|
|
19
|
+
var billsFilteredByChain = bonds.filter(function (bill) { return bill.chainId === chain; });
|
|
20
|
+
var key = chain;
|
|
21
|
+
return (_jsx(Flex, __assign({ sx: { width: '100%', flexDirection: 'column' } }, { children: _jsxs(AnimatePresence, __assign({ initial: false }, { children: [_jsx(ChainTitle, { chain: chain, pt: '5px' }), billsFilteredByChain.length > 0 && (_jsx(motion.div, __assign({ initial: { height: 0, overflow: 'hidden' }, animate: { height: 'fit-content', overflow: 'hidden', transitionEnd: { overflow: 'visible' } }, exit: { height: 0, overflow: 'hidden' }, sx: {
|
|
22
|
+
position: 'relative',
|
|
23
|
+
overflow: 'hidden',
|
|
24
|
+
width: '100%',
|
|
25
|
+
marginTop: '0px',
|
|
26
|
+
} }, { children: billsFilteredByChain === null || billsFilteredByChain === void 0 ? void 0 : billsFilteredByChain.map(function (bill) { return (_jsx(BondRow, { bond: bill, hotBonds: hotBonds, rowClick: rowClick }, bill.billAddress)); }) }), key))] })) }), key));
|
|
27
|
+
};
|
|
28
|
+
export default BondRowsWithTitle;
|
|
@@ -0,0 +1,29 @@
|
|
|
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 { NETWORK_LABEL } from '../../../config/constants/chains';
|
|
14
|
+
import { Flex, Svg } from '../../../components/uikit-sdk';
|
|
15
|
+
var ChainTitle = function (_a) {
|
|
16
|
+
var chain = _a.chain, pt = _a.pt;
|
|
17
|
+
return (_jsxs(Flex, __assign({ sx: {
|
|
18
|
+
pt: pt,
|
|
19
|
+
pb: '10px',
|
|
20
|
+
color: 'textDisabledButton',
|
|
21
|
+
fontSize: '13px',
|
|
22
|
+
fontWeight: 500,
|
|
23
|
+
cursor: 'pointer',
|
|
24
|
+
textTransform: 'uppercase',
|
|
25
|
+
display: 'flex',
|
|
26
|
+
width: '200px',
|
|
27
|
+
} }, { children: [NETWORK_LABEL[chain], " Bonds", _jsx(Flex, __assign({ sx: { ml: '7px' } }, { children: _jsx(Svg, { icon: "caret", direction: 'down', width: 8, color: "textDisabledButton" }) }))] })));
|
|
28
|
+
};
|
|
29
|
+
export default ChainTitle;
|
|
@@ -70,9 +70,9 @@ import { ChainId } from '../../enum/apeswaplists';
|
|
|
70
70
|
import { formatValue } from '../../utils/formatNumbers';
|
|
71
71
|
import { TooltipText } from '../../enum/tooltips';
|
|
72
72
|
import { TooltipBubble, Svg } from '../uikit-sdk';
|
|
73
|
-
import { BLOCK_EXPLORER
|
|
73
|
+
import { BLOCK_EXPLORER } from '../../config/constants/chains';
|
|
74
74
|
import { Input } from '../uikit-sdk/Input';
|
|
75
|
-
import
|
|
75
|
+
import BondRowsByChain from './BondRow/BondRowsByChain';
|
|
76
76
|
var Bonds = function (_a) {
|
|
77
77
|
var connectionString = _a.connectionString;
|
|
78
78
|
var _b = useWeb3React(), account = _b.account, isActive = _b.isActive;
|
|
@@ -269,12 +269,39 @@ var Bonds = function (_a) {
|
|
|
269
269
|
setBondsRendered(true);
|
|
270
270
|
}
|
|
271
271
|
}, [filteredBonds]);
|
|
272
|
-
return (_jsxs(ThemeUIProvider, __assign({ theme: defaultTheme }, { children: [isActive && account && _jsx("p", { children: account }), isActive && account && _jsx("button", __assign({ onClick: handleApprove }, { children: "Approve USDT" })), bondsRendered && (_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-search", sx: { width: '100%', maxWidth: ['200px', '200px', '200px', '340px'] } }, { children: _jsx(Input, { value: inputValue, onChange: handleInputChange, variant: "search", sx: { fontWeight: 400, background: 'white2', height: '30px', fontSize: '14px' }, width: '100%', placeholder: 'Search...' }) })), _jsx(Flex, { className: "column column-tokenicons" })] })), _jsxs(Flex, __assign({ className: "column column-bondinfo" }, { children: [_jsxs(Flex, __assign({ className: "column column-discount" }, { children: [_jsx(Flex, __assign({ className: "column tooltip" }, { 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 header-icon", onClick: function () { return handleSort('discount'); } }, { children: _jsx(Svg, { icon: "sort", width: "12px" }) }))] })), _jsxs(Flex, __assign({ className: "column column-arr" }, { children: [_jsx(Flex, __assign({ className: "column tooltip" }, { 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 header-icon", onClick: function () { return handleSort('arr'); } }, { children: _jsx(Svg, { icon: "sort", width: "12px" }) }))] })), _jsxs(Flex, __assign({ className: "column column-terms" }, { children: [_jsx(Flex, __assign({ className: "column tooltip" }, { 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 header-icon", onClick: function () { return handleSort('terms'); } }, { children: _jsx(Svg, { icon: "sort", width: "12px" }) }))] })), _jsxs(Flex, __assign({ className: "column column-tokensremaining" }, { children: [_jsx(Flex, __assign({ className: "column tooltip" }, { 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, __assign({ className: "column header-icon", onClick: function () { return handleSort('tokensRemaining'); } }, { children: _jsx(Svg, { icon: "sort", width: "12px" }) }))] })), _jsx(Flex, { className: "column column-hotbond" })] }))] })), filteredBonds.map(function (bond) { return (
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
272
|
+
return (_jsxs(ThemeUIProvider, __assign({ theme: defaultTheme }, { children: [isActive && account && _jsx("p", { children: account }), isActive && account && _jsx("button", __assign({ onClick: handleApprove }, { children: "Approve USDT" })), bondsRendered && (_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-search", sx: { width: '100%', maxWidth: ['200px', '200px', '200px', '340px'] } }, { children: _jsx(Input, { value: inputValue, onChange: handleInputChange, variant: "search", sx: { fontWeight: 400, background: 'white2', height: '30px', fontSize: '14px' }, width: '100%', placeholder: 'Search...' }) })), _jsx(Flex, { className: "column column-tokenicons" })] })), _jsxs(Flex, __assign({ className: "column column-bondinfo" }, { children: [_jsxs(Flex, __assign({ className: "column column-discount" }, { children: [_jsx(Flex, __assign({ className: "column tooltip" }, { 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 header-icon", onClick: function () { return handleSort('discount'); } }, { children: _jsx(Svg, { icon: "sort", width: "12px" }) }))] })), _jsxs(Flex, __assign({ className: "column column-arr" }, { children: [_jsx(Flex, __assign({ className: "column tooltip" }, { 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 header-icon", onClick: function () { return handleSort('arr'); } }, { children: _jsx(Svg, { icon: "sort", width: "12px" }) }))] })), _jsxs(Flex, __assign({ className: "column column-terms" }, { children: [_jsx(Flex, __assign({ className: "column tooltip" }, { 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 header-icon", onClick: function () { return handleSort('terms'); } }, { children: _jsx(Svg, { icon: "sort", width: "12px" }) }))] })), _jsxs(Flex, __assign({ className: "column column-tokensremaining" }, { children: [_jsx(Flex, __assign({ className: "column tooltip" }, { 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, __assign({ className: "column header-icon", onClick: function () { return handleSort('tokensRemaining'); } }, { children: _jsx(Svg, { icon: "sort", width: "12px" }) }))] })), _jsx(Flex, { className: "column column-hotbond" })] }))] })), filteredBonds.map(function (bond) { return (_jsx(BondRowsByChain, { bonds: filteredBonds, hotBonds: hotBonds, rowClick: rowClick }, bond.billAddress)
|
|
273
|
+
// <Flex sx={{ width: '100%', flexDirection: 'column', mt: '5px' }}>
|
|
274
|
+
// {[ChainId.MAINNET].map((chain, index) => {
|
|
275
|
+
// return (
|
|
276
|
+
// <BondRow
|
|
277
|
+
// key={bond.billAddress}
|
|
278
|
+
// bond={bond}
|
|
279
|
+
// hotBonds={hotBonds}
|
|
280
|
+
// rowClick={rowClick}
|
|
281
|
+
// />
|
|
282
|
+
// )
|
|
283
|
+
// })}
|
|
284
|
+
// {[ChainId.BSC].map((chain, index) => {
|
|
285
|
+
// return (
|
|
286
|
+
// <BondRow
|
|
287
|
+
// key={bond.billAddress}
|
|
288
|
+
// bond={bond}
|
|
289
|
+
// hotBonds={hotBonds}
|
|
290
|
+
// rowClick={rowClick}
|
|
291
|
+
// />
|
|
292
|
+
// )
|
|
293
|
+
// })}
|
|
294
|
+
// {(MAINNET_CHAINS.slice(2, MAINNET_CHAINS.length).map((chain, index) => {
|
|
295
|
+
// return (
|
|
296
|
+
// <BondRow
|
|
297
|
+
// key={bond.billAddress}
|
|
298
|
+
// bond={bond}
|
|
299
|
+
// hotBonds={hotBonds}
|
|
300
|
+
// rowClick={rowClick}
|
|
301
|
+
// />
|
|
302
|
+
// )
|
|
303
|
+
// }))}
|
|
304
|
+
// </Flex>
|
|
305
|
+
); })] })))] })));
|
|
279
306
|
};
|
|
280
307
|
export default Bonds;
|