@ape.swap/bonds-sdk 2.6.9 → 2.6.11
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/ChainOptionList/ChainOptionsButtons.d.ts +8 -0
- package/dist/components/ChainOptionList/ChainOptionsList.d.ts +7 -0
- package/dist/components/ChainOptionList/constants.d.ts +5 -0
- package/dist/components/ChainOptionList/styles.d.ts +2 -0
- package/dist/main.js +311 -110
- package/dist/state/bonds/useUserBonds.d.ts +2 -1
- package/dist/state/zap/getChainParam.d.ts +1 -1
- package/dist/styles.css +2 -1
- package/dist/utils/displayHelpers.d.ts +2 -0
- package/dist/views/YourBonds/components/ClaimAll/ClaimAllModal.d.ts +3 -0
- package/dist/views/YourBonds/components/ClaimAll/index.d.ts +3 -0
- package/dist/views/YourBonds/fetchBillsUser.d.ts +3 -2
- package/package.json +1 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ChainId } from '@ape.swap/apeswap-lists';
|
|
2
|
+
declare const ChainOptionsButtons: ({ selectedChain, setSelectedChain, setViewAllChains, chainList, }: {
|
|
3
|
+
selectedChain?: number;
|
|
4
|
+
setSelectedChain: (chain: ChainId) => void;
|
|
5
|
+
setViewAllChains: (viewAllChains: boolean) => void;
|
|
6
|
+
chainList: ChainId[];
|
|
7
|
+
}) => import("react").JSX.Element;
|
|
8
|
+
export default ChainOptionsButtons;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ChainId } from '@ape.swap/apeswap-lists';
|
|
2
|
+
declare const ChainOptionsList: ({ setSelectedChain, setViewAllChains, chainList, }: {
|
|
3
|
+
setSelectedChain: (chain: ChainId) => void;
|
|
4
|
+
setViewAllChains: (viewAllChains: boolean) => void;
|
|
5
|
+
chainList: ChainId[];
|
|
6
|
+
}) => import("react").JSX.Element;
|
|
7
|
+
export default ChainOptionsList;
|
package/dist/main.js
CHANGED
|
@@ -7625,7 +7625,7 @@ const pulse = keyframes$1({
|
|
|
7625
7625
|
'50%': { opacity: 0.4 },
|
|
7626
7626
|
'100%': { opacity: 1 },
|
|
7627
7627
|
});
|
|
7628
|
-
const styles$
|
|
7628
|
+
const styles$h = {
|
|
7629
7629
|
waves: {
|
|
7630
7630
|
position: 'relative',
|
|
7631
7631
|
overflow: 'hidden',
|
|
@@ -7657,7 +7657,7 @@ const styles$g = {
|
|
|
7657
7657
|
|
|
7658
7658
|
const Skeleton = (_a) => {
|
|
7659
7659
|
var { variant: variant$1 = variant.RECT, animation: animation$1 = animation.PULSE } = _a, props = __rest(_a, ["variant", "animation"]);
|
|
7660
|
-
return (jsx$2(Box$1, Object.assign({}, props, { sx: Object.assign(Object.assign({}, (animation$1 === animation.WAVES ? styles$
|
|
7660
|
+
return (jsx$2(Box$1, Object.assign({}, props, { sx: Object.assign(Object.assign({}, (animation$1 === animation.WAVES ? styles$h.waves : styles$h.pulse)), { height: props.height, width: props.width, borderRadius: variant$1 === variant.RECT ? '10px' : '50%' }) })));
|
|
7661
7661
|
};
|
|
7662
7662
|
|
|
7663
7663
|
var placements;
|
|
@@ -7695,7 +7695,7 @@ const container = (hide) => ({
|
|
|
7695
7695
|
display: hide ? 'none' : 'block',
|
|
7696
7696
|
},
|
|
7697
7697
|
});
|
|
7698
|
-
const styles$
|
|
7698
|
+
const styles$g = {
|
|
7699
7699
|
default: Object.assign({ color: 'text', fontSize: 0, lineHeight: '18px', fontWeight: 'normal' }, baseStyle$1),
|
|
7700
7700
|
bottomRight: {
|
|
7701
7701
|
'&::before': Object.assign(Object.assign({ position: 'absolute' }, bottomArrow), { right: '3%', borderBottomColor: 'white2' }),
|
|
@@ -7754,7 +7754,7 @@ const TooltipBubble = (_a) => {
|
|
|
7754
7754
|
const handleClick = (event) => {
|
|
7755
7755
|
event.stopPropagation();
|
|
7756
7756
|
};
|
|
7757
|
-
return (jsxs(Box$1, { sx: container(hideTooltip), onClick: handleClick, children: [jsx$2(Box$1, { sx: Object.assign({ position: 'absolute' }, (placementStyles[placement] || {})), children: jsx$2(Box$1, Object.assign({ sx: Object.assign(Object.assign(Object.assign(Object.assign({ position: 'relative' }, styles$
|
|
7757
|
+
return (jsxs(Box$1, { sx: container(hideTooltip), onClick: handleClick, children: [jsx$2(Box$1, { sx: Object.assign({ position: 'absolute' }, (placementStyles[placement] || {})), children: jsx$2(Box$1, Object.assign({ sx: Object.assign(Object.assign(Object.assign(Object.assign({ position: 'relative' }, styles$g.default), styles$g[placement]), backgroundColorStyle), { width, transform: transformTip }) }, props, { children: body })) }), children] }));
|
|
7758
7758
|
};
|
|
7759
7759
|
|
|
7760
7760
|
const warned = new Set();
|
|
@@ -17816,7 +17816,7 @@ const AnimatePresence = ({ children, exitBeforeEnter, custom, initial = true, on
|
|
|
17816
17816
|
}) }));
|
|
17817
17817
|
};
|
|
17818
17818
|
|
|
17819
|
-
const styles$
|
|
17819
|
+
const styles$f = {
|
|
17820
17820
|
container: {
|
|
17821
17821
|
padding: '20px',
|
|
17822
17822
|
background: 'white2',
|
|
@@ -17992,7 +17992,7 @@ const defaultStyle = {
|
|
|
17992
17992
|
transform: 'scale(0.9)',
|
|
17993
17993
|
},
|
|
17994
17994
|
};
|
|
17995
|
-
const styles$
|
|
17995
|
+
const styles$e = {
|
|
17996
17996
|
primary: Object.assign({}, defaultStyle),
|
|
17997
17997
|
transparent: Object.assign(Object.assign({}, defaultStyle), { backgroundColor: 'transparent', backgroundRepeat: 'no-repeat', padding: '0px', border: 'none', cursor: 'pointer', svg: {
|
|
17998
17998
|
background: 'transparent',
|
|
@@ -18001,12 +18001,12 @@ const styles$d = {
|
|
|
18001
18001
|
|
|
18002
18002
|
const IconButton = (_a) => {
|
|
18003
18003
|
var { icon = icons.DISCORD, color = 'white1', background = 'yellow', variant = iconButtonVariants.PRIMARY, iconWidth, children } = _a, props = __rest(_a, ["icon", "color", "background", "variant", "iconWidth", "children"]);
|
|
18004
|
-
return (jsx$2(Button$1, Object.assign({}, props, { variant: variant, sx: Object.assign(Object.assign({ display: 'flex', alignItems: 'center', justifyContent: 'center', position: 'relative', variant: `buttons.${variant}`, color: 'primaryBright', background }, (variant === iconButtonVariants.PRIMARY ? styles$
|
|
18004
|
+
return (jsx$2(Button$1, Object.assign({}, props, { variant: variant, sx: Object.assign(Object.assign({ display: 'flex', alignItems: 'center', justifyContent: 'center', position: 'relative', variant: `buttons.${variant}`, color: 'primaryBright', background }, (variant === iconButtonVariants.PRIMARY ? styles$e.primary : {})), (variant === iconButtonVariants.TRANSPARENT ? styles$e.transparent : {})), children: children || (jsx$2("span", { sx: { height: iconWidth, width: iconWidth }, children: jsx$2(Svg, Object.assign({ color: color, icon: icon }, props, { width: iconWidth })) })) })));
|
|
18005
18005
|
};
|
|
18006
18006
|
|
|
18007
18007
|
const ModalHeader = (_a) => {
|
|
18008
18008
|
var { children, onDismiss, hideDivider } = _a, props = __rest(_a, ["children", "onDismiss", "hideDivider"]);
|
|
18009
|
-
return (jsxs(Fragment$1, { children: [jsxs(Flex$1, Object.assign({}, props, { sx: styles$
|
|
18009
|
+
return (jsxs(Fragment$1, { children: [jsxs(Flex$1, Object.assign({}, props, { sx: styles$f.modalHead, children: [children, onDismiss && jsx$2(IconButton, { icon: "close", color: "text", variant: "transparent", onClick: onDismiss })] })), !hideDivider && jsx$2(Divider, {})] }));
|
|
18010
18010
|
};
|
|
18011
18011
|
|
|
18012
18012
|
const Modal = (_a) => {
|
|
@@ -18022,10 +18022,10 @@ const Modal = (_a) => {
|
|
|
18022
18022
|
}, transition: {
|
|
18023
18023
|
opacity: { duration: 0.2 },
|
|
18024
18024
|
transform: { duration: 0.2 },
|
|
18025
|
-
}, exit: { opacity: 0, transform: 'translate(-50%, -50%) scale(0)' } }, props, { sx: Object.assign(Object.assign({}, styles$
|
|
18025
|
+
}, exit: { opacity: 0, transform: 'translate(-50%, -50%) scale(0)' } }, props, { sx: Object.assign(Object.assign({}, styles$f.container), { zIndex }), onAnimationComplete: onAnimationComplete, children: [title && (jsx$2(ModalHeader, { onDismiss: onClose, children: jsx$2(Text, { sx: { fontSize: '22px', fontWeight: 700, lineHeight: '33px' }, children: title }) })), children] }))) }), open && jsx$2(Box$1, { sx: Object.assign(Object.assign({}, styles$f.backdrop), backdrop), onClick: onClose })] }));
|
|
18026
18026
|
};
|
|
18027
18027
|
|
|
18028
|
-
const styles$
|
|
18028
|
+
const styles$d = {
|
|
18029
18029
|
container: {
|
|
18030
18030
|
display: 'flex',
|
|
18031
18031
|
borderRadius: '10px',
|
|
@@ -39303,6 +39303,11 @@ const claimable = (userBill) => {
|
|
|
39303
39303
|
var _a, _b, _c;
|
|
39304
39304
|
return getBalanceNumber(new BigNumber$1(userBill.pendingRewards), (_c = (_b = (_a = userBill.bond.earnToken) === null || _a === void 0 ? void 0 : _a.decimals) === null || _b === void 0 ? void 0 : _b[userBill.bond.chainId]) !== null && _c !== void 0 ? _c : 18);
|
|
39305
39305
|
};
|
|
39306
|
+
const claimableUSD = (userBill) => {
|
|
39307
|
+
var _a, _b, _c;
|
|
39308
|
+
const claimableTokens = getBalanceNumber(new BigNumber$1(userBill.pendingRewards), (_c = (_b = (_a = userBill.bond.earnToken) === null || _a === void 0 ? void 0 : _a.decimals) === null || _b === void 0 ? void 0 : _b[userBill.bond.chainId]) !== null && _c !== void 0 ? _c : 18);
|
|
39309
|
+
return claimableTokens * parseFloat(userBill.bond.payoutTokenPrice);
|
|
39310
|
+
};
|
|
39306
39311
|
const earnTokenPrice = (bond) => {
|
|
39307
39312
|
var _a;
|
|
39308
39313
|
//TODO: remove this?
|
|
@@ -39312,14 +39317,15 @@ const totalPending = (userBill) => {
|
|
|
39312
39317
|
var _a, _b, _c, _d;
|
|
39313
39318
|
return getBalanceNumber(new BigNumber$1((_a = userBill === null || userBill === void 0 ? void 0 : userBill.payout) !== null && _a !== void 0 ? _a : 0), (_d = (_c = (_b = userBill.bond.earnToken) === null || _b === void 0 ? void 0 : _b.decimals) === null || _c === void 0 ? void 0 : _c[userBill.bond.chainId]) !== null && _d !== void 0 ? _d : 18);
|
|
39314
39319
|
};
|
|
39320
|
+
const totalPendingUSD = (userBill) => {
|
|
39321
|
+
var _a, _b, _c, _d;
|
|
39322
|
+
const pendingTokens = getBalanceNumber(new BigNumber$1((_a = userBill === null || userBill === void 0 ? void 0 : userBill.payout) !== null && _a !== void 0 ? _a : 0), (_d = (_c = (_b = userBill.bond.earnToken) === null || _b === void 0 ? void 0 : _b.decimals) === null || _c === void 0 ? void 0 : _c[userBill.bond.chainId]) !== null && _d !== void 0 ? _d : 18);
|
|
39323
|
+
return pendingTokens * parseFloat(userBill.bond.payoutTokenPrice);
|
|
39324
|
+
};
|
|
39315
39325
|
const vestingTimeRemaining = (userBill) => {
|
|
39316
39326
|
const currentTime = new Date().getTime() / 1000;
|
|
39317
39327
|
return getTimePeriods(parseInt(userBill.lastBlockTimestamp) + parseInt(userBill.vesting) - currentTime, true);
|
|
39318
39328
|
};
|
|
39319
|
-
const vestingTimeRemainingYourBonds = (userBill) => {
|
|
39320
|
-
const currentTime = new Date().getTime() / 1000;
|
|
39321
|
-
return parseInt(userBill.lastBlockTimestamp) + parseInt(userBill.vesting) - currentTime;
|
|
39322
|
-
};
|
|
39323
39329
|
const discountEarnTokenPrice = (bond) => {
|
|
39324
39330
|
var _a, _b;
|
|
39325
39331
|
const earnTokenPrice = parseFloat((_a = bond === null || bond === void 0 ? void 0 : bond.payoutTokenPrice) !== null && _a !== void 0 ? _a : '0');
|
|
@@ -43961,7 +43967,7 @@ function offset() {
|
|
|
43961
43967
|
return null;
|
|
43962
43968
|
}
|
|
43963
43969
|
|
|
43964
|
-
function styles$
|
|
43970
|
+
function styles$c() {
|
|
43965
43971
|
const window = getWindow();
|
|
43966
43972
|
if (this[0]) return window.getComputedStyle(this[0], null);
|
|
43967
43973
|
return {};
|
|
@@ -44340,7 +44346,7 @@ const Methods = {
|
|
|
44340
44346
|
transitionEnd: transitionEnd$1,
|
|
44341
44347
|
outerWidth,
|
|
44342
44348
|
outerHeight,
|
|
44343
|
-
styles: styles$
|
|
44349
|
+
styles: styles$c,
|
|
44344
44350
|
offset,
|
|
44345
44351
|
css,
|
|
44346
44352
|
each: each$1,
|
|
@@ -48941,7 +48947,7 @@ const getDotPos = (index, carouselLength) => {
|
|
|
48941
48947
|
: index - carouselLength;
|
|
48942
48948
|
};
|
|
48943
48949
|
|
|
48944
|
-
const styles$
|
|
48950
|
+
const styles$b = {
|
|
48945
48951
|
mainComponent: {
|
|
48946
48952
|
width: '100%',
|
|
48947
48953
|
flexDirection: 'column',
|
|
@@ -49014,7 +49020,7 @@ const CardRecommendationsMobile = ({ recommendations }) => {
|
|
|
49014
49020
|
display: 'flex',
|
|
49015
49021
|
justifyContent: 'center',
|
|
49016
49022
|
}, children: jsx$2(CardRecommendation, { cardIndex: index, bond: bond, handleBuyBondClick: () => window.open(`https://ape.bond/bonds?bondAddress=${bond.billAddress}&bondChain=${bond.chainId}`, '_blank', 'noreferrer') }, `${bond.billAddress}-${index}`) }, index));
|
|
49017
|
-
}) }), jsx$2(Flex, { sx: styles$
|
|
49023
|
+
}) }), jsx$2(Flex, { sx: styles$b.bubbleContainer, children: [...Array(recommendations === null || recommendations === void 0 ? void 0 : recommendations.length)].map((_, i) => {
|
|
49018
49024
|
return jsx$2(SwiperDots, { isActive: i === activeSlide, onClick: () => slideTo(i) }, i);
|
|
49019
49025
|
}) })] }));
|
|
49020
49026
|
};
|
|
@@ -71301,7 +71307,7 @@ const YourBondsModal = ({ onDismiss, userBill }) => {
|
|
|
71301
71307
|
}, children: "Claim" })) }), jsx$2(Flex$1, { className: "button-container transfer", children: jsx$2(Button, { className: "transfer-button", variant: "secondary", onClick: onTransferBondModal, disabled: !userBill, children: "TRANSFER" }) })] })] })] }), jsx$2(Recommendations, { onDismiss: onDismiss, billAddress: userBill === null || userBill === void 0 ? void 0 : userBill.address })] }) }));
|
|
71302
71308
|
};
|
|
71303
71309
|
|
|
71304
|
-
const styles$
|
|
71310
|
+
const styles$a = {
|
|
71305
71311
|
infoRow: {
|
|
71306
71312
|
justifyContent: 'space-between',
|
|
71307
71313
|
width: '100%',
|
|
@@ -71348,7 +71354,7 @@ const styles$9 = {
|
|
|
71348
71354
|
|
|
71349
71355
|
const ButtonsRow = ({ projectLink, twitter, bubble, audit, }) => {
|
|
71350
71356
|
const bubbleURL = `https://app.bubblemaps.io/bsc/token/${bubble}`;
|
|
71351
|
-
return (jsxs(Flex, { sx: { justifyContent: 'center' }, children: [jsx$2(Flex, { sx: styles$
|
|
71357
|
+
return (jsxs(Flex, { sx: { justifyContent: 'center' }, children: [jsx$2(Flex, { sx: styles$a.iconButton, as: Link, href: projectLink, target: "_blank", children: jsx$2(Svg, { icon: "URL", width: 18 }) }), jsx$2(Flex, { sx: styles$a.iconButton, as: Link, href: twitter, target: "_blank", children: jsx$2(Svg, { icon: "twitter", width: 18, color: "text" }) }), bubble && (jsx$2(Flex, { sx: styles$a.iconButton, as: Link, href: bubbleURL, target: "_blank", children: jsx$2(Svg, { icon: "bubble", width: 18, color: "text" }) })), audit && (jsxs(Flex, { sx: Object.assign(Object.assign({}, styles$a.iconButton), { margin: '0 0 5px 0', '& svg': { marginRight: '5px' } }), as: Link, href: audit, target: "_blank", children: [jsx$2(Svg, { icon: "audit", width: 18, color: "text" }), jsx$2(Text, { sx: { paddingRight: '5px' }, children: 'Audit' })] }))] }));
|
|
71352
71358
|
};
|
|
71353
71359
|
|
|
71354
71360
|
const ExpandedViewButton = ({ handleNavigation, rightPos }) => {
|
|
@@ -71409,7 +71415,7 @@ const BondInfoTooltip = ({ earnTokenContract, earnTokenSymbol, bondContract, pro
|
|
|
71409
71415
|
},
|
|
71410
71416
|
});
|
|
71411
71417
|
};
|
|
71412
|
-
return (jsxs(Flex, { sx: { flexDirection: 'column', flexWrap: 'wrap' }, children: [jsx$2(ButtonsRow, { twitter: twitter, projectLink: projectLink, bubble: earnTokenContract, audit: audit }), (config === null || config === void 0 ? void 0 : config.referenceId) === 'apebond' && (jsx$2(Flex, { sx: { width: '100%', my: '5px', justifyContent: 'center', position: 'relative', height: '25px' }, children: jsx$2(ExpandedViewButton, { handleNavigation: handleProjectViewNavigation, rightPos: '-5px' }) })), jsx$2(Flex, { sx: { justifyContent: 'center' }, children: jsxs(Flex, { sx: { width: '144px', flexDirection: 'column' }, children: [jsx$2(Flex, { sx: styles$
|
|
71418
|
+
return (jsxs(Flex, { sx: { flexDirection: 'column', flexWrap: 'wrap' }, children: [jsx$2(ButtonsRow, { twitter: twitter, projectLink: projectLink, bubble: earnTokenContract, audit: audit }), (config === null || config === void 0 ? void 0 : config.referenceId) === 'apebond' && (jsx$2(Flex, { sx: { width: '100%', my: '5px', justifyContent: 'center', position: 'relative', height: '25px' }, children: jsx$2(ExpandedViewButton, { handleNavigation: handleProjectViewNavigation, rightPos: '-5px' }) })), jsx$2(Flex, { sx: { justifyContent: 'center' }, children: jsxs(Flex, { sx: { width: '144px', flexDirection: 'column' }, children: [jsx$2(Flex, { sx: styles$a.linkRow, children: tokenLink && (jsxs(Link, { href: tokenLink, sx: styles$a.link, target: "_blank", children: ["View Token Contract", jsx$2(Flex, { sx: { ml: '5px' }, children: jsx$2(Svg, { icon: "external", color: "text", width: 10 }) })] })) }), jsx$2(Flex, { sx: styles$a.linkRow, children: bondLink && (jsxs(Link, { href: bondLink, sx: styles$a.link, target: "_blank", children: ["View Bond Contract", jsx$2(Flex, { sx: { ml: '5px' }, children: jsx$2(Svg, { icon: "external", color: "text", width: 10 }) })] })) }), jsx$2(Flex, { sx: styles$a.linkRow, children: bondLink && (jsxs(Link, { href: bondDashboard, sx: styles$a.link, target: "_blank", children: ["View Bond Insights", jsx$2(Flex, { sx: { ml: '5px' }, children: jsx$2(Svg, { icon: "external", color: "text", width: 10 }) })] })) })] }) })] }));
|
|
71413
71419
|
};
|
|
71414
71420
|
|
|
71415
71421
|
const UserBondRow = ({ bill }) => {
|
|
@@ -71450,7 +71456,7 @@ const UserBondRow = ({ bill }) => {
|
|
|
71450
71456
|
}
|
|
71451
71457
|
catch (error) {
|
|
71452
71458
|
setLoadingTx(false);
|
|
71453
|
-
console.error('
|
|
71459
|
+
console.error('Claim failed:', error);
|
|
71454
71460
|
addToastError(error.message);
|
|
71455
71461
|
}
|
|
71456
71462
|
});
|
|
@@ -71488,7 +71494,7 @@ const getBondsList = (apeswapListsURL) => __awaiter$9(void 0, void 0, void 0, fu
|
|
|
71488
71494
|
});
|
|
71489
71495
|
|
|
71490
71496
|
/* MODIFIED FUNCTION FROM FRONTEND SPECIFICALLY FOR THE SDK */
|
|
71491
|
-
const fetchUserOwnedBillsDataAsync = (chainId, account, bondData) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
71497
|
+
const fetchUserOwnedBillsDataAsync = (chainId, account, bondData, tokenPrices) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
71492
71498
|
try {
|
|
71493
71499
|
const bonds = bondData.filter((bond) => {
|
|
71494
71500
|
var _a;
|
|
@@ -71498,7 +71504,7 @@ const fetchUserOwnedBillsDataAsync = (chainId, account, bondData) => __awaiter$9
|
|
|
71498
71504
|
((_a = bond.contractAddress[bond.chainId]) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== ACF_TO_ABOND.toLowerCase();
|
|
71499
71505
|
});
|
|
71500
71506
|
// Fetch and set user owned bill data without NFT Data
|
|
71501
|
-
const userOwnedBills = yield fetchUserOwnedBills(chainId, account, bonds);
|
|
71507
|
+
const userOwnedBills = yield fetchUserOwnedBills(chainId, account, bonds, tokenPrices);
|
|
71502
71508
|
const mapUserOwnedBills = bonds.map((bill) => userOwnedBills.filter((b) => { var _a; return b.address.toLowerCase() === ((_a = bill.contractAddress[bill.chainId]) === null || _a === void 0 ? void 0 : _a.toLowerCase()); }));
|
|
71503
71509
|
const userOwnedBillsData = bonds.map((bill, i) => ({
|
|
71504
71510
|
index: bill.index,
|
|
@@ -71518,8 +71524,8 @@ const fetchUserOwnedBillsDataAsync = (chainId, account, bondData) => __awaiter$9
|
|
|
71518
71524
|
}
|
|
71519
71525
|
});
|
|
71520
71526
|
/* MODIFIED FUNCTION FROM FRONTEND SPECIFICALLY FOR THE SDK */
|
|
71521
|
-
const fetchUserOwnedBills = (chainId, account, bonds) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
71522
|
-
var _a, _b, _c, _d, _e;
|
|
71527
|
+
const fetchUserOwnedBills = (chainId, account, bonds, tokenPrices) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
71528
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
71523
71529
|
// Maps all the bills in the list repo to make a call to each of them to get Bills Id, meaning purchased bill ids
|
|
71524
71530
|
const billIdCalls = bonds.map((b) => {
|
|
71525
71531
|
var _a;
|
|
@@ -71534,7 +71540,6 @@ const fetchUserOwnedBills = (chainId, account, bonds) => __awaiter$9(void 0, voi
|
|
|
71534
71540
|
const billDataCalls = [];
|
|
71535
71541
|
const billVersions = [];
|
|
71536
71542
|
const billNFTCalls = [];
|
|
71537
|
-
// console.log(bonds)
|
|
71538
71543
|
billIds.forEach((idArray, index) => idArray[0].forEach((id) => id.gt(0) &&
|
|
71539
71544
|
(billDataCalls.push({
|
|
71540
71545
|
address: bonds[index].contractAddress[bonds[index].chainId],
|
|
@@ -71557,23 +71562,32 @@ const fetchUserOwnedBills = (chainId, account, bonds) => __awaiter$9(void 0, voi
|
|
|
71557
71562
|
billVersions.push(bonds[index].billVersion))));
|
|
71558
71563
|
const billData = yield multicall(chainId, BOND_ABI, billDataCalls, true, 150);
|
|
71559
71564
|
const pendingRewardsCall = yield multicall(chainId, BOND_ABI, billsPendingRewardCall);
|
|
71560
|
-
// const depositAmountCalls = await multicall(chainId, billAbi, billNFTCalls)
|
|
71561
71565
|
const result = [];
|
|
71562
71566
|
for (let i = 0; i < billsPendingRewardCall.length; i++) {
|
|
71563
71567
|
const billDataPos = i === 0 ? 0 : i * 2;
|
|
71568
|
+
let bond = billsPendingRewardCall[i].bond;
|
|
71569
|
+
bond = Object.assign(Object.assign({}, bond), { payoutTokenPrice: (_a = tokenPrices.find((tokenPrice) => {
|
|
71570
|
+
var _a, _b, _c, _d;
|
|
71571
|
+
return ((_a = tokenPrice.address) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === ((_d = (_c = (_b = bond === null || bond === void 0 ? void 0 : bond.earnToken) === null || _b === void 0 ? void 0 : _b.address) === null || _c === void 0 ? void 0 : _c[bond.chainId]) === null || _d === void 0 ? void 0 : _d.toLowerCase()) &&
|
|
71572
|
+
tokenPrice.chainId === bond.chainId;
|
|
71573
|
+
})) === null || _a === void 0 ? void 0 : _a.price, principalTokenPrice: (_b = tokenPrices.find((tokenPrice) => {
|
|
71574
|
+
var _a, _b, _c, _d;
|
|
71575
|
+
return ((_a = tokenPrice.address) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === ((_d = (_c = (_b = bond === null || bond === void 0 ? void 0 : bond.lpToken) === null || _b === void 0 ? void 0 : _b.address) === null || _c === void 0 ? void 0 : _c[bond.chainId]) === null || _d === void 0 ? void 0 : _d.toLowerCase()) &&
|
|
71576
|
+
tokenPrice.chainId === bond.chainId;
|
|
71577
|
+
})) === null || _b === void 0 ? void 0 : _b.price });
|
|
71564
71578
|
const data = billVersions[i] !== types.BillVersion.V1
|
|
71565
71579
|
? {
|
|
71566
71580
|
address: billsPendingRewardCall[i].address,
|
|
71567
71581
|
id: billsPendingRewardCall[i].params[0].toString(),
|
|
71568
|
-
payout: new BigNumber$1((
|
|
71569
|
-
.minus((
|
|
71582
|
+
payout: new BigNumber$1((_c = billData[billDataPos][0]) === null || _c === void 0 ? void 0 : _c.payout.toString())
|
|
71583
|
+
.minus((_d = billData[billDataPos][0]) === null || _d === void 0 ? void 0 : _d.payoutClaimed.toString())
|
|
71570
71584
|
.toString(),
|
|
71571
71585
|
billNftAddress: billData[billDataPos + 1][0].toString(),
|
|
71572
|
-
vesting: (
|
|
71573
|
-
lastBlockTimestamp: (
|
|
71574
|
-
truePricePaid: (
|
|
71586
|
+
vesting: (_e = billData[billDataPos][0]) === null || _e === void 0 ? void 0 : _e.vesting.toString(),
|
|
71587
|
+
lastBlockTimestamp: (_f = billData[billDataPos][0]) === null || _f === void 0 ? void 0 : _f.lastClaimTimestamp.toString(),
|
|
71588
|
+
truePricePaid: (_g = billData[billDataPos][0]) === null || _g === void 0 ? void 0 : _g.truePricePaid.toString(),
|
|
71575
71589
|
pendingRewards: pendingRewardsCall[i][0].toString(),
|
|
71576
|
-
bond
|
|
71590
|
+
bond,
|
|
71577
71591
|
}
|
|
71578
71592
|
: {
|
|
71579
71593
|
address: billsPendingRewardCall[i].address,
|
|
@@ -71584,7 +71598,7 @@ const fetchUserOwnedBills = (chainId, account, bonds) => __awaiter$9(void 0, voi
|
|
|
71584
71598
|
lastBlockTimestamp: billData[billDataPos][2].toString(),
|
|
71585
71599
|
truePricePaid: billData[billDataPos][3].toString(),
|
|
71586
71600
|
pendingRewards: pendingRewardsCall[i][0].toString(),
|
|
71587
|
-
bond
|
|
71601
|
+
bond,
|
|
71588
71602
|
};
|
|
71589
71603
|
result.push(data);
|
|
71590
71604
|
}
|
|
@@ -71596,19 +71610,20 @@ function useUserBonds() {
|
|
|
71596
71610
|
const { data: bondList } = useBondsList();
|
|
71597
71611
|
const { address } = useAccount();
|
|
71598
71612
|
const SDKConfig = useSDKConfig();
|
|
71613
|
+
const { data: tokenPrices } = useTokenPrices();
|
|
71599
71614
|
const chains = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.chains;
|
|
71600
71615
|
// Once the full list is fetched, fetch user's purchased bonds
|
|
71601
71616
|
return useQuery({
|
|
71602
71617
|
queryKey: [QUERY_KEYS.USER_BONDS, address],
|
|
71603
|
-
queryFn: () => getUserBonds(address, bondList, chains),
|
|
71618
|
+
queryFn: () => getUserBonds(address, bondList, chains, tokenPrices),
|
|
71604
71619
|
refetchOnWindowFocus: false,
|
|
71605
71620
|
refetchInterval: 60000,
|
|
71606
|
-
enabled: !!bondList && !!address,
|
|
71621
|
+
enabled: !!bondList && !!address && !!tokenPrices,
|
|
71607
71622
|
});
|
|
71608
71623
|
}
|
|
71609
|
-
const getUserBonds = (account, bondList, chains) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
71624
|
+
const getUserBonds = (account, bondList, chains, tokenPrices) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
71610
71625
|
try {
|
|
71611
|
-
const results = yield Promise.allSettled(chains.map((chain) => fetchUserOwnedBillsDataAsync(chain, account, bondList)));
|
|
71626
|
+
const results = yield Promise.allSettled(chains.map((chain) => fetchUserOwnedBillsDataAsync(chain, account, bondList, tokenPrices)));
|
|
71612
71627
|
// Filter out only fulfilled promises
|
|
71613
71628
|
const fulfilledResults = results
|
|
71614
71629
|
.filter((result) => result.status === 'fulfilled')
|
|
@@ -71813,8 +71828,208 @@ const BondFilters = ({ setChainFilterOption, chainFilterOption, filterOptions, f
|
|
|
71813
71828
|
}, children: ["Clear All", jsx$2(Flex, { sx: { ml: '7px' }, children: jsx$2(IconButton, { icon: "close", color: "textDisabledButton", variant: "transparent" }) })] })] }));
|
|
71814
71829
|
};
|
|
71815
71830
|
|
|
71831
|
+
const styles$9 = {
|
|
71832
|
+
sectionDividerFont: {
|
|
71833
|
+
fontWeight: '300',
|
|
71834
|
+
fontSize: '12px',
|
|
71835
|
+
},
|
|
71836
|
+
searchAndListContainer: {
|
|
71837
|
+
maxWidth: '100%',
|
|
71838
|
+
width: '450px',
|
|
71839
|
+
flexDirection: 'column',
|
|
71840
|
+
bg: 'white3',
|
|
71841
|
+
padding: '10px',
|
|
71842
|
+
borderRadius: '10px',
|
|
71843
|
+
height: 'calc(100% - 150px)',
|
|
71844
|
+
},
|
|
71845
|
+
searchInput: {
|
|
71846
|
+
fontWeight: '400',
|
|
71847
|
+
bg: 'white4',
|
|
71848
|
+
height: '40px',
|
|
71849
|
+
border: 'none',
|
|
71850
|
+
pl: '10px',
|
|
71851
|
+
borderRadius: '10px',
|
|
71852
|
+
mb: '8px',
|
|
71853
|
+
':focus': { outline: 'none' },
|
|
71854
|
+
},
|
|
71855
|
+
chainOptionButton: {
|
|
71856
|
+
width: '40px',
|
|
71857
|
+
height: '40px',
|
|
71858
|
+
borderRadius: 'normal',
|
|
71859
|
+
bg: 'white3',
|
|
71860
|
+
justifyContent: 'center',
|
|
71861
|
+
alignItems: ' center',
|
|
71862
|
+
':hover': {
|
|
71863
|
+
cursor: 'pointer',
|
|
71864
|
+
bg: 'white4',
|
|
71865
|
+
},
|
|
71866
|
+
},
|
|
71867
|
+
chainListContainer: {
|
|
71868
|
+
position: 'relative',
|
|
71869
|
+
mb: '10px',
|
|
71870
|
+
flexDirection: 'column',
|
|
71871
|
+
height: '100%',
|
|
71872
|
+
},
|
|
71873
|
+
chainOptionList: {
|
|
71874
|
+
width: '100%',
|
|
71875
|
+
height: '45px',
|
|
71876
|
+
borderRadius: '10px',
|
|
71877
|
+
gap: '10px',
|
|
71878
|
+
px: '10px',
|
|
71879
|
+
bg: 'white3',
|
|
71880
|
+
alignItems: ' center',
|
|
71881
|
+
':hover': {
|
|
71882
|
+
cursor: 'pointer',
|
|
71883
|
+
bg: 'white4',
|
|
71884
|
+
},
|
|
71885
|
+
},
|
|
71886
|
+
cursorHover: {
|
|
71887
|
+
':hover': {
|
|
71888
|
+
cursor: 'pointer',
|
|
71889
|
+
},
|
|
71890
|
+
},
|
|
71891
|
+
};
|
|
71892
|
+
|
|
71893
|
+
const formatChainList = (list) => {
|
|
71894
|
+
return list.map((chain) => ({
|
|
71895
|
+
chain,
|
|
71896
|
+
name: NETWORK_LABEL[chain] || 'Unknown',
|
|
71897
|
+
}));
|
|
71898
|
+
};
|
|
71899
|
+
|
|
71900
|
+
const ChainOptionsList = ({ setSelectedChain, setViewAllChains, chainList, }) => {
|
|
71901
|
+
const [searchQuery, setSearchQuery] = useState('');
|
|
71902
|
+
const handleChainSelect = (chain) => {
|
|
71903
|
+
setSelectedChain(chain);
|
|
71904
|
+
setViewAllChains(false);
|
|
71905
|
+
};
|
|
71906
|
+
const handleInput = useCallback((event) => {
|
|
71907
|
+
const input = event.target.value;
|
|
71908
|
+
setSearchQuery(input);
|
|
71909
|
+
}, []);
|
|
71910
|
+
return (jsx$2(Flex, { sx: styles$9.searchAndListContainer, children: jsxs(Flex, { sx: { position: 'relative', flexDirection: 'column', height: '100%' }, children: [jsxs(Flex, { children: [jsx$2(Input, { onChange: handleInput, sx: styles$9.searchInput, placeholder: "Search by chain name" }), jsx$2(Flex, { sx: { position: 'absolute', right: '10px', top: '12px' }, children: jsx$2(Svg, { icon: "search" }) })] }), jsx$2(Flex, { sx: styles$9.chainListContainer, children: formatChainList(chainList)
|
|
71911
|
+
.filter((chainInfo) => chainInfo.name.toLowerCase().includes(searchQuery.toLowerCase()))
|
|
71912
|
+
.map((chainInfo) => {
|
|
71913
|
+
return (jsxs(Flex, { sx: styles$9.chainOptionList, onClick: () => handleChainSelect(chainInfo.chain), children: [jsx$2(Flex, { sx: { overflow: 'hidden', borderRadius: '50px' }, children: jsx$2(Svg, { width: "25px", icon: NETWORK_ICONS[chainInfo.chain] ? NETWORK_ICONS[chainInfo.chain] : 'question' }) }), jsx$2(Text, { sx: { fontWeight: '500', fontSize: '16px' }, children: chainInfo.name })] }, chainInfo.name));
|
|
71914
|
+
}) })] }) }));
|
|
71915
|
+
};
|
|
71916
|
+
|
|
71917
|
+
const ChainOptionsButtons = ({ selectedChain, setSelectedChain, setViewAllChains, chainList, }) => {
|
|
71918
|
+
return (jsxs(Flex, { sx: { position: 'relative', mb: '10px' }, children: [formatChainList(chainList)
|
|
71919
|
+
.sort((chainInfo) => (chainInfo.chain === selectedChain ? -1 : 1))
|
|
71920
|
+
.slice(0, 7)
|
|
71921
|
+
.map((chainInfo) => {
|
|
71922
|
+
return (jsx$2(Flex, { sx: Object.assign(Object.assign({}, styles$9.chainOptionButton), { border: selectedChain === chainInfo.chain && 'primaryButton', mr: '10px' }), onClick: () => setSelectedChain(chainInfo.chain), children: jsx$2(Flex, { sx: { overflow: 'hidden', borderRadius: '50px' }, children: jsx$2(Svg, { width: "25px", icon: NETWORK_ICONS[chainInfo.chain] ? NETWORK_ICONS[chainInfo.chain] : 'question' }) }) }, chainInfo.name));
|
|
71923
|
+
}), chainList.length > 7 && (jsx$2(Flex, { sx: styles$9.chainOptionButton, onClick: () => setViewAllChains(true), children: jsxs(Text, { children: [chainList.length - 7, "+"] }) }))] }));
|
|
71924
|
+
};
|
|
71925
|
+
|
|
71926
|
+
const ClaimAllModal = () => {
|
|
71927
|
+
var _a, _b;
|
|
71928
|
+
const { chainId, address: account } = useAccount();
|
|
71929
|
+
const { switchChain } = useSwitchChain();
|
|
71930
|
+
const SDKConfig = useSDKConfig();
|
|
71931
|
+
const chains = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.chains;
|
|
71932
|
+
const [selectedChain, setSelectedChain] = useState(chainId !== null && chainId !== void 0 ? chainId : 56);
|
|
71933
|
+
const [viewAllChains, setViewAllChains] = useState(false);
|
|
71934
|
+
const { data: userOwnedBills } = useUserBonds();
|
|
71935
|
+
const ownedBills = userOwnedBills === null || userOwnedBills === void 0 ? void 0 : userOwnedBills.filter((bill) => parseFloat(bill === null || bill === void 0 ? void 0 : bill.payout) > 0);
|
|
71936
|
+
const groupedBills = ownedBills === null || ownedBills === void 0 ? void 0 : ownedBills.reduce((acc, bill) => {
|
|
71937
|
+
const bondIndex = bill.bond.index;
|
|
71938
|
+
// Check if this bond index already exists in the accumulator
|
|
71939
|
+
const existingGroup = acc.find((group) => group.bond.index === bondIndex);
|
|
71940
|
+
if (existingGroup) {
|
|
71941
|
+
// If the group already exists, add this bill to the userOwnedBills array
|
|
71942
|
+
existingGroup.userOwnedBills.push(bill);
|
|
71943
|
+
}
|
|
71944
|
+
else {
|
|
71945
|
+
// If it doesn't exist, create a new group
|
|
71946
|
+
acc.push({
|
|
71947
|
+
bond: bill.bond,
|
|
71948
|
+
userOwnedBills: [bill],
|
|
71949
|
+
});
|
|
71950
|
+
}
|
|
71951
|
+
return acc;
|
|
71952
|
+
}, []);
|
|
71953
|
+
const bondsOfSelectedChain = groupedBills === null || groupedBills === void 0 ? void 0 : groupedBills.filter((group) => group.bond.chainId === selectedChain);
|
|
71954
|
+
const ownedBillsAmount = bondsOfSelectedChain === null || bondsOfSelectedChain === void 0 ? void 0 : bondsOfSelectedChain.reduce((total, ownerBills) => { var _a; return total + (((_a = ownerBills.userOwnedBills) === null || _a === void 0 ? void 0 : _a.length) || 0); }, 0);
|
|
71955
|
+
const { addToastError } = usePopups();
|
|
71956
|
+
const { writeContractAsync } = useWriteContract();
|
|
71957
|
+
const handleClaim = () => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
71958
|
+
try {
|
|
71959
|
+
bondsOfSelectedChain === null || bondsOfSelectedChain === void 0 ? void 0 : bondsOfSelectedChain.map((purchasedBond) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
71960
|
+
const address = purchasedBond.bond.contractAddress[purchasedBond.bond.chainId];
|
|
71961
|
+
console.log(purchasedBond);
|
|
71962
|
+
console.log(address);
|
|
71963
|
+
track({
|
|
71964
|
+
event: 'bond',
|
|
71965
|
+
chain: purchasedBond.bond.chainId,
|
|
71966
|
+
data: {
|
|
71967
|
+
cat: 'claimAll',
|
|
71968
|
+
address,
|
|
71969
|
+
earnToken: purchasedBond === null || purchasedBond === void 0 ? void 0 : purchasedBond.bond.earnToken.symbol,
|
|
71970
|
+
},
|
|
71971
|
+
});
|
|
71972
|
+
return writeContractAsync({
|
|
71973
|
+
address: address,
|
|
71974
|
+
abi: BOND_ABI,
|
|
71975
|
+
functionName: 'batchRedeem',
|
|
71976
|
+
args: [purchasedBond.userOwnedBills.map((b) => b.id)],
|
|
71977
|
+
});
|
|
71978
|
+
}));
|
|
71979
|
+
}
|
|
71980
|
+
catch (error) {
|
|
71981
|
+
console.error('Claim All failed:', error);
|
|
71982
|
+
addToastError(error.message);
|
|
71983
|
+
}
|
|
71984
|
+
});
|
|
71985
|
+
const purchasedBillsChains = (_a = groupedBills === null || groupedBills === void 0 ? void 0 : groupedBills.reduce((acc, bill) => {
|
|
71986
|
+
if (acc.includes(bill.bond.chainId)) {
|
|
71987
|
+
return acc;
|
|
71988
|
+
}
|
|
71989
|
+
else
|
|
71990
|
+
return [...acc, bill.bond.chainId];
|
|
71991
|
+
}, [])) === null || _a === void 0 ? void 0 : _a.sort((a, b) => a - b);
|
|
71992
|
+
return (jsx$2(Modal, { title: "Claim All", sx: { width: '420px' }, children: viewAllChains ? (jsxs(Fragment$1, { children: [jsxs(Flex, { sx: { justifyContent: 'space-between', mb: '20px' }, children: [jsx$2(Flex, { onClick: () => setViewAllChains(false), sx: {
|
|
71993
|
+
':hover': {
|
|
71994
|
+
cursor: 'pointer',
|
|
71995
|
+
},
|
|
71996
|
+
}, children: jsx$2(Svg, { width: "10px", icon: "arrow", direction: "left" }) }), jsx$2(Text, { sx: { fontSize: '16px', fontWeight: '300' }, children: "All Chain Options" })] }), jsx$2(ChainOptionsList, { setSelectedChain: setSelectedChain, setViewAllChains: setViewAllChains, chainList: chains })] })) : (jsxs(Flex, { sx: { flexDirection: 'column', width: '100%' }, children: [jsx$2(Text, { sx: { fontSize: '14px', fontWeight: 400, my: '10px' }, children: "Select the chain from which you want to claim your Bonds." }), jsx$2(ChainOptionsButtons, { setSelectedChain: setSelectedChain, selectedChain: selectedChain, setViewAllChains: setViewAllChains, chainList: purchasedBillsChains !== null && purchasedBillsChains !== void 0 ? purchasedBillsChains : [] }), jsx$2(Flex, { sx: {
|
|
71997
|
+
width: '100%',
|
|
71998
|
+
mt: '10px',
|
|
71999
|
+
background: 'white3',
|
|
72000
|
+
borderRadius: 'normal',
|
|
72001
|
+
p: '10px',
|
|
72002
|
+
flexDirection: 'column',
|
|
72003
|
+
height: '30vh',
|
|
72004
|
+
overflowY: 'auto',
|
|
72005
|
+
}, children: bondsOfSelectedChain && (bondsOfSelectedChain === null || bondsOfSelectedChain === void 0 ? void 0 : bondsOfSelectedChain.length) > 0 ? (bondsOfSelectedChain === null || bondsOfSelectedChain === void 0 ? void 0 : bondsOfSelectedChain.filter((userBill) => userBill.bond.chainId === selectedChain).map((ownedBill, index) => {
|
|
72006
|
+
var _a, _b;
|
|
72007
|
+
return (jsxs(Flex, { sx: { width: '100%', alignItems: 'center', p: '5px' }, children: [jsx$2(TokenImage, { symbol: ownedBill.bond.earnToken.symbol, size: 30 }), jsxs(Text, { sx: { ml: '10px' }, children: [ownedBill.bond.earnToken.symbol, jsxs(Text, { sx: { fontSize: '14px', fontWeight: 400, color: 'textDisabledButton', ml: '10px' }, children: ["(", (_a = ownedBill === null || ownedBill === void 0 ? void 0 : ownedBill.userOwnedBills) === null || _a === void 0 ? void 0 : _a.length, " Bond", (ownedBill === null || ownedBill === void 0 ? void 0 : ownedBill.userOwnedBills) && ((_b = ownedBill === null || ownedBill === void 0 ? void 0 : ownedBill.userOwnedBills) === null || _b === void 0 ? void 0 : _b.length) > 1 ? 's' : '', ")"] })] })] }, `${ownedBill.bond.earnToken.symbol}-${index}`));
|
|
72008
|
+
})) : (jsx$2(Flex, { sx: {
|
|
72009
|
+
fontSize: '14px',
|
|
72010
|
+
fontWeight: 400,
|
|
72011
|
+
color: 'textDisabledButton',
|
|
72012
|
+
justifyContent: 'center',
|
|
72013
|
+
mt: '10px',
|
|
72014
|
+
}, children: "No bonds to claim for this chain" })) }), jsxs(Text, { sx: { fontSize: '14px', fontWeight: 400, mt: '15px' }, children: [`You'll claim`, " ", ownedBillsAmount, " Bonds in ", bondsOfSelectedChain === null || bondsOfSelectedChain === void 0 ? void 0 : bondsOfSelectedChain.length, " transaction", ((_b = bondsOfSelectedChain === null || bondsOfSelectedChain === void 0 ? void 0 : bondsOfSelectedChain.length) !== null && _b !== void 0 ? _b : 0) > 1 ? 's' : '', "."] }), chainId === selectedChain ? (jsx$2(Button, { sx: { mt: '15px', width: '100%' }, onClick: handleClaim, children: "Claim" })) : (jsxs(Button, { sx: { mt: '15px', width: '100%' }, onClick: () => switchChain({ chainId: selectedChain }), children: ["Switch to ", NETWORK_LABEL[selectedChain !== null && selectedChain !== void 0 ? selectedChain : 0]] }))] })) }));
|
|
72015
|
+
};
|
|
72016
|
+
|
|
72017
|
+
const ClaimAll = () => {
|
|
72018
|
+
const { address: account } = useAccount();
|
|
72019
|
+
const [onOpenModal] = useModal(jsx$2(ClaimAllModal, {}));
|
|
72020
|
+
return (jsx$2(Button, { onClick: onOpenModal, disabled: !account, sx: {
|
|
72021
|
+
height: ['36px', '36px', '36px', '26px'],
|
|
72022
|
+
lineHeight: '12px',
|
|
72023
|
+
fontSize: '14px',
|
|
72024
|
+
fontWeight: 600,
|
|
72025
|
+
width: '100%',
|
|
72026
|
+
opacity: 1,
|
|
72027
|
+
}, children: "Claim All" }));
|
|
72028
|
+
};
|
|
72029
|
+
|
|
71816
72030
|
const YourBondsMenu = ({ chainFilterOption, setChainFilterOption, filterOptions, filterOption, setFilterOption, setInputValue, inputValue, handleSort, }) => {
|
|
71817
|
-
|
|
72031
|
+
const SDKConfig = useSDKConfig();
|
|
72032
|
+
return (jsxs("div", { className: "bonds-menu", children: [jsx$2(BondFilters, { chainFilterOption: chainFilterOption !== null && chainFilterOption !== void 0 ? chainFilterOption : ['All Chains'], setChainFilterOption: setChainFilterOption, filterOptions: filterOptions, filterOption: filterOption, setFilterOption: setFilterOption, onHandleQueryChange: () => setInputValue('') }), jsxs("div", { className: "table-header-container", children: [jsx$2("div", { className: "search-container", children: jsx$2(Flex$1, { sx: { width: '100%', maxWidth: '300px' }, children: jsx$2(Input, { className: "search-input", value: inputValue, onChange: (event) => setInputValue(event.target.value), variant: "search", sx: { fontWeight: 600, background: 'white2', height: '30px', fontSize: '14px', color: 'white' }, width: '100%', placeholder: 'Search...' }) }) }), jsxs("div", { className: "headers-container", children: [jsxs("div", { className: "your-bonds-table-headers", onClick: () => handleSort('claimable'), children: ["CLAIMABLE", jsx$2(Flex$1, { sx: { ml: '5px' }, children: jsx$2(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) })] }), jsxs("div", { className: "your-bonds-table-headers", onClick: () => handleSort('pending'), children: ["PENDING", jsx$2(Flex$1, { sx: { ml: '5px' }, children: jsx$2(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) })] }), jsxs("div", { className: "your-bonds-table-headers", onClick: () => handleSort('terms'), children: ["TERMS", jsx$2(Flex$1, { sx: { ml: '5px' }, children: jsx$2(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) })] }), jsx$2(Flex$1, { className: "claim-all-button-container", children: SDKConfig.referenceId === 'apebond' && jsx$2(ClaimAll, {}) })] })] })] }));
|
|
71818
72033
|
};
|
|
71819
72034
|
|
|
71820
72035
|
const YourBonds = () => {
|
|
@@ -71824,47 +72039,60 @@ const YourBonds = () => {
|
|
|
71824
72039
|
const { data: chainFilterOption, setChainFilterOption } = useChainFilterOption();
|
|
71825
72040
|
useTokenPrices();
|
|
71826
72041
|
// State
|
|
71827
|
-
const [sortConfig, setSortConfig] = useState(
|
|
71828
|
-
|
|
72042
|
+
const [sortConfig, setSortConfig] = useState({
|
|
72043
|
+
key: 'pending',
|
|
72044
|
+
direction: 'desc',
|
|
72045
|
+
});
|
|
71829
72046
|
const [inputValue, setInputValue] = useState('');
|
|
71830
|
-
const [filteredBonds, setFilteredBonds] = useState(sortedBonds);
|
|
71831
72047
|
const filterOptions = ['CLAIMABLE', 'ALL'];
|
|
71832
72048
|
const [filterOption, setFilterOption] = useState(filterOptions[0]);
|
|
71833
72049
|
const handleSort = (key) => {
|
|
71834
|
-
let direction = '
|
|
71835
|
-
if ((sortConfig === null || sortConfig === void 0 ? void 0 : sortConfig.key) === key && (sortConfig === null || sortConfig === void 0 ? void 0 : sortConfig.direction) === '
|
|
71836
|
-
direction = '
|
|
72050
|
+
let direction = 'desc';
|
|
72051
|
+
if ((sortConfig === null || sortConfig === void 0 ? void 0 : sortConfig.key) === key && (sortConfig === null || sortConfig === void 0 ? void 0 : sortConfig.direction) === 'desc') {
|
|
72052
|
+
direction = 'asc';
|
|
71837
72053
|
}
|
|
71838
72054
|
setSortConfig({ key, direction });
|
|
71839
72055
|
};
|
|
71840
|
-
|
|
71841
|
-
useEffect(() => {
|
|
71842
|
-
var _a;
|
|
71843
|
-
//TODO: fix sorting should be usd values NOT the amount of tokens. Also it is not correct to handle this with useEffects
|
|
71844
|
-
// The correct way to handle would be to have a single const wrapped by a useMemo, in the first part handle filter and lastly handle sort
|
|
72056
|
+
const bondsToRender = useMemo(() => {
|
|
71845
72057
|
if (!userBonds)
|
|
71846
|
-
return;
|
|
71847
|
-
|
|
71848
|
-
|
|
71849
|
-
|
|
71850
|
-
|
|
71851
|
-
|
|
71852
|
-
|
|
71853
|
-
|
|
71854
|
-
|
|
72058
|
+
return [];
|
|
72059
|
+
let bondsToReturn = userBonds;
|
|
72060
|
+
// Handle Filtering //
|
|
72061
|
+
// Filter by search query
|
|
72062
|
+
if (inputValue !== '') {
|
|
72063
|
+
bondsToReturn = bondsToReturn === null || bondsToReturn === void 0 ? void 0 : bondsToReturn.filter((bond) => {
|
|
72064
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
72065
|
+
return [
|
|
72066
|
+
(_b = (_a = bond === null || bond === void 0 ? void 0 : bond.bond) === null || _a === void 0 ? void 0 : _a.showcaseTokenName) === null || _b === void 0 ? void 0 : _b.toLowerCase(),
|
|
72067
|
+
(_e = (_d = (_c = bond === null || bond === void 0 ? void 0 : bond.bond) === null || _c === void 0 ? void 0 : _c.earnToken) === null || _d === void 0 ? void 0 : _d.symbol) === null || _e === void 0 ? void 0 : _e.toLowerCase(),
|
|
72068
|
+
(_h = (_g = (_f = bond === null || bond === void 0 ? void 0 : bond.bond) === null || _f === void 0 ? void 0 : _f.lpToken) === null || _g === void 0 ? void 0 : _g.symbol) === null || _h === void 0 ? void 0 : _h.toLowerCase(),
|
|
72069
|
+
].some((property) => property === null || property === void 0 ? void 0 : property.includes(inputValue.toLowerCase()));
|
|
71855
72070
|
});
|
|
71856
|
-
setSortedBonds(sortedBills);
|
|
71857
|
-
return;
|
|
71858
72071
|
}
|
|
71859
|
-
|
|
72072
|
+
// Filter by chain selector
|
|
72073
|
+
if (!chainFilterOption.includes('All Chains')) {
|
|
72074
|
+
bondsToReturn = bondsToReturn === null || bondsToReturn === void 0 ? void 0 : bondsToReturn.filter((bond) => {
|
|
72075
|
+
return chainFilterOption.includes(bond.bond.chainId.toString());
|
|
72076
|
+
});
|
|
72077
|
+
}
|
|
72078
|
+
// Filter by filter option (claimable or all buttons)
|
|
72079
|
+
if (filterOption === 'CLAIMABLE') {
|
|
72080
|
+
bondsToReturn = bondsToReturn === null || bondsToReturn === void 0 ? void 0 : bondsToReturn.filter((bond) => {
|
|
72081
|
+
return bond.pendingRewards !== '0';
|
|
72082
|
+
});
|
|
72083
|
+
}
|
|
72084
|
+
// Handle sorting //
|
|
72085
|
+
if (sortConfig === null)
|
|
72086
|
+
return bondsToReturn;
|
|
72087
|
+
bondsToReturn = bondsToReturn === null || bondsToReturn === void 0 ? void 0 : bondsToReturn.sort((a, b) => {
|
|
71860
72088
|
let aValue, bValue;
|
|
71861
72089
|
if (sortConfig.key === 'claimable') {
|
|
71862
|
-
aValue =
|
|
71863
|
-
bValue =
|
|
72090
|
+
aValue = claimableUSD(a);
|
|
72091
|
+
bValue = claimableUSD(b);
|
|
71864
72092
|
}
|
|
71865
72093
|
else if (sortConfig.key === 'pending') {
|
|
71866
|
-
aValue =
|
|
71867
|
-
bValue =
|
|
72094
|
+
aValue = totalPendingUSD(a);
|
|
72095
|
+
bValue = totalPendingUSD(b);
|
|
71868
72096
|
}
|
|
71869
72097
|
else if (sortConfig.key === 'terms') {
|
|
71870
72098
|
const aRemainingTime = vestingTimeRemaining(a).days * 24 * 3600 +
|
|
@@ -71888,41 +72116,12 @@ const YourBonds = () => {
|
|
|
71888
72116
|
}
|
|
71889
72117
|
return 0;
|
|
71890
72118
|
});
|
|
71891
|
-
|
|
71892
|
-
}, [sortConfig,
|
|
71893
|
-
// This effect handles the filtering
|
|
71894
|
-
useEffect(() => {
|
|
71895
|
-
// TODO: when this is refactored a single filter method should be applied, this is mapping the bonds a lot of times
|
|
71896
|
-
let filtered = sortedBonds;
|
|
71897
|
-
// Filter by search query
|
|
71898
|
-
if (inputValue !== '') {
|
|
71899
|
-
filtered = filtered === null || filtered === void 0 ? void 0 : filtered.filter((bond) => {
|
|
71900
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
71901
|
-
return [
|
|
71902
|
-
(_b = (_a = bond === null || bond === void 0 ? void 0 : bond.bond) === null || _a === void 0 ? void 0 : _a.showcaseTokenName) === null || _b === void 0 ? void 0 : _b.toLowerCase(),
|
|
71903
|
-
(_e = (_d = (_c = bond === null || bond === void 0 ? void 0 : bond.bond) === null || _c === void 0 ? void 0 : _c.earnToken) === null || _d === void 0 ? void 0 : _d.symbol) === null || _e === void 0 ? void 0 : _e.toLowerCase(),
|
|
71904
|
-
(_h = (_g = (_f = bond === null || bond === void 0 ? void 0 : bond.bond) === null || _f === void 0 ? void 0 : _f.lpToken) === null || _g === void 0 ? void 0 : _g.symbol) === null || _h === void 0 ? void 0 : _h.toLowerCase(),
|
|
71905
|
-
].some((property) => property === null || property === void 0 ? void 0 : property.includes(inputValue.toLowerCase()));
|
|
71906
|
-
});
|
|
71907
|
-
}
|
|
71908
|
-
// Filter by chain selector
|
|
71909
|
-
if (!chainFilterOption.includes('All Chains')) {
|
|
71910
|
-
filtered = filtered === null || filtered === void 0 ? void 0 : filtered.filter((bond) => {
|
|
71911
|
-
return chainFilterOption.includes(bond.bond.chainId.toString());
|
|
71912
|
-
});
|
|
71913
|
-
}
|
|
71914
|
-
// Filter by filter option (claimable or all buttons)
|
|
71915
|
-
if (filterOption === 'CLAIMABLE') {
|
|
71916
|
-
filtered = filtered === null || filtered === void 0 ? void 0 : filtered.filter((bond) => {
|
|
71917
|
-
return bond.pendingRewards !== '0';
|
|
71918
|
-
});
|
|
71919
|
-
}
|
|
71920
|
-
setFilteredBonds(filtered);
|
|
71921
|
-
}, [inputValue, sortedBonds, chainFilterOption, filterOption]);
|
|
72119
|
+
return bondsToReturn;
|
|
72120
|
+
}, [userBonds, sortConfig, inputValue, chainFilterOption, filterOption, userBondsFetched]);
|
|
71922
72121
|
const handleFilterOption = useCallback((newOption) => {
|
|
71923
72122
|
setFilterOption(newOption);
|
|
71924
72123
|
}, []);
|
|
71925
|
-
return (jsxs(Flex$1, { className: "yourbonds table-container", children: [jsx$2(YourBondsMenu, { chainFilterOption: chainFilterOption, setChainFilterOption: setChainFilterOption, filterOptions: filterOptions, filterOption: filterOption, setFilterOption: handleFilterOption, setInputValue: setInputValue, inputValue: inputValue, handleSort: handleSort }), !account ? (jsx$2(PlaceholderMonkey, { text: 'You are not connected' })) :
|
|
72124
|
+
return (jsxs(Flex$1, { className: "yourbonds table-container", children: [jsx$2(YourBondsMenu, { chainFilterOption: chainFilterOption, setChainFilterOption: setChainFilterOption, filterOptions: filterOptions, filterOption: filterOption, setFilterOption: handleFilterOption, setInputValue: setInputValue, inputValue: inputValue, handleSort: handleSort }), !account ? (jsx$2(PlaceholderMonkey, { text: 'You are not connected' })) : bondsToRender && (bondsToRender === null || bondsToRender === void 0 ? void 0 : bondsToRender.length) > 0 ? (bondsToRender === null || bondsToRender === void 0 ? void 0 : bondsToRender.map((bill) => jsx$2(UserBondRow, { bill: bill }, bill.id))) : inputValue !== '' || !chainFilterOption.includes('All Chains') ? (jsx$2(PlaceholderMonkey, { text: 'No results, change filters!' })) : userBondsFetched && (userBonds === null || userBonds === void 0 ? void 0 : userBonds.length) === 0 ? (jsxs(Flex$1, { sx: { flexDirection: 'column', justifyContent: 'center', alignItems: 'center', width: '100%' }, children: [jsx$2(Svg, { icon: "placeholderMonkey" }), jsx$2(Flex$1, { sx: { mt: '15px' }, children: "You do not own any Bonds." })] })) : (jsx$2(Flex$1, { className: "yourbonds-spinner", children: jsx$2(Spinner, { size: 100 }) }))] }));
|
|
71926
72125
|
};
|
|
71927
72126
|
|
|
71928
72127
|
// This basically returns the 2 tags with the higher active bond count
|
|
@@ -72771,7 +72970,9 @@ const getLpType = (protocol) => {
|
|
|
72771
72970
|
? 'univ2'
|
|
72772
72971
|
: protocol === types.Protocols.V3 // This might be a hot fix. Lets revisit this on the future
|
|
72773
72972
|
? 'ichi'
|
|
72774
|
-
:
|
|
72973
|
+
: protocol === types.Protocols.Curve
|
|
72974
|
+
? 'curve'
|
|
72975
|
+
: null;
|
|
72775
72976
|
};
|
|
72776
72977
|
|
|
72777
72978
|
const useSlippage = () => {
|
|
@@ -72843,7 +73044,7 @@ const useSoulZapTokenQuote = (typedValue, inputCurrency, outputToken, chainId, a
|
|
|
72843
73044
|
underlyingDex: ichiUnderlyingDex,
|
|
72844
73045
|
vault: isLP ? vault : undefined,
|
|
72845
73046
|
slippage: slippage,
|
|
72846
|
-
lpAddress: lpType === 'solidly' || lpType === 'univ2' ? vault : undefined,
|
|
73047
|
+
lpAddress: lpType === 'solidly' || lpType === 'univ2' || lpType === 'curve' ? vault : undefined,
|
|
72847
73048
|
router: lpType === 'solidly' || lpType === 'univ2' ? router : undefined,
|
|
72848
73049
|
toToken: isLP ? undefined : vault,
|
|
72849
73050
|
},
|
|
@@ -74095,7 +74296,7 @@ const useSoulZapBondQuote = (typedValue, inputCurrency, bond, account) => {
|
|
|
74095
74296
|
underlyingDex: ichiUnderlyingDex,
|
|
74096
74297
|
vault: isReserveBond ? undefined : vault,
|
|
74097
74298
|
slippage: slippage,
|
|
74098
|
-
lpAddress: lpType === 'solidly' || lpType === 'univ2' ? vault : undefined,
|
|
74299
|
+
lpAddress: lpType === 'solidly' || lpType === 'univ2' || lpType === 'curve' ? vault : undefined,
|
|
74099
74300
|
router: lpType === 'solidly' || lpType === 'univ2' ? router : undefined,
|
|
74100
74301
|
toToken: isReserveBond ? vault : undefined,
|
|
74101
74302
|
},
|
|
@@ -75344,7 +75545,7 @@ const HotBondCard = ({ bond }) => {
|
|
|
75344
75545
|
},
|
|
75345
75546
|
});
|
|
75346
75547
|
};
|
|
75347
|
-
return (jsx$2(Flex, { sx: styles$
|
|
75548
|
+
return (jsx$2(Flex, { sx: styles$b.desktopCard, className: "hot-bond-card", onClick: handleOpenModal, children: jsxs(Flex, { sx: { flexDirection: 'column', width: '100%' }, children: [jsxs(Flex, { sx: { width: '100%', height: '75px' }, children: [jsx$2(Flex, { sx: { width: '66.66%' }, children: jsx$2(TokenInfoAndName, { bill: bond, isHotBond: true }) }), jsx$2(Flex, { className: "column column-tokenicons", sx: { width: '33.33% !important', justifyContent: 'center !important', alignItems: 'center' }, children: jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(BondInfoTooltip, { earnTokenContract: (_c = (_b = (_a = bond === null || bond === void 0 ? void 0 : bond.earnToken) === null || _a === void 0 ? void 0 : _a.address) === null || _b === void 0 ? void 0 : _b[bond === null || bond === void 0 ? void 0 : bond.chainId]) !== null && _c !== void 0 ? _c : '', earnTokenSymbol: (_e = (_d = bond === null || bond === void 0 ? void 0 : bond.earnToken) === null || _d === void 0 ? void 0 : _d.symbol) !== null && _e !== void 0 ? _e : '', bondContract: (_f = bond === null || bond === void 0 ? void 0 : bond.billAddress) !== null && _f !== void 0 ? _f : '', projectLink: bond === null || bond === void 0 ? void 0 : bond.projectLink, twitter: bond === null || bond === void 0 ? void 0 : bond.twitter, audit: bond === null || bond === void 0 ? void 0 : bond.audit, chain: bond === null || bond === void 0 ? void 0 : bond.chainId }), width: "205px", placement: "bottomRight", transformTip: "translate(11%, 0%)", children: jsx$2(Svg, { icon: "more", width: "20px" }) }) })] }), jsxs(Flex, { sx: { width: '100%', justifyContent: 'space-around' }, children: [jsxs(Flex, { sx: { flexDirection: 'column', alignItems: 'center', width: '100%' }, children: [jsx$2(Flex, { sx: { opacity: 0.6, fontSize: '12px', fontWeight: 400 }, children: "Bonus" }), jsx$2(Flex, { className: `${getDiscountColor(bonus)}`, sx: { width: '100%', justifyContent: 'center' }, children: bonus !== undefined ? (bonus < 0 ? '0%' : `${bonus === null || bonus === void 0 ? void 0 : bonus.toFixed(2)}%`) : '-' })] }), jsxs(Flex, { sx: { flexDirection: 'column', alignItems: 'center', width: '100%' }, children: [jsx$2(Flex, { sx: { opacity: 0.6, fontSize: '12px', fontWeight: 400, width: '100%', justifyContent: 'center' }, children: "ARR" }), jsx$2(Flex, { sx: { width: '100%', justifyContent: 'center' }, children: calculateARR(bond) !== undefined ? calculateARR(bond) : '-' })] }), jsxs(Flex, { sx: { flexDirection: 'column', alignItems: 'center', width: '100%' }, children: [jsx$2(Flex, { sx: { opacity: 0.6, fontSize: '12px', fontWeight: 400, width: '100%', justifyContent: 'center' }, children: "Terms" }), jsx$2(Flex, { sx: { width: '100%', justifyContent: 'center' }, children: ((_g = vestingTime(bond === null || bond === void 0 ? void 0 : bond.vestingTerm)) === null || _g === void 0 ? void 0 : _g.days) ? `${(_h = vestingTime(bond === null || bond === void 0 ? void 0 : bond.vestingTerm)) === null || _h === void 0 ? void 0 : _h.days} D` : '-' })] })] })] }) }));
|
|
75348
75549
|
};
|
|
75349
75550
|
|
|
75350
75551
|
function useHotBondContracts() {
|
|
@@ -75395,7 +75596,7 @@ const HotBondCards = () => {
|
|
|
75395
75596
|
setActiveSlide(index);
|
|
75396
75597
|
swiper === null || swiper === void 0 ? void 0 : swiper.slideTo(index);
|
|
75397
75598
|
};
|
|
75398
|
-
return (jsxs(Flex, { sx: styles$
|
|
75599
|
+
return (jsxs(Flex, { sx: styles$b.mainComponent, children: [jsx$2(Flex, { sx: styles$b.hotBondTitle, children: "HOT BONDS" }), jsx$2(Flex, { sx: styles$b.desktopCards, children: filteredBonds === null || filteredBonds === void 0 ? void 0 : filteredBonds.slice(0, 3).map((bond, index) => {
|
|
75399
75600
|
return jsx$2(HotBondCard, { bond: bond }, `${bond.billAddress}-${index}`);
|
|
75400
75601
|
}) }), jsxs(Flex, { sx: {
|
|
75401
75602
|
flexDirection: 'column',
|
|
@@ -75414,7 +75615,7 @@ const HotBondCards = () => {
|
|
|
75414
75615
|
display: 'flex',
|
|
75415
75616
|
justifyContent: 'center',
|
|
75416
75617
|
}, children: jsx$2(HotBondCard, { bond: bond }, `${bond.billAddress}-${index}`) }, index));
|
|
75417
|
-
}) }), jsx$2(Flex, { sx: styles$
|
|
75618
|
+
}) }), jsx$2(Flex, { sx: styles$b.bubbleContainer, children: [...Array(hotBonds === null || hotBonds === void 0 ? void 0 : hotBonds.length)].map((_, i) => {
|
|
75418
75619
|
return jsx$2(SwiperDots, { isActive: i === activeSlide, onClick: () => slideTo(i) }, i);
|
|
75419
75620
|
}) })] })] }));
|
|
75420
75621
|
};
|
|
@@ -75676,9 +75877,9 @@ const Bonds = () => {
|
|
|
75676
75877
|
if (filterOption !== 'SOLD OUT') {
|
|
75677
75878
|
billsToReturn = billsToReturn === null || billsToReturn === void 0 ? void 0 : billsToReturn.filter((bond) => !isBondSoldOut(bond));
|
|
75678
75879
|
}
|
|
75679
|
-
if (filterOption === 'SOLD OUT') {
|
|
75680
|
-
|
|
75681
|
-
}
|
|
75880
|
+
// if (filterOption === 'SOLD OUT') {
|
|
75881
|
+
// billsToReturn = billsToReturn?.filter((bond) => !bond.soldOut)
|
|
75882
|
+
// }
|
|
75682
75883
|
if (filterOption === 'FAVORITES') {
|
|
75683
75884
|
billsToReturn = billsToReturn === null || billsToReturn === void 0 ? void 0 : billsToReturn.filter((bill) => { var _a, _b; return favTokens.includes((_b = (_a = bill === null || bill === void 0 ? void 0 : bill.earnToken) === null || _a === void 0 ? void 0 : _a.symbol) === null || _b === void 0 ? void 0 : _b.toLowerCase()); });
|
|
75684
75885
|
}
|
|
@@ -75737,8 +75938,8 @@ const FullBondsView = () => {
|
|
|
75737
75938
|
};
|
|
75738
75939
|
|
|
75739
75940
|
const Toggle = ({ options, activeOption, handleToggle, claimableBillsAmount, }) => {
|
|
75740
|
-
return (jsx$2(Flex, { sx: styles$
|
|
75741
|
-
return (jsx$2(motion.div, { animate: { opacity: option === activeOption ? 1 : 0.6, scale: option === activeOption ? 1 : 0.9 }, exit: { opacity: 0, scale: 0.9 }, transition: { duration: 0.2, type: 'spring', stiffness: 50 }, sx: { overflow: 'hidden', width: '100%' }, children: jsx$2(Flex, { sx: Object.assign(Object.assign({}, styles$
|
|
75941
|
+
return (jsx$2(Flex, { sx: styles$d.container, children: jsx$2(AnimatePresence, { initial: false, children: options.map((option) => {
|
|
75942
|
+
return (jsx$2(motion.div, { animate: { opacity: option === activeOption ? 1 : 0.6, scale: option === activeOption ? 1 : 0.9 }, exit: { opacity: 0, scale: 0.9 }, transition: { duration: 0.2, type: 'spring', stiffness: 50 }, sx: { overflow: 'hidden', width: '100%' }, children: jsx$2(Flex, { sx: Object.assign(Object.assign({}, styles$d.switch), { background: option === activeOption ? 'primaryButton' : 'white2' }), onClick: () => handleToggle(option), children: jsxs(Text, { sx: { fontSize: '14px' }, children: [option, option === BondsViewOptions.YOURBONDS && claimableBillsAmount ? ` (${claimableBillsAmount})` : ''] }) }) }, option));
|
|
75742
75943
|
}) }) }));
|
|
75743
75944
|
};
|
|
75744
75945
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { UseQueryResult } from '@tanstack/react-query';
|
|
2
2
|
import { BillsConfig } from '@ape.swap/apeswap-lists';
|
|
3
3
|
import { UserBill } from '../../types/yourbonds';
|
|
4
|
+
import { TokenPrices } from '../tokenPrices/useTokenPrices';
|
|
4
5
|
export default function useUserBonds(): UseQueryResult<UserBill[]>;
|
|
5
|
-
export declare const getUserBonds: (account: string, bondList: BillsConfig[], chains: number[]) => Promise<UserBill[]>;
|
|
6
|
+
export declare const getUserBonds: (account: string, bondList: BillsConfig[], chains: number[], tokenPrices: TokenPrices[]) => Promise<UserBill[]>;
|
|
@@ -10,5 +10,5 @@ declare enum NetworkNames {
|
|
|
10
10
|
BLAST = "bls"
|
|
11
11
|
}
|
|
12
12
|
export declare const getChainParam: (chain?: ChainId) => NetworkNames | null;
|
|
13
|
-
export declare const getLpType: (protocol?: Protocols) => "ichi" | "solidly" | "univ2" | null;
|
|
13
|
+
export declare const getLpType: (protocol?: Protocols) => "ichi" | "solidly" | "univ2" | "curve" | null;
|
|
14
14
|
export {};
|
package/dist/styles.css
CHANGED
|
@@ -895,7 +895,6 @@ span.flex-inline {
|
|
|
895
895
|
.bonds-menu .headers-container {
|
|
896
896
|
display: flex;
|
|
897
897
|
width: 60%;
|
|
898
|
-
opacity: 0.6;
|
|
899
898
|
justify-content: flex-end;
|
|
900
899
|
}
|
|
901
900
|
@media screen and (min-width: 1000px) {
|
|
@@ -964,6 +963,8 @@ span.flex-inline {
|
|
|
964
963
|
align-items: flex-end;
|
|
965
964
|
justify-content: center;
|
|
966
965
|
cursor: pointer;
|
|
966
|
+
opacity: 0.6;
|
|
967
|
+
line-height: 12px;
|
|
967
968
|
}
|
|
968
969
|
@media screen and (min-width: 1000px) {
|
|
969
970
|
.bonds-menu .your-bonds-table-headers {
|
|
@@ -2,8 +2,10 @@ import { BigNumber } from 'bignumber.js';
|
|
|
2
2
|
import { UserBill } from '../types/yourbonds';
|
|
3
3
|
import { BondsData } from '../types/bonds';
|
|
4
4
|
export declare const claimable: (userBill: UserBill) => number;
|
|
5
|
+
export declare const claimableUSD: (userBill: UserBill) => number;
|
|
5
6
|
export declare const earnTokenPrice: (bond: BondsData) => string;
|
|
6
7
|
export declare const totalPending: (userBill: UserBill) => number;
|
|
8
|
+
export declare const totalPendingUSD: (userBill: UserBill) => number;
|
|
7
9
|
export declare const vestingTimeRemaining: (userBill: UserBill) => {
|
|
8
10
|
years: number;
|
|
9
11
|
months: number;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { UserBill, UserOwnedBillsData } from '../../types/yourbonds';
|
|
2
2
|
import { BillsConfig, ChainId } from '@ape.swap/apeswap-lists';
|
|
3
|
-
|
|
4
|
-
export declare const
|
|
3
|
+
import { TokenPrices } from '../../state/tokenPrices/useTokenPrices';
|
|
4
|
+
export declare const fetchUserOwnedBillsDataAsync: (chainId: ChainId, account: string, bondData: BillsConfig[], tokenPrices: TokenPrices[]) => Promise<UserOwnedBillsData[]>;
|
|
5
|
+
export declare const fetchUserOwnedBills: (chainId: ChainId, account: string, bonds: BillsConfig[], tokenPrices: TokenPrices[]) => Promise<UserBill[]>;
|