@ape.swap/bonds-sdk 2.0.4-testseed.4 → 2.0.4-testseed.6

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;
@@ -73300,7 +73300,8 @@ accordionTitle = 'What are Bonds?', accordionBody = 'Body', accordionVisible = f
73300
73300
  lodashExports.toNumber(inputValue) / lodashExports.toNumber(earnTokenPrice(bondData))).toFixed(0), jsx$2("span", { className: "text-highlight", children: "\u00A0additional" })] }), jsx$2(Flex, { className: "button-container buy", sx: { justifyContent: 'end' }, children: !account ? (jsx$2(ConnectButton, {})) : userChainId !== bondData.chainId ? (jsx$2(Button, { className: "switch-button button-narrow", disabled: loadingTx || isConfirming || (bondData === null || bondData === void 0 ? void 0 : bondData.soldOut), onClick: (event) => {
73301
73301
  event.stopPropagation();
73302
73302
  switchChain({ chainId: bondData.chainId });
73303
- }, children: `Switch to ${NETWORK_LABEL[bondData.chainId]}` })) : approvalState === ApprovalState.APPROVED ? (jsxs(Button, { className: "action-button", load: load, disabled: load || (bondData === null || bondData === void 0 ? void 0 : bondData.soldOut) || !account || !inputValue || parseFloat(inputValue) === 0, onClick: handleBothPurchases, children: ["buy ", isZap ? 'zap' : 'normal'] })) : (jsx$2(Button, { className: "action-button", load: approvalState === ApprovalState.PENDING, disabled: approvalState === ApprovalState.PENDING ||
73303
+ }, children: `Switch to ${NETWORK_LABEL[bondData.chainId]}` })) : approvalState === ApprovalState.APPROVED ? (jsxs(Button, { className: "action-button", load: load, disabled: load || (bondData === null || bondData === void 0 ? void 0 : bondData.soldOut) || !account || !inputValue || parseFloat(inputValue) === 0, onClick: handleBothPurchases, children: ["buy ", isZap ? jsx$2("span", { style: { marginLeft: '8px' }, children: jsx$2(Svg, { icon: "ZapIcon" }) })
73304
+ : ''] })) : (jsx$2(Button, { className: "action-button", load: approvalState === ApprovalState.PENDING, disabled: approvalState === ApprovalState.PENDING ||
73304
73305
  (bondData === null || bondData === void 0 ? void 0 : bondData.soldOut) ||
73305
73306
  !account ||
73306
73307
  !inputValue ||
@@ -73493,9 +73494,11 @@ const ProgressBarWrapper = ({ title, value, style, showTooltip, toolTipPlacement
73493
73494
  var ProgressBarWrapper$1 = React__default.memo(ProgressBarWrapper);
73494
73495
 
73495
73496
  const BondRow = ({ bond }) => {
73496
- var _a, _b, _c, _d, _e, _f, _g;
73497
+ var _a, _b, _c, _d, _e, _f, _g, _h;
73497
73498
  const billAddress = 'billAddress' in bond ? bond.billAddress : undefined;
73498
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;
73499
73502
  // Modal
73500
73503
  const [openBuyModal] = useModal(jsx$2(ModalHandler, { bondAddress: billAddress, bondChain: bond.chainId }), true, true, `buyBondModal-${billAddress}-${bond.chainId}`);
73501
73504
  const handleOpenModal = () => {
@@ -73533,7 +73536,7 @@ const BondRow = ({ bond }) => {
73533
73536
  const tokens = new BigNumber$1(tokensRemaining);
73534
73537
  return tokens.times(payoutTokenPrice);
73535
73538
  };
73536
- 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: {
73537
73540
  width: '127px',
73538
73541
  height: '25px',
73539
73542
  flexDirection: 'column',
@@ -73542,7 +73545,7 @@ const BondRow = ({ bond }) => {
73542
73545
  }, showTooltip: true, toolTip: `${remainingTokensFormat(bond)} ${bond.earnToken.symbol} (${formatDollar({
73543
73546
  num: remainingTokensUsd(bond).toNumber(),
73544
73547
  isPrice: true,
73545
- })})` }) }), 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));
73546
73549
  };
73547
73550
 
73548
73551
  const HotBondCard = ({ bond }) => {
@@ -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.4",
6
+ "version": "2.0.4-testseed.6",
7
7
  "module": "dist/main.js",
8
8
  "type": "module",
9
9
  "types": "dist/main.d.ts",