@ape.swap/bonds-sdk 2.6.10 → 2.6.12

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.
@@ -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;
@@ -0,0 +1,5 @@
1
+ import { ChainId } from '@ape.swap/apeswap-lists';
2
+ export declare const formatChainList: (list: ChainId[]) => {
3
+ chain: ChainId;
4
+ name: string;
5
+ }[];
@@ -0,0 +1,2 @@
1
+ import { ThemeUIStyleObject } from 'theme-ui';
2
+ export declare const styles: Record<'sectionDividerFont' | 'searchAndListContainer' | 'searchInput' | 'chainOptionButton' | 'cursorHover' | 'chainOptionList' | 'chainListContainer', ThemeUIStyleObject>;
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$g = {
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$g.waves : styles$g.pulse)), { height: props.height, width: props.width, borderRadius: variant$1 === variant.RECT ? '10px' : '50%' }) })));
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$f = {
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$f.default), styles$f[placement]), backgroundColorStyle), { width, transform: transformTip }) }, props, { children: body })) }), children] }));
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$e = {
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$d = {
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$d.primary : {})), (variant === iconButtonVariants.TRANSPARENT ? styles$d.transparent : {})), children: children || (jsx$2("span", { sx: { height: iconWidth, width: iconWidth }, children: jsx$2(Svg, Object.assign({ color: color, icon: icon }, props, { width: iconWidth })) })) })));
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$e.modalHead, children: [children, onDismiss && jsx$2(IconButton, { icon: "close", color: "text", variant: "transparent", onClick: onDismiss })] })), !hideDivider && jsx$2(Divider, {})] }));
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$e.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$e.backdrop), backdrop), onClick: onClose })] }));
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$c = {
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$b() {
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$b,
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$a = {
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$a.bubbleContainer, children: [...Array(recommendations === null || recommendations === void 0 ? void 0 : recommendations.length)].map((_, i) => {
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$9 = {
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$9.iconButton, as: Link, href: projectLink, target: "_blank", children: jsx$2(Svg, { icon: "URL", width: 18 }) }), jsx$2(Flex, { sx: styles$9.iconButton, as: Link, href: twitter, target: "_blank", children: jsx$2(Svg, { icon: "twitter", width: 18, color: "text" }) }), bubble && (jsx$2(Flex, { sx: styles$9.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$9.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' })] }))] }));
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$9.linkRow, children: tokenLink && (jsxs(Link, { href: tokenLink, sx: styles$9.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$9.linkRow, children: bondLink && (jsxs(Link, { href: bondLink, sx: styles$9.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$9.linkRow, children: bondLink && (jsxs(Link, { href: bondDashboard, sx: styles$9.link, target: "_blank", children: ["View Bond Insights", jsx$2(Flex, { sx: { ml: '5px' }, children: jsx$2(Svg, { icon: "external", color: "text", width: 10 }) })] })) })] }) })] }));
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('Approval failed:', 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;
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;
@@ -71530,11 +71536,8 @@ const fetchUserOwnedBills = (chainId, account, bonds) => __awaiter$9(void 0, voi
71530
71536
  });
71531
71537
  });
71532
71538
  const billIds = yield multicall(chainId, BOND_ABI, billIdCalls, true, 15);
71533
- const billsPendingRewardCall = [];
71534
71539
  const billDataCalls = [];
71535
71540
  const billVersions = [];
71536
- const billNFTCalls = [];
71537
- // console.log(bonds)
71538
71541
  billIds.forEach((idArray, index) => idArray[0].forEach((id) => id.gt(0) &&
71539
71542
  (billDataCalls.push({
71540
71543
  address: bonds[index].contractAddress[bonds[index].chainId],
@@ -71542,13 +71545,7 @@ const fetchUserOwnedBills = (chainId, account, bonds) => __awaiter$9(void 0, voi
71542
71545
  params: [id],
71543
71546
  bond: bonds[index],
71544
71547
  }),
71545
- billDataCalls.push({ address: bonds[index].contractAddress[bonds[index].chainId], name: 'billNft' }),
71546
- billNFTCalls.push({
71547
- address: bonds[index].billNnftAddress[bonds[index].chainId],
71548
- name: 'vestedPayout',
71549
- params: [id],
71550
- }),
71551
- billsPendingRewardCall.push({
71548
+ billDataCalls.push({
71552
71549
  address: bonds[index].contractAddress[bonds[index].chainId],
71553
71550
  name: bonds[index].billVersion !== types.BillVersion.V1 ? 'claimablePayout' : 'pendingPayoutFor',
71554
71551
  params: [id],
@@ -71556,35 +71553,45 @@ const fetchUserOwnedBills = (chainId, account, bonds) => __awaiter$9(void 0, voi
71556
71553
  }),
71557
71554
  billVersions.push(bonds[index].billVersion))));
71558
71555
  const billData = yield multicall(chainId, BOND_ABI, billDataCalls, true, 150);
71559
- const pendingRewardsCall = yield multicall(chainId, BOND_ABI, billsPendingRewardCall);
71560
- // const depositAmountCalls = await multicall(chainId, billAbi, billNFTCalls)
71561
71556
  const result = [];
71562
- for (let i = 0; i < billsPendingRewardCall.length; i++) {
71563
- const billDataPos = i === 0 ? 0 : i * 2;
71557
+ for (let i = 0; i < billVersions.length; i++) {
71558
+ const billPos = i === 0 ? 0 : i * 2;
71559
+ let bond = billDataCalls[billPos].bond;
71560
+ // const principalTokenPrice = tokenPrices.find(
71561
+ // (tokenPrice) =>
71562
+ // tokenPrice.address?.toLowerCase() === bond?.lpToken?.address?.[bond.chainId]?.toLowerCase() &&
71563
+ // tokenPrice.chainId === bond.chainId,
71564
+ // )?.price
71565
+ const payoutTokenPrice = (_a = tokenPrices.find((tokenPrice) => {
71566
+ var _a, _b, _c, _d;
71567
+ 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()) &&
71568
+ tokenPrice.chainId === bond.chainId;
71569
+ })) === null || _a === void 0 ? void 0 : _a.price;
71570
+ bond = Object.assign(Object.assign({}, bond), { payoutTokenPrice: payoutTokenPrice });
71564
71571
  const data = billVersions[i] !== types.BillVersion.V1
71565
71572
  ? {
71566
- address: billsPendingRewardCall[i].address,
71567
- id: billsPendingRewardCall[i].params[0].toString(),
71568
- payout: new BigNumber$1((_a = billData[billDataPos][0]) === null || _a === void 0 ? void 0 : _a.payout.toString())
71569
- .minus((_b = billData[billDataPos][0]) === null || _b === void 0 ? void 0 : _b.payoutClaimed.toString())
71573
+ address: billDataCalls[billPos].address,
71574
+ id: billDataCalls[billPos].params[0].toString(),
71575
+ payout: new BigNumber$1((_b = billData[billPos][0]) === null || _b === void 0 ? void 0 : _b.payout.toString())
71576
+ .minus((_c = billData[billPos][0]) === null || _c === void 0 ? void 0 : _c.payoutClaimed.toString())
71570
71577
  .toString(),
71571
- billNftAddress: billData[billDataPos + 1][0].toString(),
71572
- vesting: (_c = billData[billDataPos][0]) === null || _c === void 0 ? void 0 : _c.vesting.toString(),
71573
- lastBlockTimestamp: (_d = billData[billDataPos][0]) === null || _d === void 0 ? void 0 : _d.lastClaimTimestamp.toString(),
71574
- truePricePaid: (_e = billData[billDataPos][0]) === null || _e === void 0 ? void 0 : _e.truePricePaid.toString(),
71575
- pendingRewards: pendingRewardsCall[i][0].toString(),
71576
- bond: billsPendingRewardCall[i].bond,
71578
+ billNftAddress: bond.billNnftAddress[bond.chainId],
71579
+ vesting: (_d = billData[billPos][0]) === null || _d === void 0 ? void 0 : _d.vesting.toString(),
71580
+ lastBlockTimestamp: (_e = billData[billPos][0]) === null || _e === void 0 ? void 0 : _e.lastClaimTimestamp.toString(),
71581
+ truePricePaid: (_f = billData[billPos][0]) === null || _f === void 0 ? void 0 : _f.truePricePaid.toString(),
71582
+ pendingRewards: billData[billPos + 1][0].toString(),
71583
+ bond,
71577
71584
  }
71578
71585
  : {
71579
- address: billsPendingRewardCall[i].address,
71580
- id: billsPendingRewardCall[i].params[0].toString(),
71581
- payout: billData[billDataPos][0].toString(),
71582
- billNftAddress: billData[billDataPos + 1][0].toString(),
71583
- vesting: billData[billDataPos][1].toString(),
71584
- lastBlockTimestamp: billData[billDataPos][2].toString(),
71585
- truePricePaid: billData[billDataPos][3].toString(),
71586
- pendingRewards: pendingRewardsCall[i][0].toString(),
71587
- bond: billsPendingRewardCall[i].bond,
71586
+ address: billDataCalls[billPos].address,
71587
+ id: billDataCalls[billPos].params[0].toString(),
71588
+ payout: billData[billPos][0].toString(),
71589
+ billNftAddress: bond.billNnftAddress[bond.chainId],
71590
+ vesting: billData[billPos][1].toString(),
71591
+ lastBlockTimestamp: billData[billPos][2].toString(),
71592
+ truePricePaid: billData[billPos][3].toString(),
71593
+ pendingRewards: billData[billPos + 1][0].toString(),
71594
+ bond,
71588
71595
  };
71589
71596
  result.push(data);
71590
71597
  }
@@ -71596,19 +71603,20 @@ function useUserBonds() {
71596
71603
  const { data: bondList } = useBondsList();
71597
71604
  const { address } = useAccount();
71598
71605
  const SDKConfig = useSDKConfig();
71606
+ const { data: tokenPrices } = useTokenPrices();
71599
71607
  const chains = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.chains;
71600
71608
  // Once the full list is fetched, fetch user's purchased bonds
71601
71609
  return useQuery({
71602
71610
  queryKey: [QUERY_KEYS.USER_BONDS, address],
71603
- queryFn: () => getUserBonds(address, bondList, chains),
71611
+ queryFn: () => getUserBonds(address, bondList, chains, tokenPrices),
71604
71612
  refetchOnWindowFocus: false,
71605
71613
  refetchInterval: 60000,
71606
- enabled: !!bondList && !!address,
71614
+ enabled: !!bondList && !!address && !!tokenPrices,
71607
71615
  });
71608
71616
  }
71609
- const getUserBonds = (account, bondList, chains) => __awaiter$9(void 0, void 0, void 0, function* () {
71617
+ const getUserBonds = (account, bondList, chains, tokenPrices) => __awaiter$9(void 0, void 0, void 0, function* () {
71610
71618
  try {
71611
- const results = yield Promise.allSettled(chains.map((chain) => fetchUserOwnedBillsDataAsync(chain, account, bondList)));
71619
+ const results = yield Promise.allSettled(chains.map((chain) => fetchUserOwnedBillsDataAsync(chain, account, bondList, tokenPrices)));
71612
71620
  // Filter out only fulfilled promises
71613
71621
  const fulfilledResults = results
71614
71622
  .filter((result) => result.status === 'fulfilled')
@@ -71813,8 +71821,208 @@ const BondFilters = ({ setChainFilterOption, chainFilterOption, filterOptions, f
71813
71821
  }, children: ["Clear All", jsx$2(Flex, { sx: { ml: '7px' }, children: jsx$2(IconButton, { icon: "close", color: "textDisabledButton", variant: "transparent" }) })] })] }));
71814
71822
  };
71815
71823
 
71824
+ const styles$9 = {
71825
+ sectionDividerFont: {
71826
+ fontWeight: '300',
71827
+ fontSize: '12px',
71828
+ },
71829
+ searchAndListContainer: {
71830
+ maxWidth: '100%',
71831
+ width: '450px',
71832
+ flexDirection: 'column',
71833
+ bg: 'white3',
71834
+ padding: '10px',
71835
+ borderRadius: '10px',
71836
+ height: 'calc(100% - 150px)',
71837
+ },
71838
+ searchInput: {
71839
+ fontWeight: '400',
71840
+ bg: 'white4',
71841
+ height: '40px',
71842
+ border: 'none',
71843
+ pl: '10px',
71844
+ borderRadius: '10px',
71845
+ mb: '8px',
71846
+ ':focus': { outline: 'none' },
71847
+ },
71848
+ chainOptionButton: {
71849
+ width: '40px',
71850
+ height: '40px',
71851
+ borderRadius: 'normal',
71852
+ bg: 'white3',
71853
+ justifyContent: 'center',
71854
+ alignItems: ' center',
71855
+ ':hover': {
71856
+ cursor: 'pointer',
71857
+ bg: 'white4',
71858
+ },
71859
+ },
71860
+ chainListContainer: {
71861
+ position: 'relative',
71862
+ mb: '10px',
71863
+ flexDirection: 'column',
71864
+ height: '100%',
71865
+ },
71866
+ chainOptionList: {
71867
+ width: '100%',
71868
+ height: '45px',
71869
+ borderRadius: '10px',
71870
+ gap: '10px',
71871
+ px: '10px',
71872
+ bg: 'white3',
71873
+ alignItems: ' center',
71874
+ ':hover': {
71875
+ cursor: 'pointer',
71876
+ bg: 'white4',
71877
+ },
71878
+ },
71879
+ cursorHover: {
71880
+ ':hover': {
71881
+ cursor: 'pointer',
71882
+ },
71883
+ },
71884
+ };
71885
+
71886
+ const formatChainList = (list) => {
71887
+ return list.map((chain) => ({
71888
+ chain,
71889
+ name: NETWORK_LABEL[chain] || 'Unknown',
71890
+ }));
71891
+ };
71892
+
71893
+ const ChainOptionsList = ({ setSelectedChain, setViewAllChains, chainList, }) => {
71894
+ const [searchQuery, setSearchQuery] = useState('');
71895
+ const handleChainSelect = (chain) => {
71896
+ setSelectedChain(chain);
71897
+ setViewAllChains(false);
71898
+ };
71899
+ const handleInput = useCallback((event) => {
71900
+ const input = event.target.value;
71901
+ setSearchQuery(input);
71902
+ }, []);
71903
+ 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)
71904
+ .filter((chainInfo) => chainInfo.name.toLowerCase().includes(searchQuery.toLowerCase()))
71905
+ .map((chainInfo) => {
71906
+ 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));
71907
+ }) })] }) }));
71908
+ };
71909
+
71910
+ const ChainOptionsButtons = ({ selectedChain, setSelectedChain, setViewAllChains, chainList, }) => {
71911
+ return (jsxs(Flex, { sx: { position: 'relative', mb: '10px' }, children: [formatChainList(chainList)
71912
+ .sort((chainInfo) => (chainInfo.chain === selectedChain ? -1 : 1))
71913
+ .slice(0, 7)
71914
+ .map((chainInfo) => {
71915
+ 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));
71916
+ }), chainList.length > 7 && (jsx$2(Flex, { sx: styles$9.chainOptionButton, onClick: () => setViewAllChains(true), children: jsxs(Text, { children: [chainList.length - 7, "+"] }) }))] }));
71917
+ };
71918
+
71919
+ const ClaimAllModal = () => {
71920
+ var _a, _b;
71921
+ const { chainId, address: account } = useAccount();
71922
+ const { switchChain } = useSwitchChain();
71923
+ const SDKConfig = useSDKConfig();
71924
+ const chains = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.chains;
71925
+ const [selectedChain, setSelectedChain] = useState(chainId !== null && chainId !== void 0 ? chainId : 56);
71926
+ const [viewAllChains, setViewAllChains] = useState(false);
71927
+ const { data: userOwnedBills } = useUserBonds();
71928
+ const ownedBills = userOwnedBills === null || userOwnedBills === void 0 ? void 0 : userOwnedBills.filter((bill) => parseFloat(bill === null || bill === void 0 ? void 0 : bill.payout) > 0);
71929
+ const groupedBills = ownedBills === null || ownedBills === void 0 ? void 0 : ownedBills.reduce((acc, bill) => {
71930
+ const bondIndex = bill.bond.index;
71931
+ // Check if this bond index already exists in the accumulator
71932
+ const existingGroup = acc.find((group) => group.bond.index === bondIndex);
71933
+ if (existingGroup) {
71934
+ // If the group already exists, add this bill to the userOwnedBills array
71935
+ existingGroup.userOwnedBills.push(bill);
71936
+ }
71937
+ else {
71938
+ // If it doesn't exist, create a new group
71939
+ acc.push({
71940
+ bond: bill.bond,
71941
+ userOwnedBills: [bill],
71942
+ });
71943
+ }
71944
+ return acc;
71945
+ }, []);
71946
+ const bondsOfSelectedChain = groupedBills === null || groupedBills === void 0 ? void 0 : groupedBills.filter((group) => group.bond.chainId === selectedChain);
71947
+ 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);
71948
+ const { addToastError } = usePopups();
71949
+ const { writeContractAsync } = useWriteContract();
71950
+ const handleClaim = () => __awaiter$9(void 0, void 0, void 0, function* () {
71951
+ try {
71952
+ bondsOfSelectedChain === null || bondsOfSelectedChain === void 0 ? void 0 : bondsOfSelectedChain.map((purchasedBond) => __awaiter$9(void 0, void 0, void 0, function* () {
71953
+ const address = purchasedBond.bond.contractAddress[purchasedBond.bond.chainId];
71954
+ console.log(purchasedBond);
71955
+ console.log(address);
71956
+ track({
71957
+ event: 'bond',
71958
+ chain: purchasedBond.bond.chainId,
71959
+ data: {
71960
+ cat: 'claimAll',
71961
+ address,
71962
+ earnToken: purchasedBond === null || purchasedBond === void 0 ? void 0 : purchasedBond.bond.earnToken.symbol,
71963
+ },
71964
+ });
71965
+ return writeContractAsync({
71966
+ address: address,
71967
+ abi: BOND_ABI,
71968
+ functionName: 'batchRedeem',
71969
+ args: [purchasedBond.userOwnedBills.map((b) => b.id)],
71970
+ });
71971
+ }));
71972
+ }
71973
+ catch (error) {
71974
+ console.error('Claim All failed:', error);
71975
+ addToastError(error.message);
71976
+ }
71977
+ });
71978
+ const purchasedBillsChains = (_a = groupedBills === null || groupedBills === void 0 ? void 0 : groupedBills.reduce((acc, bill) => {
71979
+ if (acc.includes(bill.bond.chainId)) {
71980
+ return acc;
71981
+ }
71982
+ else
71983
+ return [...acc, bill.bond.chainId];
71984
+ }, [])) === null || _a === void 0 ? void 0 : _a.sort((a, b) => a - b);
71985
+ 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: {
71986
+ ':hover': {
71987
+ cursor: 'pointer',
71988
+ },
71989
+ }, 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: {
71990
+ width: '100%',
71991
+ mt: '10px',
71992
+ background: 'white3',
71993
+ borderRadius: 'normal',
71994
+ p: '10px',
71995
+ flexDirection: 'column',
71996
+ height: '30vh',
71997
+ overflowY: 'auto',
71998
+ }, 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) => {
71999
+ var _a, _b;
72000
+ 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}`));
72001
+ })) : (jsx$2(Flex, { sx: {
72002
+ fontSize: '14px',
72003
+ fontWeight: 400,
72004
+ color: 'textDisabledButton',
72005
+ justifyContent: 'center',
72006
+ mt: '10px',
72007
+ }, 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]] }))] })) }));
72008
+ };
72009
+
72010
+ const ClaimAll = () => {
72011
+ const { address: account } = useAccount();
72012
+ const [onOpenModal] = useModal(jsx$2(ClaimAllModal, {}));
72013
+ return (jsx$2(Button, { onClick: onOpenModal, disabled: !account, sx: {
72014
+ height: ['36px', '36px', '36px', '26px'],
72015
+ lineHeight: '12px',
72016
+ fontSize: '14px',
72017
+ fontWeight: 600,
72018
+ width: '100%',
72019
+ opacity: 1,
72020
+ }, children: "Claim All" }));
72021
+ };
72022
+
71816
72023
  const YourBondsMenu = ({ chainFilterOption, setChainFilterOption, filterOptions, filterOption, setFilterOption, setInputValue, inputValue, handleSort, }) => {
71817
- 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" })] })] })] }));
72024
+ const SDKConfig = useSDKConfig();
72025
+ 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
72026
  };
71819
72027
 
71820
72028
  const YourBonds = () => {
@@ -71824,47 +72032,60 @@ const YourBonds = () => {
71824
72032
  const { data: chainFilterOption, setChainFilterOption } = useChainFilterOption();
71825
72033
  useTokenPrices();
71826
72034
  // State
71827
- const [sortConfig, setSortConfig] = useState(null);
71828
- const [sortedBonds, setSortedBonds] = useState();
72035
+ const [sortConfig, setSortConfig] = useState({
72036
+ key: 'pending',
72037
+ direction: 'desc',
72038
+ });
71829
72039
  const [inputValue, setInputValue] = useState('');
71830
- const [filteredBonds, setFilteredBonds] = useState(sortedBonds);
71831
72040
  const filterOptions = ['CLAIMABLE', 'ALL'];
71832
72041
  const [filterOption, setFilterOption] = useState(filterOptions[0]);
71833
72042
  const handleSort = (key) => {
71834
- let direction = 'asc';
71835
- if ((sortConfig === null || sortConfig === void 0 ? void 0 : sortConfig.key) === key && (sortConfig === null || sortConfig === void 0 ? void 0 : sortConfig.direction) === 'asc') {
71836
- direction = 'desc';
72043
+ let direction = 'desc';
72044
+ if ((sortConfig === null || sortConfig === void 0 ? void 0 : sortConfig.key) === key && (sortConfig === null || sortConfig === void 0 ? void 0 : sortConfig.direction) === 'desc') {
72045
+ direction = 'asc';
71837
72046
  }
71838
72047
  setSortConfig({ key, direction });
71839
72048
  };
71840
- // This Effects handles the sorting
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
72049
+ const bondsToRender = useMemo(() => {
71845
72050
  if (!userBonds)
71846
- return;
71847
- if (sortConfig === null) {
71848
- const sortedBills = (_a = [...userBonds]) === null || _a === void 0 ? void 0 : _a.sort((a, b) => {
71849
- const vestingDifference = parseFloat(vestingTimeRemainingYourBonds(b).toFixed(3)) -
71850
- parseFloat(vestingTimeRemainingYourBonds(a).toFixed(3));
71851
- if (vestingDifference !== 0) {
71852
- return vestingDifference;
71853
- }
71854
- return 0;
72051
+ return [];
72052
+ let bondsToReturn = userBonds;
72053
+ // Handle Filtering //
72054
+ // Filter by search query
72055
+ if (inputValue !== '') {
72056
+ bondsToReturn = bondsToReturn === null || bondsToReturn === void 0 ? void 0 : bondsToReturn.filter((bond) => {
72057
+ var _a, _b, _c, _d, _e, _f, _g, _h;
72058
+ return [
72059
+ (_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(),
72060
+ (_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(),
72061
+ (_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(),
72062
+ ].some((property) => property === null || property === void 0 ? void 0 : property.includes(inputValue.toLowerCase()));
72063
+ });
72064
+ }
72065
+ // Filter by chain selector
72066
+ if (!chainFilterOption.includes('All Chains')) {
72067
+ bondsToReturn = bondsToReturn === null || bondsToReturn === void 0 ? void 0 : bondsToReturn.filter((bond) => {
72068
+ return chainFilterOption.includes(bond.bond.chainId.toString());
72069
+ });
72070
+ }
72071
+ // Filter by filter option (claimable or all buttons)
72072
+ if (filterOption === 'CLAIMABLE') {
72073
+ bondsToReturn = bondsToReturn === null || bondsToReturn === void 0 ? void 0 : bondsToReturn.filter((bond) => {
72074
+ return bond.pendingRewards !== '0';
71855
72075
  });
71856
- setSortedBonds(sortedBills);
71857
- return;
71858
72076
  }
71859
- const sorted = [...userBonds].sort((a, b) => {
72077
+ // Handle sorting //
72078
+ if (sortConfig === null)
72079
+ return bondsToReturn;
72080
+ bondsToReturn = bondsToReturn === null || bondsToReturn === void 0 ? void 0 : bondsToReturn.sort((a, b) => {
71860
72081
  let aValue, bValue;
71861
72082
  if (sortConfig.key === 'claimable') {
71862
- aValue = parseFloat(claimable(a).toFixed(3));
71863
- bValue = parseFloat(claimable(b).toFixed(3));
72083
+ aValue = claimableUSD(a);
72084
+ bValue = claimableUSD(b);
71864
72085
  }
71865
72086
  else if (sortConfig.key === 'pending') {
71866
- aValue = parseFloat(totalPending(a).toFixed(0));
71867
- bValue = parseFloat(totalPending(b).toFixed(0));
72087
+ aValue = totalPendingUSD(a);
72088
+ bValue = totalPendingUSD(b);
71868
72089
  }
71869
72090
  else if (sortConfig.key === 'terms') {
71870
72091
  const aRemainingTime = vestingTimeRemaining(a).days * 24 * 3600 +
@@ -71888,41 +72109,12 @@ const YourBonds = () => {
71888
72109
  }
71889
72110
  return 0;
71890
72111
  });
71891
- setSortedBonds(sorted);
71892
- }, [sortConfig, userBonds]);
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]);
72112
+ return bondsToReturn;
72113
+ }, [userBonds, sortConfig, inputValue, chainFilterOption, filterOption, userBondsFetched]);
71922
72114
  const handleFilterOption = useCallback((newOption) => {
71923
72115
  setFilterOption(newOption);
71924
72116
  }, []);
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' })) : filteredBonds && (filteredBonds === null || filteredBonds === void 0 ? void 0 : filteredBonds.length) > 0 ? (filteredBonds === null || filteredBonds === void 0 ? void 0 : filteredBonds.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 }) }))] }));
72117
+ 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
72118
  };
71927
72119
 
71928
72120
  // This basically returns the 2 tags with the higher active bond count
@@ -75346,7 +75538,7 @@ const HotBondCard = ({ bond }) => {
75346
75538
  },
75347
75539
  });
75348
75540
  };
75349
- return (jsx$2(Flex, { sx: styles$a.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` : '-' })] })] })] }) }));
75541
+ 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` : '-' })] })] })] }) }));
75350
75542
  };
75351
75543
 
75352
75544
  function useHotBondContracts() {
@@ -75397,7 +75589,7 @@ const HotBondCards = () => {
75397
75589
  setActiveSlide(index);
75398
75590
  swiper === null || swiper === void 0 ? void 0 : swiper.slideTo(index);
75399
75591
  };
75400
- return (jsxs(Flex, { sx: styles$a.mainComponent, children: [jsx$2(Flex, { sx: styles$a.hotBondTitle, children: "HOT BONDS" }), jsx$2(Flex, { sx: styles$a.desktopCards, children: filteredBonds === null || filteredBonds === void 0 ? void 0 : filteredBonds.slice(0, 3).map((bond, index) => {
75592
+ 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) => {
75401
75593
  return jsx$2(HotBondCard, { bond: bond }, `${bond.billAddress}-${index}`);
75402
75594
  }) }), jsxs(Flex, { sx: {
75403
75595
  flexDirection: 'column',
@@ -75416,7 +75608,7 @@ const HotBondCards = () => {
75416
75608
  display: 'flex',
75417
75609
  justifyContent: 'center',
75418
75610
  }, children: jsx$2(HotBondCard, { bond: bond }, `${bond.billAddress}-${index}`) }, index));
75419
- }) }), jsx$2(Flex, { sx: styles$a.bubbleContainer, children: [...Array(hotBonds === null || hotBonds === void 0 ? void 0 : hotBonds.length)].map((_, i) => {
75611
+ }) }), jsx$2(Flex, { sx: styles$b.bubbleContainer, children: [...Array(hotBonds === null || hotBonds === void 0 ? void 0 : hotBonds.length)].map((_, i) => {
75420
75612
  return jsx$2(SwiperDots, { isActive: i === activeSlide, onClick: () => slideTo(i) }, i);
75421
75613
  }) })] })] }));
75422
75614
  };
@@ -75678,9 +75870,9 @@ const Bonds = () => {
75678
75870
  if (filterOption !== 'SOLD OUT') {
75679
75871
  billsToReturn = billsToReturn === null || billsToReturn === void 0 ? void 0 : billsToReturn.filter((bond) => !isBondSoldOut(bond));
75680
75872
  }
75681
- if (filterOption === 'SOLD OUT') {
75682
- billsToReturn = billsToReturn === null || billsToReturn === void 0 ? void 0 : billsToReturn.filter((bond) => !bond.soldOut);
75683
- }
75873
+ // if (filterOption === 'SOLD OUT') {
75874
+ // billsToReturn = billsToReturn?.filter((bond) => !bond.soldOut)
75875
+ // }
75684
75876
  if (filterOption === 'FAVORITES') {
75685
75877
  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()); });
75686
75878
  }
@@ -75739,8 +75931,8 @@ const FullBondsView = () => {
75739
75931
  };
75740
75932
 
75741
75933
  const Toggle = ({ options, activeOption, handleToggle, claimableBillsAmount, }) => {
75742
- return (jsx$2(Flex, { sx: styles$c.container, children: jsx$2(AnimatePresence, { initial: false, children: options.map((option) => {
75743
- 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$c.switch), { background: option === activeOption ? 'primaryButton' : 'white2' }), onClick: () => handleToggle(option), children: jsxs(Text, { sx: { fontSize: '14px' }, children: [option, option === BondsViewOptions.YOURBONDS && claimableBillsAmount ? ` (${claimableBillsAmount})` : ''] }) }) }, option));
75934
+ return (jsx$2(Flex, { sx: styles$d.container, children: jsx$2(AnimatePresence, { initial: false, children: options.map((option) => {
75935
+ 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));
75744
75936
  }) }) }));
75745
75937
  };
75746
75938
 
@@ -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[]>;
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;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const ClaimAllModal: () => React.JSX.Element;
3
+ export default ClaimAllModal;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const ClaimAll: () => React.JSX.Element;
3
+ export default ClaimAll;
@@ -1,4 +1,5 @@
1
1
  import { UserBill, UserOwnedBillsData } from '../../types/yourbonds';
2
2
  import { BillsConfig, ChainId } from '@ape.swap/apeswap-lists';
3
- export declare const fetchUserOwnedBillsDataAsync: (chainId: ChainId, account: string, bondData: BillsConfig[]) => Promise<UserOwnedBillsData[]>;
4
- export declare const fetchUserOwnedBills: (chainId: ChainId, account: string, bonds: BillsConfig[]) => Promise<UserBill[]>;
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[]>;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Ape Bond SDK",
4
4
  "author": "Ape Bond",
5
5
  "license": "MIT",
6
- "version": "2.6.10",
6
+ "version": "2.6.12",
7
7
  "module": "dist/main.js",
8
8
  "type": "module",
9
9
  "types": "dist/main.d.ts",