@ape.swap/bonds-sdk 4.2.3-test.0 → 4.2.3-test.2
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/components/uikit-sdk/Svg/Icons/TurnArrow.d.ts +4 -0
- package/dist/components/uikit-sdk/Svg/types.d.ts +1 -0
- package/dist/hooks/useTopTags.d.ts +1 -2
- package/dist/main.js +416 -373
- package/dist/views/Bonds/Bonds.d.ts +4 -0
- package/dist/views/Bonds/components/BondRows/{BondRowsWithTitle.d.ts → ActiveBondRows.d.ts} +3 -4
- package/dist/views/Bonds/components/BondRows/BondRow.d.ts +2 -0
- package/dist/views/Bonds/components/BondRows/CollapsableSoldoutRow.d.ts +7 -0
- package/dist/views/Bonds/components/BondRows/SoldOutRows.d.ts +7 -0
- package/package.json +1 -1
- package/dist/views/Bonds/components/BondRows/BondRowsByChain.d.ts +0 -10
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const useTopTags: (initialBondList?: BondsData[]) => string[];
|
|
1
|
+
export declare const useTopTags: () => string[];
|
package/dist/main.js
CHANGED
|
@@ -4219,6 +4219,7 @@ var tslib_es6$1 = /*#__PURE__*/Object.freeze({
|
|
|
4219
4219
|
|
|
4220
4220
|
var icons;
|
|
4221
4221
|
(function (icons) {
|
|
4222
|
+
icons["TURN_ARROW"] = "turnArrow";
|
|
4222
4223
|
icons["CARET"] = "caret";
|
|
4223
4224
|
icons["EXTERNAL"] = "external";
|
|
4224
4225
|
icons["MORE"] = "more";
|
|
@@ -4849,6 +4850,10 @@ const BASE$1 = ({ width }) => {
|
|
|
4849
4850
|
return (jsxs("svg", { width: width || '30', height: width || '30', viewBox: "0 0 30 30", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsx$2("rect", { width: "30", height: "30", fill: "#0052FF" }), jsx$2("path", { d: "M14.9646 25.5633C20.7986 25.5633 25.528 20.8339 25.528 14.9999C25.528 9.16591 20.7986 4.43652 14.9646 4.43652C9.43001 4.43652 4.88952 8.69296 4.43809 14.1109H20.1134V15.87H4.43652C4.87896 21.297 9.42354 25.5633 14.9646 25.5633Z", fill: "white" })] }));
|
|
4850
4851
|
};
|
|
4851
4852
|
|
|
4853
|
+
const TurnArrow = ({ width }) => {
|
|
4854
|
+
return (jsx$2("svg", { xmlns: "http://www.w3.org/2000/svg", width: width || '30', height: width || '30', viewBox: "0 0 24 24", sx: { transform: 'rotate(270deg)' }, children: jsxs("g", { fill: "none", stroke: "#73728E", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "0.5", children: [jsx$2("path", { d: "m14 15l-5 5l-5-5" }), jsx$2("path", { d: "M20 4h-7a4 4 0 0 0-4 4v12" })] }) }));
|
|
4855
|
+
};
|
|
4856
|
+
|
|
4852
4857
|
const Svg = (_a) => {
|
|
4853
4858
|
var { icon } = _a, props = __rest(_a, ["icon"]);
|
|
4854
4859
|
const getStyles = ({ degree, color, margin }) => dynamicStyles$1.generic({
|
|
@@ -4933,6 +4938,8 @@ const Svg = (_a) => {
|
|
|
4933
4938
|
return jsx$2(Timer, Object.assign({}, props, { getStyles: getStyles }));
|
|
4934
4939
|
case icons.TICK:
|
|
4935
4940
|
return jsx$2(Tick, Object.assign({}, props, { getStyles: getStyles }));
|
|
4941
|
+
case icons.TURN_ARROW:
|
|
4942
|
+
return jsx$2(TurnArrow, Object.assign({}, props, { getStyles: getStyles }));
|
|
4936
4943
|
// ONLY TOKENS BELOW
|
|
4937
4944
|
case icons.BLAST:
|
|
4938
4945
|
return jsx$2(BLAST, Object.assign({}, props, { getStyles: getStyles }));
|
|
@@ -76669,39 +76676,44 @@ const YourBonds = ({ showOnly }) => {
|
|
|
76669
76676
|
};
|
|
76670
76677
|
|
|
76671
76678
|
// This basically returns the 2 tags with the higher active bond count
|
|
76672
|
-
const useTopTags = (
|
|
76679
|
+
const useTopTags = () => {
|
|
76680
|
+
const { data: bonds } = useBondsData();
|
|
76673
76681
|
const SDKConfig = useSDKConfig();
|
|
76674
76682
|
const chains = SDKConfig.chains;
|
|
76675
|
-
|
|
76676
|
-
|
|
76677
|
-
|
|
76678
|
-
|
|
76679
|
-
|
|
76680
|
-
|
|
76681
|
-
|
|
76682
|
-
|
|
76683
|
-
|
|
76684
|
-
|
|
76685
|
-
|
|
76686
|
-
|
|
76687
|
-
|
|
76688
|
-
|
|
76683
|
+
return useMemo(() => {
|
|
76684
|
+
if (!bonds || bonds.length === 0)
|
|
76685
|
+
return [];
|
|
76686
|
+
const countTagsInBonds = (bonds) => {
|
|
76687
|
+
const tagCount = {};
|
|
76688
|
+
bonds === null || bonds === void 0 ? void 0 : bonds.forEach((bond) => {
|
|
76689
|
+
var _a;
|
|
76690
|
+
if (bond.soldOut)
|
|
76691
|
+
return;
|
|
76692
|
+
(_a = bond.tags) === null || _a === void 0 ? void 0 : _a.forEach((tag) => {
|
|
76693
|
+
if (tag in tagCount) {
|
|
76694
|
+
tagCount[tag] += 1;
|
|
76695
|
+
}
|
|
76696
|
+
else {
|
|
76697
|
+
tagCount[tag] = 1;
|
|
76698
|
+
}
|
|
76699
|
+
});
|
|
76689
76700
|
});
|
|
76701
|
+
return tagCount;
|
|
76702
|
+
};
|
|
76703
|
+
const activeBonds = bonds === null || bonds === void 0 ? void 0 : bonds.filter((bond) => !bond.soldOut && (chains === null || chains === void 0 ? void 0 : chains.includes(bond.chainId)));
|
|
76704
|
+
const filteredBonds = activeBonds === null || activeBonds === void 0 ? void 0 : activeBonds.filter((bond) => {
|
|
76705
|
+
var _a, _b;
|
|
76706
|
+
if (SDKConfig.bondPartner) {
|
|
76707
|
+
return ((_a = bond === null || bond === void 0 ? void 0 : bond.bondPartner) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === ((_b = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.bondPartner) === null || _b === void 0 ? void 0 : _b.toLowerCase());
|
|
76708
|
+
}
|
|
76709
|
+
else
|
|
76710
|
+
return true;
|
|
76690
76711
|
});
|
|
76691
|
-
|
|
76692
|
-
|
|
76693
|
-
|
|
76694
|
-
|
|
76695
|
-
|
|
76696
|
-
if (SDKConfig.bondPartner) {
|
|
76697
|
-
return ((_a = bond === null || bond === void 0 ? void 0 : bond.bondPartner) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === ((_b = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.bondPartner) === null || _b === void 0 ? void 0 : _b.toLowerCase());
|
|
76698
|
-
}
|
|
76699
|
-
else
|
|
76700
|
-
return true;
|
|
76701
|
-
});
|
|
76702
|
-
const countedTags = countTagsInBonds(filteredBonds);
|
|
76703
|
-
const sortedTagsArray = Object.entries(countedTags).sort((a, b) => b[1] - a[1]);
|
|
76704
|
-
return sortedTagsArray.slice(0, 2).map((tagCountArray) => tagCountArray[0]);
|
|
76712
|
+
const countedTags = countTagsInBonds(filteredBonds);
|
|
76713
|
+
const sortedTagsArray = Object.entries(countedTags).sort((a, b) => b[1] - a[1]);
|
|
76714
|
+
return sortedTagsArray.slice(0, 2).map((tagCountArray) => tagCountArray[0]);
|
|
76715
|
+
/* eslint-disable react-hooks/exhaustive-deps */
|
|
76716
|
+
}, [bonds === null || bonds === void 0 ? void 0 : bonds.length]);
|
|
76705
76717
|
};
|
|
76706
76718
|
|
|
76707
76719
|
function adjustDecimals(numStr) {
|
|
@@ -79776,7 +79788,7 @@ const BuyComponentSolana = ({ onDismiss, bondAddress, bondChain, isProjectView,
|
|
|
79776
79788
|
});
|
|
79777
79789
|
// waits 3 seconds before triggering after-purchase flow
|
|
79778
79790
|
yield new Promise((resolve) => setTimeout(resolve, 3000));
|
|
79779
|
-
console.
|
|
79791
|
+
console.log('3 seconds elapsed. trigger bonds refetch');
|
|
79780
79792
|
addToastSuccess(txId, bondChain);
|
|
79781
79793
|
setBillId === null || setBillId === void 0 ? void 0 : setBillId(nftMint.publicKey.toString());
|
|
79782
79794
|
}
|
|
@@ -80265,21 +80277,151 @@ const CheckUrl = () => {
|
|
|
80265
80277
|
return jsx$2(Fragment$1, {});
|
|
80266
80278
|
};
|
|
80267
80279
|
|
|
80268
|
-
const
|
|
80280
|
+
const styles$8 = {
|
|
80281
|
+
smallCardContainer: {
|
|
80282
|
+
width: '100%',
|
|
80283
|
+
p: '6px 12px',
|
|
80284
|
+
background: 'white2',
|
|
80285
|
+
borderRadius: 'normal',
|
|
80286
|
+
justifyContent: 'space-between',
|
|
80287
|
+
alignItems: 'center',
|
|
80288
|
+
cursor: 'pointer',
|
|
80289
|
+
mr: '10px',
|
|
80290
|
+
':last-of-type': {
|
|
80291
|
+
mr: '0px',
|
|
80292
|
+
},
|
|
80293
|
+
},
|
|
80294
|
+
subTitle: {
|
|
80295
|
+
color: 'textDisabledButton',
|
|
80296
|
+
fontSize: '12px',
|
|
80297
|
+
fontWeight: 400,
|
|
80298
|
+
lineHeight: '16px',
|
|
80299
|
+
},
|
|
80300
|
+
};
|
|
80301
|
+
|
|
80302
|
+
const SmallRecommendationCard = ({ recommendation }) => {
|
|
80269
80303
|
var _a;
|
|
80270
|
-
const
|
|
80271
|
-
return (jsxs(Flex, {
|
|
80272
|
-
|
|
80273
|
-
|
|
80274
|
-
|
|
80275
|
-
|
|
80276
|
-
|
|
80277
|
-
|
|
80278
|
-
|
|
80279
|
-
|
|
80280
|
-
|
|
80281
|
-
|
|
80282
|
-
|
|
80304
|
+
const vestingTime = getTimePeriods((_a = recommendation.vestingTerm) !== null && _a !== void 0 ? _a : 0, true);
|
|
80305
|
+
return (jsxs(Flex, { sx: styles$8.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$8.subTitle, children: [vestingTime.days, "D"] })] })] }), jsxs(Flex, { sx: { alignItems: 'center' }, children: [jsx$2(Flex, { sx: styles$8.subTitle, children: "Bonus" }), jsxs(Flex, { sx: { fontSize: '12px', color: recommendation.bonus > 0 ? 'success' : 'error', ml: '6px' }, children: [recommendation.bonus.toFixed(2), "%"] })] })] }));
|
|
80306
|
+
};
|
|
80307
|
+
|
|
80308
|
+
function useHotBondContracts() {
|
|
80309
|
+
const apiUrl = useURLByEnvironment('apiV2');
|
|
80310
|
+
return useQuery({
|
|
80311
|
+
queryKey: [QUERY_KEYS.HOT_BONDS_CONTRACTS],
|
|
80312
|
+
queryFn: () => getHotBondsContracts(apiUrl),
|
|
80313
|
+
staleTime: Infinity,
|
|
80314
|
+
refetchOnWindowFocus: false,
|
|
80315
|
+
refetchOnMount: false,
|
|
80316
|
+
retry: 1,
|
|
80317
|
+
});
|
|
80318
|
+
}
|
|
80319
|
+
function useHotBonds() {
|
|
80320
|
+
const { data: bondsData } = useBondsData();
|
|
80321
|
+
const { data: hotBondContracts } = useHotBondContracts();
|
|
80322
|
+
return useQuery({
|
|
80323
|
+
queryKey: [QUERY_KEYS.HOT_BONDS, bondsData === null || bondsData === void 0 ? void 0 : bondsData.length, hotBondContracts === null || hotBondContracts === void 0 ? void 0 : hotBondContracts.length],
|
|
80324
|
+
queryFn: () => getHotBonds(bondsData, hotBondContracts),
|
|
80325
|
+
refetchOnWindowFocus: false,
|
|
80326
|
+
refetchInterval: 30000,
|
|
80327
|
+
enabled: !!bondsData && bondsData.length > 0 && !!hotBondContracts && hotBondContracts.length > 0,
|
|
80328
|
+
retry: 0,
|
|
80329
|
+
});
|
|
80330
|
+
}
|
|
80331
|
+
const getHotBondsContracts = (apiUrl) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
80332
|
+
try {
|
|
80333
|
+
const response = yield axios.get(`${STRAPI_URL}/hot-bonds`);
|
|
80334
|
+
return response.data.map((bond) => bond.BondAddress.toLowerCase());
|
|
80335
|
+
}
|
|
80336
|
+
catch (e) {
|
|
80337
|
+
reportError({
|
|
80338
|
+
apiUrl,
|
|
80339
|
+
error: e,
|
|
80340
|
+
extraInfo: { type: 'getHotBondsContracts', e },
|
|
80341
|
+
});
|
|
80342
|
+
return [];
|
|
80343
|
+
}
|
|
80344
|
+
});
|
|
80345
|
+
const getHotBonds = (bondData, hotBondContracts) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
80346
|
+
return bondData.filter((bond) => { var _a, _b, _c; return hotBondContracts.includes((_c = (_b = (_a = bond === null || bond === void 0 ? void 0 : bond.contractAddress) === null || _a === void 0 ? void 0 : _a[bond === null || bond === void 0 ? void 0 : bond.chainId]) === null || _b === void 0 ? void 0 : _b.toLowerCase()) !== null && _c !== void 0 ? _c : ''); });
|
|
80347
|
+
});
|
|
80348
|
+
|
|
80349
|
+
const RecommendationCards$1 = () => {
|
|
80350
|
+
const topTags = useTopTags();
|
|
80351
|
+
const { address: account } = useEVMAccount();
|
|
80352
|
+
const options = account ? ['For You', 'Hot', ...topTags] : ['Hot', ...topTags];
|
|
80353
|
+
const [activeOption, setActiveOption] = useState(options[0]);
|
|
80354
|
+
const { data: hotRecommendations } = useHotBonds();
|
|
80355
|
+
const { data: bonds } = useBondsData();
|
|
80356
|
+
const SDKConfig = useSDKConfig();
|
|
80357
|
+
const { data: forYouRecommendations } = useGetBondRecommendations(account, undefined, '3');
|
|
80358
|
+
const sortedBonds = bonds && (bonds === null || bonds === void 0 ? void 0 : bonds.length) > 0
|
|
80359
|
+
? [...bonds].sort((a, b) => {
|
|
80360
|
+
var _a, _b, _c, _d;
|
|
80361
|
+
return ((_b = (_a = findHighestTrueBondPrice('0', b === null || b === void 0 ? void 0 : b.trueBondPrices)) === null || _a === void 0 ? void 0 : _a.bonusWithFee) !== null && _b !== void 0 ? _b : 0) -
|
|
80362
|
+
((_d = (_c = findHighestTrueBondPrice('0', a === null || a === void 0 ? void 0 : a.trueBondPrices)) === null || _c === void 0 ? void 0 : _c.bonusWithFee) !== null && _d !== void 0 ? _d : 0);
|
|
80363
|
+
})
|
|
80364
|
+
: undefined;
|
|
80365
|
+
const filteredBonds = sortedBonds === null || sortedBonds === void 0 ? void 0 : sortedBonds.filter((bond) => { var _a, _b; return ((_a = bond === null || bond === void 0 ? void 0 : bond.tags) === null || _a === void 0 ? void 0 : _a.includes(activeOption)) && !(bond === null || bond === void 0 ? void 0 : bond.soldOut) && ((_b = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.chains) === null || _b === void 0 ? void 0 : _b.includes(bond.chainId)); });
|
|
80366
|
+
const selectedBonds = activeOption === 'For You' ? forYouRecommendations : activeOption === 'Hot' ? hotRecommendations : filteredBonds;
|
|
80367
|
+
const slicedBonds = selectedBonds === null || selectedBonds === void 0 ? void 0 : selectedBonds.filter((bond) => { var _a; return (_a = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.chains) === null || _a === void 0 ? void 0 : _a.includes(bond.chainId); }).slice(0, 3);
|
|
80368
|
+
const parsedBondsToRender = slicedBonds === null || slicedBonds === void 0 ? void 0 : slicedBonds.map((bond) => {
|
|
80369
|
+
var _a, _b, _c, _d;
|
|
80370
|
+
const contractAddress = 'billAddress' in bond ? bond.billAddress : (_a = bond === null || bond === void 0 ? void 0 : bond.contractAddress) === null || _a === void 0 ? void 0 : _a[bond === null || bond === void 0 ? void 0 : bond.chainId];
|
|
80371
|
+
const payoutTokenName = 'payoutTokenName' in bond ? bond.payoutTokenName : bond.earnToken.symbol;
|
|
80372
|
+
return {
|
|
80373
|
+
payoutTokenName: payoutTokenName,
|
|
80374
|
+
contractAddress,
|
|
80375
|
+
vestingTerm: (_b = bond.vestingTerm) !== null && _b !== void 0 ? _b : 0,
|
|
80376
|
+
bonus: 'bonus' in bond ? bond.bonus : ((_d = (_c = findHighestTrueBondPrice('0', bond === null || bond === void 0 ? void 0 : bond.trueBondPrices)) === null || _c === void 0 ? void 0 : _c.bonusWithFee) !== null && _d !== void 0 ? _d : 0),
|
|
80377
|
+
chainId: bond.chainId,
|
|
80378
|
+
};
|
|
80379
|
+
});
|
|
80380
|
+
useEffect(() => {
|
|
80381
|
+
if (account) {
|
|
80382
|
+
setActiveOption('For You');
|
|
80383
|
+
}
|
|
80384
|
+
else {
|
|
80385
|
+
setActiveOption('Hot');
|
|
80386
|
+
}
|
|
80387
|
+
}, [account]);
|
|
80388
|
+
return (jsxs(Flex, { sx: { mt: '15px', flexDirection: 'column', width: '100%', display: ['none', 'none', 'none', 'flex'] }, children: [jsxs(Flex, { sx: { width: '100%', justifyContent: 'space-between' }, children: [jsxs(Flex, { children: [jsx$2(Flex, { sx: {
|
|
80389
|
+
width: ['60px', '60px', '60px', 'unset'],
|
|
80390
|
+
mr: ['0px', '0px', '0px', '15px'],
|
|
80391
|
+
alignItems: 'center',
|
|
80392
|
+
color: 'grey',
|
|
80393
|
+
fontSize: ['11px'],
|
|
80394
|
+
fontWeight: 500,
|
|
80395
|
+
}, children: "BONDS MARKETS:" }), jsx$2(RecommendationSelector, { options: options, activeOption: activeOption, setActiveOption: setActiveOption })] }), jsx$2(Flex, { sx: { display: ['none', 'none', 'none', 'flex'] } })] }), jsx$2(Flex, { sx: {
|
|
80396
|
+
my: '10px',
|
|
80397
|
+
minHeight: '47.45px',
|
|
80398
|
+
}, children: parsedBondsToRender &&
|
|
80399
|
+
parsedBondsToRender.length > 0 &&
|
|
80400
|
+
parsedBondsToRender.map((bond, index) => {
|
|
80401
|
+
return jsx$2(SmallRecommendationCard, { recommendation: bond }, `${bond.payoutTokenName}-${index}`);
|
|
80402
|
+
}) })] }));
|
|
80403
|
+
};
|
|
80404
|
+
|
|
80405
|
+
// import track from 'utils/track'
|
|
80406
|
+
const FavIcon = ({ filterOption, setFilterOption, }) => {
|
|
80407
|
+
const handleFilterOption = (newOption) => {
|
|
80408
|
+
setFilterOption(newOption);
|
|
80409
|
+
};
|
|
80410
|
+
return (jsx$2(Flex, { sx: { justifyContent: 'center', alignItems: 'center', minWidth: '25px', cursor: 'pointer', ml: '15px' }, className: "search-fav-icon", onClick: () => {
|
|
80411
|
+
handleFilterOption(filterOption !== 'FAVORITES' ? 'FAVORITES' : 'ALL');
|
|
80412
|
+
}, children: jsx$2(AnimatePresence, { mode: "wait", children: jsx$2(motion.div, { initial: false, animate: { opacity: 1, scale: 1.0 }, exit: { opacity: 0, scale: 0.8 }, transition: { duration: 0.2 }, style: { display: 'flex', alignItems: 'center' }, children: filterOption === 'FAVORITES' ? (jsx$2(Svg, { icon: "StarFilled", width: 22, height: 22 })) : (jsx$2(Svg, { icon: "Star", width: 20, height: 20 })) }, filterOption === 'FAVORITES' ? 'StarFilled' : 'Star') }) }));
|
|
80413
|
+
};
|
|
80414
|
+
|
|
80415
|
+
const BondsMenu = ({ searchQuery, setSearchQuery, setChainFilterOption, chainFilterOption, filterOptions, filterOption, setFilterOption, onSort, }) => {
|
|
80416
|
+
const { namingPreference } = useSDKConfig();
|
|
80417
|
+
return (jsxs("div", { className: "bonds-menu", children: [jsx$2(BondFilters, { chainFilterOption: chainFilterOption !== null && chainFilterOption !== void 0 ? chainFilterOption : ['All Chains'], setChainFilterOption: setChainFilterOption, filterOptions: filterOptions, filterOption: filterOption, setFilterOption: setFilterOption, onHandleQueryChange: () => setSearchQuery('') }), jsxs("div", { className: "table-header-container", children: [jsx$2("div", { className: "search-container", children: jsxs(Flex$1, { sx: { width: '100%', maxWidth: '340px' }, children: [jsx$2(Input, { value: searchQuery, onChange: (event) => setSearchQuery(event.target.value), variant: "search", width: '100%', sx: {
|
|
80418
|
+
fontWeight: 600,
|
|
80419
|
+
background: 'white2',
|
|
80420
|
+
height: '30px',
|
|
80421
|
+
fontSize: '14px',
|
|
80422
|
+
color: 'white',
|
|
80423
|
+
width: ['calc(50vw - 25px)'],
|
|
80424
|
+
}, placeholder: 'Search...' }), jsx$2(FavIcon, { filterOption: filterOption, setFilterOption: setFilterOption })] }) }), jsxs("div", { className: "headers-container", children: [jsx$2(Flex$1, { sx: { width: '125px' } }), jsxs("div", { className: "discount-header", onClick: () => onSort('bonus'), children: [namingPreference.toUpperCase(), jsx$2(Flex$1, { sx: { ml: '5px', mb: '3px' }, children: jsx$2(Svg, { icon: "sort", width: 10, color: "textDisabledButton" }) })] }), jsxs("div", { className: "terms-header", onClick: () => onSort('terms'), children: ["TERMS", jsx$2(Flex$1, { sx: { ml: '5px', mb: '3px' }, children: jsx$2(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) })] }), jsxs("div", { className: "tokens-remaining-header", onClick: () => onSort('tokensRemaining'), children: ["TOKENS REMAINING", jsx$2(Flex$1, { sx: { ml: '5px', mb: '3px' }, children: jsx$2(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) })] }), jsx$2("div", { className: "tooltip-header" })] })] })] }));
|
|
80283
80425
|
};
|
|
80284
80426
|
|
|
80285
80427
|
const BonusContainer = ({ trueBondPrices, minTier, bonus, airdropTooltip, tooltipPosition = 'bottomRight', }) => {
|
|
@@ -80287,7 +80429,7 @@ const BonusContainer = ({ trueBondPrices, minTier, bonus, airdropTooltip, toolti
|
|
|
80287
80429
|
return (jsx$2("div", { className: `discount-column`, children: jsx$2(BonusComponent, { trueBondPrices: trueBondPrices, minTier: minTier, bonus: bonus, airdropTooltip: airdropTooltip, tooltipPosition: isMobile ? tooltipPosition : 'bottomLeft' }) }));
|
|
80288
80430
|
};
|
|
80289
80431
|
|
|
80290
|
-
const BondRow = ({ bondAddress, bondChain, billArtCollection, payoutToken, billType, tag, bondSoldOut, trueBondPrices, minTier, bonus, airdropTooltip, vestingTermString, vestingCliffString, percentageAvailable, remainingTokensString, projectURL, twitterURL, auditURL, shortDescription, }) => {
|
|
80432
|
+
const BondRow = ({ bondAddress, bondChain, billArtCollection, payoutToken, billType, tag, bondSoldOut, trueBondPrices, minTier, bonus, airdropTooltip, vestingTermString, vestingCliffString, percentageAvailable, remainingTokensString, projectURL, twitterURL, auditURL, shortDescription, soldoutBondsCount, isOpen, }) => {
|
|
80291
80433
|
var _a, _b, _c;
|
|
80292
80434
|
const SDKConfig = useSDKConfig();
|
|
80293
80435
|
const locationPath = window.location.pathname.replace('/', '');
|
|
@@ -80317,13 +80459,134 @@ const BondRow = ({ bondAddress, bondChain, billArtCollection, payoutToken, billT
|
|
|
80317
80459
|
});
|
|
80318
80460
|
};
|
|
80319
80461
|
return (jsxs("div", { className: "bond-row" // Insert special campaign styles here
|
|
80320
|
-
, onClick: handleOpenModal, sx: Object.assign({ borderRadius: 'normal' }, bondRowCampaignStyles[billArtCollection]), children: [jsx$2("div", { className: "token-info-container", sx: { width: ['40%', '40%', '40%', '30%'] }, children: jsx$2(TokenInfoAndName, { tokenSymbol: payoutToken === null || payoutToken === void 0 ? void 0 : payoutToken.symbol, chain: bondChain, tag: tag, billArtCollection: billArtCollection }) }), SDKConfig.useCardsView && shortDescription && (jsx$2("div", { className: "short-description", children: jsx$2(SafeHTMLComponent, { html: shortDescription }) })), jsxs("div", { className: "bond-info-columns", sx: { width: ['60%', '60%', '60%', '70%'] }, children: [!SDKConfig.useCardsView && jsx$2(Flex, { sx: { display: ['none', 'none', 'none', 'flex'], width: '125px' } }), jsx$2(BonusContainer, { trueBondPrices: trueBondPrices, minTier: minTier, bonus: bonus, airdropTooltip: airdropTooltip }), jsxs("div", { className: "terms-column", children: [vestingTermString, vestingCliffString && (jsx$2(TooltipBubble, { className: "tooltip-bubble", 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: {
|
|
80462
|
+
, onClick: handleOpenModal, sx: Object.assign({ borderRadius: 'normal' }, bondRowCampaignStyles[billArtCollection]), children: [jsx$2("div", { className: "token-info-container", sx: { width: ['40%', '40%', '40%', '30%'] }, children: jsx$2(TokenInfoAndName, { tokenSymbol: payoutToken === null || payoutToken === void 0 ? void 0 : payoutToken.symbol, chain: bondChain, tag: tag, billArtCollection: billArtCollection }) }), SDKConfig.useCardsView && shortDescription && (jsx$2("div", { className: "short-description", children: jsx$2(SafeHTMLComponent, { html: shortDescription }) })), jsxs("div", { className: "bond-info-columns", sx: { width: ['60%', '60%', '60%', '70%'] }, children: [!SDKConfig.useCardsView && jsx$2(Flex, { sx: { display: ['none', 'none', 'none', 'flex'], width: '125px' } }), jsx$2(BonusContainer, { trueBondPrices: trueBondPrices, minTier: minTier, bonus: bonus, airdropTooltip: airdropTooltip }), jsxs("div", { className: "terms-column", children: [vestingTermString, vestingCliffString && (jsx$2(TooltipBubble, { className: "tooltip-bubble", 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: bondSoldOut ? ('-') : (jsx$2(ProgressBarWrapper$1, { title: '', value: jsx$2(ProgressBar, { value: percentageAvailable }), style: {
|
|
80321
80463
|
width: '127px',
|
|
80322
80464
|
height: '25px',
|
|
80323
80465
|
flexDirection: 'column',
|
|
80324
80466
|
justifyContent: 'center',
|
|
80325
80467
|
display: ['none', 'none', 'none', 'flex'],
|
|
80326
|
-
}, showTooltip: true, toolTip: remainingTokensString }) }), jsx$2("div", { className: "tooltip-column", children: jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(BondInfoTooltip, { earnTokenContract: (_b = (_a = payoutToken === null || payoutToken === void 0 ? void 0 : payoutToken.address) === null || _a === void 0 ? void 0 : _a[bondChain]) !== null && _b !== void 0 ? _b : '', earnTokenSymbol: (_c = payoutToken === null || payoutToken === void 0 ? void 0 : payoutToken.symbol) !== null && _c !== void 0 ? _c : '', bondContract: bondAddress !== null && bondAddress !== void 0 ? bondAddress : '', projectLink: projectURL, twitter: twitterURL, audit: auditURL, chain: bondChain, isSoldOut: bondSoldOut, billType: billType }), width: "205px", placement: "bottomRight", transformTip: "translate(7%, -2%)", children: jsx$2(Flex, { className: "more-icon", sx: { opacity: 0.8 }, children: jsx$2(Svg, { icon: "more", width: "25px" }) }) }) })] })] }, `${bondAddress}-${bondChain}`));
|
|
80468
|
+
}, showTooltip: true, toolTip: remainingTokensString })) }), jsx$2("div", { className: "tooltip-column", children: soldoutBondsCount ? (jsxs(Flex, { sx: { gap: '5px', fontSize: '13px', fontWeight: 500, opacity: 0.5 }, children: ["(", soldoutBondsCount, ")", jsx$2(Svg, { icon: "caret", direction: isOpen ? 'up' : 'down', width: "8px" })] })) : (jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(BondInfoTooltip, { earnTokenContract: (_b = (_a = payoutToken === null || payoutToken === void 0 ? void 0 : payoutToken.address) === null || _a === void 0 ? void 0 : _a[bondChain]) !== null && _b !== void 0 ? _b : '', earnTokenSymbol: (_c = payoutToken === null || payoutToken === void 0 ? void 0 : payoutToken.symbol) !== null && _c !== void 0 ? _c : '', bondContract: bondAddress !== null && bondAddress !== void 0 ? bondAddress : '', projectLink: projectURL, twitter: twitterURL, audit: auditURL, chain: bondChain, isSoldOut: bondSoldOut, billType: billType }), width: "205px", placement: "bottomRight", transformTip: "translate(7%, -2%)", children: jsx$2(Flex, { className: "more-icon", sx: { opacity: 0.8 }, children: jsx$2(Svg, { icon: "more", width: "25px" }) }) })) })] })] }, `${bondAddress}-${bondChain}`));
|
|
80469
|
+
};
|
|
80470
|
+
|
|
80471
|
+
const getUserApiStats = (account) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
80472
|
+
if (!account)
|
|
80473
|
+
return null;
|
|
80474
|
+
const { data } = yield axios.get(`https://dashboard-api.ape.bond/collector/userSalesInfo/purchased/${account}`);
|
|
80475
|
+
return data;
|
|
80476
|
+
});
|
|
80477
|
+
function useUserApiStats() {
|
|
80478
|
+
const { address: account } = useEVMAccount();
|
|
80479
|
+
return useQuery({
|
|
80480
|
+
queryKey: [`${QUERY_KEYS.USER_STATS}-${account}`],
|
|
80481
|
+
queryFn: () => getUserApiStats(account),
|
|
80482
|
+
staleTime: Infinity,
|
|
80483
|
+
refetchOnWindowFocus: false,
|
|
80484
|
+
refetchOnMount: false,
|
|
80485
|
+
retry: 1,
|
|
80486
|
+
});
|
|
80487
|
+
}
|
|
80488
|
+
|
|
80489
|
+
const BuyAgainRow = () => {
|
|
80490
|
+
var _a, _b, _c;
|
|
80491
|
+
const { data: userData } = useUserApiStats();
|
|
80492
|
+
const { data: bills } = useBondsData();
|
|
80493
|
+
const SDKConfig = useSDKConfig();
|
|
80494
|
+
const chains = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.chains;
|
|
80495
|
+
const bond = useMemo(() => {
|
|
80496
|
+
if (userData && (userData === null || userData === void 0 ? void 0 : userData.Sales.length) > 0) {
|
|
80497
|
+
const sortedPurchases = userData === null || userData === void 0 ? void 0 : userData.Sales.sort((a, b) => b.dollarValue - a.dollarValue);
|
|
80498
|
+
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)));
|
|
80499
|
+
const highestActivePurchase = sortedPurchases === null || sortedPurchases === void 0 ? void 0 : sortedPurchases.find((purchase) => activeBills === null || activeBills === void 0 ? void 0 : activeBills.find((bill) => {
|
|
80500
|
+
var _a, _b;
|
|
80501
|
+
if (purchase.contractAddress.toLowerCase() === ((_b = (_a = bill === null || bill === void 0 ? void 0 : bill.contractAddress) === null || _a === void 0 ? void 0 : _a[bill.chainId]) === null || _b === void 0 ? void 0 : _b.toLowerCase()))
|
|
80502
|
+
return true;
|
|
80503
|
+
}));
|
|
80504
|
+
return activeBills === null || activeBills === void 0 ? void 0 : activeBills.find((bill) => {
|
|
80505
|
+
var _a, _b, _c;
|
|
80506
|
+
return ((_b = (_a = bill === null || bill === void 0 ? void 0 : bill.contractAddress) === null || _a === void 0 ? void 0 : _a[bill.chainId]) === null || _b === void 0 ? void 0 : _b.toLowerCase()) ===
|
|
80507
|
+
((_c = highestActivePurchase === null || highestActivePurchase === void 0 ? void 0 : highestActivePurchase.contractAddress) === null || _c === void 0 ? void 0 : _c.toLowerCase());
|
|
80508
|
+
});
|
|
80509
|
+
}
|
|
80510
|
+
}, [SDKConfig.showLowValueBonds, bills, chains, userData]);
|
|
80511
|
+
const bondAddress = (_a = bond === null || bond === void 0 ? void 0 : bond.contractAddress) === null || _a === void 0 ? void 0 : _a[bond.chainId];
|
|
80512
|
+
const remainingTokensFormat = (bond) => {
|
|
80513
|
+
const tokensRemaining = 'tokensRemaining' in bond ? bond.tokensRemaining : '0';
|
|
80514
|
+
return formatNumberSI(parseFloat(tokensRemaining !== null && tokensRemaining !== void 0 ? tokensRemaining : '0'), 0);
|
|
80515
|
+
};
|
|
80516
|
+
const remainingTokensUsd = (bond) => {
|
|
80517
|
+
const tokensRemaining = 'tokensRemaining' in bond ? bond.tokensRemaining : '0';
|
|
80518
|
+
const payoutTokenPrice = 'payoutTokenPrice' in bond ? bond.payoutTokenPrice : 0;
|
|
80519
|
+
const tokens = new BigNumber$1(tokensRemaining !== null && tokensRemaining !== void 0 ? tokensRemaining : '0');
|
|
80520
|
+
return tokens.times(payoutTokenPrice !== null && payoutTokenPrice !== void 0 ? payoutTokenPrice : '0');
|
|
80521
|
+
};
|
|
80522
|
+
const remainingTokensString = bond
|
|
80523
|
+
? `${remainingTokensFormat(bond)} ${bond.earnToken.symbol} ($${formatNumberSI(remainingTokensUsd(bond).toNumber())})`
|
|
80524
|
+
: '';
|
|
80525
|
+
return bond ? (jsx$2(AnimatePresence, { children: jsxs(motion.div, { initial: { height: 0, overflow: 'hidden' }, animate: { height: 'fit-content', overflow: 'hidden', transitionEnd: { overflow: 'visible' } }, exit: { height: 0, overflow: 'hidden' }, sx: {
|
|
80526
|
+
position: 'relative',
|
|
80527
|
+
overflow: 'hidden',
|
|
80528
|
+
width: '100%',
|
|
80529
|
+
mb: '10px',
|
|
80530
|
+
}, children: [jsx$2(Flex, { sx: {
|
|
80531
|
+
p: '0 1px',
|
|
80532
|
+
width: '100%',
|
|
80533
|
+
pt: '5px',
|
|
80534
|
+
background: 'primaryButton',
|
|
80535
|
+
borderRadius: 'normal',
|
|
80536
|
+
flexDirection: 'column',
|
|
80537
|
+
opacity: 0.5,
|
|
80538
|
+
}, children: jsx$2(Flex, { className: "buy-again-header", sx: {
|
|
80539
|
+
width: '100%',
|
|
80540
|
+
fontSize: '12px',
|
|
80541
|
+
fontWeight: 500,
|
|
80542
|
+
pl: '26px',
|
|
80543
|
+
color: 'primaryBright',
|
|
80544
|
+
height: '91px',
|
|
80545
|
+
}, children: "BUY AGAIN" }) }), jsx$2(Flex, { onClick: () => {
|
|
80546
|
+
track({
|
|
80547
|
+
event: 'buyAgainClick',
|
|
80548
|
+
chain: bond.chainId,
|
|
80549
|
+
data: {
|
|
80550
|
+
bond: bond.earnToken.symbol,
|
|
80551
|
+
},
|
|
80552
|
+
});
|
|
80553
|
+
}, sx: { position: 'absolute', top: '25px', left: '1px', width: 'calc(100% - 2px)' }, children: jsx$2(BondRow, { bondAddress: (_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], bondChain: bond.chainId, billType: bond.billType, payoutToken: bond.earnToken, tag: (_c = bond.tags) === null || _c === void 0 ? void 0 : _c[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;
|
|
80554
|
+
};
|
|
80555
|
+
|
|
80556
|
+
const LoadingSkeleton = () => {
|
|
80557
|
+
return (jsxs(Flex$1, { sx: { width: '100%', flexDirection: 'column', mt: '35px' }, children: [Array.from({ length: 5 }).map((_, index) => (jsx$2(Skeleton, { animation: "waves", sx: {
|
|
80558
|
+
width: '100%',
|
|
80559
|
+
height: '70px',
|
|
80560
|
+
borderRadius: 'normal',
|
|
80561
|
+
mb: '5px',
|
|
80562
|
+
} }, `row-shadow-${index}`))), jsx$2(Flex$1, { sx: { width: '100%', gap: '15px', mt: '25px' }, children: Array.from({ length: 3 }).map((_, index) => (jsx$2(Skeleton, { animation: "waves", sx: {
|
|
80563
|
+
width: '100%',
|
|
80564
|
+
height: '125px',
|
|
80565
|
+
borderRadius: 'normal',
|
|
80566
|
+
mb: '5px',
|
|
80567
|
+
} }, `hot-card-shadow${index}`))) }), jsx$2(Flex$1, { sx: { width: '100%', flexDirection: 'column', mt: '25px' }, children: Array.from({ length: 3 }).map((_, index) => (jsx$2(Skeleton, { animation: "waves", sx: {
|
|
80568
|
+
width: '100%',
|
|
80569
|
+
height: '70px',
|
|
80570
|
+
borderRadius: 'normal',
|
|
80571
|
+
mb: '5px',
|
|
80572
|
+
} }, `second-row-shadow-${index}`))) })] }));
|
|
80573
|
+
};
|
|
80574
|
+
|
|
80575
|
+
const ChainTitle = ({ chain, pt, hideTitles, isOpen, }) => {
|
|
80576
|
+
var _a;
|
|
80577
|
+
const isMobile = useIsMobile();
|
|
80578
|
+
return (jsxs(Flex, { id: `${NETWORK_LABEL[chain].toLowerCase().replace(/\s+/g, '')}`, className: "chaintitle", sx: {
|
|
80579
|
+
pt,
|
|
80580
|
+
pb: '10px',
|
|
80581
|
+
color: 'textDisabledButton',
|
|
80582
|
+
fontSize: '13px',
|
|
80583
|
+
fontWeight: 500,
|
|
80584
|
+
cursor: 'pointer',
|
|
80585
|
+
textTransform: 'uppercase',
|
|
80586
|
+
display: hideTitles ? 'none' : 'flex',
|
|
80587
|
+
width: '300px',
|
|
80588
|
+
alignItems: 'center',
|
|
80589
|
+
}, children: [NETWORK_LABEL[chain], " Bonds", jsx$2(Flex, { sx: { ml: '7px' }, children: jsx$2(Svg, { icon: "caret", direction: isOpen ? 'down' : 'up', width: 8, color: "textDisabledButton" }) }), ((_a = NETWORK_LABEL[chain]) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes('testnet')) && (jsxs(Flex, { sx: { ml: '15px' }, children: [jsx$2(Text, { sx: { fontSize: '12px', color: '#DE62F3', fontWeight: 700, mr: '7px' }, children: "TESTNET" }), jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Text, { sx: { textTransform: 'none' }, children: "Testnet Bonds let you experiment with fake tokens for free on upcoming chains still in development." }), width: isMobile ? '272px' : '280px', placement: isMobile ? 'bottomRight' : 'bottomLeft', transformTip: isMobile ? 'translate(10%, -5%)' : 'translate(-5%, -5%)', children: jsx$2(Svg, { icon: "questionCircle", width: 14, color: "textDisabledButton" }) })] }))] }));
|
|
80327
80590
|
};
|
|
80328
80591
|
|
|
80329
80592
|
const SwiperContext$1 = createContext$1({
|
|
@@ -80342,7 +80605,7 @@ const SwiperProvider = ({ children }) => {
|
|
|
80342
80605
|
return jsx$2(SwiperContext$1.Provider, { value: { swiper, setSwiper, destroySwiper }, children: children });
|
|
80343
80606
|
};
|
|
80344
80607
|
|
|
80345
|
-
const styles$
|
|
80608
|
+
const styles$7 = {
|
|
80346
80609
|
mainComponent: {
|
|
80347
80610
|
width: '100%',
|
|
80348
80611
|
flexDirection: 'column',
|
|
@@ -80404,7 +80667,7 @@ const HotBondCard = ({ bond }) => {
|
|
|
80404
80667
|
},
|
|
80405
80668
|
});
|
|
80406
80669
|
};
|
|
80407
|
-
return (jsx$2(Flex, { sx: styles$
|
|
80670
|
+
return (jsx$2(Flex, { sx: styles$7.desktopCard, className: "hot-bond-card", onClick: handleOpenModal, children: jsxs(Flex, { sx: { flexDirection: 'column', width: '100%' }, children: [jsxs(Flex, { sx: { width: '100%', height: '75px' }, children: [jsx$2(Flex, { sx: { width: '66.66%' }, children: jsx$2(TokenInfoAndName, { tokenSymbol: bond.earnToken.symbol, chain: bond.chainId, tag: (_d = bond.tags) === null || _d === void 0 ? void 0 : _d[0], isHotBond: true }) }), jsx$2(Flex, { className: "column column-tokenicons", sx: { width: '33.33% !important', justifyContent: 'center !important', alignItems: 'center' }, children: jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(BondInfoTooltip, { earnTokenContract: (_g = (_f = (_e = bond === null || bond === void 0 ? void 0 : bond.earnToken) === null || _e === void 0 ? void 0 : _e.address) === null || _f === void 0 ? void 0 : _f[bond === null || bond === void 0 ? void 0 : bond.chainId]) !== null && _g !== void 0 ? _g : '', earnTokenSymbol: (_j = (_h = bond === null || bond === void 0 ? void 0 : bond.earnToken) === null || _h === void 0 ? void 0 : _h.symbol) !== null && _j !== void 0 ? _j : '', bondContract: (_l = (_k = bond === null || bond === void 0 ? void 0 : bond.contractAddress) === null || _k === void 0 ? void 0 : _k[bond === null || bond === void 0 ? void 0 : bond.chainId]) !== null && _l !== void 0 ? _l : '', 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(11%, 0%)", children: jsx$2(Svg, { icon: "more", width: "20px" }) }) })] }), jsxs(Flex, { sx: { width: '100%', justifyContent: 'space-around' }, children: [jsxs(Flex, { sx: { flexDirection: 'column', alignItems: 'center', width: '100%' }, children: [jsx$2(Flex, { sx: { opacity: 0.6, fontSize: '12px', fontWeight: 400 }, children: "Bonus" }), jsx$2(Flex, { className: `${getDiscountColor(bonus)}`, sx: { width: '100%', justifyContent: 'center' }, children: bonus !== undefined ? (bonus < 0 ? '0%' : `${bonus === null || bonus === void 0 ? void 0 : bonus.toFixed(2)}%`) : '-' })] }), jsxs(Flex, { sx: { flexDirection: 'column', alignItems: 'center', width: '100%' }, children: [jsx$2(Flex, { sx: { opacity: 0.6, fontSize: '12px', fontWeight: 400, width: '100%', justifyContent: 'center' }, children: "ARR" }), jsx$2(Flex, { sx: { width: '100%', justifyContent: 'center' }, children: calculateARR(bond, SDKConfig.useTiers) })] }), jsxs(Flex, { sx: { flexDirection: 'column', alignItems: 'center', width: '100%' }, children: [jsx$2(Flex, { sx: { opacity: 0.6, fontSize: '12px', fontWeight: 400, width: '100%', justifyContent: 'center' }, children: "Terms" }), jsx$2(Flex, { sx: { width: '100%', justifyContent: 'center' }, children: ((_m = vestingTime(bond === null || bond === void 0 ? void 0 : bond.vestingTerm)) === null || _m === void 0 ? void 0 : _m.days) ? `${(_o = vestingTime(bond === null || bond === void 0 ? void 0 : bond.vestingTerm)) === null || _o === void 0 ? void 0 : _o.days} D` : '-' })] })] })] }) }));
|
|
80408
80671
|
};
|
|
80409
80672
|
|
|
80410
80673
|
/**
|
|
@@ -85555,47 +85818,6 @@ const getDotPos = (index, carouselLength) => {
|
|
|
85555
85818
|
: index - carouselLength;
|
|
85556
85819
|
};
|
|
85557
85820
|
|
|
85558
|
-
function useHotBondContracts() {
|
|
85559
|
-
const apiUrl = useURLByEnvironment('apiV2');
|
|
85560
|
-
return useQuery({
|
|
85561
|
-
queryKey: [QUERY_KEYS.HOT_BONDS_CONTRACTS],
|
|
85562
|
-
queryFn: () => getHotBondsContracts(apiUrl),
|
|
85563
|
-
staleTime: Infinity,
|
|
85564
|
-
refetchOnWindowFocus: false,
|
|
85565
|
-
refetchOnMount: false,
|
|
85566
|
-
retry: 1,
|
|
85567
|
-
});
|
|
85568
|
-
}
|
|
85569
|
-
function useHotBonds() {
|
|
85570
|
-
const { data: bondsData } = useBondsData();
|
|
85571
|
-
const { data: hotBondContracts } = useHotBondContracts();
|
|
85572
|
-
return useQuery({
|
|
85573
|
-
queryKey: [QUERY_KEYS.HOT_BONDS, bondsData === null || bondsData === void 0 ? void 0 : bondsData.length, hotBondContracts === null || hotBondContracts === void 0 ? void 0 : hotBondContracts.length],
|
|
85574
|
-
queryFn: () => getHotBonds(bondsData, hotBondContracts),
|
|
85575
|
-
refetchOnWindowFocus: false,
|
|
85576
|
-
refetchInterval: 30000,
|
|
85577
|
-
enabled: !!bondsData && bondsData.length > 0 && !!hotBondContracts && hotBondContracts.length > 0,
|
|
85578
|
-
retry: 0,
|
|
85579
|
-
});
|
|
85580
|
-
}
|
|
85581
|
-
const getHotBondsContracts = (apiUrl) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
85582
|
-
try {
|
|
85583
|
-
const response = yield axios.get(`${STRAPI_URL}/hot-bonds`);
|
|
85584
|
-
return response.data.map((bond) => bond.BondAddress.toLowerCase());
|
|
85585
|
-
}
|
|
85586
|
-
catch (e) {
|
|
85587
|
-
reportError({
|
|
85588
|
-
apiUrl,
|
|
85589
|
-
error: e,
|
|
85590
|
-
extraInfo: { type: 'getHotBondsContracts', e },
|
|
85591
|
-
});
|
|
85592
|
-
return [];
|
|
85593
|
-
}
|
|
85594
|
-
});
|
|
85595
|
-
const getHotBonds = (bondData, hotBondContracts) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
85596
|
-
return bondData.filter((bond) => { var _a, _b, _c; return hotBondContracts.includes((_c = (_b = (_a = bond === null || bond === void 0 ? void 0 : bond.contractAddress) === null || _a === void 0 ? void 0 : _a[bond === null || bond === void 0 ? void 0 : bond.chainId]) === null || _b === void 0 ? void 0 : _b.toLowerCase()) !== null && _c !== void 0 ? _c : ''); });
|
|
85597
|
-
});
|
|
85598
|
-
|
|
85599
85821
|
const HotBondCards = () => {
|
|
85600
85822
|
var _a;
|
|
85601
85823
|
const { data: hotBonds } = useHotBonds();
|
|
@@ -85618,7 +85840,7 @@ const HotBondCards = () => {
|
|
|
85618
85840
|
setActiveSlide(index);
|
|
85619
85841
|
swiper === null || swiper === void 0 ? void 0 : swiper.slideTo(index);
|
|
85620
85842
|
};
|
|
85621
|
-
return (jsxs(Flex, { sx: styles$
|
|
85843
|
+
return (jsxs(Flex, { sx: styles$7.mainComponent, children: [jsx$2(Flex, { sx: styles$7.hotBondTitle, children: "HOT BONDS" }), jsx$2(Flex, { sx: styles$7.desktopCards, children: filteredBonds === null || filteredBonds === void 0 ? void 0 : filteredBonds.slice(0, 3).map((bond, index) => {
|
|
85622
85844
|
var _a;
|
|
85623
85845
|
return jsx$2(HotBondCard, { bond: bond }, `${(_a = bond === null || bond === void 0 ? void 0 : bond.contractAddress) === null || _a === void 0 ? void 0 : _a[bond === null || bond === void 0 ? void 0 : bond.chainId]}-${index}`);
|
|
85624
85846
|
}) }), jsxs(Flex, { sx: {
|
|
@@ -85705,31 +85927,16 @@ const ChainBanner = ({ chainId }) => {
|
|
|
85705
85927
|
}, children: "Get Started" }))] })] }, `banner-container-${chainId}`));
|
|
85706
85928
|
};
|
|
85707
85929
|
|
|
85708
|
-
const
|
|
85930
|
+
const ActiveBondRows = ({ chain, bonds, hideTitles, showHotBonds }) => {
|
|
85709
85931
|
const { namingPreference } = useSDKConfig();
|
|
85710
85932
|
const [isOpen, setIsOpen] = useState(true);
|
|
85711
85933
|
const key = chain;
|
|
85712
|
-
|
|
85713
|
-
const solanaBondCount = useMemo(() => {
|
|
85714
|
-
var _a, _b;
|
|
85715
|
-
return (_b = (_a = bondList === null || bondList === void 0 ? void 0 : bondList.filter((bond) => bond.chainId === main.ChainId.SOL)) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
85716
|
-
/* eslint-disable react-hooks/exhaustive-deps */
|
|
85717
|
-
}, [bondList === null || bondList === void 0 ? void 0 : bondList.length]);
|
|
85718
|
-
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 && chain !== main.ChainId.SOL) ||
|
|
85719
|
-
hideTitles ||
|
|
85720
|
-
(!showSolSkeleton && chain === main.ChainId.SOL && bonds.length <= 0), isOpen: isOpen }) }), isOpen && (bonds.length > 0 || chain === main.ChainId.SOL) && (jsxs(motion.div, { initial: { height: 0, overflow: 'hidden' }, animate: { height: 'fit-content', overflow: 'hidden', transitionEnd: { overflow: 'visible' } }, exit: { height: 0, overflow: 'hidden' }, sx: {
|
|
85934
|
+
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 && chain !== main.ChainId.SOL) || hideTitles, isOpen: isOpen }) }), isOpen && (bonds.length > 0 || chain === main.ChainId.SOL) && (jsxs(motion.div, { initial: { height: 0, overflow: 'hidden' }, animate: { height: 'fit-content', overflow: 'hidden', transitionEnd: { overflow: 'visible' } }, exit: { height: 0, overflow: 'hidden' }, sx: {
|
|
85721
85935
|
position: 'relative',
|
|
85722
85936
|
overflow: 'hidden',
|
|
85723
85937
|
width: '100%',
|
|
85724
85938
|
marginTop: '0px',
|
|
85725
|
-
}, className: "bonds-card-container", children: [[main.ChainId.SOL, main.ChainId.MONAD_TESTNET].includes(chain) && !hideTitles &&
|
|
85726
|
-
return (jsx$2(Skeleton, { animation: "waves", sx: {
|
|
85727
|
-
width: '100%',
|
|
85728
|
-
height: '70px',
|
|
85729
|
-
borderRadius: 'normal',
|
|
85730
|
-
mb: '5px',
|
|
85731
|
-
} }, `sol-shadow-${index}`));
|
|
85732
|
-
}) }, key)), bonds === null || bonds === void 0 ? void 0 : bonds.map((bondFromMap, index) => {
|
|
85939
|
+
}, className: "bonds-card-container", children: [[main.ChainId.SOL, main.ChainId.MONAD_TESTNET].includes(chain) && !hideTitles && jsx$2(ChainBanner, { chainId: chain }), bonds === null || bonds === void 0 ? void 0 : bonds.map((bondFromMap, index) => {
|
|
85733
85940
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2;
|
|
85734
85941
|
if (bondFromMap.soldOut) {
|
|
85735
85942
|
const bond = bondFromMap;
|
|
@@ -85767,297 +85974,130 @@ const BondRowsWithTitle = ({ chain, bonds, hideTitles, showHotBonds, showSolSkel
|
|
|
85767
85974
|
}), showHotBonds && (jsx$2(SwiperProvider, { children: jsx$2(HotBondCards, {}) }))] }, key))] }) }, key));
|
|
85768
85975
|
};
|
|
85769
85976
|
|
|
85770
|
-
const
|
|
85771
|
-
var _a;
|
|
85772
|
-
const SDKConfig = useSDKConfig();
|
|
85773
|
-
const validatedChains = (_a = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.chains) === null || _a === void 0 ? void 0 : _a.filter((chain) => MAINNET_CHAINS.includes(chain));
|
|
85774
|
-
const groupedBonds = bonds.reduce((acc, bond) => {
|
|
85775
|
-
const { chainId } = bond;
|
|
85776
|
-
if (!acc[chainId])
|
|
85777
|
-
acc[chainId] = [];
|
|
85778
|
-
acc[chainId].push(bond);
|
|
85779
|
-
return acc;
|
|
85780
|
-
}, {});
|
|
85781
|
-
return (jsx$2(Flex$1, { className: "bondrowsbychain", children: validatedChains === null || validatedChains === void 0 ? void 0 : validatedChains.map((chain) => {
|
|
85782
|
-
var _a, _b;
|
|
85783
|
-
return (jsx$2(BondRowsWithTitle, { chain: chain, bonds: (_a = groupedBonds[chain]) !== null && _a !== void 0 ? _a : [], hideTitles: hideTitles, showHotBonds: hideTitles ? false : SDKConfig.useHotBonds ? (_b = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.hotBondChains) === null || _b === void 0 ? void 0 : _b.includes(chain) : false, showSolSkeleton: showSolSkeleton }, chain));
|
|
85784
|
-
}) }));
|
|
85785
|
-
};
|
|
85786
|
-
|
|
85787
|
-
const styles$7 = {
|
|
85788
|
-
smallCardContainer: {
|
|
85789
|
-
width: '100%',
|
|
85790
|
-
p: '6px 12px',
|
|
85791
|
-
background: 'white2',
|
|
85792
|
-
borderRadius: 'normal',
|
|
85793
|
-
justifyContent: 'space-between',
|
|
85794
|
-
alignItems: 'center',
|
|
85795
|
-
cursor: 'pointer',
|
|
85796
|
-
mr: '10px',
|
|
85797
|
-
':last-of-type': {
|
|
85798
|
-
mr: '0px',
|
|
85799
|
-
},
|
|
85800
|
-
},
|
|
85801
|
-
subTitle: {
|
|
85802
|
-
color: 'textDisabledButton',
|
|
85803
|
-
fontSize: '12px',
|
|
85804
|
-
fontWeight: 400,
|
|
85805
|
-
lineHeight: '16px',
|
|
85806
|
-
},
|
|
85807
|
-
};
|
|
85808
|
-
|
|
85809
|
-
const SmallRecommendationCard = ({ recommendation }) => {
|
|
85810
|
-
var _a;
|
|
85811
|
-
const vestingTime = getTimePeriods((_a = recommendation.vestingTerm) !== null && _a !== void 0 ? _a : 0, true);
|
|
85812
|
-
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: "Bonus" }), jsxs(Flex, { sx: { fontSize: '12px', color: recommendation.bonus > 0 ? 'success' : 'error', ml: '6px' }, children: [recommendation.bonus.toFixed(2), "%"] })] })] }));
|
|
85813
|
-
};
|
|
85814
|
-
|
|
85815
|
-
const RecommendationCards$1 = () => {
|
|
85816
|
-
const topTags = useTopTags();
|
|
85817
|
-
const { address: account } = useEVMAccount();
|
|
85818
|
-
const options = account ? ['For You', 'Hot', ...topTags] : ['Hot', ...topTags];
|
|
85819
|
-
const [activeOption, setActiveOption] = useState(options[0]);
|
|
85820
|
-
const { data: hotRecommendations } = useHotBonds();
|
|
85821
|
-
const { data: bonds } = useBondsData();
|
|
85822
|
-
const SDKConfig = useSDKConfig();
|
|
85823
|
-
const { data: forYouRecommendations } = useGetBondRecommendations(account, undefined, '3');
|
|
85824
|
-
const sortedBonds = bonds && (bonds === null || bonds === void 0 ? void 0 : bonds.length) > 0
|
|
85825
|
-
? [...bonds].sort((a, b) => {
|
|
85826
|
-
var _a, _b, _c, _d;
|
|
85827
|
-
return ((_b = (_a = findHighestTrueBondPrice('0', b === null || b === void 0 ? void 0 : b.trueBondPrices)) === null || _a === void 0 ? void 0 : _a.bonusWithFee) !== null && _b !== void 0 ? _b : 0) -
|
|
85828
|
-
((_d = (_c = findHighestTrueBondPrice('0', a === null || a === void 0 ? void 0 : a.trueBondPrices)) === null || _c === void 0 ? void 0 : _c.bonusWithFee) !== null && _d !== void 0 ? _d : 0);
|
|
85829
|
-
})
|
|
85830
|
-
: undefined;
|
|
85831
|
-
const filteredBonds = sortedBonds === null || sortedBonds === void 0 ? void 0 : sortedBonds.filter((bond) => { var _a, _b; return ((_a = bond === null || bond === void 0 ? void 0 : bond.tags) === null || _a === void 0 ? void 0 : _a.includes(activeOption)) && !(bond === null || bond === void 0 ? void 0 : bond.soldOut) && ((_b = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.chains) === null || _b === void 0 ? void 0 : _b.includes(bond.chainId)); });
|
|
85832
|
-
const selectedBonds = activeOption === 'For You' ? forYouRecommendations : activeOption === 'Hot' ? hotRecommendations : filteredBonds;
|
|
85833
|
-
const slicedBonds = selectedBonds === null || selectedBonds === void 0 ? void 0 : selectedBonds.filter((bond) => { var _a; return (_a = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.chains) === null || _a === void 0 ? void 0 : _a.includes(bond.chainId); }).slice(0, 3);
|
|
85834
|
-
const parsedBondsToRender = slicedBonds === null || slicedBonds === void 0 ? void 0 : slicedBonds.map((bond) => {
|
|
85835
|
-
var _a, _b, _c, _d;
|
|
85836
|
-
const contractAddress = 'billAddress' in bond ? bond.billAddress : (_a = bond === null || bond === void 0 ? void 0 : bond.contractAddress) === null || _a === void 0 ? void 0 : _a[bond === null || bond === void 0 ? void 0 : bond.chainId];
|
|
85837
|
-
const payoutTokenName = 'payoutTokenName' in bond ? bond.payoutTokenName : bond.earnToken.symbol;
|
|
85838
|
-
return {
|
|
85839
|
-
payoutTokenName: payoutTokenName,
|
|
85840
|
-
contractAddress,
|
|
85841
|
-
vestingTerm: (_b = bond.vestingTerm) !== null && _b !== void 0 ? _b : 0,
|
|
85842
|
-
bonus: 'bonus' in bond ? bond.bonus : ((_d = (_c = findHighestTrueBondPrice('0', bond === null || bond === void 0 ? void 0 : bond.trueBondPrices)) === null || _c === void 0 ? void 0 : _c.bonusWithFee) !== null && _d !== void 0 ? _d : 0),
|
|
85843
|
-
chainId: bond.chainId,
|
|
85844
|
-
};
|
|
85845
|
-
});
|
|
85846
|
-
useEffect(() => {
|
|
85847
|
-
if (account) {
|
|
85848
|
-
setActiveOption('For You');
|
|
85849
|
-
}
|
|
85850
|
-
else {
|
|
85851
|
-
setActiveOption('Hot');
|
|
85852
|
-
}
|
|
85853
|
-
}, [account]);
|
|
85854
|
-
return (jsxs(Flex, { sx: { mt: '15px', flexDirection: 'column', width: '100%', display: ['none', 'none', 'none', 'flex'] }, children: [jsxs(Flex, { sx: { width: '100%', justifyContent: 'space-between' }, children: [jsxs(Flex, { children: [jsx$2(Flex, { sx: {
|
|
85855
|
-
width: ['60px', '60px', '60px', 'unset'],
|
|
85856
|
-
mr: ['0px', '0px', '0px', '15px'],
|
|
85857
|
-
alignItems: 'center',
|
|
85858
|
-
color: 'grey',
|
|
85859
|
-
fontSize: ['11px'],
|
|
85860
|
-
fontWeight: 500,
|
|
85861
|
-
}, children: "BONDS MARKETS:" }), jsx$2(RecommendationSelector, { options: options, activeOption: activeOption, setActiveOption: setActiveOption })] }), jsx$2(Flex, { sx: { display: ['none', 'none', 'none', 'flex'] } })] }), jsx$2(Flex, { sx: {
|
|
85862
|
-
my: '10px',
|
|
85863
|
-
minHeight: '47.45px',
|
|
85864
|
-
}, children: parsedBondsToRender &&
|
|
85865
|
-
parsedBondsToRender.length > 0 &&
|
|
85866
|
-
parsedBondsToRender.map((bond, index) => {
|
|
85867
|
-
return jsx$2(SmallRecommendationCard, { recommendation: bond }, `${bond.payoutTokenName}-${index}`);
|
|
85868
|
-
}) })] }));
|
|
85869
|
-
};
|
|
85870
|
-
|
|
85871
|
-
// import track from 'utils/track'
|
|
85872
|
-
const FavIcon = ({ filterOption, setFilterOption, }) => {
|
|
85873
|
-
const handleFilterOption = (newOption) => {
|
|
85874
|
-
setFilterOption(newOption);
|
|
85875
|
-
};
|
|
85876
|
-
return (jsx$2(Flex, { sx: { justifyContent: 'center', alignItems: 'center', minWidth: '25px', cursor: 'pointer', ml: '15px' }, className: "search-fav-icon", onClick: () => {
|
|
85877
|
-
handleFilterOption(filterOption !== 'FAVORITES' ? 'FAVORITES' : 'ALL');
|
|
85878
|
-
}, children: jsx$2(AnimatePresence, { mode: "wait", children: jsx$2(motion.div, { initial: false, animate: { opacity: 1, scale: 1.0 }, exit: { opacity: 0, scale: 0.8 }, transition: { duration: 0.2 }, style: { display: 'flex', alignItems: 'center' }, children: filterOption === 'FAVORITES' ? (jsx$2(Svg, { icon: "StarFilled", width: 22, height: 22 })) : (jsx$2(Svg, { icon: "Star", width: 20, height: 20 })) }, filterOption === 'FAVORITES' ? 'StarFilled' : 'Star') }) }));
|
|
85879
|
-
};
|
|
85880
|
-
|
|
85881
|
-
const BondsMenu = ({ searchQuery, setSearchQuery, setChainFilterOption, chainFilterOption, filterOptions, filterOption, setFilterOption, onSort, }) => {
|
|
85882
|
-
const { namingPreference } = useSDKConfig();
|
|
85883
|
-
return (jsxs("div", { className: "bonds-menu", children: [jsx$2(BondFilters, { chainFilterOption: chainFilterOption !== null && chainFilterOption !== void 0 ? chainFilterOption : ['All Chains'], setChainFilterOption: setChainFilterOption, filterOptions: filterOptions, filterOption: filterOption, setFilterOption: setFilterOption, onHandleQueryChange: () => setSearchQuery('') }), jsxs("div", { className: "table-header-container", children: [jsx$2("div", { className: "search-container", children: jsxs(Flex$1, { sx: { width: '100%', maxWidth: '340px' }, children: [jsx$2(Input, { value: searchQuery, onChange: (event) => setSearchQuery(event.target.value), variant: "search", width: '100%', sx: {
|
|
85884
|
-
fontWeight: 600,
|
|
85885
|
-
background: 'white2',
|
|
85886
|
-
height: '30px',
|
|
85887
|
-
fontSize: '14px',
|
|
85888
|
-
color: 'white',
|
|
85889
|
-
width: ['calc(50vw - 25px)'],
|
|
85890
|
-
}, placeholder: 'Search...' }), jsx$2(FavIcon, { filterOption: filterOption, setFilterOption: setFilterOption })] }) }), jsxs("div", { className: "headers-container", children: [jsx$2(Flex$1, { sx: { width: '125px' } }), jsxs("div", { className: "discount-header", onClick: () => onSort('bonus'), children: [namingPreference.toUpperCase(), jsx$2(Flex$1, { sx: { ml: '5px', mb: '3px' }, children: jsx$2(Svg, { icon: "sort", width: 10, color: "textDisabledButton" }) })] }), jsxs("div", { className: "terms-header", onClick: () => onSort('terms'), children: ["TERMS", jsx$2(Flex$1, { sx: { ml: '5px', mb: '3px' }, children: jsx$2(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) })] }), jsxs("div", { className: "tokens-remaining-header", onClick: () => onSort('tokensRemaining'), children: ["TOKENS REMAINING", jsx$2(Flex$1, { sx: { ml: '5px', mb: '3px' }, children: jsx$2(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) })] }), jsx$2("div", { className: "tooltip-header" })] })] })] }));
|
|
85891
|
-
};
|
|
85892
|
-
|
|
85893
|
-
const getUserApiStats = (account) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
85894
|
-
if (!account)
|
|
85895
|
-
return null;
|
|
85896
|
-
const { data } = yield axios.get(`https://dashboard-api.ape.bond/collector/userSalesInfo/purchased/${account}`);
|
|
85897
|
-
return data;
|
|
85898
|
-
});
|
|
85899
|
-
function useUserApiStats() {
|
|
85900
|
-
const { address: account } = useEVMAccount();
|
|
85901
|
-
return useQuery({
|
|
85902
|
-
queryKey: [`${QUERY_KEYS.USER_STATS}-${account}`],
|
|
85903
|
-
queryFn: () => getUserApiStats(account),
|
|
85904
|
-
staleTime: Infinity,
|
|
85905
|
-
refetchOnWindowFocus: false,
|
|
85906
|
-
refetchOnMount: false,
|
|
85907
|
-
retry: 1,
|
|
85908
|
-
});
|
|
85909
|
-
}
|
|
85910
|
-
|
|
85911
|
-
const BuyAgainRow = () => {
|
|
85977
|
+
const CollapsableSoldoutRow = ({ groupedBonds }) => {
|
|
85912
85978
|
var _a, _b, _c;
|
|
85913
|
-
const
|
|
85914
|
-
const
|
|
85915
|
-
const
|
|
85916
|
-
|
|
85917
|
-
|
|
85918
|
-
|
|
85919
|
-
|
|
85920
|
-
|
|
85921
|
-
|
|
85922
|
-
|
|
85923
|
-
|
|
85924
|
-
return true;
|
|
85925
|
-
}));
|
|
85926
|
-
return activeBills === null || activeBills === void 0 ? void 0 : activeBills.find((bill) => {
|
|
85927
|
-
var _a, _b, _c;
|
|
85928
|
-
return ((_b = (_a = bill === null || bill === void 0 ? void 0 : bill.contractAddress) === null || _a === void 0 ? void 0 : _a[bill.chainId]) === null || _b === void 0 ? void 0 : _b.toLowerCase()) ===
|
|
85929
|
-
((_c = highestActivePurchase === null || highestActivePurchase === void 0 ? void 0 : highestActivePurchase.contractAddress) === null || _c === void 0 ? void 0 : _c.toLowerCase());
|
|
85930
|
-
});
|
|
85931
|
-
}
|
|
85932
|
-
}, [SDKConfig.showLowValueBonds, bills, chains, userData]);
|
|
85933
|
-
const bondAddress = (_a = bond === null || bond === void 0 ? void 0 : bond.contractAddress) === null || _a === void 0 ? void 0 : _a[bond.chainId];
|
|
85934
|
-
const remainingTokensFormat = (bond) => {
|
|
85935
|
-
const tokensRemaining = 'tokensRemaining' in bond ? bond.tokensRemaining : '0';
|
|
85936
|
-
return formatNumberSI(parseFloat(tokensRemaining !== null && tokensRemaining !== void 0 ? tokensRemaining : '0'), 0);
|
|
85937
|
-
};
|
|
85938
|
-
const remainingTokensUsd = (bond) => {
|
|
85939
|
-
const tokensRemaining = 'tokensRemaining' in bond ? bond.tokensRemaining : '0';
|
|
85940
|
-
const payoutTokenPrice = 'payoutTokenPrice' in bond ? bond.payoutTokenPrice : 0;
|
|
85941
|
-
const tokens = new BigNumber$1(tokensRemaining !== null && tokensRemaining !== void 0 ? tokensRemaining : '0');
|
|
85942
|
-
return tokens.times(payoutTokenPrice !== null && payoutTokenPrice !== void 0 ? payoutTokenPrice : '0');
|
|
85943
|
-
};
|
|
85944
|
-
const remainingTokensString = bond
|
|
85945
|
-
? `${remainingTokensFormat(bond)} ${bond.earnToken.symbol} ($${formatNumberSI(remainingTokensUsd(bond).toNumber())})`
|
|
85946
|
-
: '';
|
|
85947
|
-
return bond ? (jsx$2(AnimatePresence, { children: jsxs(motion.div, { initial: { height: 0, overflow: 'hidden' }, animate: { height: 'fit-content', overflow: 'hidden', transitionEnd: { overflow: 'visible' } }, exit: { height: 0, overflow: 'hidden' }, sx: {
|
|
85948
|
-
position: 'relative',
|
|
85949
|
-
overflow: 'hidden',
|
|
85950
|
-
width: '100%',
|
|
85951
|
-
mb: '10px',
|
|
85952
|
-
}, children: [jsx$2(Flex, { sx: {
|
|
85953
|
-
p: '0 1px',
|
|
85954
|
-
width: '100%',
|
|
85955
|
-
pt: '5px',
|
|
85956
|
-
background: 'primaryButton',
|
|
85957
|
-
borderRadius: 'normal',
|
|
85958
|
-
flexDirection: 'column',
|
|
85959
|
-
opacity: 0.5,
|
|
85960
|
-
}, children: jsx$2(Flex, { className: "buy-again-header", sx: {
|
|
85979
|
+
const [symbol, bonds] = groupedBonds;
|
|
85980
|
+
const bond = bonds[0];
|
|
85981
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
85982
|
+
bonds.length > 1;
|
|
85983
|
+
return (jsxs(AnimatePresence, { initial: false, children: [jsx$2(Flex, { sx: { cursor: 'pointer' }, onClick: () => setIsOpen(!isOpen), children: jsx$2(BondRow, { bondAddress: (_a = bond.contractAddress) === null || _a === void 0 ? void 0 : _a[bond.chainId], billArtCollection: (_b = bond.billArt) === null || _b === void 0 ? void 0 : _b.collection, bondChain: bond.chainId, payoutToken: bond.earnToken, billType: bond.billType, tag: (_c = bond.tags) === null || _c === void 0 ? void 0 : _c[0], bondSoldOut: true, percentageAvailable: 100, remainingTokensString: `${formatNumberSI(0, 0)} ${bond.earnToken.symbol} ($${formatNumberSI(0, 2)})`, vestingTermString: "-", projectURL: bond.projectLink, twitterURL: bond.twitter, auditURL: bond.audit, shortDescription: bond.shortDescription, soldoutBondsCount: bonds.length > 1 ? bonds.length : undefined, isOpen: isOpen }, `${bond.contractAddress[bond.chainId]}-${bond.chainId}`) }), bonds.length > 1 &&
|
|
85984
|
+
isOpen &&
|
|
85985
|
+
bonds.map((bond) => {
|
|
85986
|
+
var _a, _b, _c;
|
|
85987
|
+
return (jsx$2(motion.div, { initial: { height: 0, overflow: 'hidden' }, animate: { height: 'fit-content', overflow: 'hidden', transitionEnd: { overflow: 'visible' } }, exit: { height: 0, overflow: 'hidden' }, sx: {
|
|
85988
|
+
position: 'relative',
|
|
85989
|
+
overflow: 'hidden',
|
|
85961
85990
|
width: '100%',
|
|
85962
|
-
|
|
85963
|
-
|
|
85964
|
-
|
|
85965
|
-
color: 'primaryBright',
|
|
85966
|
-
height: '91px',
|
|
85967
|
-
}, children: "BUY AGAIN" }) }), jsx$2(Flex, { onClick: () => {
|
|
85968
|
-
track({
|
|
85969
|
-
event: 'buyAgainClick',
|
|
85970
|
-
chain: bond.chainId,
|
|
85971
|
-
data: {
|
|
85972
|
-
bond: bond.earnToken.symbol,
|
|
85973
|
-
},
|
|
85974
|
-
});
|
|
85975
|
-
}, sx: { position: 'absolute', top: '25px', left: '1px', width: 'calc(100% - 2px)' }, children: jsx$2(BondRow, { bondAddress: (_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], bondChain: bond.chainId, billType: bond.billType, payoutToken: bond.earnToken, tag: (_c = bond.tags) === null || _c === void 0 ? void 0 : _c[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;
|
|
85991
|
+
marginTop: '0px',
|
|
85992
|
+
}, className: "bonds-card-container", children: jsxs(Flex, { sx: { cursor: 'pointer' }, onClick: () => setIsOpen(!isOpen), children: [jsx$2(Flex, { sx: { alignItems: 'center', pb: '10px' }, children: jsx$2(Svg, { icon: "turnArrow", direction: 'up' }) }), jsx$2(BondRow, { bondAddress: (_a = bond.contractAddress) === null || _a === void 0 ? void 0 : _a[bond.chainId], billArtCollection: (_b = bond.billArt) === null || _b === void 0 ? void 0 : _b.collection, bondChain: bond.chainId, payoutToken: bond.earnToken, billType: bond.billType, tag: (_c = bond.tags) === null || _c === void 0 ? void 0 : _c[0], bondSoldOut: true, percentageAvailable: 100, remainingTokensString: `${formatNumberSI(0, 0)} ${bond.earnToken.symbol} ($${formatNumberSI(0, 2)})`, vestingTermString: "-", projectURL: bond.projectLink, twitterURL: bond.twitter, auditURL: bond.audit, shortDescription: bond.shortDescription })] }) }, `${bond.contractAddress[bond.chainId]}-${bond.chainId}`));
|
|
85993
|
+
})] }));
|
|
85976
85994
|
};
|
|
85977
85995
|
|
|
85978
|
-
const
|
|
85979
|
-
return (
|
|
85980
|
-
width: '100%',
|
|
85981
|
-
height: '70px',
|
|
85982
|
-
borderRadius: 'normal',
|
|
85983
|
-
mb: '5px',
|
|
85984
|
-
} }, `row-shadow-${index}`))), jsx$2(Flex$1, { sx: { width: '100%', gap: '15px', mt: '25px' }, children: Array.from({ length: 3 }).map((_, index) => (jsx$2(Skeleton, { animation: "waves", sx: {
|
|
85985
|
-
width: '100%',
|
|
85986
|
-
height: '125px',
|
|
85987
|
-
borderRadius: 'normal',
|
|
85988
|
-
mb: '5px',
|
|
85989
|
-
} }, `hot-card-shadow${index}`))) }), jsx$2(Flex$1, { sx: { width: '100%', flexDirection: 'column', mt: '25px' }, children: Array.from({ length: 3 }).map((_, index) => (jsx$2(Skeleton, { animation: "waves", sx: {
|
|
85990
|
-
width: '100%',
|
|
85991
|
-
height: '70px',
|
|
85992
|
-
borderRadius: 'normal',
|
|
85993
|
-
mb: '5px',
|
|
85994
|
-
} }, `second-row-shadow-${index}`))) })] }));
|
|
85996
|
+
const SoldOutRows = ({ bonds }) => {
|
|
85997
|
+
return (jsx$2(Fragment$1, { children: Object.entries(bonds).map((groupedBonds) => (jsx$2(CollapsableSoldoutRow, { groupedBonds: groupedBonds }, groupedBonds[0]))) }));
|
|
85995
85998
|
};
|
|
85996
85999
|
|
|
85997
86000
|
const Bonds = () => {
|
|
85998
|
-
var _a;
|
|
86001
|
+
var _a, _b, _c;
|
|
85999
86002
|
// Fetch data
|
|
86000
86003
|
useHotBonds();
|
|
86004
|
+
const SDKConfig = useSDKConfig();
|
|
86001
86005
|
const { favTokens } = useFavoriteTokens();
|
|
86002
86006
|
const { data: bondData, refetch } = useBondsData();
|
|
86003
86007
|
const { data: allBonds } = useBondsList();
|
|
86004
86008
|
const { data: allPreBonds } = useBondsListPreTGE();
|
|
86005
86009
|
const { data: chainFilterOption, setChainFilterOption } = useChainFilterOption();
|
|
86006
86010
|
const { data: tokenPrices } = useTokenPrices();
|
|
86007
|
-
const
|
|
86011
|
+
const topTags = useTopTags();
|
|
86008
86012
|
// State
|
|
86009
86013
|
const [sortConfig, setSortConfig] = useState({ key: 'bonus', direction: 'desc' });
|
|
86010
86014
|
const [searchQuery, setSearchQuery] = useState('');
|
|
86011
86015
|
const [filterOption, setFilterOption] = useState('ALL');
|
|
86012
|
-
|
|
86013
|
-
const topTags = useTopTags(sortedBonds);
|
|
86016
|
+
// Static data
|
|
86014
86017
|
const filterOptions = ['ALL', 'FAVORITES', ...topTags, 'SOLD OUT'];
|
|
86018
|
+
const validatedChains = (_a = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.chains) === null || _a === void 0 ? void 0 : _a.filter((chain) => MAINNET_CHAINS.includes(chain));
|
|
86015
86019
|
const billsToRender = useMemo(() => {
|
|
86016
|
-
|
|
86017
|
-
|
|
86018
|
-
|
|
86019
|
-
|
|
86020
|
+
if (!allBonds || !allPreBonds)
|
|
86021
|
+
return {};
|
|
86022
|
+
const sortedBonds = sortBonds(sortConfig, bondData);
|
|
86023
|
+
const bondsToUse = filterOption === 'SOLD OUT' ? [...allPreBonds, ...allBonds] : sortedBonds;
|
|
86024
|
+
const filteredBonds = bondsToUse === null || bondsToUse === void 0 ? void 0 : bondsToUse.filter((bill) => {
|
|
86025
|
+
var _a, _b, _c, _d, _e, _f;
|
|
86026
|
+
// filter incompatible bonds
|
|
86027
|
+
if (!isBondSupported(SDKConfig.highestCompatibleVersion, bill.version))
|
|
86028
|
+
return false;
|
|
86029
|
+
// filter onlyPartner Bonds
|
|
86030
|
+
if (bill.onlyPartner && SDKConfig.bondPartner !== bill.bondPartner)
|
|
86031
|
+
return false;
|
|
86032
|
+
// filter searchQuery
|
|
86033
|
+
if (searchQuery) {
|
|
86034
|
+
const matchesSearch = [
|
|
86035
|
+
`${(_a = bill === null || bill === void 0 ? void 0 : bill.earnToken) === null || _a === void 0 ? void 0 : _a.symbol.toUpperCase()}`,
|
|
86036
|
+
`${(_b = bill === null || bill === void 0 ? void 0 : bill.lpToken) === null || _b === void 0 ? void 0 : _b.symbol.toUpperCase()}`,
|
|
86037
|
+
].some((property) => property === null || property === void 0 ? void 0 : property.includes(searchQuery.toUpperCase()));
|
|
86038
|
+
if (!matchesSearch)
|
|
86039
|
+
return false;
|
|
86040
|
+
}
|
|
86041
|
+
// filter tiers
|
|
86042
|
+
if (!(SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.useTiers) && 'minTier' in bill) {
|
|
86043
|
+
if (bill.minTier !== null && bill.minTier !== undefined)
|
|
86044
|
+
return false;
|
|
86045
|
+
}
|
|
86046
|
+
// filter bondPartner
|
|
86047
|
+
if ((SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.bondPartner) && bill.bondPartner !== SDKConfig.bondPartner)
|
|
86048
|
+
return false;
|
|
86049
|
+
// filter topTags
|
|
86050
|
+
if (topTags.includes(filterOption) && !((_c = bill === null || bill === void 0 ? void 0 : bill.tags) === null || _c === void 0 ? void 0 : _c.includes(filterOption)))
|
|
86051
|
+
return false;
|
|
86052
|
+
// filter chainFilterOption
|
|
86053
|
+
if (chainFilterOption && !(chainFilterOption === null || chainFilterOption === void 0 ? void 0 : chainFilterOption.includes('All Chains'))) {
|
|
86054
|
+
if (!(chainFilterOption === null || chainFilterOption === void 0 ? void 0 : chainFilterOption.includes((_d = bill === null || bill === void 0 ? void 0 : bill.chainId) === null || _d === void 0 ? void 0 : _d.toString())))
|
|
86055
|
+
return false;
|
|
86056
|
+
}
|
|
86057
|
+
// filter SOLD OUT
|
|
86058
|
+
if (filterOption === 'SOLD OUT' && !isBondSoldOut(bill, SDKConfig.showLowValueBonds))
|
|
86059
|
+
return false;
|
|
86060
|
+
// filter not SOLD OUT
|
|
86061
|
+
if (filterOption !== 'SOLD OUT' && isBondSoldOut(bill, SDKConfig.showLowValueBonds))
|
|
86062
|
+
return false;
|
|
86063
|
+
// filter FAVORITES
|
|
86064
|
+
if (filterOption === 'FAVORITES' && !favTokens.includes((_f = (_e = bill === null || bill === void 0 ? void 0 : bill.earnToken) === null || _e === void 0 ? void 0 : _e.symbol) === null || _f === void 0 ? void 0 : _f.toLowerCase()))
|
|
86065
|
+
return false;
|
|
86066
|
+
return true;
|
|
86020
86067
|
});
|
|
86021
|
-
if (searchQuery) {
|
|
86022
|
-
billsToReturn = billsToReturn === null || billsToReturn === void 0 ? void 0 : billsToReturn.filter((bill) => {
|
|
86023
|
-
var _a, _b;
|
|
86024
|
-
return [`${(_a = bill === null || bill === void 0 ? void 0 : bill.earnToken) === null || _a === void 0 ? void 0 : _a.symbol.toUpperCase()}`, `${(_b = bill === null || bill === void 0 ? void 0 : bill.lpToken) === null || _b === void 0 ? void 0 : _b.symbol.toUpperCase()}`].some((property) => property === null || property === void 0 ? void 0 : property.includes(searchQuery.toUpperCase()));
|
|
86025
|
-
});
|
|
86026
|
-
}
|
|
86027
|
-
if (!(SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.useTiers)) {
|
|
86028
|
-
billsToReturn = billsToReturn === null || billsToReturn === void 0 ? void 0 : billsToReturn.filter((bill) => {
|
|
86029
|
-
return 'minTier' in bill ? bill.minTier === null || bill.minTier === undefined : true; //TODO: check this
|
|
86030
|
-
});
|
|
86031
|
-
}
|
|
86032
|
-
if (SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.bondPartner) {
|
|
86033
|
-
billsToReturn = billsToReturn === null || billsToReturn === void 0 ? void 0 : billsToReturn.filter((bill) => bill.bondPartner === SDKConfig.bondPartner);
|
|
86034
|
-
}
|
|
86035
|
-
if (topTags.includes(filterOption)) {
|
|
86036
|
-
billsToReturn = billsToReturn === null || billsToReturn === void 0 ? void 0 : billsToReturn.filter((bill) => { var _a; return (_a = bill === null || bill === void 0 ? void 0 : bill.tags) === null || _a === void 0 ? void 0 : _a.includes(filterOption); });
|
|
86037
|
-
}
|
|
86038
|
-
if (!(chainFilterOption === null || chainFilterOption === void 0 ? void 0 : chainFilterOption.includes('All Chains'))) {
|
|
86039
|
-
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()); });
|
|
86040
|
-
}
|
|
86041
|
-
if (filterOption !== 'SOLD OUT') {
|
|
86042
|
-
billsToReturn = billsToReturn === null || billsToReturn === void 0 ? void 0 : billsToReturn.filter((bond) => !isBondSoldOut(bond, SDKConfig.showLowValueBonds));
|
|
86043
|
-
}
|
|
86044
86068
|
if (filterOption === 'SOLD OUT') {
|
|
86045
|
-
|
|
86069
|
+
return filteredBonds === null || filteredBonds === void 0 ? void 0 : filteredBonds.reduce((acc, bond) => {
|
|
86070
|
+
var _a;
|
|
86071
|
+
const symbol = (_a = bond === null || bond === void 0 ? void 0 : bond.earnToken) === null || _a === void 0 ? void 0 : _a.symbol;
|
|
86072
|
+
const chainId = bond.chainId;
|
|
86073
|
+
if (!acc[chainId])
|
|
86074
|
+
acc[chainId] = {};
|
|
86075
|
+
if (!acc[chainId][symbol])
|
|
86076
|
+
acc[chainId][symbol] = [];
|
|
86077
|
+
acc[chainId][symbol].push(bond);
|
|
86078
|
+
return acc;
|
|
86079
|
+
}, {});
|
|
86046
86080
|
}
|
|
86047
|
-
|
|
86048
|
-
|
|
86081
|
+
else {
|
|
86082
|
+
return filteredBonds === null || filteredBonds === void 0 ? void 0 : filteredBonds.reduce((acc, bond) => {
|
|
86083
|
+
const { chainId } = bond;
|
|
86084
|
+
if (!acc[chainId])
|
|
86085
|
+
acc[chainId] = [];
|
|
86086
|
+
acc[chainId].push(bond);
|
|
86087
|
+
return acc;
|
|
86088
|
+
}, {});
|
|
86049
86089
|
}
|
|
86050
|
-
return billsToReturn;
|
|
86051
86090
|
}, [
|
|
86052
|
-
filterOption,
|
|
86053
|
-
allPreBonds,
|
|
86054
86091
|
allBonds,
|
|
86055
|
-
|
|
86056
|
-
|
|
86057
|
-
|
|
86058
|
-
|
|
86092
|
+
allPreBonds,
|
|
86093
|
+
sortConfig,
|
|
86094
|
+
bondData,
|
|
86095
|
+
filterOption,
|
|
86059
86096
|
SDKConfig.highestCompatibleVersion,
|
|
86097
|
+
SDKConfig.bondPartner,
|
|
86098
|
+
SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.useTiers,
|
|
86060
86099
|
SDKConfig.showLowValueBonds,
|
|
86100
|
+
searchQuery,
|
|
86061
86101
|
topTags,
|
|
86062
86102
|
chainFilterOption,
|
|
86063
86103
|
favTokens,
|
|
@@ -86098,8 +86138,11 @@ const Bonds = () => {
|
|
|
86098
86138
|
refetch();
|
|
86099
86139
|
}
|
|
86100
86140
|
/* eslint-disable react-hooks/exhaustive-deps */
|
|
86101
|
-
}, [(
|
|
86102
|
-
return (jsxs(Flex, { className: "bonds-container", children: [jsx$2(CheckUrl, {}), jsx$2(BondsMenu, { searchQuery: searchQuery, setSearchQuery: setSearchQuery, setChainFilterOption: setChainFilterOption, chainFilterOption: chainFilterOption !== null && chainFilterOption !== void 0 ? chainFilterOption : ['All Chains'], filterOptions: filterOptions, filterOption: filterOption, setFilterOption: handleChangeFilterOption, onSort: handleSortOptions }), SDKConfig.useHotBonds && !SDKConfig.bondPartner && jsx$2(BuyAgainRow, {}), (billsToRender === null ||
|
|
86141
|
+
}, [(_b = Object.keys(tokenPrices !== null && tokenPrices !== void 0 ? tokenPrices : {})) === null || _b === void 0 ? void 0 : _b.length, bondData === null || bondData === void 0 ? void 0 : bondData.length, refetch]);
|
|
86142
|
+
return (jsxs(Flex, { className: "bonds-container", children: [jsx$2(CheckUrl, {}), jsx$2(BondsMenu, { searchQuery: searchQuery, setSearchQuery: setSearchQuery, setChainFilterOption: setChainFilterOption, chainFilterOption: chainFilterOption !== null && chainFilterOption !== void 0 ? chainFilterOption : ['All Chains'], filterOptions: filterOptions, filterOption: filterOption, setFilterOption: handleChangeFilterOption, onSort: handleSortOptions }), SDKConfig.useHotBonds && !SDKConfig.bondPartner && jsx$2(BuyAgainRow, {}), ((_c = Object.keys(billsToRender)) === null || _c === void 0 ? void 0 : _c.length) > 0 ? (jsx$2(Flex, { className: "bondrowsbychain", children: validatedChains === null || validatedChains === void 0 ? void 0 : validatedChains.map((chain) => {
|
|
86143
|
+
var _a, _b, _c;
|
|
86144
|
+
return filterOption === 'SOLD OUT' ? (jsx$2(SoldOutRows, { bonds: ((_a = billsToRender[chain]) !== null && _a !== void 0 ? _a : {}) }, chain)) : (jsx$2(ActiveBondRows, { chain: chain, bonds: ((_b = billsToRender[chain]) !== null && _b !== void 0 ? _b : []), hideTitles: searchQuery !== '', showHotBonds: !searchQuery && SDKConfig.useHotBonds && ((_c = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.hotBondChains) === null || _c === void 0 ? void 0 : _c.includes(chain)) }, chain));
|
|
86145
|
+
}) })) : searchQuery || !chainFilterOption.includes('All Chains') ? (jsx$2(Flex, { className: "placeholder-monkey-wrapper", children: jsx$2(PlaceholderMonkey, { text: 'No results, change filters.' }) })) : filterOption === 'FAVORITES' ? (jsxs(Flex, { sx: {
|
|
86103
86146
|
width: '100%',
|
|
86104
86147
|
height: '300px',
|
|
86105
86148
|
background: 'white2',
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { BondsData } from '../../types/bonds';
|
|
3
|
+
import { BaseBondConfig } from '@ape.swap/apeswap-lists';
|
|
2
4
|
type SortableKeys = 'bonus' | 'arr' | 'terms' | 'tokensRemaining';
|
|
3
5
|
type SortDirection = 'asc' | 'desc';
|
|
4
6
|
export interface SortOptions {
|
|
5
7
|
key: SortableKeys;
|
|
6
8
|
direction: SortDirection;
|
|
7
9
|
}
|
|
10
|
+
export type GroupedByChain = Record<number, (BondsData | BaseBondConfig)[]>;
|
|
11
|
+
export type GroupedBySymbol = Record<number, Record<string, (BondsData | BaseBondConfig)[]>>;
|
|
8
12
|
declare const Bonds: () => React.JSX.Element;
|
|
9
13
|
export default Bonds;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { BondsData } from '../../../../types/bonds';
|
|
3
3
|
import { BaseBondConfig } from '@ape.swap/apeswap-lists';
|
|
4
|
-
export interface
|
|
4
|
+
export interface ActiveBondRowsProps {
|
|
5
5
|
chain: number;
|
|
6
6
|
bonds: (BondsData | BaseBondConfig)[];
|
|
7
7
|
hideTitles: boolean;
|
|
8
8
|
showHotBonds: boolean;
|
|
9
|
-
showSolSkeleton: boolean;
|
|
10
9
|
}
|
|
11
|
-
declare const
|
|
12
|
-
export default
|
|
10
|
+
declare const ActiveBondRows: React.FC<ActiveBondRowsProps>;
|
|
11
|
+
export default ActiveBondRows;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BaseBondConfig } from '@ape.swap/apeswap-lists';
|
|
3
|
+
import { BondsData } from '../../../../types/bonds';
|
|
4
|
+
declare const CollapsableSoldoutRow: ({ groupedBonds }: {
|
|
5
|
+
groupedBonds: [string, (BondsData | BaseBondConfig)[]];
|
|
6
|
+
}) => React.JSX.Element;
|
|
7
|
+
export default CollapsableSoldoutRow;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BondsData } from '../../../../types/bonds';
|
|
3
|
+
import { BaseBondConfig } from '@ape.swap/apeswap-lists';
|
|
4
|
+
declare const SoldOutRows: ({ bonds }: {
|
|
5
|
+
bonds: Record<string, (BondsData | BaseBondConfig)[]>;
|
|
6
|
+
}) => React.JSX.Element;
|
|
7
|
+
export default SoldOutRows;
|
package/package.json
CHANGED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { BondsData } from '../../../../types/bonds';
|
|
3
|
-
import { BaseBondConfig } from '@ape.swap/apeswap-lists';
|
|
4
|
-
export interface BondRowsByChainProps {
|
|
5
|
-
bonds: (BondsData | BaseBondConfig)[];
|
|
6
|
-
hideTitles: boolean;
|
|
7
|
-
showSolSkeleton: boolean;
|
|
8
|
-
}
|
|
9
|
-
declare const BondRowsByChain: React.FC<BondRowsByChainProps>;
|
|
10
|
-
export default BondRowsByChain;
|