@ape.swap/bonds-sdk 3.0.85-test.3 → 3.0.85
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
|
@@ -58355,7 +58355,7 @@ const useSDKConfig = (config) => {
|
|
|
58355
58355
|
const urls = process.env.NODE_ENV === 'production' ? defaultUrls : stagingUrls;
|
|
58356
58356
|
const { data } = useQuery({
|
|
58357
58357
|
queryKey: [QUERY_KEYS.SDK_CONFIG],
|
|
58358
|
-
initialData: Object.assign(Object.assign({ useHotBonds: true, useRainbowKit: false, useTiers: false, useTGEBonds: false,
|
|
58358
|
+
initialData: Object.assign(Object.assign({ useHotBonds: true, useRainbowKit: false, useTiers: false, useTGEBonds: false, showLowValueBonds: false }, config), { urls: Object.assign(Object.assign({}, urls), config === null || config === void 0 ? void 0 : config.urls), highestCompatibleVersion: '2.1.1' }),
|
|
58359
58359
|
});
|
|
58360
58360
|
return data;
|
|
58361
58361
|
};
|
|
@@ -73816,7 +73816,7 @@ const useTopTags = (initialBondList) => {
|
|
|
73816
73816
|
return sortedTagsArray.slice(0, 2).map((tagCountArray) => tagCountArray[0]);
|
|
73817
73817
|
};
|
|
73818
73818
|
|
|
73819
|
-
const isBondSoldOut = (bill) => {
|
|
73819
|
+
const isBondSoldOut = (bill, showLowValueBonds) => {
|
|
73820
73820
|
var _a;
|
|
73821
73821
|
if (bill.soldOut)
|
|
73822
73822
|
return true;
|
|
@@ -73825,6 +73825,8 @@ const isBondSoldOut = (bill) => {
|
|
|
73825
73825
|
const { tokensRemaining, payoutTokenPrice } = bill;
|
|
73826
73826
|
if (!tokensRemaining)
|
|
73827
73827
|
return false;
|
|
73828
|
+
if (showLowValueBonds)
|
|
73829
|
+
return false;
|
|
73828
73830
|
const thresholdToHide = new BigNumber$1(100).div(payoutTokenPrice !== null && payoutTokenPrice !== void 0 ? payoutTokenPrice : 0);
|
|
73829
73831
|
if ((_a = new BigNumber$1(tokensRemaining)) === null || _a === void 0 ? void 0 : _a.lte(thresholdToHide)) {
|
|
73830
73832
|
// If there's less than 100 usd bond will be hidden
|
|
@@ -79899,9 +79901,8 @@ const BonusContainer = ({ trueBondPrices, minTier, bonus, tooltipPosition = 'bot
|
|
|
79899
79901
|
return (jsx$2("div", { className: `discount-column`, children: jsx$2(BonusComponent, { trueBondPrices: trueBondPrices, minTier: minTier, bonus: bonus, tooltipPosition: isMobile ? tooltipPosition : 'bottomLeft' }) }));
|
|
79900
79902
|
};
|
|
79901
79903
|
|
|
79902
|
-
const BondRow = ({ bondAddress, bondChain, payoutToken, tag, bondSoldOut, trueBondPrices, minTier, bonus, vestingTermString, vestingCliffString, percentageAvailable, remainingTokensString, projectURL, twitterURL, auditURL,
|
|
79904
|
+
const BondRow = ({ bondAddress, bondChain, payoutToken, tag, bondSoldOut, trueBondPrices, minTier, bonus, vestingTermString, vestingCliffString, percentageAvailable, remainingTokensString, projectURL, twitterURL, auditURL, }) => {
|
|
79903
79905
|
var _a, _b, _c;
|
|
79904
|
-
const SDKConfig = useSDKConfig();
|
|
79905
79906
|
const locationPath = window.location.pathname.replace('/', '');
|
|
79906
79907
|
// Modal
|
|
79907
79908
|
const [openBuyModal] = useModal(jsx$2(ModalHandler, { bondAddress: bondAddress, bondChain: bondChain }), true, true, `buyBondModal-${bondAddress.toLowerCase()}-${bondChain}`);
|
|
@@ -79931,7 +79932,7 @@ const BondRow = ({ bondAddress, bondChain, payoutToken, tag, bondSoldOut, trueBo
|
|
|
79931
79932
|
});
|
|
79932
79933
|
};
|
|
79933
79934
|
return (jsxs("div", { className: "bond-row" // Insert special campaign styles here
|
|
79934
|
-
, onClick: handleOpenModal, sx: { borderRadius: 'normal' }, children: [jsx$2("div", { className: "gold-ribbon" }), jsx$2("div", { className: "token-info-container", sx: { width: ['70%', '70%', '65%', '30%'] }, children: jsx$2(TokenInfoAndName, { tokenSymbol: payoutToken === null || payoutToken === void 0 ? void 0 : payoutToken.symbol, chain: bondChain, tag: tag }) }),
|
|
79935
|
+
, onClick: handleOpenModal, sx: { borderRadius: 'normal' }, children: [jsx$2("div", { className: "gold-ribbon" }), jsx$2("div", { className: "token-info-container", sx: { width: ['70%', '70%', '65%', '30%'] }, children: jsx$2(TokenInfoAndName, { tokenSymbol: payoutToken === null || payoutToken === void 0 ? void 0 : payoutToken.symbol, chain: bondChain, tag: tag }) }), jsxs("div", { className: "bond-info-columns", sx: { width: '55%' }, children: [jsx$2(BonusContainer, { trueBondPrices: trueBondPrices, minTier: minTier, bonus: bonus }), jsxs("div", { className: "terms-column", children: [vestingTermString, vestingCliffString && (jsx$2(TooltipBubble, { className: "tooltip-bubble",
|
|
79935
79936
|
// body={<Flex>{getVestingTermsTooltipString(bond)}</Flex>}
|
|
79936
79937
|
body: jsx$2(Flex, { children: vestingCliffString }), width: "180px", placement: "bottomRight", transformTip: "translate(13%, 0%)", children: jsx$2(Flex, { sx: { opacity: 0.6, ml: '6px' }, children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) }))] }), jsx$2("div", { className: "tokens-remaining-column", children: jsx$2(ProgressBarWrapper$1, { title: '', value: jsx$2(ProgressBar, { value: percentageAvailable }), style: {
|
|
79937
79938
|
width: '127px',
|
|
@@ -80086,6 +80087,7 @@ const BannerTestnet = ({ chainId }) => {
|
|
|
80086
80087
|
|
|
80087
80088
|
const BondRowsWithTitle = ({ chain, bonds, showHotBonds }) => {
|
|
80088
80089
|
const key = chain;
|
|
80090
|
+
const SDKConfig = useSDKConfig();
|
|
80089
80091
|
const [isOpen, setIsOpen] = useState(true);
|
|
80090
80092
|
return (jsx$2(Flex$1, { className: "bondrowswithtitle", children: jsxs(AnimatePresence, { initial: false, children: [jsx$2(Flex$1, { onClick: () => setIsOpen(!isOpen), sx: { cursor: 'pointer' }, children: jsx$2(ChainTitle, { chain: chain, pt: '5px', hideTitles: bonds.length <= 0, isOpen: isOpen }) }), bonds.length > 0 && isOpen && (jsxs(motion.div, { initial: { height: 0, overflow: 'hidden' }, animate: { height: 'fit-content', overflow: 'hidden', transitionEnd: { overflow: 'visible' } }, exit: { height: 0, overflow: 'hidden' }, sx: {
|
|
80091
80093
|
position: 'relative',
|
|
@@ -80096,7 +80098,7 @@ const BondRowsWithTitle = ({ chain, bonds, showHotBonds }) => {
|
|
|
80096
80098
|
var _a, _b, _c, _d, _e;
|
|
80097
80099
|
const bondAddress = (_a = bond === null || bond === void 0 ? void 0 : bond.billAddress) !== null && _a !== void 0 ? _a : (_b = bond === null || bond === void 0 ? void 0 : bond.contractAddress) === null || _b === void 0 ? void 0 : _b[bond === null || bond === void 0 ? void 0 : bond.chainId];
|
|
80098
80100
|
const remainingTokensString = getRemainingTokensString(bond);
|
|
80099
|
-
return (jsx$2(BondRow, { bondAddress: (_c = bond.billAddress) !== null && _c !== void 0 ? _c : (_d = bond.contractAddress) === null || _d === void 0 ? void 0 : _d[bond.chainId], bondChain: bond.chainId, payoutToken: bond.earnToken, tag: (_e = bond.tags) === null || _e === void 0 ? void 0 : _e[0], bondSoldOut: isBondSoldOut(bond), trueBondPrices: bond === null || bond === void 0 ? void 0 : bond.trueBondPrices, minTier: bond === null || bond === void 0 ? void 0 : bond.minTier, vestingTermString: getVestingTermsString(bond), vestingCliffString: getVestingTermsTooltipString(bond), percentageAvailable: remainingPercentage(bond), remainingTokensString: remainingTokensString, projectURL: bond.projectLink, twitterURL: bond.twitter, auditURL: bond.audit
|
|
80101
|
+
return (jsx$2(BondRow, { bondAddress: (_c = bond.billAddress) !== null && _c !== void 0 ? _c : (_d = bond.contractAddress) === null || _d === void 0 ? void 0 : _d[bond.chainId], bondChain: bond.chainId, payoutToken: bond.earnToken, tag: (_e = bond.tags) === null || _e === void 0 ? void 0 : _e[0], bondSoldOut: isBondSoldOut(bond, SDKConfig.showLowValueBonds), trueBondPrices: bond === null || bond === void 0 ? void 0 : bond.trueBondPrices, minTier: bond === null || bond === void 0 ? void 0 : bond.minTier, vestingTermString: getVestingTermsString(bond), vestingCliffString: getVestingTermsTooltipString(bond), percentageAvailable: remainingPercentage(bond), remainingTokensString: remainingTokensString, projectURL: bond.projectLink, twitterURL: bond.twitter, auditURL: bond.audit }, `${bondAddress}-${bond.chainId}-${index}`));
|
|
80100
80102
|
}), showHotBonds && (jsx$2(SwiperProvider, { children: jsx$2(HotBondCards, {}) }))] }, key))] }) }, key));
|
|
80101
80103
|
};
|
|
80102
80104
|
|
|
@@ -80281,7 +80283,7 @@ const BuyAgainRow = () => {
|
|
|
80281
80283
|
const bond = useMemo(() => {
|
|
80282
80284
|
if (userData && (userData === null || userData === void 0 ? void 0 : userData.Sales.length) > 0) {
|
|
80283
80285
|
const sortedPurchases = userData === null || userData === void 0 ? void 0 : userData.Sales.sort((a, b) => b.dollarValue - a.dollarValue);
|
|
80284
|
-
const activeBills = bills === null || bills === void 0 ? void 0 : bills.filter((bill) => !isBondSoldOut(bill) && (chains === null || chains === void 0 ? void 0 : chains.includes(bill.chainId)));
|
|
80286
|
+
const activeBills = bills === null || bills === void 0 ? void 0 : bills.filter((bill) => !isBondSoldOut(bill, SDKConfig.showLowValueBonds) && (chains === null || chains === void 0 ? void 0 : chains.includes(bill.chainId)));
|
|
80285
80287
|
const highestActivePurchase = sortedPurchases === null || sortedPurchases === void 0 ? void 0 : sortedPurchases.find((purchase) => activeBills === null || activeBills === void 0 ? void 0 : activeBills.find((bill) => {
|
|
80286
80288
|
var _a;
|
|
80287
80289
|
if (purchase.contractAddress.toLowerCase() === ((_a = bill === null || bill === void 0 ? void 0 : bill.billAddress) === null || _a === void 0 ? void 0 : _a.toLowerCase()))
|
|
@@ -80335,7 +80337,7 @@ const BuyAgainRow = () => {
|
|
|
80335
80337
|
bond: bond.earnToken.symbol,
|
|
80336
80338
|
},
|
|
80337
80339
|
});
|
|
80338
|
-
}, sx: { position: 'absolute', top: '32px', left: '1px', width: 'calc(100% - 2px)' }, children: jsx$2(BondRow, { bondAddress: bond.billAddress, bondChain: bond.chainId, payoutToken: bond.earnToken, tag: (_a = bond.tags) === null || _a === void 0 ? void 0 : _a[0], bondSoldOut: isBondSoldOut(bond), trueBondPrices: bond === null || bond === void 0 ? void 0 : bond.trueBondPrices, minTier: bond === null || bond === void 0 ? void 0 : bond.minTier, vestingTermString: getVestingTermsString(bond), vestingCliffString: getVestingTermsTooltipString(bond), percentageAvailable: remainingPercentage(bond), remainingTokensString: remainingTokensString }, `${bondAddress}-${bond.chainId}`) })] }) })) : null;
|
|
80340
|
+
}, sx: { position: 'absolute', top: '32px', left: '1px', width: 'calc(100% - 2px)' }, children: jsx$2(BondRow, { bondAddress: bond.billAddress, bondChain: bond.chainId, payoutToken: bond.earnToken, tag: (_a = bond.tags) === null || _a === void 0 ? void 0 : _a[0], bondSoldOut: isBondSoldOut(bond, SDKConfig.showLowValueBonds), trueBondPrices: bond === null || bond === void 0 ? void 0 : bond.trueBondPrices, minTier: bond === null || bond === void 0 ? void 0 : bond.minTier, vestingTermString: getVestingTermsString(bond), vestingCliffString: getVestingTermsTooltipString(bond), percentageAvailable: remainingPercentage(bond), remainingTokensString: remainingTokensString }, `${bondAddress}-${bond.chainId}`) })] }) })) : null;
|
|
80339
80341
|
};
|
|
80340
80342
|
|
|
80341
80343
|
const Bonds = () => {
|
|
@@ -80400,10 +80402,10 @@ const Bonds = () => {
|
|
|
80400
80402
|
billsToReturn = billsToReturn === null || billsToReturn === void 0 ? void 0 : billsToReturn.filter((bill) => { var _a; return chainFilterOption === null || chainFilterOption === void 0 ? void 0 : chainFilterOption.includes((_a = bill === null || bill === void 0 ? void 0 : bill.chainId) === null || _a === void 0 ? void 0 : _a.toString()); });
|
|
80401
80403
|
}
|
|
80402
80404
|
if (filterOption !== 'SOLD OUT') {
|
|
80403
|
-
billsToReturn = billsToReturn === null || billsToReturn === void 0 ? void 0 : billsToReturn.filter((bond) => !isBondSoldOut(bond));
|
|
80405
|
+
billsToReturn = billsToReturn === null || billsToReturn === void 0 ? void 0 : billsToReturn.filter((bond) => !isBondSoldOut(bond, SDKConfig.showLowValueBonds));
|
|
80404
80406
|
}
|
|
80405
80407
|
if (filterOption === 'SOLD OUT') {
|
|
80406
|
-
billsToReturn = billsToReturn === null || billsToReturn === void 0 ? void 0 : billsToReturn.filter((bond) => isBondSoldOut(bond));
|
|
80408
|
+
billsToReturn = billsToReturn === null || billsToReturn === void 0 ? void 0 : billsToReturn.filter((bond) => isBondSoldOut(bond, SDKConfig.showLowValueBonds));
|
|
80407
80409
|
}
|
|
80408
80410
|
if (filterOption === 'FAVORITES') {
|
|
80409
80411
|
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()); });
|
|
@@ -5,9 +5,9 @@ export interface SDKProps {
|
|
|
5
5
|
useHotBonds?: boolean;
|
|
6
6
|
useTiers?: boolean;
|
|
7
7
|
useTGEBonds?: boolean;
|
|
8
|
+
showLowValueBonds?: boolean;
|
|
8
9
|
urls?: Partial<Record<URLKeys, string>>;
|
|
9
10
|
theme?: any;
|
|
10
|
-
useCardsView?: boolean;
|
|
11
11
|
}
|
|
12
12
|
export declare const useSDKConfig: (config?: SDKProps) => {
|
|
13
13
|
urls: {
|
|
@@ -23,8 +23,8 @@ export declare const useSDKConfig: (config?: SDKProps) => {
|
|
|
23
23
|
useHotBonds: boolean;
|
|
24
24
|
useTiers: boolean;
|
|
25
25
|
useTGEBonds: boolean;
|
|
26
|
+
showLowValueBonds: boolean;
|
|
26
27
|
theme?: any;
|
|
27
|
-
useCardsView: boolean;
|
|
28
28
|
};
|
|
29
29
|
export type URLKeys = 'apiV2' | 'realTimeApi' | 'apeswapLists' | 'mainUrl';
|
|
30
30
|
export declare const useURLByEnvironment: (key: URLKeys) => string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BondsData } from '../../types/bonds';
|
|
2
2
|
import { SortOptions } from './Bonds';
|
|
3
3
|
import { BillsConfig } from '@ape.swap/apeswap-lists';
|
|
4
|
-
export declare const isBondSoldOut: (bill: BondsData) => boolean;
|
|
4
|
+
export declare const isBondSoldOut: (bill: BondsData, showLowValueBonds: boolean) => boolean;
|
|
5
5
|
export declare const sortBonds: (sortConfig?: SortOptions, bonds?: BondsData[]) => BondsData[];
|
|
6
6
|
export declare const vestingTime: (vestingTerm?: number) => {
|
|
7
7
|
years: number;
|