@ape.swap/bonds-sdk 3.0.34 → 3.0.36

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
@@ -22356,7 +22356,7 @@ const PRICE_GETTER_ADDRESSES = {
22356
22356
  [types.ChainId.AVAX]: '0x01dadaa586D30d93Ac92C79A5Cb02a8F276a8B4F', // Price getter V3
22357
22357
  [types.ChainId.CROSSFI]: '0xC22Db8dDe3A3591fFB02be868Ce2901d30671FE4', // Price getter V3
22358
22358
  [types.ChainId.SONIC]: '0xC22Db8dDe3A3591fFB02be868Ce2901d30671FE4', // Price getter V3
22359
- [types.ChainId.MONAD_TESTNET]: '0x0187D959A28B0D3B490c2D898fA1CcD054cCC3cd',
22359
+ [types.ChainId.MONAD_TESTNET]: '0x0187D959A28B0D3B490c2D898fA1CcD054cCC3cd', // Price getter V3
22360
22360
  };
22361
22361
  const MULTICALL_V2 = {
22362
22362
  [types.ChainId.BSC]: '0x38ce767d81de3940CFa5020B55af1A400ED4F657',
@@ -58384,11 +58384,13 @@ const getVestingTermsTooltipString = (bond) => {
58384
58384
  const vestingCliffString = getTimePeriods(vestingCliff);
58385
58385
  return `${vestingCliffString.days} days cliff + ${vestingTime.days} days linear vesting.`;
58386
58386
  };
58387
- const discountEarnTokenPrice = (bond) => {
58388
- var _a, _b;
58389
- const earnTokenPrice = parseFloat((_a = bond === null || bond === void 0 ? void 0 : bond.payoutTokenPrice) !== null && _a !== void 0 ? _a : '0');
58390
- const trueBondPrice = findHighestTrueBondPrice(TIERS_WEIGHT[types.LaunchBondTiers.Legend], bond);
58391
- return getFirstNonZeroDigits(earnTokenPrice - earnTokenPrice * (((_b = trueBondPrice === null || trueBondPrice === void 0 ? void 0 : trueBondPrice.bonusWithFee) !== null && _b !== void 0 ? _b : 0) / 100));
58387
+ const discountEarnTokenPrice = (bond, useTiers) => {
58388
+ var _a, _b, _c;
58389
+ const fee = (_a = bond === null || bond === void 0 ? void 0 : bond.feeInPayout) !== null && _a !== void 0 ? _a : 0;
58390
+ const principalTokenPrice = parseFloat((_b = bond.principalTokenPrice) !== null && _b !== void 0 ? _b : '0');
58391
+ const trueBondPrice = (_c = findHighestTrueBondPrice(useTiers ? TIERS_WEIGHT[types.LaunchBondTiers.Legend] : '0', bond)) === null || _c === void 0 ? void 0 : _c.trueBondPrice;
58392
+ const trueBondPriceWithFee = getBalanceNumber(new BigNumber$1(trueBondPrice).times((100 + fee) / 100));
58393
+ return getFirstNonZeroDigits(principalTokenPrice * trueBondPriceWithFee);
58392
58394
  };
58393
58395
  const maxBuy = (bond) => {
58394
58396
  var _a, _b, _c, _d, _e, _f;
@@ -69610,12 +69612,10 @@ const getBatchTokensExternal = (params) => __awaiter$9(void 0, void 0, void 0, f
69610
69612
  chain: chainId,
69611
69613
  });
69612
69614
  return response.data.map((token) => {
69613
- var _a;
69614
69615
  return {
69615
69616
  symbol: token.symbol,
69616
69617
  address: token.tokenAddress,
69617
69618
  price: parseFloat(token.price),
69618
- decimals: (_a = tokens.find((t) => t.address.toLowerCase() === token.tokenAddress.toLowerCase())) === null || _a === void 0 ? void 0 : _a.decimals,
69619
69619
  chainId,
69620
69620
  };
69621
69621
  });
@@ -70868,7 +70868,7 @@ const ButtonsRow = ({ projectLink, twitter, bubble, audit, chain }) => {
70868
70868
  };
70869
70869
 
70870
70870
  const ExpandedViewButton = ({ handleNavigation, rightPos }) => {
70871
- return (jsx$2(Flex, { sx: { justifyContent: 'flex-end', position: 'absolute', top: '6px', right: rightPos !== null && rightPos !== void 0 ? rightPos : '10px', width: '122px' }, children: jsxs(Flex, { sx: {
70871
+ return (jsx$2(Flex, { sx: { justifyContent: 'flex-end', position: 'absolute', top: '6px', right: rightPos !== null && rightPos !== void 0 ? rightPos : '35px', width: '122px' }, children: jsxs(Flex, { sx: {
70872
70872
  fontSize: '12px',
70873
70873
  fontWeight: 500,
70874
70874
  mr: '15px',
@@ -71531,7 +71531,7 @@ const ClaimAll = () => {
71531
71531
  fontWeight: 600,
71532
71532
  width: '100%',
71533
71533
  opacity: 1,
71534
- ml: '10px',
71534
+ ml: ['10px', '10px', '10px', '0'],
71535
71535
  }, children: "Claim All" }));
71536
71536
  };
71537
71537
 
@@ -76247,13 +76247,14 @@ const BondModalMinTierHeader = ({ minTier }) => {
76247
76247
  width: ['100%', '100%', '100%', 'auto', 'auto'],
76248
76248
  }, children: Object.values(TIERS_NAMES).map((tier, index) => {
76249
76249
  if (index >= minTier) {
76250
- return (jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { sx: { justifyContent: 'center' }, children: tier }), width: "100px", placement: "bottomLeft", transformTip: "translate(1%, -5%)", children: jsx$2("img", { src: `/images/launch/${tier.toLowerCase()}.png`, alt: "minTier", style: { width: '30px', height: '30px', marginLeft: '3px', zIndex: 1 } }, `tier-logo-${index}`) }, tier));
76250
+ return (jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { sx: { justifyContent: 'center' }, children: tier }), width: "100px", placement: "bottomLeft", transformTip: "translate(1%, -5%)", children: jsx$2("img", { src: `/images/launch/${tier.toLowerCase()}.png`, alt: "minTier", style: { width: '25px', height: '25px', marginLeft: '3px', zIndex: 1 } }, `tier-logo-${index}`) }, tier));
76251
76251
  }
76252
76252
  }) })) }));
76253
76253
  };
76254
76254
 
76255
76255
  const BondModalHeader = ({ bondData, onDismiss, showProjectInfoButton, }) => {
76256
76256
  var _a, _b;
76257
+ const SDKConfig = useSDKConfig();
76257
76258
  const [onOpenSlippageModal] = useModal(jsx$2(SlippageModal, {}));
76258
76259
  const minTier = bondData.minTier !== undefined ? bondData.minTier : null;
76259
76260
  const handleClose = () => {
@@ -76274,7 +76275,32 @@ const BondModalHeader = ({ bondData, onDismiss, showProjectInfoButton, }) => {
76274
76275
  },
76275
76276
  });
76276
76277
  };
76277
- return (jsxs(Flex, { className: "modaltable-container title-container", sx: { flexDirection: 'column', justifyContent: 'center', alignItems: 'start' }, children: [jsxs(Flex, { className: "slipagge-close-icon", sx: { width: '100%', height: '30px', mb: ['10px', '10px', '10px', '0px'] }, children: [jsx$2(Flex, { sx: { display: ['flex', 'flex', 'flex', 'none', 'none'] }, children: jsx$2(BondModalMinTierHeader, { minTier: minTier }) }), jsx$2(Flex, { sx: { flexDirection: 'column', position: 'absolute', right: '0px' }, children: onDismiss ? (jsxs(Fragment$1, { children: [showProjectInfoButton && jsx$2(ExpandedViewButton, { handleNavigation: handleProjectViewNavigation }), jsx$2(IconButton, { icon: "close", color: "text", variant: "transparent", onClick: handleClose }), jsx$2(Flex, { sx: { py: '3px' }, onClick: onOpenSlippageModal, children: jsx$2(Svg, { icon: "cog", width: "16px" }) })] })) : (jsx$2(Flex, { sx: { py: '3px', mt: '10px' }, onClick: onOpenSlippageModal, children: jsx$2(Svg, { icon: "cog", width: "16px" }) })) })] }), jsxs(Flex, { sx: { width: '100%' }, children: [jsx$2(Flex, { className: "title-container bondicon", children: jsx$2(TokenImage, { symbol: (_a = bondData.showcaseTokenName) !== null && _a !== void 0 ? _a : bondData.earnToken.symbol, size: 50, chain: bondData.chainId }) }), jsxs(Flex, { className: "title-container bondname", children: [bondData === null || bondData === void 0 ? void 0 : bondData.showcaseTokenName, jsx$2(ListTag, { text: (_b = bondData === null || bondData === void 0 ? void 0 : bondData.tags) === null || _b === void 0 ? void 0 : _b[0] })] }), jsxs(Flex, { className: "title-container price-container", sx: { flexDirection: 'column', paddingLeft: '20px' }, children: [jsxs(Flex, { className: "price-container price", children: ["$", earnTokenPrice(bondData)] }), jsxs(Flex, { className: "price-container discounted", children: ["$", discountEarnTokenPrice(bondData)] })] }), jsx$2(Flex, { sx: { display: ['none', 'none', 'none', 'flex', 'flex'], ml: '10px' }, children: jsx$2(BondModalMinTierHeader, { minTier: minTier }) })] })] }));
76278
+ return (jsxs(Flex, { className: "modaltable-container title-container", sx: { flexDirection: 'column', justifyContent: 'center', alignItems: 'start' }, children: [jsxs(Flex, { sx: {
76279
+ width: '100%',
76280
+ height: '30px',
76281
+ mb: ['10px', '10px', '10px', '0px'],
76282
+ justifyContent: ['space-between', 'space-between', 'space-between', 'flex-end'],
76283
+ }, children: [jsx$2(Flex, { sx: { display: ['flex', 'flex', 'flex', 'none'] }, children: jsx$2(BondModalMinTierHeader, { minTier: minTier }) }), jsx$2(Flex, { sx: { cursor: 'pointer' }, children: onDismiss ? (jsxs(Fragment$1, { children: [showProjectInfoButton && jsx$2(ExpandedViewButton, { handleNavigation: handleProjectViewNavigation }), jsx$2(Flex, { sx: { mx: '10px' }, onClick: onOpenSlippageModal, children: jsx$2(Svg, { icon: "cog", width: "16px" }) }), jsx$2(Flex, { onClick: handleClose, children: jsx$2(Svg, { icon: "close", color: "text" }) })] })) : (jsx$2(Flex, { sx: { py: '3px', mt: '10px' }, onClick: onOpenSlippageModal, children: jsx$2(Svg, { icon: "cog", width: "16px" }) })) })] }), jsxs(Flex, { sx: { width: '100%' }, children: [jsx$2(Flex, { className: "title-container bondicon", children: jsx$2(TokenImage, { symbol: (_a = bondData.showcaseTokenName) !== null && _a !== void 0 ? _a : bondData.earnToken.symbol, size: 50, chain: bondData.chainId }) }), jsxs(Flex, { className: "title-container bondname", children: [bondData === null || bondData === void 0 ? void 0 : bondData.showcaseTokenName, jsx$2(ListTag, { text: (_b = bondData === null || bondData === void 0 ? void 0 : bondData.tags) === null || _b === void 0 ? void 0 : _b[0] })] }), jsxs(Flex, { className: "title-container price-container", sx: { flexDirection: 'column', pl: '20px' }, children: [jsxs(Flex, { className: "price-container price", children: ["$", earnTokenPrice(bondData)] }), SDKConfig.useTiers ? (jsxs(Flex, { sx: {
76284
+ p: '3px 6px',
76285
+ border: '1px solid var(--theme-ui-colors-primaryButton)',
76286
+ borderRadius: 'normal',
76287
+ background: 'transparent',
76288
+ position: 'relative',
76289
+ overflow: 'hidden',
76290
+ }, children: [jsx$2(Flex, { sx: {
76291
+ position: 'absolute',
76292
+ width: '100%',
76293
+ height: '100%',
76294
+ top: 0,
76295
+ left: 0,
76296
+ zIndex: 1,
76297
+ background: 'primaryButton',
76298
+ opacity: 0.3,
76299
+ } }), jsxs(Flex, { sx: { width: '100%', zIndex: 2, alignItems: 'center' }, children: [jsx$2("img", { src: `/images/launch/legend.png`, alt: "minTier", style: { width: '21px', height: '21px', marginRight: '3px', zIndex: 1 } }), jsx$2(Flex, { sx: { fontSize: '14px', mr: '3px' }, children: "Up to" }), jsxs(Flex, { sx: {
76300
+ color: findHighestTrueBondPrice(TIERS_WEIGHT[types.LaunchBondTiers.Legend], bondData).bonusWithFee > 0
76301
+ ? 'success'
76302
+ : 'error',
76303
+ }, children: ["$", discountEarnTokenPrice(bondData, true)] })] })] })) : (jsxs(Flex, { sx: { fontSize: '24px', fontWeight: 700 }, children: ["$", discountEarnTokenPrice(bondData)] }))] }), jsx$2(Flex, { sx: { display: ['none', 'none', 'none', 'flex'], ml: '10px' }, children: jsx$2(BondModalMinTierHeader, { minTier: minTier }) })] })] }));
76278
76304
  };
76279
76305
 
76280
76306
  const YouTooltip = () => {
@@ -77725,7 +77751,7 @@ const SelectItem = (_a) => {
77725
77751
  };
77726
77752
 
77727
77753
  const ListTag = ({ text = '' }) => {
77728
- return (jsx$2(Flex, { className: "list-tag", sx: {
77754
+ return (jsx$2(Flex, { sx: {
77729
77755
  background: '#3C6AB530',
77730
77756
  color: '#3b78d3',
77731
77757
  fontSize: '10px',
@@ -77734,6 +77760,7 @@ const ListTag = ({ text = '' }) => {
77734
77760
  p: '2px 6px',
77735
77761
  borderRadius: '5px',
77736
77762
  ml: '5px',
77763
+ width: 'fit-content',
77737
77764
  }, children: text }));
77738
77765
  };
77739
77766
 
@@ -4,7 +4,6 @@ export interface TokenPrices {
4
4
  symbol: string | undefined;
5
5
  address: string | undefined;
6
6
  price: number | undefined;
7
- decimals: number | undefined;
8
7
  chainId: ChainId | undefined;
9
8
  }
10
9
  export default function useTokenPrices(): UseQueryResult<TokenPrices[]>;
package/dist/styles.css CHANGED
@@ -169,14 +169,6 @@
169
169
  flex-direction: column;
170
170
  }
171
171
 
172
- .modaltable-container.title-container {
173
- width: 100%;
174
- font-weight: bold;
175
- font-size: 1.5rem;
176
- display: flex;
177
- align-items: center;
178
- }
179
-
180
172
  .title-container.bondicon {
181
173
  display: flex;
182
174
  flex-direction: row;
@@ -219,8 +211,9 @@
219
211
  .title-container.bondname {
220
212
  display: flex;
221
213
  flex-direction: column;
222
- align-items: center;
223
214
  padding-left: 20px;
215
+ font-size: 24px;
216
+ font-weight: 700;
224
217
  }
225
218
 
226
219
  .title-container.bondname-small {
@@ -234,11 +227,7 @@
234
227
  font-size: 14px;
235
228
  text-decoration: line-through;
236
229
  opacity: 0.5;
237
- font-weight: 600;
238
- }
239
-
240
- .price-container.discounted {
241
- display: flex;
230
+ font-weight: 400;
242
231
  }
243
232
 
244
233
  .title-container.tokentags {
@@ -713,10 +702,6 @@ span.flex-inline {
713
702
  .bond-row.gold-rush {
714
703
  background: linear-gradient(90deg, rgba(227, 164, 85, 0.6) 7%, rgba(103, 61, 34, 0.6) 18%, rgba(246, 219, 166, 0.6) 36%, rgba(255, 235, 195, 0.6) 43%, rgba(240, 190, 121, 0.6) 53%, rgba(238, 188, 112, 0.6) 77%, rgba(63, 31, 15, 0.6) 92%), linear-gradient(0deg, #FFAE00 0%, #FFAE00 100%), var(--Neutral-Elevation-1, #161420);
715
704
  }
716
- .bond-row.gold-rush .list-tag {
717
- color: white;
718
- background: linear-gradient(99.09deg, #A16552 0%, #FFB300 106.96%);
719
- }
720
705
  .bond-row.gold-rush .gold-ribbon {
721
706
  display: block;
722
707
  }
@@ -19,7 +19,7 @@ export declare const vestingTimeRemainingString: (userBill?: UserBill) => string
19
19
  export declare const getPendingVestingString: (bond?: UserBill) => string;
20
20
  export declare const getVestingTermsString: (bond?: BondsData | BillsConfig) => string;
21
21
  export declare const getVestingTermsTooltipString: (bond?: BondsData | BillsConfig) => string;
22
- export declare const discountEarnTokenPrice: (bond: BondsData) => string;
22
+ export declare const discountEarnTokenPrice: (bond: BondsData, useTiers?: boolean) => string;
23
23
  export declare const maxBuy: (bond: BondsData) => BigNumber;
24
24
  export declare function formatNumber(input: string): string;
25
25
  export declare function formatUSDNumber(input: string): string;
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.34",
6
+ "version": "3.0.36",
7
7
  "module": "dist/main.js",
8
8
  "type": "module",
9
9
  "types": "dist/main.d.ts",