@ape.swap/bonds-sdk 2.0.4-testseed.5 → 2.0.4-testseed.7

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
@@ -71557,10 +71557,10 @@ const remainingPercentage = (bond) => {
71557
71557
  const remainingTokens = new BigNumber$1((_d = bond.tokensRemaining) !== null && _d !== void 0 ? _d : '0');
71558
71558
  return remainingTokens.div(totalMaxPayout).times(100).toNumber();
71559
71559
  };
71560
- const getDiscountColor = (discount) => {
71560
+ const getDiscountColor = (discount, greenAlt = false) => {
71561
71561
  if (!discount)
71562
71562
  return 'white';
71563
- return discount < 0 ? '#DF4141' : '#38A611';
71563
+ return discount < 0 ? '#DF4141' : (greenAlt ? '#34B96D' : '#38A611');
71564
71564
  };
71565
71565
  const calculateARR = (bond) => {
71566
71566
  const discount2 = 'discount' in bond ? bond.discount : undefined;
@@ -73494,9 +73494,11 @@ const ProgressBarWrapper = ({ title, value, style, showTooltip, toolTipPlacement
73494
73494
  var ProgressBarWrapper$1 = React__default.memo(ProgressBarWrapper);
73495
73495
 
73496
73496
  const BondRow = ({ bond }) => {
73497
- var _a, _b, _c, _d, _e, _f, _g;
73497
+ var _a, _b, _c, _d, _e, _f, _g, _h;
73498
73498
  const billAddress = 'billAddress' in bond ? bond.billAddress : undefined;
73499
73499
  const discount = 'discount' in bond ? bond.discount : undefined;
73500
+ const SDKConfig = useSDKConfig();
73501
+ let greenAlt = (_a = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.greenAlt) !== null && _a !== void 0 ? _a : false;
73500
73502
  // Modal
73501
73503
  const [openBuyModal] = useModal(jsx$2(ModalHandler, { bondAddress: billAddress, bondChain: bond.chainId }), true, true, `buyBondModal-${billAddress}-${bond.chainId}`);
73502
73504
  const handleOpenModal = () => {
@@ -73534,7 +73536,7 @@ const BondRow = ({ bond }) => {
73534
73536
  const tokens = new BigNumber$1(tokensRemaining);
73535
73537
  return tokens.times(payoutTokenPrice);
73536
73538
  };
73537
- return (jsxs("div", { className: "bond-row", onClick: handleOpenModal, children: [jsx$2("div", { className: "token-info-container", children: jsx$2(TokenInfoAndName, { bill: bond }) }), jsxs("div", { className: "bond-info-columns", children: [jsx$2("div", { className: "discount-column", style: { color: getDiscountColor(discount) }, children: discount !== undefined ? `${discount === null || discount === void 0 ? void 0 : discount.toFixed(2)}%` : '-' }), jsx$2("div", { className: "arr-column", children: calculateARR(bond) !== undefined ? calculateARR(bond) : '-' }), jsx$2("div", { className: "terms-column", children: ((_a = vestingTime(bond === null || bond === void 0 ? void 0 : bond.vestingTerm)) === null || _a === void 0 ? void 0 : _a.days) ? `${(_b = vestingTime(bond === null || bond === void 0 ? void 0 : bond.vestingTerm)) === null || _b === void 0 ? void 0 : _b.days} D` : '-' }), jsx$2("div", { className: "tokens-remaining-column", children: jsx$2(ProgressBarWrapper$1, { title: '', value: jsx$2(ProgressBar, { value: remainingPercentage(bond) }), style: {
73539
+ return (jsxs("div", { className: "bond-row", onClick: handleOpenModal, children: [jsx$2("div", { className: "token-info-container", children: jsx$2(TokenInfoAndName, { bill: bond }) }), jsxs("div", { className: "bond-info-columns", children: [jsx$2("div", { className: "discount-column", style: { color: getDiscountColor(discount, greenAlt) }, children: discount !== undefined ? `${discount === null || discount === void 0 ? void 0 : discount.toFixed(2)}%` : '-' }), jsx$2("div", { className: "arr-column", children: calculateARR(bond) !== undefined ? calculateARR(bond) : '-' }), jsx$2("div", { className: "terms-column", children: ((_b = vestingTime(bond === null || bond === void 0 ? void 0 : bond.vestingTerm)) === null || _b === void 0 ? void 0 : _b.days) ? `${(_c = vestingTime(bond === null || bond === void 0 ? void 0 : bond.vestingTerm)) === null || _c === void 0 ? void 0 : _c.days} D` : '-' }), jsx$2("div", { className: "tokens-remaining-column", children: jsx$2(ProgressBarWrapper$1, { title: '', value: jsx$2(ProgressBar, { value: remainingPercentage(bond) }), style: {
73538
73540
  width: '127px',
73539
73541
  height: '25px',
73540
73542
  flexDirection: 'column',
@@ -73543,7 +73545,7 @@ const BondRow = ({ bond }) => {
73543
73545
  }, showTooltip: true, toolTip: `${remainingTokensFormat(bond)} ${bond.earnToken.symbol} (${formatDollar({
73544
73546
  num: remainingTokensUsd(bond).toNumber(),
73545
73547
  isPrice: true,
73546
- })})` }) }), jsx$2("div", { className: "tooltip-column", children: jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(BondInfoTooltip, { earnTokenContract: (_e = (_d = (_c = bond === null || bond === void 0 ? void 0 : bond.earnToken) === null || _c === void 0 ? void 0 : _c.address) === null || _d === void 0 ? void 0 : _d[bond === null || bond === void 0 ? void 0 : bond.chainId]) !== null && _e !== void 0 ? _e : '', earnTokenSymbol: (_g = (_f = bond === null || bond === void 0 ? void 0 : bond.earnToken) === null || _f === void 0 ? void 0 : _f.symbol) !== null && _g !== void 0 ? _g : '', bondContract: billAddress !== null && billAddress !== void 0 ? billAddress : '', 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(7%, -2%)", children: jsx$2(Flex, { sx: { opacity: 0.8 }, children: jsx$2(Svg, { icon: "more", width: "25px" }) }) }) })] })] }, billAddress));
73548
+ })})` }) }), jsx$2("div", { className: "tooltip-column", children: jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(BondInfoTooltip, { earnTokenContract: (_f = (_e = (_d = bond === null || bond === void 0 ? void 0 : bond.earnToken) === null || _d === void 0 ? void 0 : _d.address) === null || _e === void 0 ? void 0 : _e[bond === null || bond === void 0 ? void 0 : bond.chainId]) !== null && _f !== void 0 ? _f : '', earnTokenSymbol: (_h = (_g = bond === null || bond === void 0 ? void 0 : bond.earnToken) === null || _g === void 0 ? void 0 : _g.symbol) !== null && _h !== void 0 ? _h : '', bondContract: billAddress !== null && billAddress !== void 0 ? billAddress : '', 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(7%, -2%)", children: jsx$2(Flex, { sx: { opacity: 0.8 }, children: jsx$2(Svg, { icon: "more", width: "25px" }) }) }) })] })] }, billAddress));
73547
73549
  };
73548
73550
 
73549
73551
  const HotBondCard = ({ bond }) => {
@@ -73750,7 +73752,7 @@ const styles$7 = {
73750
73752
  const SmallRecommendationCard = ({ recommendation }) => {
73751
73753
  var _a;
73752
73754
  const vestingTime = getTimePeriods((_a = recommendation.vestingTerm) !== null && _a !== void 0 ? _a : 0, true);
73753
- return (jsxs(Flex, { sx: styles$7.smallCardContainer, onClick: () => window.open(`${window.location.origin}/bonds/${recommendation.contractAddress}/${recommendation.chainId}`, '_self'), children: [jsxs(Flex, { sx: { alignItems: 'center' }, children: [jsx$2(TokenImage, { symbol: recommendation.payoutTokenName, size: 32, chain: recommendation.chainId }), jsxs(Flex, { sx: { mx: '10px', alignItems: 'center' }, children: [jsx$2(Flex, { sx: { fontSize: '14px', px: '6px' }, children: recommendation.payoutTokenName }), jsxs(Flex, { sx: styles$7.subTitle, children: [vestingTime.days, "D"] })] })] }), jsxs(Flex, { sx: { alignItems: 'center' }, children: [jsx$2(Flex, { sx: styles$7.subTitle, children: "Discount" }), jsxs(Flex, { sx: { fontSize: '12px', color: recommendation.discount > 0 ? 'success' : 'error', ml: '6px' }, children: [recommendation.discount.toFixed(2), "%"] })] })] }));
73755
+ return (jsxs(Flex, { sx: styles$7.smallCardContainer, onClick: () => window.open(`${window.location.origin}/bonds?bondAddress=${recommendation.contractAddress}&bondChain=${recommendation.chainId}`, '_self'), children: [jsxs(Flex, { sx: { alignItems: 'center' }, children: [jsx$2(TokenImage, { symbol: recommendation.payoutTokenName, size: 32, chain: recommendation.chainId }), jsxs(Flex, { sx: { mx: '10px', alignItems: 'center' }, children: [jsx$2(Flex, { sx: { fontSize: '14px', px: '6px' }, children: recommendation.payoutTokenName }), jsxs(Flex, { sx: styles$7.subTitle, children: [vestingTime.days, "D"] })] })] }), jsxs(Flex, { sx: { alignItems: 'center' }, children: [jsx$2(Flex, { sx: styles$7.subTitle, children: "Discount" }), jsxs(Flex, { sx: { fontSize: '12px', color: recommendation.discount > 0 ? 'success' : 'error', ml: '6px' }, children: [recommendation.discount.toFixed(2), "%"] })] })] }));
73754
73756
  };
73755
73757
 
73756
73758
  const RecommendationCards$1 = () => {
@@ -5,8 +5,9 @@ export interface SDKProps {
5
5
  chains: number[];
6
6
  useRainbowKit: boolean;
7
7
  modalVariant: 'alt' | 'standard';
8
- accordionTitle: string;
9
- accordionBody: string;
8
+ accordionTitle?: string;
9
+ accordionBody?: string;
10
+ greenAlt: boolean;
10
11
  };
11
12
  }
12
13
  export declare const useSDKConfig: (config?: SDKProps) => {
@@ -15,8 +16,9 @@ export declare const useSDKConfig: (config?: SDKProps) => {
15
16
  chains: number[];
16
17
  useRainbowKit: boolean;
17
18
  modalVariant: "alt" | "standard";
18
- accordionTitle: string;
19
- accordionBody: string;
19
+ accordionTitle?: string;
20
+ accordionBody?: string;
21
+ greenAlt: boolean;
20
22
  } | undefined;
21
23
  export type URLKeys = 'apiV2' | 'realTimeApi' | 'apeswap-lists';
22
24
  export declare const useURLByEnvironment: (key: URLKeys) => string;
@@ -13,5 +13,5 @@ export declare const vestingTime: (vestingTerm?: number) => {
13
13
  };
14
14
  export declare const remainingPercentage: (bond: BondsData) => number;
15
15
  export declare const getBillContractURL: (bond: BondsData | BillsConfig) => string;
16
- export declare const getDiscountColor: (discount?: number) => string;
16
+ export declare const getDiscountColor: (discount?: number, greenAlt?: boolean) => string;
17
17
  export declare const calculateARR: (bond: BondsData | BillsConfig) => 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": "2.0.4-testseed.5",
6
+ "version": "2.0.4-testseed.7",
7
7
  "module": "dist/main.js",
8
8
  "type": "module",
9
9
  "types": "dist/main.d.ts",