@ape.swap/bonds-sdk 3.0.42 → 3.0.43

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/main.js CHANGED
@@ -21917,6 +21917,17 @@ const findHighestTrueBondPrice = (userPoints, bondData) => {
21917
21917
  return currentPoints.isGreaterThan(highestPoints) ? current : highest;
21918
21918
  });
21919
21919
  };
21920
+ /**
21921
+ * Finds the TrueBondPrices element with the highest points in the array, regardless of user points.
21922
+ * @param bondData - Bond Data containing an array of TrueBondPrices to analyze.
21923
+ * @returns The TrueBondPrices element with the highest points, or `undefined` if no data is available.
21924
+ */
21925
+ const findHighestTrueBondPriceUserAgnostic = (bondData) => {
21926
+ var _a;
21927
+ if (!((_a = bondData === null || bondData === void 0 ? void 0 : bondData.trueBondPrices) === null || _a === void 0 ? void 0 : _a.length))
21928
+ return undefined;
21929
+ return bondData.trueBondPrices.reduce((highest, current) => new BigNumber$1(current.points).isGreaterThan(new BigNumber$1(highest.points)) ? current : highest);
21930
+ };
21920
21931
 
21921
21932
  var lensContractABI = [
21922
21933
  {
@@ -58135,13 +58146,16 @@ const multicall = (chainId, abi, calls, batch, batchSize) => __awaiter$9(void 0,
58135
58146
  }
58136
58147
  });
58137
58148
 
58138
- const boostMap = {
58149
+ /**
58150
+ * @deprecated This map is deprecated. Boost values are now being retrieved from the Realtime API.
58151
+ */
58152
+ ({
58139
58153
  [types.LaunchBondTiers.Bronze]: '+1%',
58140
58154
  [types.LaunchBondTiers.Silver]: '+2%',
58141
58155
  [types.LaunchBondTiers.Gold]: '+3%',
58142
58156
  [types.LaunchBondTiers.Diamond]: '+4%',
58143
58157
  [types.LaunchBondTiers.Legend]: '+5%',
58144
- };
58158
+ });
58145
58159
  const TIERS_COLORS = {
58146
58160
  [types.LaunchBondTiers.Bronze]: 'linear-gradient(90deg, #473129 0%, #33231D 100%)',
58147
58161
  [types.LaunchBondTiers.Silver]: 'linear-gradient(90deg, #3A3A3C 0%, #2C2C2F 100%)',
@@ -58254,7 +58268,7 @@ const BonusTable = ({ bond, hideTitle }) => {
58254
58268
  return (jsxs(Flex, { sx: { width: '100%', flexDirection: 'column' }, children: [!hideTitle && jsx$2(Flex, { sx: { width: '100%', justifyContent: 'center', mb: '10px' }, children: "Ape Tier Bonuses" }), bond.trueBondPrices
58255
58269
  .sort((a, b) => new BigNumber$1(b.points).minus(new BigNumber$1(a.points)).toNumber())
58256
58270
  .map((tier, i) => {
58257
- var _a, _b;
58271
+ var _a, _b, _c;
58258
58272
  const tierToUse = getUserTier(tier.points);
58259
58273
  const tierName = `${TIERS_NAMES[tierToUse]}`;
58260
58274
  const you = tier.points === (usersTrueBondPrices === null || usersTrueBondPrices === void 0 ? void 0 : usersTrueBondPrices.points);
@@ -58274,7 +58288,7 @@ const BonusTable = ({ bond, hideTitle }) => {
58274
58288
  px: '4px',
58275
58289
  ml: '3px',
58276
58290
  color: 'success',
58277
- }, children: boostMap[tierToUse] }))] }))] }, tier.points));
58291
+ }, children: `+${(_c = tier === null || tier === void 0 ? void 0 : tier.boost) !== null && _c !== void 0 ? _c : 0}%` }))] }))] }, tier.points));
58278
58292
  }), !hideTitle && (jsx$2(Button, { variant: "secondary", sx: { width: '100%', mt: '10px' }, onClick: () => window.open('https://ape.bond/tier-staking', '_blank'), children: "get tier" }))] }));
58279
58293
  };
58280
58294
 
@@ -76556,7 +76570,7 @@ const BondCards = ({ bondData }) => {
76556
76570
  };
76557
76571
 
76558
76572
  const Estimations = ({ depositAmount, bondData, youSpendString, isZap, fetchingZapQuote, zapError, }) => {
76559
- var _a, _b, _c, _d;
76573
+ var _a, _b, _c, _d, _e;
76560
76574
  const { data: userPoints } = useTierPoints();
76561
76575
  const trueBondPrice = findHighestTrueBondPrice(userPoints, bondData);
76562
76576
  const SDKConfig = useSDKConfig();
@@ -76586,7 +76600,7 @@ const Estimations = ({ depositAmount, bondData, youSpendString, isZap, fetchingZ
76586
76600
  background: 'primaryButton',
76587
76601
  opacity: 0.3,
76588
76602
  borderRadius: 'normal',
76589
- } }), jsxs(Flex, { className: "row-container premium", sx: { zIndex: 1 }, children: [jsx$2("img", { src: `/images/launch/${tierName === null || tierName === void 0 ? void 0 : tierName.toLowerCase()}.png`, alt: "minTier", style: { width: '21px', height: '21px', marginRight: '3px', zIndex: 1 } }), jsx$2(Flex, { sx: { color: 'success', mr: '3px', fontWeight: 700 }, children: boostMap[userTier] }), "Boost:", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: TooltipText.Boost }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, 0%)", children: jsx$2(Flex, { className: "row-container premium-icon", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), isZap && fetchingZapQuote ? (jsx$2(Dots, {})) : isZap && zapError ? ('-') : (jsxs(Flex, { className: `row-container premium-val premium-positive`, children: ["$ ", formatUSDNumber(boostAmount.toString())] }))] })), !!bondData.feeInPayout && (jsxs(Flex, { className: "text-container row", children: [jsxs(Flex, { className: "row-container premium", children: ["Fee:", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsxs(Flex, { children: ["This is the platform fee (", bondData.feeInPayout, "%)."] }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: jsx$2(Flex, { className: "row-container premium-icon", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), isZap && fetchingZapQuote ? (jsx$2(Dots, {})) : isZap && zapError ? ('-') : (jsxs(Flex, { className: `row-container premium-val`, children: ["$ ", formatUSDNumber(feeUSD.toString())] }))] })), jsxs(Flex, { className: "text-container row", children: [jsxs(Flex, { className: "row-container get", children: ["You Get (over ", vestingTime(((_c = bondData === null || bondData === void 0 ? void 0 : bondData.vestingTerm) !== null && _c !== void 0 ? _c : 0) - ((_d = bondData.vestingCliff) !== null && _d !== void 0 ? _d : 0)).days, " days):"] }), isZap && fetchingZapQuote ? (jsx$2(Dots, {})) : isZap && zapError ? ('-') : (jsxs(Flex, { className: "row-container get-val", children: [formatNumber$1(estimatedOutputAmount.toString()), " ", bondData === null || bondData === void 0 ? void 0 : bondData.showcaseTokenName, " = $", ' ', formatUSDNumber(estimatedOutputUSD.toString())] }))] })] }));
76603
+ } }), jsxs(Flex, { className: "row-container premium", sx: { zIndex: 1 }, children: [jsx$2("img", { src: `/images/launch/${tierName === null || tierName === void 0 ? void 0 : tierName.toLowerCase()}.png`, alt: "minTier", style: { width: '21px', height: '21px', marginRight: '3px', zIndex: 1 } }), jsx$2(Flex, { sx: { color: 'success', mr: '3px', fontWeight: 700 }, children: `+${(_c = trueBondPrice === null || trueBondPrice === void 0 ? void 0 : trueBondPrice.boost) !== null && _c !== void 0 ? _c : 0}%` }), "Boost:", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: TooltipText.Boost }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, 0%)", children: jsx$2(Flex, { className: "row-container premium-icon", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), isZap && fetchingZapQuote ? (jsx$2(Dots, {})) : isZap && zapError ? ('-') : (jsxs(Flex, { className: `row-container premium-val premium-positive`, children: ["$ ", formatUSDNumber(boostAmount.toString())] }))] })), !!bondData.feeInPayout && (jsxs(Flex, { className: "text-container row", children: [jsxs(Flex, { className: "row-container premium", children: ["Fee:", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsxs(Flex, { children: ["This is the platform fee (", bondData.feeInPayout, "%)."] }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: jsx$2(Flex, { className: "row-container premium-icon", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), isZap && fetchingZapQuote ? (jsx$2(Dots, {})) : isZap && zapError ? ('-') : (jsxs(Flex, { className: `row-container premium-val`, children: ["$ ", formatUSDNumber(feeUSD.toString())] }))] })), jsxs(Flex, { className: "text-container row", children: [jsxs(Flex, { className: "row-container get", children: ["You Get (over ", vestingTime(((_d = bondData === null || bondData === void 0 ? void 0 : bondData.vestingTerm) !== null && _d !== void 0 ? _d : 0) - ((_e = bondData.vestingCliff) !== null && _e !== void 0 ? _e : 0)).days, " days):"] }), isZap && fetchingZapQuote ? (jsx$2(Dots, {})) : isZap && zapError ? ('-') : (jsxs(Flex, { className: "row-container get-val", children: [formatNumber$1(estimatedOutputAmount.toString()), " ", bondData === null || bondData === void 0 ? void 0 : bondData.showcaseTokenName, " = $", ' ', formatUSDNumber(estimatedOutputUSD.toString())] }))] })] }));
76590
76604
  };
76591
76605
 
76592
76606
  const ProjectDescription = ({ description, isProjectView }) => {
@@ -76708,12 +76722,14 @@ const getTierProofSig = (apiAddress, account, bondAddress, chainId) => __awaiter
76708
76722
  });
76709
76723
 
76710
76724
  const GetUpToComponent = ({ bond, depositAmount }) => {
76725
+ var _a;
76711
76726
  // Hooks & Data
76712
76727
  const { data: userPoints } = useTierPoints();
76713
76728
  const userTier = getUserTier(userPoints);
76714
76729
  const bonusString = getRawBonus$1(bond, depositAmount, TIERS_WEIGHT[types.LaunchBondTiers.Legend]);
76715
76730
  const noTierAmount = getRawBonus$1(bond, depositAmount, '0');
76716
76731
  const boostAmount = parseFloat(bonusString) - parseFloat(noTierAmount);
76732
+ const trueBondPrice = findHighestTrueBondPriceUserAgnostic(bond);
76717
76733
  //State
76718
76734
  const [isOpen, setIsOpen] = useState(false);
76719
76735
  return (userTier !== types.LaunchBondTiers.Legend &&
@@ -76744,7 +76760,7 @@ const GetUpToComponent = ({ bond, depositAmount }) => {
76744
76760
  zIndex: 0,
76745
76761
  background: 'primaryButton',
76746
76762
  opacity: 0.3,
76747
- } }), jsxs(Flex, { sx: { alignItems: 'center', display: ['ruby', 'ruby', 'ruby', 'flex'] }, children: [jsx$2("img", { src: `/images/launch/legend.png`, alt: "minTier", style: { width: '21px', height: '21px', marginRight: '3px', zIndex: 1 } }), "Get up to", jsx$2(Flex, { sx: { color: 'success', mx: '3px', fontWeight: 700 }, children: boostMap[types.LaunchBondTiers.Legend] }), "Boost By locking ABOND"] }), jsxs(Flex, { sx: { color: 'success', fontWeight: 700, minWidth: '65px', justifyContent: 'flex-end' }, children: ["$ ", formatUSDNumber(boostAmount.toString()), jsx$2(Flex, { sx: { ml: '4px' }, children: jsx$2(Svg, { icon: "caret", direction: isOpen ? 'up' : 'down' }) })] })] }), jsx$2(AnimatePresence, { children: isOpen && (jsx$2(motion.div, { initial: { height: 0 }, animate: { height: 'fit-content' }, transition: { opacity: { duration: 0.2 } }, exit: { height: 0 }, sx: { overflow: 'hidden', width: '100%', marginTop: '5px' }, children: jsx$2(BonusTable, { bond: bond, hideTitle: true }) })) })] })));
76763
+ } }), jsxs(Flex, { sx: { alignItems: 'center', display: ['ruby', 'ruby', 'ruby', 'flex'] }, children: [jsx$2("img", { src: `/images/launch/legend.png`, alt: "minTier", style: { width: '21px', height: '21px', marginRight: '3px', zIndex: 1 } }), "Get up to", jsx$2(Flex, { sx: { color: 'success', mx: '3px', fontWeight: 700 }, children: `+${(_a = trueBondPrice === null || trueBondPrice === void 0 ? void 0 : trueBondPrice.boost) !== null && _a !== void 0 ? _a : 0}%` }), "Boost By locking ABOND"] }), jsxs(Flex, { sx: { color: 'success', fontWeight: 700, minWidth: '65px', justifyContent: 'flex-end' }, children: ["$ ", formatUSDNumber(boostAmount.toString()), jsx$2(Flex, { sx: { ml: '4px' }, children: jsx$2(Svg, { icon: "caret", direction: isOpen ? 'up' : 'down' }) })] })] }), jsx$2(AnimatePresence, { children: isOpen && (jsx$2(motion.div, { initial: { height: 0 }, animate: { height: 'fit-content' }, transition: { opacity: { duration: 0.2 } }, exit: { height: 0 }, sx: { overflow: 'hidden', width: '100%', marginTop: '5px' }, children: jsx$2(BonusTable, { bond: bond, hideTitle: true }) })) })] })));
76748
76764
  };
76749
76765
 
76750
76766
  const BuyBond = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, isProjectView }) => {
@@ -1,4 +1,7 @@
1
1
  import { LaunchBondTiers } from '@ape.swap/apeswap-lists';
2
+ /**
3
+ * @deprecated This map is deprecated. Boost values are now being retrieved from the Realtime API.
4
+ */
2
5
  export declare const boostMap: {
3
6
  0: string;
4
7
  1: string;
@@ -4,6 +4,7 @@ export interface TrueBondPrices {
4
4
  trueBondPrice: string;
5
5
  bonus: number;
6
6
  bonusWithFee: number;
7
+ boost?: number;
7
8
  }
8
9
  export interface BondsData {
9
10
  index?: number;
@@ -6,3 +6,9 @@ import { BondsData, TrueBondPrices } from '../../types/bonds';
6
6
  * @returns The highest TrueBondPrices element where userPoints is higher than the item's points, or `undefined` if none matches.
7
7
  */
8
8
  export declare const findHighestTrueBondPrice: (userPoints?: string | null, bondData?: BondsData) => TrueBondPrices;
9
+ /**
10
+ * Finds the TrueBondPrices element with the highest points in the array, regardless of user points.
11
+ * @param bondData - Bond Data containing an array of TrueBondPrices to analyze.
12
+ * @returns The TrueBondPrices element with the highest points, or `undefined` if no data is available.
13
+ */
14
+ export declare const findHighestTrueBondPriceUserAgnostic: (bondData?: BondsData) => TrueBondPrices;
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": "3.0.42",
6
+ "version": "3.0.43",
7
7
  "module": "dist/main.js",
8
8
  "type": "module",
9
9
  "types": "dist/main.d.ts",