@ape.swap/bonds-sdk 3.0.5 → 3.0.8
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/{TagXmasFlashBond/TagXmasFlashBond.d.ts → TagMinTierFlashBond/TagMinTierFlashBond.d.ts} +3 -3
- package/dist/components/TokenInfoAndName/MinTierRow.d.ts +5 -0
- package/dist/components/uikit-sdk/TooltipBubble/types.d.ts +2 -1
- package/dist/components/uikit-sdk/index.d.ts +1 -0
- package/dist/main.js +322 -303
- package/dist/state/zap/useSoulZapBondQuote.d.ts +1 -1
- package/dist/styles.css +8 -108
- package/dist/views/BondModal/components/BondModalMinTierHeader.d.ts +5 -0
- package/dist/views/BondModal/components/Estimations.d.ts +3 -6
- package/dist/views/BondModal/components/NewRateModal/NewRateModal.d.ts +14 -0
- package/dist/views/Bonds/components/BondRows/BondRowsByChain.d.ts +0 -1
- package/package.json +1 -1
- /package/dist/views/BondModal/{NoBonusModal.d.ts → components/NoBonusModal/NoBonusModal.d.ts} +0 -0
package/dist/main.js
CHANGED
|
@@ -7664,6 +7664,7 @@ var placements;
|
|
|
7664
7664
|
placements["BOTTOMRIGHT"] = "bottomRight";
|
|
7665
7665
|
placements["BOTTOMLEFT"] = "bottomLeft";
|
|
7666
7666
|
placements["ONLYCONTAINERRIGHT"] = "onlyContainerRight";
|
|
7667
|
+
placements["LEFT"] = "left";
|
|
7667
7668
|
})(placements || (placements = {}));
|
|
7668
7669
|
|
|
7669
7670
|
const baseStyle$1 = {
|
|
@@ -7682,6 +7683,7 @@ const baseDirectionArrow = {
|
|
|
7682
7683
|
};
|
|
7683
7684
|
const topArrow = Object.assign(Object.assign({ bottom: 0 }, baseDirectionArrow), { borderBottom: 0, borderTopWidth: '15px', borderTopStyle: 'solid', transform: 'translate(-50%, calc(100%))' });
|
|
7684
7685
|
const bottomArrow = Object.assign(Object.assign({ top: 0 }, baseDirectionArrow), { borderTop: 0, borderBottomWidth: '15px', borderBottomStyle: 'solid', transform: 'translate(-50%, calc(-100%))' });
|
|
7686
|
+
const leftArrow = Object.assign(Object.assign({}, baseDirectionArrow), { borderRight: 0, borderRightWidth: '15px', borderRightStyle: 'solid', transform: 'translate(-50%, calc(-100%))' });
|
|
7685
7687
|
const container = (hide) => ({
|
|
7686
7688
|
position: 'relative',
|
|
7687
7689
|
display: 'flex',
|
|
@@ -7713,6 +7715,9 @@ const styles$h = {
|
|
|
7713
7715
|
borderBottomColor: 'white2',
|
|
7714
7716
|
},
|
|
7715
7717
|
},
|
|
7718
|
+
left: {
|
|
7719
|
+
'&::before': Object.assign({ position: 'absolute', top: '65%', left: '-13px', color: 'white2' }, leftArrow),
|
|
7720
|
+
},
|
|
7716
7721
|
};
|
|
7717
7722
|
|
|
7718
7723
|
const placementStyles = {
|
|
@@ -7736,6 +7741,10 @@ const placementStyles = {
|
|
|
7736
7741
|
top: 'calc(100% + 15px)',
|
|
7737
7742
|
right: 0,
|
|
7738
7743
|
},
|
|
7744
|
+
[placements.LEFT]: {
|
|
7745
|
+
left: 'calc(100% + 15px)',
|
|
7746
|
+
right: 0,
|
|
7747
|
+
},
|
|
7739
7748
|
};
|
|
7740
7749
|
const TooltipBubble = (_a) => {
|
|
7741
7750
|
var { width, placement = placements.BOTTOMRIGHT, body, backgroundColor, hideTooltip, children, transformTip } = _a, props = __rest(_a, ["width", "placement", "body", "backgroundColor", "hideTooltip", "children", "transformTip"]);
|
|
@@ -7743,8 +7752,12 @@ const TooltipBubble = (_a) => {
|
|
|
7743
7752
|
? {
|
|
7744
7753
|
backgroundColor,
|
|
7745
7754
|
'&:before': {
|
|
7746
|
-
borderBottomColor: placement === placements.BOTTOMLEFT || placement === placements.BOTTOMRIGHT
|
|
7747
|
-
|
|
7755
|
+
borderBottomColor: placement === placements.BOTTOMLEFT || placement === placements.BOTTOMRIGHT || placement === placements.LEFT
|
|
7756
|
+
? backgroundColor
|
|
7757
|
+
: undefined,
|
|
7758
|
+
borderTopColor: placement === placements.TOPLEFT || placement === placements.TOPRIGHT || placement === placements.LEFT
|
|
7759
|
+
? backgroundColor
|
|
7760
|
+
: undefined,
|
|
7748
7761
|
},
|
|
7749
7762
|
}
|
|
7750
7763
|
: {};
|
|
@@ -17828,7 +17841,7 @@ const styles$g = {
|
|
|
17828
17841
|
left: '50%',
|
|
17829
17842
|
transform: 'translate(-50%, -50%)',
|
|
17830
17843
|
width: '380px',
|
|
17831
|
-
minWidth: ['95%', 'min(
|
|
17844
|
+
minWidth: ['95%', 'min(380px, 90%)', '380px'],
|
|
17832
17845
|
overflowY: ['auto', 'auto', 'auto', 'unset'],
|
|
17833
17846
|
maxHeight: 'calc(100% - 30px)',
|
|
17834
17847
|
maxWidth: '95vw',
|
|
@@ -19140,11 +19153,13 @@ const TokenInfoAndName = ({ bill, vestEnds, isHotBond, }) => {
|
|
|
19140
19153
|
left: '-20px',
|
|
19141
19154
|
}, children: jsx$2(Flex, { sx: { borderRadius: '56px', overflow: 'hidden' }, children: jsx$2(Svg, { width: 100, height: 100, icon: (_a = NETWORK_ICONS === null || NETWORK_ICONS === void 0 ? void 0 : NETWORK_ICONS[bill === null || bill === void 0 ? void 0 : bill.chainId]) !== null && _a !== void 0 ? _a : 'question' }) }) })) : (jsxs(Fragment$1, { children: [jsx$2(Flex, { className: "tokeninfoname chain", children: jsx$2(Svg, { width: 20, height: 20, icon: (_b = NETWORK_ICONS === null || NETWORK_ICONS === void 0 ? void 0 : NETWORK_ICONS[bill === null || bill === void 0 ? void 0 : bill.chainId]) !== null && _b !== void 0 ? _b : 'question' }) }), jsx$2(Flex, { className: "tokeninfoname gradient", sx: {
|
|
19142
19155
|
background: isHotBond || vestEnds ? 'transparent' : NETWORK_COLORS[bill.chainId],
|
|
19143
|
-
} })] })), jsxs(Flex, { className: "tokeninfoname tokencontainer", sx: {
|
|
19144
|
-
|
|
19156
|
+
} })] })), jsxs(Flex, { className: "tokeninfoname tokencontainer", sx: {
|
|
19157
|
+
marginTop: vestEnds ? ['10px', '10px', '10px', '0px'] : 0,
|
|
19158
|
+
maxWidth: ['140px', '140px', '140px', '190px', '190px'],
|
|
19159
|
+
}, children: [jsx$2(TokenImage, { symbol: tokenName, size: 33 }), jsxs(Flex, { className: "tokeninfoname tokentext", children: [tokenName, vestEnds && (jsx$2(Flex, { sx: { fontSize: '12px', fontWeight: 400, opacity: 0.6, lineHeight: '14px' }, children: vestEnds }))] }), jsx$2(Flex, { className: "tokeninfofav", sx: { minWidth: '25px', p: '5px' }, children: jsx$2(AddFavToken, { tokenSymbol: tokenName, hotBond: isHotBond }) })] }), jsx$2(Flex, { sx: {
|
|
19145
19160
|
justifyContent: isHotBond ? 'center' : 'flex-start',
|
|
19146
|
-
|
|
19147
|
-
}, children: ((_c = bill.tags) === null || _c === void 0 ? void 0 : _c[0]) && jsx$2(ListTag, { text: (_e = (_d = bill.tags) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.toUpperCase() }) }), jsx$2(Flex, { className: vestEnds ? '' : 'short-description-basepad', sx: { display: 'none' }, children: bill.shortDescription })] }));
|
|
19161
|
+
alignItems: 'center',
|
|
19162
|
+
}, children: jsx$2(Flex, { sx: { display: isHotBond ? 'flex' : ['none', 'none', 'none', 'none', 'flex'] }, children: ((_c = bill.tags) === null || _c === void 0 ? void 0 : _c[0]) && jsx$2(ListTag, { text: (_e = (_d = bill.tags) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.toUpperCase() }) }) }), jsx$2(Flex, { className: vestEnds ? '' : 'short-description-basepad', sx: { display: 'none' }, children: bill.shortDescription })] }));
|
|
19148
19163
|
};
|
|
19149
19164
|
|
|
19150
19165
|
const formatNumber$3 = (number, minPrecision = 2, maxPrecision = 2) => {
|
|
@@ -22265,7 +22280,6 @@ function formatUSDNumber(input) {
|
|
|
22265
22280
|
// Note: Between 1k and 0.01 show 2 decimals
|
|
22266
22281
|
return parseFloat(number.toFixed(2)).toLocaleString('en-US');
|
|
22267
22282
|
}
|
|
22268
|
-
const youSpend = (inputValue) => formatNumber$2(inputValue);
|
|
22269
22283
|
const youSpendUSD = (bond, inputValue) => {
|
|
22270
22284
|
return (parseFloat(inputValue) * parseFloat(bond.principalTokenPrice)).toString();
|
|
22271
22285
|
};
|
|
@@ -22298,8 +22312,6 @@ const getRawBonus = (bond, inputValue) => {
|
|
|
22298
22312
|
if (!bond || !inputValue)
|
|
22299
22313
|
return '0';
|
|
22300
22314
|
const premiumUSD = parseFloat(youGetUSD(bond, inputValue)) - parseFloat(youSpendUSD(bond, inputValue));
|
|
22301
|
-
//TODO: rollback this
|
|
22302
|
-
// return formatUSDNumber(premiumUSD.toString())
|
|
22303
22315
|
return premiumUSD.toString();
|
|
22304
22316
|
};
|
|
22305
22317
|
const getFeeAmount = (bond, inputValue) => {
|
|
@@ -70914,30 +70926,7 @@ const ExpandedViewButton = ({ handleNavigation, rightPos }) => {
|
|
|
70914
70926
|
cursor: 'pointer',
|
|
70915
70927
|
width: '100%',
|
|
70916
70928
|
display: 'flex',
|
|
70917
|
-
}, onClick: handleNavigation, children: [jsx$2(Flex, { sx: {
|
|
70918
|
-
background: '#DF414166',
|
|
70919
|
-
borderRadius: 'small',
|
|
70920
|
-
p: '1px 5px',
|
|
70921
|
-
position: 'absolute',
|
|
70922
|
-
height: '20px',
|
|
70923
|
-
left: '-50px',
|
|
70924
|
-
fontSize: '12px',
|
|
70925
|
-
fontWeight: 400,
|
|
70926
|
-
lineHeight: '17px',
|
|
70927
|
-
width: '40px',
|
|
70928
|
-
'&:before': {
|
|
70929
|
-
content: '""',
|
|
70930
|
-
display: 'block',
|
|
70931
|
-
height: 0,
|
|
70932
|
-
width: 0,
|
|
70933
|
-
position: 'absolute',
|
|
70934
|
-
top: '50%',
|
|
70935
|
-
left: 'calc(100% - 0px)',
|
|
70936
|
-
border: '5px solid transparent',
|
|
70937
|
-
borderLeftColor: '#DF414166',
|
|
70938
|
-
transform: 'translateY(-50%)',
|
|
70939
|
-
},
|
|
70940
|
-
}, children: "NEW" }), "Project Info", jsx$2(Flex, { sx: { ml: '4px' }, children: jsx$2(Svg, { icon: "expand", width: 20, color: "white" }) })] }) }));
|
|
70929
|
+
}, onClick: handleNavigation, children: ["Project Info", jsx$2(Flex, { sx: { ml: '4px' }, children: jsx$2(Svg, { icon: "expand", width: 20, color: "white" }) })] }) }));
|
|
70941
70930
|
};
|
|
70942
70931
|
|
|
70943
70932
|
const BondInfoTooltip = ({ earnTokenContract, earnTokenSymbol, bondContract, projectLink, twitter, audit, chain, }) => {
|
|
@@ -71699,27 +71688,11 @@ const useTopTags = (initialBondList) => {
|
|
|
71699
71688
|
};
|
|
71700
71689
|
|
|
71701
71690
|
const isBondSoldOut = (bill) => {
|
|
71702
|
-
var _a;
|
|
71703
71691
|
if (bill.soldOut)
|
|
71704
71692
|
return true;
|
|
71705
71693
|
if (bill.inactive)
|
|
71706
71694
|
return true;
|
|
71707
|
-
|
|
71708
|
-
if (!tokensRemaining)
|
|
71709
|
-
return false;
|
|
71710
|
-
const thresholdToHide = new BigNumber$1(100).div(payoutTokenPrice !== null && payoutTokenPrice !== void 0 ? payoutTokenPrice : 0);
|
|
71711
|
-
if (bonus && bonus > 50) {
|
|
71712
|
-
// If discount is over 50% it will be hidden
|
|
71713
|
-
// console.log('Soldout contract:', billAddress)
|
|
71714
|
-
return true;
|
|
71715
|
-
}
|
|
71716
|
-
if (((_a = new BigNumber$1(tokensRemaining)) === null || _a === void 0 ? void 0 : _a.lte(thresholdToHide)) || bonus === 100) {
|
|
71717
|
-
// If there's less than 100 usd bond will be hidden
|
|
71718
|
-
// console.log('Soldout contract: ', billAddress)
|
|
71719
|
-
return true;
|
|
71720
|
-
}
|
|
71721
|
-
else
|
|
71722
|
-
return false;
|
|
71695
|
+
return false;
|
|
71723
71696
|
};
|
|
71724
71697
|
const sortBonds = (sortConfig, bonds) => {
|
|
71725
71698
|
const bondsToSort = bonds !== null && bonds !== void 0 ? bonds : [];
|
|
@@ -71989,12 +71962,13 @@ const getSymbol = (token, chainId) => {
|
|
|
71989
71962
|
};
|
|
71990
71963
|
|
|
71991
71964
|
const TokenRow = ({ token, chainId, handleTokenSelect, }) => {
|
|
71992
|
-
var _a;
|
|
71965
|
+
var _a, _b;
|
|
71993
71966
|
const symbol = getSymbol(token, chainId);
|
|
71994
71967
|
const tokenAddress = token === 'NATIVE' ? 'NATIVE' : token.address[chainId];
|
|
71995
71968
|
const { address } = useAccount();
|
|
71996
71969
|
const { isLoading, data: tokenBalance } = useCurrencyBalance(token, address !== null && address !== void 0 ? address : null, chainId);
|
|
71997
|
-
|
|
71970
|
+
const splited = typeof token !== 'string' ? (_a = token === null || token === void 0 ? void 0 : token.symbol) === null || _a === void 0 ? void 0 : _a.split('-') : undefined;
|
|
71971
|
+
return (jsxs(Flex, { sx: { p: '8px', justifyContent: 'space-between', cursor: 'pointer', '&:hover': { background: 'white4' } }, onClick: () => handleTokenSelect(tokenAddress !== null && tokenAddress !== void 0 ? tokenAddress : ''), children: [jsxs(Flex, { children: [lodashExports.isArray(splited) ? (jsx$2(TokenImage, { symbol: splited[0], symbol2: splited[1], size: 28, chain: chainId })) : (jsx$2(TokenImage, { symbol: getSymbol(token, chainId), size: 28, chain: chainId })), jsx$2(Flex, { sx: { mx: '8px', lineHeight: '28px', fontSize: '14px' }, children: symbol })] }), address && (jsx$2(Flex, { sx: { fontSize: '14px' }, children: tokenBalance === '0' ? ('0') : !tokenBalance && isLoading ? (jsx$2(Spinner, { size: 15 })) : (jsx$2(Fragment$1, { children: (_b = new BigNumber$1(tokenBalance !== null && tokenBalance !== void 0 ? tokenBalance : '0')) === null || _b === void 0 ? void 0 : _b.toPrecision(5) })) }))] }));
|
|
71998
71972
|
};
|
|
71999
71973
|
|
|
72000
71974
|
const TokenSelectorModal = ({ bondPrincipalToken, bondEarnToken, handleCurrencySelect, chainId, onDismiss, }) => {
|
|
@@ -72219,6 +72193,7 @@ const useSoulZapTokenQuote = (typedValue, inputCurrency, outputToken, chainId, a
|
|
|
72219
72193
|
const { data: response, isLoading, error, } = useQuery({
|
|
72220
72194
|
queryKey: [QUERY_KEYS.ZAP_TOKEN_QUOTE, queryKey],
|
|
72221
72195
|
queryFn: fetchZapDetails,
|
|
72196
|
+
refetchInterval: 20000,
|
|
72222
72197
|
enabled: !!queryKey,
|
|
72223
72198
|
retry: 1,
|
|
72224
72199
|
});
|
|
@@ -73390,7 +73365,7 @@ const AccordionText = ({ isVisible = false }) => {
|
|
|
73390
73365
|
};
|
|
73391
73366
|
|
|
73392
73367
|
const useSoulZapBondQuote = (typedValue, inputCurrency, bond, account) => {
|
|
73393
|
-
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, _3, _4, _5, _6, _7, _8, _9, _10;
|
|
73368
|
+
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, _3, _4, _5, _6, _7, _8, _9, _10, _11;
|
|
73394
73369
|
const debouncedInput = useDebounce(typedValue, 400);
|
|
73395
73370
|
const [slippage] = useSlippage();
|
|
73396
73371
|
const principalToken = bond === null || bond === void 0 ? void 0 : bond.lpToken;
|
|
@@ -73484,9 +73459,10 @@ const useSoulZapBondQuote = (typedValue, inputCurrency, bond, account) => {
|
|
|
73484
73459
|
console.log((_c = (_b = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.result) === null || _c === void 0 ? void 0 : _c.data);
|
|
73485
73460
|
return (_f = (_e = (_d = response.data) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.result) === null || _f === void 0 ? void 0 : _f.data;
|
|
73486
73461
|
});
|
|
73487
|
-
const { data: response, isLoading, error, } = useQuery({
|
|
73462
|
+
const { data: response, isLoading, isFetching, error, } = useQuery({
|
|
73488
73463
|
queryKey: [QUERY_KEYS.ZAP_TOKEN_QUOTE, queryKey],
|
|
73489
73464
|
queryFn: fetchZapDetails,
|
|
73465
|
+
refetchInterval: 60000, // i.e. 60 sec
|
|
73490
73466
|
enabled: !!queryKey,
|
|
73491
73467
|
retry: 1,
|
|
73492
73468
|
});
|
|
@@ -73515,7 +73491,11 @@ const useSoulZapBondQuote = (typedValue, inputCurrency, bond, account) => {
|
|
|
73515
73491
|
const isWrap = inputCurrency === 'NATIVE' &&
|
|
73516
73492
|
((_7 = (_6 = (_5 = bond === null || bond === void 0 ? void 0 : bond.lpToken) === null || _5 === void 0 ? void 0 : _5.address) === null || _6 === void 0 ? void 0 : _6[chainId]) === null || _7 === void 0 ? void 0 : _7.toLowerCase()) === ((_10 = (_9 = (_8 = WNATIVE[chainId]) === null || _8 === void 0 ? void 0 : _8.address) === null || _9 === void 0 ? void 0 : _9[chainId]) === null || _10 === void 0 ? void 0 : _10.toLowerCase());
|
|
73517
73493
|
const estimatedDepositAmountToReturn = isWrap ? typedValue : estimatedDepositAmount.toString();
|
|
73518
|
-
|
|
73494
|
+
const trueBondPrice = (_11 = response === null || response === void 0 ? void 0 : response.protocolQuote) === null || _11 === void 0 ? void 0 : _11.trueBondPrice;
|
|
73495
|
+
const zapLoading = isLoading || isFetching;
|
|
73496
|
+
if (zapLoading)
|
|
73497
|
+
return [true, undefined, '', false, undefined];
|
|
73498
|
+
return [zapLoading, response, estimatedDepositAmountToReturn, zapError, trueBondPrice];
|
|
73519
73499
|
};
|
|
73520
73500
|
|
|
73521
73501
|
const useSendReferenceId = () => {
|
|
@@ -73533,197 +73513,6 @@ const useSendReferenceId = () => {
|
|
|
73533
73513
|
}), [config === null || config === void 0 ? void 0 : config.referenceId, apiV2URL]);
|
|
73534
73514
|
};
|
|
73535
73515
|
|
|
73536
|
-
const BondModalHeader = ({ bondData, onDismiss, showProjectInfoButton, }) => {
|
|
73537
|
-
var _a, _b;
|
|
73538
|
-
const [onOpenSlippageModal] = useModal(jsx$2(SlippageModal, {}));
|
|
73539
|
-
const handleClose = () => {
|
|
73540
|
-
if (typeof window !== 'undefined') {
|
|
73541
|
-
window.history.pushState({}, '', `/bonds`);
|
|
73542
|
-
}
|
|
73543
|
-
onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss();
|
|
73544
|
-
};
|
|
73545
|
-
const handleProjectViewNavigation = () => {
|
|
73546
|
-
window.open(`${window.location.origin}/bonds/${bondData.billAddress}/${bondData.chainId}`, '_self');
|
|
73547
|
-
track({
|
|
73548
|
-
event: 'projectInfoClick',
|
|
73549
|
-
chain: bondData.chainId,
|
|
73550
|
-
data: {
|
|
73551
|
-
cat: 'Modal',
|
|
73552
|
-
bond: bondData.earnToken.symbol,
|
|
73553
|
-
bondChain: bondData.chainId,
|
|
73554
|
-
},
|
|
73555
|
-
});
|
|
73556
|
-
};
|
|
73557
|
-
return (jsxs(Flex, { className: "modaltable-container title-container", children: [jsxs(Flex, { className: "title-container bondicon", children: [jsx$2("img", { src: "/images/bills/xmasHat.png", alt: "xmas-hat", className: "xmas-hat" }), jsx$2(TokenImage, { symbol: (_a = bondData.showcaseTokenName) !== null && _a !== void 0 ? _a : bondData.earnToken.symbol, size: 50, chain: bondData.chainId })] }), jsxs(Flex, { className: "title-container bondname", children: [bondData === null || bondData === void 0 ? void 0 : bondData.showcaseTokenName, jsx$2(ListTag, { text: (_b = bondData === null || bondData === void 0 ? void 0 : bondData.tags) === null || _b === void 0 ? void 0 : _b[0] })] }), jsxs(Flex, { className: "title-container price-container", children: [jsxs(Flex, { className: "price-container price", children: ["$", earnTokenPrice(bondData)] }), jsxs(Flex, { className: "price-container discounted", children: ["$", discountEarnTokenPrice(bondData)] })] }), jsx$2(Flex, { className: "slipagge-close-icons", children: onDismiss ? (jsxs(Fragment$1, { children: [showProjectInfoButton && jsx$2(ExpandedViewButton, { handleNavigation: handleProjectViewNavigation }), jsx$2(IconButton, { icon: "close", color: "text", variant: "transparent", onClick: handleClose }), jsx$2(Flex, { sx: { py: '3px' }, onClick: onOpenSlippageModal, children: jsx$2(Svg, { icon: "cog", width: "16px" }) })] })) : (jsx$2(Flex, { sx: { py: '3px' }, onClick: onOpenSlippageModal, children: jsx$2(Svg, { icon: "cog", width: "16px" }) })) })] }));
|
|
73558
|
-
};
|
|
73559
|
-
|
|
73560
|
-
const BondCards = ({ bondData }) => {
|
|
73561
|
-
var _a, _b, _c, _d, _e, _f;
|
|
73562
|
-
return (jsxs("div", { className: "bonds-cards", children: [jsxs("div", { className: "bond-card-block", style: { color: getDiscountColor(bondData === null || bondData === void 0 ? void 0 : bondData.bonusWithFee) }, children: [jsxs("div", { className: "bond-card-title", children: ["Bonus", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: TooltipText.Discount }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: jsx$2("div", { className: "bond-card-tooltip", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), jsx$2("div", { className: "bond-card-content", children: (bondData === null || bondData === void 0 ? void 0 : bondData.bonusWithFee) < 0 ? '0%' : `${(_a = bondData === null || bondData === void 0 ? void 0 : bondData.bonusWithFee) === null || _a === void 0 ? void 0 : _a.toFixed(2)}%` })] }), bondData.type !== 'staking' && (jsxs("div", { className: "bond-card-block hide-mobile", children: [jsxs("div", { className: "bond-card-title", children: ["ARR", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: TooltipText.ARR }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: jsx$2("div", { className: "bond-card-tooltip", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), jsx$2("div", { className: "bond-card-content", children: (bondData === null || bondData === void 0 ? void 0 : bondData.bonusWithFee) < 0
|
|
73563
|
-
? '0%'
|
|
73564
|
-
: `${((((_b = bondData === null || bondData === void 0 ? void 0 : bondData.bonusWithFee) !== null && _b !== void 0 ? _b : 0) * 365) / vestingTime((_c = bondData === null || bondData === void 0 ? void 0 : bondData.vestingTerm) !== null && _c !== void 0 ? _c : 0).days).toFixed(2)}%` })] })), jsxs("div", { className: "bond-card-block", children: [jsxs("div", { className: "bond-card-title", children: ["Terms", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: TooltipText.Terms }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: jsx$2("div", { className: "bond-card-tooltip", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), jsxs("div", { className: "bond-card-content", children: [bondData.type === 'staking' ? `${daysLeftOnBasepadPool()} D Lock` : getVestingTermsString(bondData), bondData.vestingCliff && (jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: getVestingTermsTooltipString(bondData) }), 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" }) }) }))] })] }), jsxs("div", { className: "bond-card-block", children: [jsxs("div", { className: "bond-card-title", children: ["Max Buy", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: TooltipText.MaxBuy((_d = bondData === null || bondData === void 0 ? void 0 : bondData.earnToken) === null || _d === void 0 ? void 0 : _d.symbol) }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: jsx$2("div", { className: "bond-card-tooltip", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), jsxs("div", { className: "bond-card-content", children: [jsx$2("div", { style: { paddingRight: '3px' }, children: jsx$2(TokenImage, { symbol: (_e = bondData.showcaseTokenName) !== null && _e !== void 0 ? _e : bondData.earnToken.symbol, size: 20 }) }), (_f = parseFloat(maxBuy(bondData).toFixed(0))) === null || _f === void 0 ? void 0 : _f.toLocaleString('en-US')] })] })] }));
|
|
73565
|
-
};
|
|
73566
|
-
|
|
73567
|
-
const Estimations = ({ bondData, inputValue, inputToken, depositAmount, inputTokenPrice, isZap, fetchingZapQuote, zapError, }) => {
|
|
73568
|
-
var _a, _b, _c, _d, _e;
|
|
73569
|
-
const rawPayoutAmount = getRawPayoutAmount(bondData, depositAmount);
|
|
73570
|
-
// Estimations
|
|
73571
|
-
const rawEstimatedOutputUSD = rawPayoutAmount * parseFloat((_a = bondData === null || bondData === void 0 ? void 0 : bondData.payoutTokenPrice) !== null && _a !== void 0 ? _a : '0');
|
|
73572
|
-
const estimatedInputUSD = parseFloat(inputValue) * (inputTokenPrice !== null && inputTokenPrice !== void 0 ? inputTokenPrice : 0);
|
|
73573
|
-
const rawBonus = getRawBonus(bondData, depositAmount);
|
|
73574
|
-
const bonusString = isZap ? (rawEstimatedOutputUSD - estimatedInputUSD).toString() : rawBonus;
|
|
73575
|
-
const fee = getFeeAmount(bondData, depositAmount);
|
|
73576
|
-
const feeUSD = fee * parseFloat((_b = bondData === null || bondData === void 0 ? void 0 : bondData.payoutTokenPrice) !== null && _b !== void 0 ? _b : '0');
|
|
73577
|
-
const estimatedOutputAmount = getPayoutAmount(bondData, depositAmount);
|
|
73578
|
-
const estimatedOutputUSD = estimatedOutputAmount * parseFloat((_c = bondData === null || bondData === void 0 ? void 0 : bondData.payoutTokenPrice) !== null && _c !== void 0 ? _c : '0');
|
|
73579
|
-
return (jsxs(Flex, { className: "modaltable-container text-container", children: [jsxs(Flex, { className: "text-container row", children: [jsx$2(Flex, { className: "row-container spend", children: "You Spend:" }), jsxs(Flex, { className: "row-container spend-val", children: [youSpend(inputValue), " ", getSymbol(inputToken, bondData.chainId), " = $", ' ', formatUSDNumber(estimatedInputUSD === null || estimatedInputUSD === void 0 ? void 0 : estimatedInputUSD.toString())] })] }), jsxs(Flex, { className: "text-container row", children: [jsxs(Flex, { className: "row-container premium", children: ["Bonus:", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: TooltipText.Premium }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: jsx$2(Flex, { className: "row-container premium-icon", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), isZap && fetchingZapQuote ? (jsx$2(Dots, {})) : isZap && zapError ? ('-') : (jsxs(Flex, { className: `row-container premium-val ${getBonusColor(bonusString)}`, children: ["$ ", formatUSDNumber(bonusString)] }))] }), bondData.feeInPayout && (jsxs(Flex, { className: "text-container row", children: [jsxs(Flex, { className: "row-container premium", children: ["Fee:", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: TooltipText.Fee }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: jsx$2(Flex, { className: "row-container premium-icon", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), jsxs(Flex, { className: `row-container premium-val`, children: ["$ ", formatUSDNumber(feeUSD.toString())] })] })), jsxs(Flex, { className: "text-container row", children: [jsxs(Flex, { className: "row-container get", children: ["You Get (over ", vestingTime(((_d = bondData === null || bondData === void 0 ? void 0 : bondData.vestingTerm) !== null && _d !== void 0 ? _d : 0) - ((_e = bondData.vestingCliff) !== null && _e !== void 0 ? _e : 0)).days, " days):"] }), isZap && fetchingZapQuote ? (jsx$2(Dots, {})) : isZap && zapError ? ('-') : (jsxs(Flex, { className: "row-container get-val", children: [formatNumber$2(estimatedOutputAmount.toString()), " ", bondData === null || bondData === void 0 ? void 0 : bondData.showcaseTokenName, " = $", ' ', formatUSDNumber(estimatedOutputUSD.toString())] }))] })] }));
|
|
73580
|
-
};
|
|
73581
|
-
|
|
73582
|
-
// Custom HTML sanitizer
|
|
73583
|
-
function sanitizeHTML(html) {
|
|
73584
|
-
var _a;
|
|
73585
|
-
const tagWhitelist = ['a', 'br', 'span']; // Allowed tags
|
|
73586
|
-
const attrWhitelist = ['target', 'rel', 'style', 'href']; // Allowed attributes
|
|
73587
|
-
const doc = new DOMParser().parseFromString(html, 'text/html');
|
|
73588
|
-
const elements = doc.body.querySelectorAll('*');
|
|
73589
|
-
for (const el of elements) {
|
|
73590
|
-
// Remove elements that are not in the whitelist
|
|
73591
|
-
if (!tagWhitelist.includes(el.tagName.toLowerCase())) {
|
|
73592
|
-
(_a = el === null || el === void 0 ? void 0 : el.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(el);
|
|
73593
|
-
continue;
|
|
73594
|
-
}
|
|
73595
|
-
// Loop through the element's attributes and remove those that are not in the whitelist
|
|
73596
|
-
Array.from(el.attributes).forEach((attr) => {
|
|
73597
|
-
if (!attrWhitelist.includes(attr.name.toLowerCase())) {
|
|
73598
|
-
el.removeAttribute(attr.name);
|
|
73599
|
-
}
|
|
73600
|
-
});
|
|
73601
|
-
}
|
|
73602
|
-
return doc.body.innerHTML;
|
|
73603
|
-
}
|
|
73604
|
-
const SafeHTMLComponent = ({ html }) => {
|
|
73605
|
-
const sanitizedHTML = sanitizeHTML(html);
|
|
73606
|
-
return jsx$2("div", { dangerouslySetInnerHTML: { __html: sanitizedHTML } });
|
|
73607
|
-
};
|
|
73608
|
-
|
|
73609
|
-
const ProjectDescription = ({ description }) => {
|
|
73610
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
73611
|
-
return (jsxs(Flex, { className: "description-container", children: [jsxs(Flex, { sx: { display: ['flex', 'flex', 'flex', 'none'], flexDirection: 'column' }, children: [jsx$2(Text, { sx: {
|
|
73612
|
-
fontSize: ['12px', '12px', '12px', '14px'],
|
|
73613
|
-
mt: '10px',
|
|
73614
|
-
lineHeight: ['18px', '18px', '18px', '21px'],
|
|
73615
|
-
fontWeight: 400,
|
|
73616
|
-
overflow: 'hidden',
|
|
73617
|
-
maxHeight: isOpen ? 'unset' : '54px',
|
|
73618
|
-
}, children: description && jsx$2(SafeHTMLComponent, { html: description }) }), !isOpen && (jsxs(Text, { sx: {
|
|
73619
|
-
color: 'primaryButton',
|
|
73620
|
-
fontSize: '12px',
|
|
73621
|
-
lineHeight: '18px',
|
|
73622
|
-
fontWeight: 400,
|
|
73623
|
-
cursor: 'pointer',
|
|
73624
|
-
}, onClick: () => setIsOpen(true), children: ["View More ", '>'] }))] }), jsx$2(Flex, { sx: { display: ['none', 'none', 'none', 'flex'] }, children: jsx$2(SafeHTMLComponent, { html: description !== null && description !== void 0 ? description : '' }) })] }));
|
|
73625
|
-
};
|
|
73626
|
-
|
|
73627
|
-
const BondModalHeaderAlt = ({ bondData, onDismiss, showProjectInfoButton, }) => {
|
|
73628
|
-
var _a, _b, _c, _d, _e, _f;
|
|
73629
|
-
const [onOpenSlippageModal] = useModal(jsx$2(SlippageModal, {}));
|
|
73630
|
-
const handleClose = () => {
|
|
73631
|
-
if (typeof window !== 'undefined') {
|
|
73632
|
-
window.history.pushState({}, '', `/bonds`);
|
|
73633
|
-
}
|
|
73634
|
-
onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss();
|
|
73635
|
-
};
|
|
73636
|
-
// const handleProjectViewNavigation = () => {
|
|
73637
|
-
// window.open(`${window.location.origin}/bonds/${bondData.billAddress}/${bondData.chainId}`, '_self')
|
|
73638
|
-
// track({
|
|
73639
|
-
// event: 'projectInfoClick',
|
|
73640
|
-
// chain: bondData.chainId,
|
|
73641
|
-
// data: {
|
|
73642
|
-
// cat: 'Modal',
|
|
73643
|
-
// bond: bondData.earnToken.symbol,
|
|
73644
|
-
// bondChain: bondData.chainId,
|
|
73645
|
-
// },
|
|
73646
|
-
// })
|
|
73647
|
-
// }
|
|
73648
|
-
return (jsx$2(Flex, { className: "modaltable-container title-container", children: jsx$2(Flex, { className: "slipagge-close-icons", sx: { flexDirection: 'row' }, children: onDismiss ? (jsxs(Fragment$1, { children: [jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(BondInfoTooltip, { earnTokenContract: (_c = (_b = (_a = bondData === null || bondData === void 0 ? void 0 : bondData.earnToken) === null || _a === void 0 ? void 0 : _a.address) === null || _b === void 0 ? void 0 : _b[bondData === null || bondData === void 0 ? void 0 : bondData.chainId]) !== null && _c !== void 0 ? _c : '', earnTokenSymbol: (_e = (_d = bondData === null || bondData === void 0 ? void 0 : bondData.earnToken) === null || _d === void 0 ? void 0 : _d.symbol) !== null && _e !== void 0 ? _e : '', bondContract: (_f = bondData.billAddress) !== null && _f !== void 0 ? _f : '', projectLink: bondData === null || bondData === void 0 ? void 0 : bondData.projectLink, twitter: bondData === null || bondData === void 0 ? void 0 : bondData.twitter, audit: bondData === null || bondData === void 0 ? void 0 : bondData.audit, chain: bondData === null || bondData === void 0 ? void 0 : bondData.chainId }), 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" }) }) }), jsx$2(Flex, { sx: { pr: '10px' }, onClick: onOpenSlippageModal, children: jsx$2(Svg, { icon: "cog", width: "16px" }) }), jsx$2(IconButton, { icon: "close", color: "text", variant: "transparent", onClick: handleClose })] })) : (jsx$2(Flex, { sx: {}, onClick: onOpenSlippageModal, children: jsx$2(Svg, { icon: "cog", width: "16px" }) })) }) }));
|
|
73649
|
-
};
|
|
73650
|
-
|
|
73651
|
-
const ImageAndShortDescription = ({ bondData, onDismiss }) => {
|
|
73652
|
-
var _a;
|
|
73653
|
-
const SDKConfig = useSDKConfig();
|
|
73654
|
-
// Swiper logic for the alt view
|
|
73655
|
-
const [activeSlide, setActiveSlide] = useState(0);
|
|
73656
|
-
const { swiper, setSwiper } = useSwiper();
|
|
73657
|
-
const imagesLength = 3;
|
|
73658
|
-
const handleSlide = (event) => {
|
|
73659
|
-
const slideNumber = getDotPos(event.activeIndex, imagesLength);
|
|
73660
|
-
setActiveSlide(slideNumber);
|
|
73661
|
-
};
|
|
73662
|
-
const slideTo = (index) => {
|
|
73663
|
-
setActiveSlide(index);
|
|
73664
|
-
swiper === null || swiper === void 0 ? void 0 : swiper.slideTo(index);
|
|
73665
|
-
};
|
|
73666
|
-
return (jsxs(Flex, { sx: { maxWidth: ['unset', 'unset', 'unset', '500px'], flexDirection: 'column', alignItems: 'center' }, children: [jsxs(Flex, { sx: {
|
|
73667
|
-
flexDirection: 'column',
|
|
73668
|
-
width: '100%',
|
|
73669
|
-
alignItems: 'center',
|
|
73670
|
-
overflow: 'hidden',
|
|
73671
|
-
position: 'relative',
|
|
73672
|
-
}, children: [jsxs(Swiper, { id: "hotbondsSweper", onSwiper: setSwiper, slidesPerView: "auto", centeredSlides: true, lazy: true, preloadImages: false, onSlideChange: handleSlide, style: { width: '100%', overflow: 'visible' }, children: [jsx$2(SwiperSlide, { style: {
|
|
73673
|
-
width: '100%',
|
|
73674
|
-
display: 'flex',
|
|
73675
|
-
justifyContent: 'center',
|
|
73676
|
-
}, children: jsx$2("img", { className: "project-image", src: "https://placehold.co/400x200" }) }, 0), jsx$2(SwiperSlide, { style: {
|
|
73677
|
-
width: '100%',
|
|
73678
|
-
display: 'flex',
|
|
73679
|
-
justifyContent: 'center',
|
|
73680
|
-
}, children: jsx$2("img", { className: "project-image", src: "https://placehold.co/400x200" }) }, 1), jsx$2(SwiperSlide, { style: {
|
|
73681
|
-
width: '100%',
|
|
73682
|
-
display: 'flex',
|
|
73683
|
-
justifyContent: 'center',
|
|
73684
|
-
}, children: jsx$2("img", { className: "project-image", src: "https://placehold.co/400x200" }) }, 2)] }), jsx$2(Flex, { sx: { position: 'absolute', bottom: ['15px', '15px', '15px', '20px'], left: 'calc(50% - 28,5px)', zIndex: 2 }, children: [...Array(imagesLength)].map((_, i) => {
|
|
73685
|
-
return jsx$2(SwiperDots, { isActive: i === activeSlide, onClick: () => slideTo(i) }, i);
|
|
73686
|
-
}) })] }), jsxs(Flex, { sx: { alignItems: 'center', display: ['flex', 'flex', 'flex', 'none'], p: '10px', width: '100%' }, children: [jsxs(Flex, { sx: { width: ['50%', '50%', '50%', '100%'], alignItems: 'center' }, children: [jsx$2(Flex, { sx: { mr: '5px' }, children: jsx$2(TokenImage, { symbol: (_a = bondData.showcaseTokenName) !== null && _a !== void 0 ? _a : bondData.earnToken.symbol, size: 30, chain: bondData.chainId }) }), jsxs("h2", { className: "modal-tokenname-chainicon", sx: { margin: '0px' }, children: [bondData === null || bondData === void 0 ? void 0 : bondData.showcaseTokenName, ' '] })] }), jsx$2(Flex, { className: "modal-marketprice-header", sx: { justifyContent: 'flex-end', alignItems: 'center' }, children: jsxs("span", { className: "modal-marketprice", children: ["Market Price: $", earnTokenPrice(bondData)] }) }), jsx$2(Flex, { className: "bondmodal-header-alt", sx: { mb: '10px' }, children: jsx$2(BondModalHeaderAlt, { bondData: bondData, onDismiss: onDismiss, showProjectInfoButton: (SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.referenceId) === 'apebond' }) })] }), jsx$2(Flex, { className: "description-container paragraph-spaced", sx: { px: '10px', opacity: 0.7, mt: ['0', '0', '0', '10px'] }, children: jsx$2(ProjectDescription, { description: bondData === null || bondData === void 0 ? void 0 : bondData.shortDescription }) })] }));
|
|
73687
|
-
};
|
|
73688
|
-
|
|
73689
|
-
// Fetch country code to check if the region is allowed
|
|
73690
|
-
const fetchLocation = (apiv2URL) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
73691
|
-
const resp = yield axios.get(`${apiv2URL}/check`);
|
|
73692
|
-
const { isRestrictedRegion, countryCode } = resp === null || resp === void 0 ? void 0 : resp.data;
|
|
73693
|
-
return { isRestrictedRegion, countryCode };
|
|
73694
|
-
});
|
|
73695
|
-
function useGeoFencing() {
|
|
73696
|
-
const apiv2URL = useURLByEnvironment('apiV2');
|
|
73697
|
-
return useQuery({
|
|
73698
|
-
queryKey: [QUERY_KEYS.GEO_FENCING],
|
|
73699
|
-
queryFn: () => fetchLocation(apiv2URL),
|
|
73700
|
-
staleTime: Infinity,
|
|
73701
|
-
refetchOnMount: false,
|
|
73702
|
-
refetchOnWindowFocus: false,
|
|
73703
|
-
});
|
|
73704
|
-
}
|
|
73705
|
-
|
|
73706
|
-
const RestrictedRegionModal = ({ onDismiss }) => {
|
|
73707
|
-
const { data: geoData } = useGeoFencing();
|
|
73708
|
-
return (jsxs(Modal, { className: "modal", title: "Notice", sx: { maxWidth: '200px' }, children: [jsxs(Flex, { sx: { my: '20px' }, children: ["Unfortunately, this bond is restricted for your region: ", geoData === null || geoData === void 0 ? void 0 : geoData.countryCode, "."] }), jsx$2(Button, { fullWidth: true, onClick: onDismiss, children: "Close" })] }));
|
|
73709
|
-
};
|
|
73710
|
-
|
|
73711
|
-
const NoBonusModal = ({ onAcknowledge, showcaseTokenName }) => {
|
|
73712
|
-
const [isOpen, setIsOpen] = useState(true);
|
|
73713
|
-
const [isChecked, setIsChecked] = useState(false);
|
|
73714
|
-
const handleAcknowledge = () => {
|
|
73715
|
-
onAcknowledge();
|
|
73716
|
-
setIsOpen(false);
|
|
73717
|
-
};
|
|
73718
|
-
const handleCancel = () => {
|
|
73719
|
-
setIsOpen(false);
|
|
73720
|
-
};
|
|
73721
|
-
const handleCheckboxChange = () => {
|
|
73722
|
-
setIsChecked(!isChecked);
|
|
73723
|
-
};
|
|
73724
|
-
return (isOpen && (jsxs(Modal, { className: "nobonus-modal", title: "Warning", onClose: handleAcknowledge, children: [jsxs("p", { children: ["You're buying ", showcaseTokenName, " at a higher price than the market, which will result in receiving fewer tokens compared to swapping via an exchange."] }), jsx$2("p", { children: "You will not receive any bonus tokens when buying this bond." }), jsxs(Flex, { className: "nobonus-checkbox-row", sx: { flexDirection: 'row', gap: '8px', pb: '20px' }, children: [jsx$2(Flex, { className: "nobonus-checkbox", children: jsx$2(Checkbox, { onChange: handleCheckboxChange }) }), jsx$2(Flex, { className: "nobonus-checkbox-text", children: "I understand and want to proceed." })] }), jsxs(Flex, { className: "nobonus-actions", sx: { flexDirection: 'row', gap: '8px' }, children: [jsx$2(Button, { classname: "nobonus-cancel", onClick: handleCancel, sx: { width: '100%', justifyContent: 'center' }, variant: "secondary", children: "Cancel" }), jsx$2(Button, { className: "nobonus-buy", onClick: handleAcknowledge, disabled: !isChecked, sx: { width: '100%', justifyContent: 'center' }, children: "Buy" })] })] })));
|
|
73725
|
-
};
|
|
73726
|
-
|
|
73727
73516
|
var lensContractABI = [
|
|
73728
73517
|
{
|
|
73729
73518
|
inputs: [
|
|
@@ -74130,11 +73919,196 @@ function useGetUserEscrowWeight(account) {
|
|
|
74130
73919
|
});
|
|
74131
73920
|
}
|
|
74132
73921
|
|
|
74133
|
-
const
|
|
73922
|
+
const BondModalMinTierHeader = ({ minTier }) => {
|
|
73923
|
+
return (jsx$2(Fragment$1, { children: minTier !== null && minTier !== undefined && (jsx$2(Flex, { sx: {
|
|
73924
|
+
justifyContent: 'start',
|
|
73925
|
+
alignItems: 'center',
|
|
73926
|
+
flexDirection: 'row-reverse',
|
|
73927
|
+
width: ['100%', '100%', '100%', 'auto', 'auto'],
|
|
73928
|
+
}, children: Object.values(TIERS_NAMES).map((tier, index) => {
|
|
73929
|
+
if (index >= minTier) {
|
|
73930
|
+
return (jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { sx: { justifyContent: 'center' }, children: tier }), width: "100px", placement: "bottomLeft", transformTip: "translate(1%, -5%)", children: jsx$2("img", { src: `/images/launch/${tier.toLowerCase()}.png`, alt: "minTier", style: { width: '30px', height: '30px', marginLeft: '3px', zIndex: 1 } }, `tier-logo-${index}`) }, tier));
|
|
73931
|
+
}
|
|
73932
|
+
}) })) }));
|
|
73933
|
+
};
|
|
73934
|
+
|
|
73935
|
+
const BondModalHeader = ({ bondData, onDismiss, showProjectInfoButton, }) => {
|
|
73936
|
+
var _a, _b;
|
|
73937
|
+
const [onOpenSlippageModal] = useModal(jsx$2(SlippageModal, {}));
|
|
73938
|
+
const minTier = bondData.minTier !== undefined ? bondData.minTier : null;
|
|
73939
|
+
const handleClose = () => {
|
|
73940
|
+
if (typeof window !== 'undefined') {
|
|
73941
|
+
window.history.pushState({}, '', `/bonds`);
|
|
73942
|
+
}
|
|
73943
|
+
onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss();
|
|
73944
|
+
};
|
|
73945
|
+
const handleProjectViewNavigation = () => {
|
|
73946
|
+
window.open(`${window.location.origin}/bonds/${bondData.billAddress}/${bondData.chainId}`, '_self');
|
|
73947
|
+
track({
|
|
73948
|
+
event: 'projectInfoClick',
|
|
73949
|
+
chain: bondData.chainId,
|
|
73950
|
+
data: {
|
|
73951
|
+
cat: 'Modal',
|
|
73952
|
+
bond: bondData.earnToken.symbol,
|
|
73953
|
+
bondChain: bondData.chainId,
|
|
73954
|
+
},
|
|
73955
|
+
});
|
|
73956
|
+
};
|
|
73957
|
+
return (jsxs(Flex, { className: "modaltable-container title-container", sx: { flexDirection: 'column', justifyContent: 'center', alignItems: 'start' }, children: [jsxs(Flex, { className: "slipagge-close-icon", sx: { width: '100%', height: '30px', mb: ['10px', '10px', '10px', '0px'], mt: '-10px' }, children: [jsx$2(Flex, { sx: { display: ['flex', 'flex', 'flex', 'none', 'none'] }, children: jsx$2(BondModalMinTierHeader, { minTier: minTier }) }), jsx$2(Flex, { sx: { flexDirection: 'column', position: 'absolute', right: '0px' }, children: onDismiss ? (jsxs(Fragment$1, { children: [showProjectInfoButton && jsx$2(ExpandedViewButton, { handleNavigation: handleProjectViewNavigation }), jsx$2(IconButton, { icon: "close", color: "text", variant: "transparent", onClick: handleClose }), jsx$2(Flex, { sx: { py: '3px' }, onClick: onOpenSlippageModal, children: jsx$2(Svg, { icon: "cog", width: "16px" }) })] })) : (jsx$2(Flex, { sx: { py: '3px' }, onClick: onOpenSlippageModal, children: jsx$2(Svg, { icon: "cog", width: "16px" }) })) })] }), jsxs(Flex, { sx: { width: '100%' }, children: [jsx$2(Flex, { className: "title-container bondicon", children: jsx$2(TokenImage, { symbol: (_a = bondData.showcaseTokenName) !== null && _a !== void 0 ? _a : bondData.earnToken.symbol, size: 50, chain: bondData.chainId }) }), jsxs(Flex, { className: "title-container bondname", children: [bondData === null || bondData === void 0 ? void 0 : bondData.showcaseTokenName, jsx$2(ListTag, { text: (_b = bondData === null || bondData === void 0 ? void 0 : bondData.tags) === null || _b === void 0 ? void 0 : _b[0] })] }), jsxs(Flex, { className: "title-container price-container", sx: { flexDirection: 'column', paddingLeft: '20px' }, children: [jsxs(Flex, { className: "price-container price", children: ["$", earnTokenPrice(bondData)] }), jsxs(Flex, { className: "price-container discounted", children: ["$", discountEarnTokenPrice(bondData)] })] }), jsx$2(Flex, { sx: { display: ['none', 'none', 'none', 'flex', 'flex'], ml: '10px' }, children: jsx$2(BondModalMinTierHeader, { minTier: minTier }) })] })] }));
|
|
73958
|
+
};
|
|
73959
|
+
|
|
73960
|
+
const BondCards = ({ bondData }) => {
|
|
73961
|
+
var _a, _b, _c, _d, _e, _f;
|
|
73962
|
+
return (jsxs("div", { className: "bonds-cards", children: [jsxs("div", { className: "bond-card-block", style: { color: getDiscountColor(bondData === null || bondData === void 0 ? void 0 : bondData.bonusWithFee) }, children: [jsxs("div", { className: "bond-card-title", children: ["Bonus", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: TooltipText.Discount }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: jsx$2("div", { className: "bond-card-tooltip", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), jsx$2("div", { className: "bond-card-content", children: (bondData === null || bondData === void 0 ? void 0 : bondData.bonusWithFee) < 0 ? '0%' : `${(_a = bondData === null || bondData === void 0 ? void 0 : bondData.bonusWithFee) === null || _a === void 0 ? void 0 : _a.toFixed(2)}%` })] }), bondData.type !== 'staking' && (jsxs("div", { className: "bond-card-block hide-mobile", children: [jsxs("div", { className: "bond-card-title", children: ["ARR", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: TooltipText.ARR }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: jsx$2("div", { className: "bond-card-tooltip", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), jsx$2("div", { className: "bond-card-content", children: (bondData === null || bondData === void 0 ? void 0 : bondData.bonusWithFee) < 0
|
|
73963
|
+
? '0%'
|
|
73964
|
+
: `${((((_b = bondData === null || bondData === void 0 ? void 0 : bondData.bonusWithFee) !== null && _b !== void 0 ? _b : 0) * 365) / vestingTime((_c = bondData === null || bondData === void 0 ? void 0 : bondData.vestingTerm) !== null && _c !== void 0 ? _c : 0).days).toFixed(2)}%` })] })), jsxs("div", { className: "bond-card-block", children: [jsxs("div", { className: "bond-card-title", children: ["Terms", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: TooltipText.Terms }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: jsx$2("div", { className: "bond-card-tooltip", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), jsxs("div", { className: "bond-card-content", children: [bondData.type === 'staking' ? `${daysLeftOnBasepadPool()} D Lock` : getVestingTermsString(bondData), bondData.vestingCliff && (jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: getVestingTermsTooltipString(bondData) }), 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" }) }) }))] })] }), jsxs("div", { className: "bond-card-block", children: [jsxs("div", { className: "bond-card-title", children: ["Max Buy", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: TooltipText.MaxBuy((_d = bondData === null || bondData === void 0 ? void 0 : bondData.earnToken) === null || _d === void 0 ? void 0 : _d.symbol) }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: jsx$2("div", { className: "bond-card-tooltip", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), jsxs("div", { className: "bond-card-content", children: [jsx$2("div", { style: { paddingRight: '3px' }, children: jsx$2(TokenImage, { symbol: (_e = bondData.showcaseTokenName) !== null && _e !== void 0 ? _e : bondData.earnToken.symbol, size: 20 }) }), (_f = parseFloat(maxBuy(bondData).toFixed(0))) === null || _f === void 0 ? void 0 : _f.toLocaleString('en-US')] })] })] }));
|
|
73965
|
+
};
|
|
73966
|
+
|
|
73967
|
+
const Estimations = ({ depositAmount, bondData, youSpendString, isZap, fetchingZapQuote, zapError, }) => {
|
|
73968
|
+
var _a, _b, _c, _d;
|
|
73969
|
+
// Estimations
|
|
73970
|
+
const bonusString = getRawBonus(bondData, depositAmount);
|
|
73971
|
+
const fee = getFeeAmount(bondData, depositAmount);
|
|
73972
|
+
const feeUSD = fee * parseFloat((_a = bondData === null || bondData === void 0 ? void 0 : bondData.payoutTokenPrice) !== null && _a !== void 0 ? _a : '0');
|
|
73973
|
+
const estimatedOutputAmount = getPayoutAmount(bondData, depositAmount);
|
|
73974
|
+
const estimatedOutputUSD = estimatedOutputAmount * parseFloat((_b = bondData === null || bondData === void 0 ? void 0 : bondData.payoutTokenPrice) !== null && _b !== void 0 ? _b : '0');
|
|
73975
|
+
return (jsxs(Flex, { className: "modaltable-container text-container", children: [jsxs(Flex, { className: "text-container row", children: [jsx$2(Flex, { className: "row-container spend", children: "You Spend:" }), jsx$2(Flex, { className: "row-container spend-val", children: youSpendString })] }), jsxs(Flex, { className: "text-container row", children: [jsxs(Flex, { className: "row-container premium", children: ["Bonus:", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: TooltipText.Premium }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: jsx$2(Flex, { className: "row-container premium-icon", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), isZap && fetchingZapQuote ? (jsx$2(Dots, {})) : isZap && zapError ? ('-') : (jsxs(Flex, { className: `row-container premium-val ${getBonusColor(bonusString)}`, children: ["$ ", formatUSDNumber(bonusString)] }))] }), bondData.feeInPayout && (jsxs(Flex, { className: "text-container row", children: [jsxs(Flex, { className: "row-container premium", children: ["Fee:", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: TooltipText.Fee }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: jsx$2(Flex, { className: "row-container premium-icon", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), jsxs(Flex, { className: `row-container premium-val`, children: ["$ ", formatUSDNumber(feeUSD.toString())] })] })), jsxs(Flex, { className: "text-container row", children: [jsxs(Flex, { className: "row-container get", children: ["You Get (over ", vestingTime(((_c = bondData === null || bondData === void 0 ? void 0 : bondData.vestingTerm) !== null && _c !== void 0 ? _c : 0) - ((_d = bondData.vestingCliff) !== null && _d !== void 0 ? _d : 0)).days, " days):"] }), isZap && fetchingZapQuote ? (jsx$2(Dots, {})) : isZap && zapError ? ('-') : (jsxs(Flex, { className: "row-container get-val", children: [formatNumber$2(estimatedOutputAmount.toString()), " ", bondData === null || bondData === void 0 ? void 0 : bondData.showcaseTokenName, " = $", ' ', formatUSDNumber(estimatedOutputUSD.toString())] }))] })] }));
|
|
73976
|
+
};
|
|
73977
|
+
|
|
73978
|
+
// Custom HTML sanitizer
|
|
73979
|
+
function sanitizeHTML(html) {
|
|
73980
|
+
var _a;
|
|
73981
|
+
const tagWhitelist = ['a', 'br', 'span']; // Allowed tags
|
|
73982
|
+
const attrWhitelist = ['target', 'rel', 'style', 'href']; // Allowed attributes
|
|
73983
|
+
const doc = new DOMParser().parseFromString(html, 'text/html');
|
|
73984
|
+
const elements = doc.body.querySelectorAll('*');
|
|
73985
|
+
for (const el of elements) {
|
|
73986
|
+
// Remove elements that are not in the whitelist
|
|
73987
|
+
if (!tagWhitelist.includes(el.tagName.toLowerCase())) {
|
|
73988
|
+
(_a = el === null || el === void 0 ? void 0 : el.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(el);
|
|
73989
|
+
continue;
|
|
73990
|
+
}
|
|
73991
|
+
// Loop through the element's attributes and remove those that are not in the whitelist
|
|
73992
|
+
Array.from(el.attributes).forEach((attr) => {
|
|
73993
|
+
if (!attrWhitelist.includes(attr.name.toLowerCase())) {
|
|
73994
|
+
el.removeAttribute(attr.name);
|
|
73995
|
+
}
|
|
73996
|
+
});
|
|
73997
|
+
}
|
|
73998
|
+
return doc.body.innerHTML;
|
|
73999
|
+
}
|
|
74000
|
+
const SafeHTMLComponent = ({ html }) => {
|
|
74001
|
+
const sanitizedHTML = sanitizeHTML(html);
|
|
74002
|
+
return jsx$2("div", { dangerouslySetInnerHTML: { __html: sanitizedHTML } });
|
|
74003
|
+
};
|
|
74004
|
+
|
|
74005
|
+
const ProjectDescription = ({ description }) => {
|
|
74006
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
74007
|
+
return (jsxs(Flex, { className: "description-container", children: [jsxs(Flex, { sx: { display: ['flex', 'flex', 'flex', 'none'], flexDirection: 'column' }, children: [jsx$2(Text, { sx: {
|
|
74008
|
+
fontSize: ['12px', '12px', '12px', '14px'],
|
|
74009
|
+
mt: '10px',
|
|
74010
|
+
lineHeight: ['18px', '18px', '18px', '21px'],
|
|
74011
|
+
fontWeight: 400,
|
|
74012
|
+
overflow: 'hidden',
|
|
74013
|
+
maxHeight: isOpen ? 'unset' : '54px',
|
|
74014
|
+
}, children: description && jsx$2(SafeHTMLComponent, { html: description }) }), !isOpen && (jsxs(Text, { sx: {
|
|
74015
|
+
color: 'primaryButton',
|
|
74016
|
+
fontSize: '12px',
|
|
74017
|
+
lineHeight: '18px',
|
|
74018
|
+
fontWeight: 400,
|
|
74019
|
+
cursor: 'pointer',
|
|
74020
|
+
}, onClick: () => setIsOpen(true), children: ["View More ", '>'] }))] }), jsx$2(Flex, { sx: { display: ['none', 'none', 'none', 'flex'] }, children: jsx$2(SafeHTMLComponent, { html: description !== null && description !== void 0 ? description : '' }) })] }));
|
|
74021
|
+
};
|
|
74022
|
+
|
|
74023
|
+
const BondModalHeaderAlt = ({ bondData, onDismiss, showProjectInfoButton, }) => {
|
|
74024
|
+
var _a, _b, _c, _d, _e, _f;
|
|
74025
|
+
const [onOpenSlippageModal] = useModal(jsx$2(SlippageModal, {}));
|
|
74026
|
+
const handleClose = () => {
|
|
74027
|
+
if (typeof window !== 'undefined') {
|
|
74028
|
+
window.history.pushState({}, '', `/bonds`);
|
|
74029
|
+
}
|
|
74030
|
+
onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss();
|
|
74031
|
+
};
|
|
74032
|
+
// const handleProjectViewNavigation = () => {
|
|
74033
|
+
// window.open(`${window.location.origin}/bonds/${bondData.billAddress}/${bondData.chainId}`, '_self')
|
|
74034
|
+
// track({
|
|
74035
|
+
// event: 'projectInfoClick',
|
|
74036
|
+
// chain: bondData.chainId,
|
|
74037
|
+
// data: {
|
|
74038
|
+
// cat: 'Modal',
|
|
74039
|
+
// bond: bondData.earnToken.symbol,
|
|
74040
|
+
// bondChain: bondData.chainId,
|
|
74041
|
+
// },
|
|
74042
|
+
// })
|
|
74043
|
+
// }
|
|
74044
|
+
return (jsx$2(Flex, { className: "modaltable-container title-container", children: jsx$2(Flex, { className: "slipagge-close-icons", sx: { flexDirection: 'row' }, children: onDismiss ? (jsxs(Fragment$1, { children: [jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(BondInfoTooltip, { earnTokenContract: (_c = (_b = (_a = bondData === null || bondData === void 0 ? void 0 : bondData.earnToken) === null || _a === void 0 ? void 0 : _a.address) === null || _b === void 0 ? void 0 : _b[bondData === null || bondData === void 0 ? void 0 : bondData.chainId]) !== null && _c !== void 0 ? _c : '', earnTokenSymbol: (_e = (_d = bondData === null || bondData === void 0 ? void 0 : bondData.earnToken) === null || _d === void 0 ? void 0 : _d.symbol) !== null && _e !== void 0 ? _e : '', bondContract: (_f = bondData.billAddress) !== null && _f !== void 0 ? _f : '', projectLink: bondData === null || bondData === void 0 ? void 0 : bondData.projectLink, twitter: bondData === null || bondData === void 0 ? void 0 : bondData.twitter, audit: bondData === null || bondData === void 0 ? void 0 : bondData.audit, chain: bondData === null || bondData === void 0 ? void 0 : bondData.chainId }), 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" }) }) }), jsx$2(Flex, { sx: { pr: '10px' }, onClick: onOpenSlippageModal, children: jsx$2(Svg, { icon: "cog", width: "16px" }) }), jsx$2(IconButton, { icon: "close", color: "text", variant: "transparent", onClick: handleClose })] })) : (jsx$2(Flex, { sx: {}, onClick: onOpenSlippageModal, children: jsx$2(Svg, { icon: "cog", width: "16px" }) })) }) }));
|
|
74045
|
+
};
|
|
74046
|
+
|
|
74047
|
+
const ImageAndShortDescription = ({ bondData, onDismiss }) => {
|
|
74048
|
+
var _a;
|
|
74049
|
+
const SDKConfig = useSDKConfig();
|
|
74050
|
+
// Swiper logic for the alt view
|
|
74051
|
+
const [activeSlide, setActiveSlide] = useState(0);
|
|
74052
|
+
const { swiper, setSwiper } = useSwiper();
|
|
74053
|
+
const imagesLength = 3;
|
|
74054
|
+
const handleSlide = (event) => {
|
|
74055
|
+
const slideNumber = getDotPos(event.activeIndex, imagesLength);
|
|
74056
|
+
setActiveSlide(slideNumber);
|
|
74057
|
+
};
|
|
74058
|
+
const slideTo = (index) => {
|
|
74059
|
+
setActiveSlide(index);
|
|
74060
|
+
swiper === null || swiper === void 0 ? void 0 : swiper.slideTo(index);
|
|
74061
|
+
};
|
|
74062
|
+
return (jsxs(Flex, { sx: { maxWidth: ['unset', 'unset', 'unset', '500px'], flexDirection: 'column', alignItems: 'center' }, children: [jsxs(Flex, { sx: {
|
|
74063
|
+
flexDirection: 'column',
|
|
74064
|
+
width: '100%',
|
|
74065
|
+
alignItems: 'center',
|
|
74066
|
+
overflow: 'hidden',
|
|
74067
|
+
position: 'relative',
|
|
74068
|
+
}, children: [jsxs(Swiper, { id: "hotbondsSweper", onSwiper: setSwiper, slidesPerView: "auto", centeredSlides: true, lazy: true, preloadImages: false, onSlideChange: handleSlide, style: { width: '100%', overflow: 'visible' }, children: [jsx$2(SwiperSlide, { style: {
|
|
74069
|
+
width: '100%',
|
|
74070
|
+
display: 'flex',
|
|
74071
|
+
justifyContent: 'center',
|
|
74072
|
+
}, children: jsx$2("img", { className: "project-image", src: "https://placehold.co/400x200" }) }, 0), jsx$2(SwiperSlide, { style: {
|
|
74073
|
+
width: '100%',
|
|
74074
|
+
display: 'flex',
|
|
74075
|
+
justifyContent: 'center',
|
|
74076
|
+
}, children: jsx$2("img", { className: "project-image", src: "https://placehold.co/400x200" }) }, 1), jsx$2(SwiperSlide, { style: {
|
|
74077
|
+
width: '100%',
|
|
74078
|
+
display: 'flex',
|
|
74079
|
+
justifyContent: 'center',
|
|
74080
|
+
}, children: jsx$2("img", { className: "project-image", src: "https://placehold.co/400x200" }) }, 2)] }), jsx$2(Flex, { sx: { position: 'absolute', bottom: ['15px', '15px', '15px', '20px'], left: 'calc(50% - 28,5px)', zIndex: 2 }, children: [...Array(imagesLength)].map((_, i) => {
|
|
74081
|
+
return jsx$2(SwiperDots, { isActive: i === activeSlide, onClick: () => slideTo(i) }, i);
|
|
74082
|
+
}) })] }), jsxs(Flex, { sx: { alignItems: 'center', display: ['flex', 'flex', 'flex', 'none'], p: '10px', width: '100%' }, children: [jsxs(Flex, { sx: { width: ['50%', '50%', '50%', '100%'], alignItems: 'center' }, children: [jsx$2(Flex, { sx: { mr: '5px' }, children: jsx$2(TokenImage, { symbol: (_a = bondData.showcaseTokenName) !== null && _a !== void 0 ? _a : bondData.earnToken.symbol, size: 30, chain: bondData.chainId }) }), jsxs("h2", { className: "modal-tokenname-chainicon", sx: { margin: '0px' }, children: [bondData === null || bondData === void 0 ? void 0 : bondData.showcaseTokenName, ' '] })] }), jsx$2(Flex, { className: "modal-marketprice-header", sx: { justifyContent: 'flex-end', alignItems: 'center' }, children: jsxs("span", { className: "modal-marketprice", children: ["Market Price: $", earnTokenPrice(bondData)] }) }), jsx$2(Flex, { className: "bondmodal-header-alt", sx: { mb: '10px' }, children: jsx$2(BondModalHeaderAlt, { bondData: bondData, onDismiss: onDismiss, showProjectInfoButton: (SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.referenceId) === 'apebond' }) })] }), jsx$2(Flex, { className: "description-container paragraph-spaced", sx: { px: '10px', opacity: 0.7, mt: ['0', '0', '0', '10px'] }, children: jsx$2(ProjectDescription, { description: bondData === null || bondData === void 0 ? void 0 : bondData.shortDescription }) })] }));
|
|
74083
|
+
};
|
|
74084
|
+
|
|
74085
|
+
// Fetch country code to check if the region is allowed
|
|
74086
|
+
const fetchLocation = (apiv2URL) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
74087
|
+
const resp = yield axios.get(`${apiv2URL}/check`);
|
|
74088
|
+
const { isRestrictedRegion, countryCode } = resp === null || resp === void 0 ? void 0 : resp.data;
|
|
74089
|
+
return { isRestrictedRegion, countryCode };
|
|
74090
|
+
});
|
|
74091
|
+
function useGeoFencing() {
|
|
74092
|
+
const apiv2URL = useURLByEnvironment('apiV2');
|
|
74093
|
+
return useQuery({
|
|
74094
|
+
queryKey: [QUERY_KEYS.GEO_FENCING],
|
|
74095
|
+
queryFn: () => fetchLocation(apiv2URL),
|
|
74096
|
+
staleTime: Infinity,
|
|
74097
|
+
refetchOnMount: false,
|
|
74098
|
+
refetchOnWindowFocus: false,
|
|
74099
|
+
});
|
|
74100
|
+
}
|
|
74101
|
+
|
|
74102
|
+
const RestrictedRegionModal = ({ onDismiss }) => {
|
|
74103
|
+
const { data: geoData } = useGeoFencing();
|
|
74104
|
+
return (jsxs(Modal, { className: "modal", title: "Notice", sx: { maxWidth: '200px' }, children: [jsxs(Flex, { sx: { my: '20px' }, children: ["Unfortunately, this bond is restricted for your region: ", geoData === null || geoData === void 0 ? void 0 : geoData.countryCode, "."] }), jsx$2(Button, { fullWidth: true, onClick: onDismiss, children: "Close" })] }));
|
|
74105
|
+
};
|
|
74106
|
+
|
|
74107
|
+
const TagMinTierBond = ({ userTier, minTier }) => {
|
|
74134
74108
|
return (jsxs(Flex, { sx: {
|
|
74135
74109
|
p: '5px 10px',
|
|
74136
74110
|
width: '100%',
|
|
74137
|
-
background: '#
|
|
74111
|
+
background: '#DE62F366',
|
|
74138
74112
|
borderRadius: 'normal',
|
|
74139
74113
|
mt: '10px',
|
|
74140
74114
|
fontSize: '12px',
|
|
@@ -74142,11 +74116,56 @@ const TagXmasFlashBond = ({ userTier, minTier }) => {
|
|
|
74142
74116
|
justifyContent: 'center',
|
|
74143
74117
|
textAlign: 'center',
|
|
74144
74118
|
display: 'block',
|
|
74145
|
-
}, children: ["
|
|
74119
|
+
}, children: ["To be eligible to purchase this bond you need to get a", jsxs("span", { style: { fontWeight: 700 }, children: [` ${TIERS_NAMES[minTier]}`, " Tier or better!"] })] }));
|
|
74120
|
+
};
|
|
74121
|
+
|
|
74122
|
+
const NewRateModal = ({ bond, zapTrueBondPrice, depositAmount, youSpendString, isZap, fetchingZapQuote, zapError, handleZap, onDismiss, }) => {
|
|
74123
|
+
var _a, _b, _c, _d, _e;
|
|
74124
|
+
const tokenSymbol = (_a = bond === null || bond === void 0 ? void 0 : bond.earnToken) === null || _a === void 0 ? void 0 : _a.symbol;
|
|
74125
|
+
const oldBonus = (_b = bond === null || bond === void 0 ? void 0 : bond.bonusWithFee) !== null && _b !== void 0 ? _b : 0;
|
|
74126
|
+
const fee = (_c = bond === null || bond === void 0 ? void 0 : bond.feeInPayout) !== null && _c !== void 0 ? _c : 0;
|
|
74127
|
+
const earnTokenPrice = parseFloat((_d = bond === null || bond === void 0 ? void 0 : bond.payoutTokenPrice) !== null && _d !== void 0 ? _d : '0');
|
|
74128
|
+
const lpPrice = parseFloat((_e = bond === null || bond === void 0 ? void 0 : bond.principalTokenPrice) !== null && _e !== void 0 ? _e : '0');
|
|
74129
|
+
const trueBillPriceMinusFee = new BigNumber$1(zapTrueBondPrice !== null && zapTrueBondPrice !== void 0 ? zapTrueBondPrice : '0').times((100 + fee) / 100);
|
|
74130
|
+
const priceUSDMinusFee = getBalanceNumber(trueBillPriceMinusFee) * lpPrice;
|
|
74131
|
+
const discountWithoutFee = ((earnTokenPrice - priceUSDMinusFee) / earnTokenPrice) * 100;
|
|
74132
|
+
const zapBonusWithFee = discountWithoutFee > 0 ? (discountWithoutFee / (100 - discountWithoutFee)) * 100 : 0;
|
|
74133
|
+
return (jsx$2(Modal, { title: "Bonus update", sx: { width: '380px' }, children: jsxs(Flex, { sx: { width: '100%', alignItems: 'center', flexDirection: 'column', mt: '10px' }, children: [jsxs(Flex, { sx: { display: 'block', fontSize: '14px', fontWeight: 500, color: 'textDisabledButton' }, children: ["The bonus for the bond you are purchasing has been adjusted by", ' ', jsxs(Text, { sx: { color: 'error' }, children: [(zapBonusWithFee - oldBonus).toFixed(2), "%"] }), "."] }), jsxs(Flex, { sx: {
|
|
74134
|
+
p: '8px 4px 4px 4px',
|
|
74135
|
+
borderRadius: '8px',
|
|
74136
|
+
width: '100%',
|
|
74137
|
+
alignItems: 'center',
|
|
74138
|
+
}, children: [jsxs(Flex, { sx: { alignItems: 'center' }, children: [jsx$2(TokenImage, { size: 30, symbol: tokenSymbol }), jsxs(Flex, { sx: { flexDirection: 'column', ml: '10px' }, children: [jsx$2(Text, { sx: { fontSize: '12px', fontWeight: '300', lineHeight: '14px' }, children: "Old Bonus:" }), jsxs(Text, { sx: { fontSize: '12px', fontWeight: 400 }, children: [oldBonus === null || oldBonus === void 0 ? void 0 : oldBonus.toFixed(2), "% ", tokenSymbol] })] })] }), jsx$2(Flex, { sx: { width: '15px', height: '15px', ml: '20px', mr: '10px', alignItems: 'center' }, children: jsx$2(Svg, { icon: "arrow", direction: "right" }) }), jsxs(Flex, { sx: { alignItems: 'center' }, children: [jsx$2(TokenImage, { size: 30, symbol: tokenSymbol }), jsxs(Flex, { sx: { flexDirection: 'column', ml: '10px' }, children: [jsx$2(Text, { sx: { fontSize: '12px', fontWeight: '300', lineHeight: '14px' }, children: "New Bonus:" }), jsxs(Text, { sx: { fontSize: '12px', fontWeight: 400 }, children: [zapBonusWithFee.toFixed(2), "% ", tokenSymbol] })] })] })] }), jsx$2(Estimations, { depositAmount: depositAmount, bondData: Object.assign(Object.assign({}, bond), { trueBillPrice: zapTrueBondPrice }), youSpendString: youSpendString, isZap: isZap, fetchingZapQuote: fetchingZapQuote, zapError: zapError }), jsx$2(Flex, { sx: {
|
|
74139
|
+
width: '100%',
|
|
74140
|
+
fontSize: '14px',
|
|
74141
|
+
fontWeight: 500,
|
|
74142
|
+
color: 'textDisabledButton',
|
|
74143
|
+
justifyContent: 'flex-start',
|
|
74144
|
+
mb: '10px',
|
|
74145
|
+
}, children: "Would you like to confirm the new rate?" }), jsx$2(Button, { fullWidth: true, onClick: () => {
|
|
74146
|
+
handleZap();
|
|
74147
|
+
onDismiss && onDismiss();
|
|
74148
|
+
}, disabled: fetchingZapQuote, load: fetchingZapQuote, children: fetchingZapQuote ? 'Loading' : 'Buy' })] }) }));
|
|
74149
|
+
};
|
|
74150
|
+
|
|
74151
|
+
const NoBonusModal = ({ onAcknowledge, showcaseTokenName }) => {
|
|
74152
|
+
const [isOpen, setIsOpen] = useState(true);
|
|
74153
|
+
const [isChecked, setIsChecked] = useState(false);
|
|
74154
|
+
const handleAcknowledge = () => {
|
|
74155
|
+
onAcknowledge();
|
|
74156
|
+
setIsOpen(false);
|
|
74157
|
+
};
|
|
74158
|
+
const handleCancel = () => {
|
|
74159
|
+
setIsOpen(false);
|
|
74160
|
+
};
|
|
74161
|
+
const handleCheckboxChange = () => {
|
|
74162
|
+
setIsChecked(!isChecked);
|
|
74163
|
+
};
|
|
74164
|
+
return (isOpen && (jsxs(Modal, { className: "nobonus-modal", title: "Warning", onClose: handleAcknowledge, children: [jsxs("p", { children: ["You're buying ", showcaseTokenName, " at a higher price than the market, which will result in receiving fewer tokens compared to swapping via an exchange."] }), jsx$2("p", { children: "You will not receive any bonus tokens when buying this bond." }), jsxs(Flex, { className: "nobonus-checkbox-row", sx: { flexDirection: 'row', gap: '8px', pb: '20px' }, children: [jsx$2(Flex, { className: "nobonus-checkbox", children: jsx$2(Checkbox, { onChange: handleCheckboxChange }) }), jsx$2(Flex, { className: "nobonus-checkbox-text", children: "I understand and want to proceed." })] }), jsxs(Flex, { className: "nobonus-actions", sx: { flexDirection: 'row', gap: '8px' }, children: [jsx$2(Button, { classname: "nobonus-cancel", onClick: handleCancel, sx: { width: '100%', justifyContent: 'center' }, variant: "secondary", children: "Cancel" }), jsx$2(Button, { className: "nobonus-buy", onClick: handleAcknowledge, disabled: !isChecked, sx: { width: '100%', justifyContent: 'center' }, children: "Buy" })] })] })));
|
|
74146
74165
|
};
|
|
74147
74166
|
|
|
74148
74167
|
const BondModal = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond }) => {
|
|
74149
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
74168
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
74150
74169
|
const SDKConfig = useSDKConfig();
|
|
74151
74170
|
const { data: geoData } = useGeoFencing();
|
|
74152
74171
|
// State
|
|
@@ -74163,19 +74182,21 @@ const BondModal = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond }) =
|
|
|
74163
74182
|
const { data: userEscrowWeight } = useGetUserEscrowWeight(account);
|
|
74164
74183
|
const userTier = getUserTier(userEscrowWeight !== null && userEscrowWeight !== void 0 ? userEscrowWeight : '0');
|
|
74165
74184
|
// State
|
|
74166
|
-
const bondData =
|
|
74167
|
-
const
|
|
74185
|
+
const bondData = bonds === null || bonds === void 0 ? void 0 : bonds.find((bond) => { var _a; return ((_a = bond === null || bond === void 0 ? void 0 : bond.billAddress) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === (bondAddress === null || bondAddress === void 0 ? void 0 : bondAddress.toLowerCase()); });
|
|
74186
|
+
const minTier = (bondData === null || bondData === void 0 ? void 0 : bondData.minTier) !== undefined ? bondData.minTier : null;
|
|
74168
74187
|
const [buyTxHash, setBuyTxHash] = useState();
|
|
74169
74188
|
const [inputValue, setInputValue] = useState('');
|
|
74170
|
-
const [inputTokenString, setInputTokenString] = useState((
|
|
74189
|
+
const [inputTokenString, setInputTokenString] = useState((_b = (_a = bondData === null || bondData === void 0 ? void 0 : bondData.lpToken) === null || _a === void 0 ? void 0 : _a.address) === null || _b === void 0 ? void 0 : _b[bondData.chainId]);
|
|
74171
74190
|
// Data
|
|
74172
74191
|
const inputToken = useTokenFromZapList(inputTokenString, bondData === null || bondData === void 0 ? void 0 : bondData.chainId, bondData === null || bondData === void 0 ? void 0 : bondData.lpToken);
|
|
74173
|
-
const isZap = (inputTokenString === null || inputTokenString === void 0 ? void 0 : inputTokenString.toLowerCase()) !== ((
|
|
74174
|
-
const [fetchingZapQuote, zapData, zapDepositAmount, zapError] = useSoulZapBondQuote(inputValue, inputToken, bondData, account);
|
|
74192
|
+
const isZap = (inputTokenString === null || inputTokenString === void 0 ? void 0 : inputTokenString.toLowerCase()) !== ((_e = (_d = (_c = bondData === null || bondData === void 0 ? void 0 : bondData.lpToken) === null || _c === void 0 ? void 0 : _c.address) === null || _d === void 0 ? void 0 : _d[bondData === null || bondData === void 0 ? void 0 : bondData.chainId]) === null || _e === void 0 ? void 0 : _e.toLowerCase());
|
|
74193
|
+
const [fetchingZapQuote, zapData, zapDepositAmount, zapError, zapTrueBondPrice] = useSoulZapBondQuote(inputValue, inputToken, bondData, account);
|
|
74175
74194
|
const inputTokenPrice = useCurrencyPrice(inputToken !== null && inputToken !== void 0 ? inputToken : null, bondChain);
|
|
74176
|
-
const { data: inputCurrencyBalance } = useCurrencyBalance(inputToken !== null && inputToken !== void 0 ? inputToken : null, account !== null && account !== void 0 ? account : null, (
|
|
74195
|
+
const { data: inputCurrencyBalance } = useCurrencyBalance(inputToken !== null && inputToken !== void 0 ? inputToken : null, account !== null && account !== void 0 ? account : null, (_f = bondData === null || bondData === void 0 ? void 0 : bondData.chainId) !== null && _f !== void 0 ? _f : null);
|
|
74177
74196
|
// Estimations
|
|
74178
74197
|
const depositAmount = isZap ? zapDepositAmount : inputValue;
|
|
74198
|
+
const youSpendString = `${formatNumber$2(inputValue)} ${getSymbol(inputToken, bondData === null || bondData === void 0 ? void 0 : bondData.chainId)} =
|
|
74199
|
+
$${formatUSDNumber((parseFloat(inputValue) * ((_g = inputTokenPrice === null || inputTokenPrice === void 0 ? void 0 : inputTokenPrice.price) !== null && _g !== void 0 ? _g : 0)).toString())}`;
|
|
74179
74200
|
// Loading State
|
|
74180
74201
|
const [loadingTx, setLoadingTx] = useState(false);
|
|
74181
74202
|
const { addToastError } = usePopups();
|
|
@@ -74325,6 +74346,8 @@ const BondModal = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond }) =
|
|
|
74325
74346
|
'0x94A283756B70c2A77bc58Ae0E2615Caf14310186'.toLowerCase(),
|
|
74326
74347
|
'0x6639D4acAe77967c253C75cBfEd7C612682E2704'.toLowerCase(),
|
|
74327
74348
|
];
|
|
74349
|
+
const rateChanged = parseFloat(zapTrueBondPrice !== null && zapTrueBondPrice !== void 0 ? zapTrueBondPrice : '0') > parseFloat((_k = bondData === null || bondData === void 0 ? void 0 : bondData.trueBillPrice) !== null && _k !== void 0 ? _k : '0');
|
|
74350
|
+
const [openNewRateModal] = useModal(jsx$2(NewRateModal, { bond: bondData, zapTrueBondPrice: zapTrueBondPrice, depositAmount: depositAmount, youSpendString: youSpendString, isZap: isZap, fetchingZapQuote: fetchingZapQuote, zapError: zapError, handleZap: () => handleZapCallback().finally(() => setLoadingTx(false)) }), true, false);
|
|
74328
74351
|
const handleBothPurchases = () => {
|
|
74329
74352
|
var _a, _b;
|
|
74330
74353
|
if ((geoData === null || geoData === void 0 ? void 0 : geoData.countryCode) === 'AE' && blockedBondsForAE.includes((_b = (_a = bondData === null || bondData === void 0 ? void 0 : bondData.billAddress) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== null && _b !== void 0 ? _b : '')) {
|
|
@@ -74333,7 +74356,12 @@ const BondModal = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond }) =
|
|
|
74333
74356
|
else {
|
|
74334
74357
|
setLoadingTx(true);
|
|
74335
74358
|
if (isZap) {
|
|
74336
|
-
|
|
74359
|
+
if (rateChanged) {
|
|
74360
|
+
openNewRateModal();
|
|
74361
|
+
}
|
|
74362
|
+
else {
|
|
74363
|
+
handleZapCallback().finally(() => setLoadingTx(false));
|
|
74364
|
+
}
|
|
74337
74365
|
}
|
|
74338
74366
|
else {
|
|
74339
74367
|
handleBuyCallback().finally(() => setLoadingTx(false));
|
|
@@ -74362,7 +74390,20 @@ const BondModal = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond }) =
|
|
|
74362
74390
|
window.open(`https://ape.bond/swap?outputcurrency=${bondData === null || bondData === void 0 ? void 0 : bondData.lpToken.address[bondData === null || bondData === void 0 ? void 0 : bondData.chainId]}&outputChain=${bondData === null || bondData === void 0 ? void 0 : bondData.chainId}`, '_blank');
|
|
74363
74391
|
}
|
|
74364
74392
|
};
|
|
74365
|
-
|
|
74393
|
+
// Effects
|
|
74394
|
+
const [hasChecked, setHasChecked] = useState(false);
|
|
74395
|
+
useEffect(() => {
|
|
74396
|
+
var _a, _b, _c;
|
|
74397
|
+
if (inputCurrencyBalance !== 'undefined' &&
|
|
74398
|
+
inputCurrencyBalance === '0' &&
|
|
74399
|
+
(inputTokenString === null || inputTokenString === void 0 ? void 0 : inputTokenString.toLowerCase()) === ((_c = (_b = (_a = bondData === null || bondData === void 0 ? void 0 : bondData.lpToken) === null || _a === void 0 ? void 0 : _a.address) === null || _b === void 0 ? void 0 : _b[bondData === null || bondData === void 0 ? void 0 : bondData.chainId]) === null || _c === void 0 ? void 0 : _c.toLowerCase()) &&
|
|
74400
|
+
!hasChecked) {
|
|
74401
|
+
setHasChecked(true);
|
|
74402
|
+
setInputTokenString('NATIVE');
|
|
74403
|
+
console.log('change to native');
|
|
74404
|
+
}
|
|
74405
|
+
}, [inputCurrencyBalance]);
|
|
74406
|
+
return (jsx$2(Modal, { className: "modal", onDismiss: onDismiss, sx: { width: '400px' }, children: modalVariant === 'standard' ? (jsx$2(Fragment$1, { children: bondData && (jsxs(Flex, { className: "modal-content", children: [typeof window !== 'undefined' && window.location.origin === 'http://localhost:5173' && (jsxs(Text, { sx: { borderBottom: '1px solid white', fontSize: '14px', mb: '10px' }, children: ["Dev mode - Current view: \"standard\"", jsx$2(Text, { onClick: () => setModalVariant('alt'), sx: { ml: '15px', textDecoration: 'underline', cursor: 'pointer' }, children: "Switch view" })] })), jsxs(Flex, { className: "modaltable-container", children: [jsx$2(BondModalHeader, { bondData: bondData, onDismiss: onDismiss, showProjectInfoButton: (SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.referenceId) === 'apebond' }), jsx$2(ProjectDescription, { description: bondData.shortDescription }), jsx$2(BondCards, { bondData: bondData }), jsx$2(Estimations, { depositAmount: depositAmount, bondData: bondData, youSpendString: youSpendString, isZap: isZap, fetchingZapQuote: fetchingZapQuote, zapError: zapError }), jsx$2(TokenSelectorPanel, { typedValue: inputValue, setTypedValue: setInputValue, selectedToken: inputToken, handleValueBtn: () => { var _a; return setInputValue((_a = new BigNumber$1(inputCurrencyBalance !== null && inputCurrencyBalance !== void 0 ? inputCurrencyBalance : '0')) === null || _a === void 0 ? void 0 : _a.toString()); }, handleCurrencySelect: handleCurrencySelect, chainId: bondData === null || bondData === void 0 ? void 0 : bondData.chainId, enableZap: supportedByLIFI.includes(bondData === null || bondData === void 0 ? void 0 : bondData.chainId), bondPrincipalToken: bondData === null || bondData === void 0 ? void 0 : bondData.lpToken, tokenBalance: inputCurrencyBalance, selectedTokenPrice: inputTokenPrice === null || inputTokenPrice === void 0 ? void 0 : inputTokenPrice.price, inputDisabled: minTier !== null && (!userTier || userTier < minTier) ? true : false }), bondData.type === 'staking' && (jsxs(Flex, { sx: {
|
|
74366
74407
|
p: '5px 10px',
|
|
74367
74408
|
width: '100%',
|
|
74368
74409
|
background: '#8E568F',
|
|
@@ -74372,8 +74413,7 @@ const BondModal = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond }) =
|
|
|
74372
74413
|
fontWeight: 400,
|
|
74373
74414
|
justifyContent: 'center',
|
|
74374
74415
|
display: 'block',
|
|
74375
|
-
}, children: ["Tokens bought through this bond will go directly to the", ' ', jsx$2("span", { onClick: () => window.open('https://basepad.finance/earn', '_blank'), style: { textDecoration: 'underline', cursor: 'pointer', color: 'blue' }, children: "$BPAD staking pool" }), ' ', "with a ", daysLeftOnBasepadPool(), " days lock."] })),
|
|
74376
|
-
(!isXmasStyle || (isXmasStyle && bondData.minTier && userTier && userTier >= bondData.minTier)) && (jsx$2(Flex, { className: "button-container get", children: jsxs(Button, { className: "action-button", onClick: () => supportedByLIFI.includes(bondData === null || bondData === void 0 ? void 0 : bondData.chainId) ? handleOpenZapModal() : openExternal(), variant: "secondary", children: ["Get ", getSymbol(bondData === null || bondData === void 0 ? void 0 : bondData.lpToken)] }) })), jsx$2(Flex, { className: "button-container buy", children: !account ? (jsx$2(ConnectButton, {})) : isXmasStyle && bondData.minTier && (!userTier || userTier < bondData.minTier) ? (jsx$2(Button, { className: "action-button", onClick: () => window.open(`https://www.ape.bond/tier-staking`, '_blank'), children: "GET YOUR TIER" })) : userChainId !== bondData.chainId ? (jsx$2(Button, { className: "switch-button", disabled: loadingTx || isConfirming || (bondData === null || bondData === void 0 ? void 0 : bondData.soldOut), onClick: (event) => {
|
|
74416
|
+
}, children: ["Tokens bought through this bond will go directly to the", ' ', jsx$2("span", { onClick: () => window.open('https://basepad.finance/earn', '_blank'), style: { textDecoration: 'underline', cursor: 'pointer', color: 'blue' }, children: "$BPAD staking pool" }), ' ', "with a ", daysLeftOnBasepadPool(), " days lock."] })), minTier !== null && jsx$2(TagMinTierBond, { userTier: userTier, minTier: minTier }), jsxs(Flex, { className: "modaltable-container button-container", children: [account && (minTier === null || (minTier !== null && userTier !== null && userTier >= minTier)) && (jsx$2(Flex, { className: "button-container get", children: jsxs(Button, { className: "action-button", onClick: () => supportedByLIFI.includes(bondData === null || bondData === void 0 ? void 0 : bondData.chainId) ? handleOpenZapModal() : openExternal(), variant: "secondary", fullWidth: true, children: ["Get ", getSymbol(bondData === null || bondData === void 0 ? void 0 : bondData.lpToken)] }) })), jsx$2(Flex, { className: "button-container buy", children: !account ? (jsx$2(ConnectButton, {})) : minTier !== null && (!userTier || userTier < minTier) ? (jsx$2(Button, { className: "action-button", onClick: () => window.open(`https://www.ape.bond/tier-staking`, '_blank'), children: "GET YOUR TIER" })) : userChainId !== bondData.chainId ? (jsx$2(Button, { className: "action-button", disabled: loadingTx || isConfirming || (bondData === null || bondData === void 0 ? void 0 : bondData.soldOut), onClick: (event) => {
|
|
74377
74417
|
event.stopPropagation();
|
|
74378
74418
|
switchChain({ chainId: bondData.chainId });
|
|
74379
74419
|
}, style: { fontSize: '14px', padding: '6px', marginLeft: '0px' }, children: `Switch to ${NETWORK_LABEL[bondData.chainId]}` })) : approvalState === ApprovalState.APPROVED ? (jsx$2(Button, { className: "action-button", load: load || fetchingZapQuote, disabled: load ||
|
|
@@ -74386,8 +74426,8 @@ const BondModal = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond }) =
|
|
|
74386
74426
|
(bondData === null || bondData === void 0 ? void 0 : bondData.soldOut) ||
|
|
74387
74427
|
!account ||
|
|
74388
74428
|
!inputValue ||
|
|
74389
|
-
parseFloat(inputValue) === 0, onClick: handleApprove, children: "enable" })) })] })] })] })) })) : (jsx$2(Fragment$1, { children: bondData && (jsxs(Fragment$1, { children: [jsxs(Flex, { className: "modal-content font-small", children: [typeof window !== 'undefined' && window.location.origin === 'http://localhost:5173' && (jsxs(Text, { sx: { borderBottom: '1px solid white' }, children: ["Dev Mode - Current view: \"alt\"", jsx$2(Text, { onClick: () => setModalVariant('standard'), sx: { ml: '15px', textDecoration: 'underline', cursor: 'pointer' }, children: "Switch view" })] })), jsxs(Flex, { className: "modaltable-container", sx: { flexDirection: 'row', gap: ['0px', '0px', '0px', '20px'] }, children: [jsx$2(ImageAndShortDescription, { bondData: bondData, onDismiss: onDismiss }), jsxs(Flex, { sx: { flexDirection: 'column', width: '600px' }, children: [jsxs(Flex, { sx: { alignItems: 'center', display: ['none', 'none', 'none', 'flex'] }, children: [jsx$2(Flex, { sx: { width: ['50%', '50%', '50%', '50%'], ml: ['0px', '0px', '0px', '10px'] }, children: jsxs(Flex, { className: "modal-tokenname-chainicon", sx: { margin: '0px' }, children: [jsx$2(Flex, { sx: { fontSize: '26px', fontWeight: 700, mr: '4px' }, children: bondData === null || bondData === void 0 ? void 0 : bondData.showcaseTokenName }), jsx$2(Svg, { width: 20, height: 20, icon: (
|
|
74390
|
-
lodashExports.toNumber(inputValue) / lodashExports.toNumber(earnTokenPrice(bondData))).toFixed(0))] }), jsx$2("span", { className: "text-highlight", children: "\u00A0Additional" })] })] }), jsx$2(Flex, { className: "button-container buy", sx: { justifyContent: 'end' }, children: !account ? (jsx$2(ConnectButton, {})) : userChainId !== bondData.chainId ? (jsx$2(Button, { className: "
|
|
74429
|
+
parseFloat(inputValue) === 0, onClick: handleApprove, children: "enable" })) })] })] })] })) })) : (jsx$2(Fragment$1, { children: bondData && (jsxs(Fragment$1, { children: [jsxs(Flex, { className: "modal-content font-small", children: [typeof window !== 'undefined' && window.location.origin === 'http://localhost:5173' && (jsxs(Text, { sx: { borderBottom: '1px solid white' }, children: ["Dev Mode - Current view: \"alt\"", jsx$2(Text, { onClick: () => setModalVariant('standard'), sx: { ml: '15px', textDecoration: 'underline', cursor: 'pointer' }, children: "Switch view" })] })), jsxs(Flex, { className: "modaltable-container", sx: { flexDirection: 'row', gap: ['0px', '0px', '0px', '20px'] }, children: [jsx$2(ImageAndShortDescription, { bondData: bondData, onDismiss: onDismiss }), jsxs(Flex, { sx: { flexDirection: 'column', width: '600px' }, children: [jsxs(Flex, { sx: { alignItems: 'center', display: ['none', 'none', 'none', 'flex'] }, children: [jsx$2(Flex, { sx: { width: ['50%', '50%', '50%', '50%'], ml: ['0px', '0px', '0px', '10px'] }, children: jsxs(Flex, { className: "modal-tokenname-chainicon", sx: { margin: '0px' }, children: [jsx$2(Flex, { sx: { fontSize: '26px', fontWeight: 700, mr: '4px' }, children: bondData === null || bondData === void 0 ? void 0 : bondData.showcaseTokenName }), jsx$2(Svg, { width: 20, height: 20, icon: (_l = NETWORK_ICONS === null || NETWORK_ICONS === void 0 ? void 0 : NETWORK_ICONS[bondData.chainId]) !== null && _l !== void 0 ? _l : 'question' })] }) }), jsxs(Flex, { className: "modal-marketprice-header", sx: { justifyContent: 'space-between', width: '100%', alignItems: 'center' }, children: [jsx$2(TokenImage, { symbol: (_m = bondData.showcaseTokenName) !== null && _m !== void 0 ? _m : bondData.earnToken.symbol, size: 30 }), jsx$2("span", { className: "modal-marketprice-token", children: bondData.earnToken.symbol }), jsx$2("hr", { className: "fading-hr rotate-hr" }), jsxs("span", { className: "modal-marketprice", children: ["Market Price: $", earnTokenPrice(bondData)] }), jsx$2("hr", { className: "fading-hr rotate-hr" })] }), jsx$2(Flex, { className: "bondmodal-header-alt", sx: { mb: '10px' }, children: jsx$2(BondModalHeaderAlt, { bondData: bondData, onDismiss: onDismiss, showProjectInfoButton: (SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.referenceId) === 'apebond' }) })] }), jsxs(Flex, { sx: { flexDirection: 'column', marginTop: '20px', mx: '10px' }, children: [jsx$2(TokenSelectorPanel, { typedValue: inputValue, setTypedValue: setInputValue, selectedToken: inputToken, handleValueBtn: (value) => setInputValue(value), handleCurrencySelect: handleCurrencySelect, chainId: bondData === null || bondData === void 0 ? void 0 : bondData.chainId, enableZap: true, bondPrincipalToken: bondData === null || bondData === void 0 ? void 0 : bondData.lpToken, tokenBalance: inputCurrencyBalance, selectedTokenPrice: inputTokenPrice === null || inputTokenPrice === void 0 ? void 0 : inputTokenPrice.price, modalVariant: modalVariant }), jsxs(Flex, { className: "modal-youreceive-row", sx: { justifyContent: 'space-between', alignItems: 'center', fontSize: '14px' }, children: [jsxs(Flex, { className: "modal-youreceive-textbox", children: [jsx$2(Flex, { sx: { opacity: 0.8 }, children: "You will receive:" }), jsxs(Flex, { children: [jsx$2(Flex, { className: "modal-youreceive-tokenimage", sx: { marginLeft: '15px', marginRight: '5px' }, children: jsx$2(TokenImage, { symbol: (_o = bondData.showcaseTokenName) !== null && _o !== void 0 ? _o : bondData.earnToken.symbol, size: 20 }) }), jsxs(Flex, { className: "modal-receive-text", sx: { opacity: 0.8 }, children: [formatNumber$2((lodashExports.toNumber(inputValue) / lodashExports.toNumber(earnTokenPrice(bondData))).toFixed(0)), ' ', bondData.earnToken.symbol, " + \u00A0", formatNumber$2((getRawPayoutAmount(bondData, inputValue) -
|
|
74430
|
+
lodashExports.toNumber(inputValue) / lodashExports.toNumber(earnTokenPrice(bondData))).toFixed(0))] }), jsx$2("span", { className: "text-highlight", children: "\u00A0Additional" })] })] }), jsx$2(Flex, { className: "button-container buy", sx: { justifyContent: 'end' }, children: !account ? (jsx$2(ConnectButton, {})) : userChainId !== bondData.chainId ? (jsx$2(Button, { className: "action-button", disabled: loadingTx || isConfirming || (bondData === null || bondData === void 0 ? void 0 : bondData.soldOut), onClick: (event) => {
|
|
74391
74431
|
event.stopPropagation();
|
|
74392
74432
|
switchChain({ chainId: bondData.chainId });
|
|
74393
74433
|
}, children: `Switch Chain` })) : approvalState === ApprovalState.APPROVED ? (jsxs(Button, { className: "action-button", load: load, disabled: load || (bondData === null || bondData === void 0 ? void 0 : bondData.soldOut) || !account || !inputValue || parseFloat(inputValue) === 0, onClick: handleBothPurchases, children: ["buy", ' ', isZap ? (jsx$2("span", { style: { marginLeft: '8px' }, children: jsx$2(Svg, { icon: "ZapIcon" }) })) : ('')] })) : (jsx$2(Button, { className: "action-button", load: approvalState === ApprovalState.PENDING, disabled: approvalState === ApprovalState.PENDING ||
|
|
@@ -74407,7 +74447,7 @@ const BondModal = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond }) =
|
|
|
74407
74447
|
width: '100%',
|
|
74408
74448
|
justifyContent: 'center',
|
|
74409
74449
|
flexDirection: ['column', 'column', 'column', 'row'],
|
|
74410
|
-
}, children: [jsx$2(Flex, { className: "modal-footer-header", sx: { justifyContent: ['flex-end', 'flex-end', 'flex-end', 'flex-start'] }, children: "Vesting end Date:\u00A0" }), jsxs(Flex, { sx: { justifyContent: ['flex-end', 'flex-end', 'flex-end', 'flex-start'] }, children: [' ', new Intl.DateTimeFormat('en-GB', { day: '2-digit', month: 'short', year: 'numeric' }).format(new Date(Date.now() + vestingTime((
|
|
74450
|
+
}, children: [jsx$2(Flex, { className: "modal-footer-header", sx: { justifyContent: ['flex-end', 'flex-end', 'flex-end', 'flex-start'] }, children: "Vesting end Date:\u00A0" }), jsxs(Flex, { sx: { justifyContent: ['flex-end', 'flex-end', 'flex-end', 'flex-start'] }, children: [' ', new Intl.DateTimeFormat('en-GB', { day: '2-digit', month: 'short', year: 'numeric' }).format(new Date(Date.now() + vestingTime((_p = bondData === null || bondData === void 0 ? void 0 : bondData.vestingTerm) !== null && _p !== void 0 ? _p : 0).days * 86400000))] })] })] }), jsx$2("hr", { className: "fading-hr hide-mobile" }), jsxs(Flex, { sx: {
|
|
74411
74451
|
width: '100%',
|
|
74412
74452
|
justifyContent: ['space-between', 'space-between', 'space-between', 'space-around'],
|
|
74413
74453
|
}, children: [jsxs(Flex, { sx: { justifyContent: 'center', flexDirection: ['column', 'column', 'column', 'row'] }, children: [jsx$2(Flex, { className: "modal-footer-header", children: "Vesting type:\u00A0" }), " ", jsx$2(Flex, { children: " Linear" })] }), jsxs(Flex, { sx: {
|
|
@@ -74602,6 +74642,10 @@ const ProgressBarWrapper = ({ title, value, style, showTooltip, toolTipPlacement
|
|
|
74602
74642
|
};
|
|
74603
74643
|
var ProgressBarWrapper$1 = React__default.memo(ProgressBarWrapper);
|
|
74604
74644
|
|
|
74645
|
+
const MinTierRow = ({ minTier }) => {
|
|
74646
|
+
return (jsx$2(Fragment$1, { children: minTier !== null && minTier != undefined && (jsx$2(Flex, { children: jsxs(TooltipBubble, { className: "tooltip-bubble", body: jsxs(Flex, { sx: { textAlign: 'center' }, children: ["You need a ", TIERS_NAMES[minTier], " Ape Tier or better in order to buy this Bond."] }), width: "200px", placement: "bottomLeft", transformTip: "translate(1%, 0%)", children: [jsx$2("img", { src: `/images/launch/${TIERS_NAMES[minTier].toLowerCase()}.png`, alt: "minTier", style: { width: '30px', height: '30px', marginLeft: '10px', zIndex: 1 } }), minTier < 4 && (jsx$2("img", { src: `/images/launch/iconPlus.png`, alt: "minTier", style: { width: '30px', height: '30px', marginLeft: '-11px', zIndex: 0 } }))] }) })) }));
|
|
74647
|
+
};
|
|
74648
|
+
|
|
74605
74649
|
const BondRow = ({ bond }) => {
|
|
74606
74650
|
var _a, _b, _c, _d, _e;
|
|
74607
74651
|
const locationPath = window.location.pathname.replace('/', '');
|
|
@@ -74611,7 +74655,7 @@ const BondRow = ({ bond }) => {
|
|
|
74611
74655
|
? bond.contractAddress[bond.chainId]
|
|
74612
74656
|
: undefined;
|
|
74613
74657
|
const bonus = 'bonus' in bond ? bond.bonusWithFee : undefined;
|
|
74614
|
-
const
|
|
74658
|
+
const minTier = bond.minTier !== undefined ? bond.minTier : null;
|
|
74615
74659
|
// Modal
|
|
74616
74660
|
const [openBuyModal] = useModal(jsx$2(ModalHandler, { bondAddress: billAddress, bondChain: bond.chainId }), true, true, `buyBondModal-${billAddress}-${bond.chainId}`);
|
|
74617
74661
|
const handleOpenModal = () => {
|
|
@@ -74649,7 +74693,7 @@ const BondRow = ({ bond }) => {
|
|
|
74649
74693
|
const tokens = new BigNumber$1(tokensRemaining);
|
|
74650
74694
|
return tokens.times(payoutTokenPrice);
|
|
74651
74695
|
};
|
|
74652
|
-
return (jsxs("div", { className: `bond-row
|
|
74696
|
+
return (jsxs("div", { className: `bond-row`, onClick: handleOpenModal, children: [jsx$2("div", { className: "token-info-container", sx: { width: ['45%', '45%', '33%', '30%'] }, children: jsx$2(TokenInfoAndName, { bill: bond }) }), jsx$2("div", { className: "min-tiers-container", sx: { width: ['20%', '20%', '17%', '10%'] }, children: jsx$2(MinTierRow, { minTier: minTier }) }), jsxs("div", { className: "bond-info-columns", sx: { width: ['33%', '33%', '60%', '60%'] }, children: [jsx$2("div", { className: `discount-column ${getDiscountColor(bonus)}`, children: bonus !== undefined ? (bonus <= 0 ? (jsx$2(TooltipBubble, { className: "tooltip-bubble", body: 'This bond is currently on cooldown and has no bonus. Please check back soon.', width: "205px", placement: "bottomRight", transformTip: "translate(10%, 0%)", children: jsx$2(Svg, { icon: "Timer", width: "20px", color: "#81CFEA" }) })) : (`${bonus === null || bonus === void 0 ? void 0 : bonus.toFixed(2)}%`)) : ('-') }), jsx$2("div", { className: "arr-column", children: bonus !== undefined && bonus <= 0 ? (jsx$2(TooltipBubble, { className: "tooltip-bubble", body: 'This bond is currently on cooldown and has no bonus. Please check back soon.', width: "205px", placement: "bottomRight", transformTip: "translate(10%, 0%)", children: jsx$2(Svg, { icon: "Timer", width: "20px", color: "#81CFEA" }) })) : calculateARR(bond) !== undefined ? (calculateARR(bond)) : ('-') }), jsxs("div", { className: "terms-column", children: [bond.type === 'staking' ? `${daysLeftOnBasepadPool()} D Lock` : getVestingTermsString(bond), bond.vestingCliff && (jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: getVestingTermsTooltipString(bond) }), 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: remainingPercentage(bond) }), style: {
|
|
74653
74697
|
width: '127px',
|
|
74654
74698
|
height: '25px',
|
|
74655
74699
|
flexDirection: 'column',
|
|
@@ -74769,16 +74813,12 @@ const BondRowsWithTitle = ({ chain, bonds, hideTitles, showHotBonds }) => {
|
|
|
74769
74813
|
}), showHotBonds && (jsx$2(SwiperProvider, { children: jsx$2(HotBondCards, {}) }))] }, key))] }) }, key));
|
|
74770
74814
|
};
|
|
74771
74815
|
|
|
74772
|
-
const BondRowsByChain = ({ bonds, hideTitles
|
|
74816
|
+
const BondRowsByChain = ({ bonds, hideTitles }) => {
|
|
74773
74817
|
var _a;
|
|
74774
74818
|
const SDKConfig = useSDKConfig();
|
|
74775
74819
|
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));
|
|
74776
74820
|
return (jsx$2(Flex$1, { className: "bondrowsbychain", children: validatedChains === null || validatedChains === void 0 ? void 0 : validatedChains.map((chain) => {
|
|
74777
|
-
return (jsx$2(BondRowsWithTitle, { chain: chain, bonds: bonds, hideTitles: hideTitles, showHotBonds: hideTitles
|
|
74778
|
-
? false
|
|
74779
|
-
: !isCampaign && SDKConfig.useHotBonds
|
|
74780
|
-
? chain === types.ChainId.BASE || chain === types.ChainId.MAINNET
|
|
74781
|
-
: false }, chain));
|
|
74821
|
+
return (jsx$2(BondRowsWithTitle, { chain: chain, bonds: bonds, hideTitles: hideTitles, showHotBonds: hideTitles ? false : SDKConfig.useHotBonds ? chain === types.ChainId.BASE || chain === types.ChainId.MAINNET : false }, chain));
|
|
74782
74822
|
}) }));
|
|
74783
74823
|
};
|
|
74784
74824
|
|
|
@@ -74974,31 +75014,9 @@ const Bonds = () => {
|
|
|
74974
75014
|
const topTags = useTopTags(sortedBonds);
|
|
74975
75015
|
// remove favorites for seedify
|
|
74976
75016
|
const filterOptions = SDKConfig.referenceId !== 'seedify' ? ['ALL', 'FAVORITES', ...topTags, 'SOLD OUT'] : ['ALL', ...topTags, 'SOLD OUT'];
|
|
74977
|
-
let campaign = 'noCampaign';
|
|
74978
|
-
if (typeof window !== 'undefined' &&
|
|
74979
|
-
(window.location.host.includes('ape.bond') ||
|
|
74980
|
-
window.location.host.includes('apebond') ||
|
|
74981
|
-
window.location.host.includes('localhost'))) {
|
|
74982
|
-
if (window.location.pathname.includes('christmas-sale'))
|
|
74983
|
-
campaign = 'xmas';
|
|
74984
|
-
if (window.location.pathname.includes('bonds'))
|
|
74985
|
-
campaign = 'combined';
|
|
74986
|
-
}
|
|
74987
75017
|
const billsToRender = useMemo(() => {
|
|
74988
75018
|
let billsToReturn = filterOption === 'SOLD OUT' ? (allBonds !== null && allBonds !== void 0 ? allBonds : []) : (sortedBonds !== null && sortedBonds !== void 0 ? sortedBonds : []);
|
|
74989
75019
|
billsToReturn = billsToReturn === null || billsToReturn === void 0 ? void 0 : billsToReturn.filter((bill) => isBondSupported(SDKConfig.highestCompatibleVersion, bill.version));
|
|
74990
|
-
if (campaign === undefined || campaign === 'noCampaign') {
|
|
74991
|
-
billsToReturn = billsToReturn === null || billsToReturn === void 0 ? void 0 : billsToReturn.filter((bill) => {
|
|
74992
|
-
const isXmasStyle = 'minTier' in bill ? bill.minTier : null;
|
|
74993
|
-
return !isXmasStyle;
|
|
74994
|
-
});
|
|
74995
|
-
}
|
|
74996
|
-
if (campaign === 'xmas') {
|
|
74997
|
-
billsToReturn = billsToReturn === null || billsToReturn === void 0 ? void 0 : billsToReturn.filter((bill) => {
|
|
74998
|
-
const isXmasStyle = 'minTier' in bill ? bill.minTier : null;
|
|
74999
|
-
return isXmasStyle;
|
|
75000
|
-
});
|
|
75001
|
-
}
|
|
75002
75020
|
if (searchQuery) {
|
|
75003
75021
|
billsToReturn = billsToReturn === null || billsToReturn === void 0 ? void 0 : billsToReturn.filter((bill) => {
|
|
75004
75022
|
var _a, _b;
|
|
@@ -75033,7 +75051,7 @@ const Bonds = () => {
|
|
|
75033
75051
|
const handleChangeFilterOption = useCallback((newOption) => {
|
|
75034
75052
|
setFilterOption(newOption);
|
|
75035
75053
|
}, []);
|
|
75036
|
-
return (jsxs(Flex$1, { 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 }),
|
|
75054
|
+
return (jsxs(Flex$1, { 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 && jsx$2(BuyAgainRow, {}), (billsToRender === null || billsToRender === void 0 ? void 0 : billsToRender.length) > 0 ? (jsx$2(BondRowsByChain, { bonds: billsToRender, hideTitles: searchQuery !== '' })) : searchQuery ? (jsx$2(PlaceholderMonkey, { text: 'No results' })) : filterOption === 'FAVORITES' ? (jsxs(Flex$1, { sx: {
|
|
75037
75055
|
width: '100%',
|
|
75038
75056
|
height: '300px',
|
|
75039
75057
|
background: 'white2',
|
|
@@ -75042,7 +75060,7 @@ const Bonds = () => {
|
|
|
75042
75060
|
alignItems: 'center',
|
|
75043
75061
|
flexDirection: 'column',
|
|
75044
75062
|
mt: '10px',
|
|
75045
|
-
}, children: [jsx$2(Svg, { icon: "StarFilled", width: 75, height: 75 }), jsx$2(Flex$1, { sx: { mt: '10px' }, children: `You don't have any Favorite Bonds yet!` }), jsx$2(Flex$1, { sx: { fontSize: '12px', fontWeight: 400, color: 'textDisabledButton', mt: '10px' }, children: `Click on the 'star' or 'fire' icon to add Bonds to the list.` })] })) : (jsx$2(Flex$1, { className: "bonds-spinner", children: jsx$2(Spinner, { size: 100 }) })),
|
|
75063
|
+
}, children: [jsx$2(Svg, { icon: "StarFilled", width: 75, height: 75 }), jsx$2(Flex$1, { sx: { mt: '10px' }, children: `You don't have any Favorite Bonds yet!` }), jsx$2(Flex$1, { sx: { fontSize: '12px', fontWeight: 400, color: 'textDisabledButton', mt: '10px' }, children: `Click on the 'star' or 'fire' icon to add Bonds to the list.` })] })) : (jsx$2(Flex$1, { className: "bonds-spinner", children: jsx$2(Spinner, { size: 100 }) })), SDKConfig.useHotBonds && jsx$2(RecommendationCards$1, {})] }));
|
|
75046
75064
|
};
|
|
75047
75065
|
|
|
75048
75066
|
var BondsViewOptions;
|
|
@@ -91465,14 +91483,14 @@ const PriceChart = ({ selectedBond, historicalPrices, }) => {
|
|
|
91465
91483
|
};
|
|
91466
91484
|
|
|
91467
91485
|
const ProjectView = ({ bondAddress, bondChain, historicalPrices }) => {
|
|
91468
|
-
var _a, _b, _c, _d, _e, _f;
|
|
91486
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
91469
91487
|
const { data: bonds } = useBondsData();
|
|
91470
91488
|
const bondData = bonds === null || bonds === void 0 ? void 0 : bonds.find((bond) => {
|
|
91471
91489
|
var _a;
|
|
91472
91490
|
return ((_a = bond === null || bond === void 0 ? void 0 : bond.billAddress) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === (bondAddress === null || bondAddress === void 0 ? void 0 : bondAddress.toLowerCase()) &&
|
|
91473
91491
|
bondChain === bond.chainId.toString();
|
|
91474
91492
|
});
|
|
91475
|
-
const
|
|
91493
|
+
const minTier = (bondData === null || bondData === void 0 ? void 0 : bondData.minTier) ? bondData.minTier : null;
|
|
91476
91494
|
// Hooks
|
|
91477
91495
|
const userChainId = useChainId();
|
|
91478
91496
|
const { address: account } = useAccount();
|
|
@@ -91500,6 +91518,8 @@ const ProjectView = ({ bondAddress, bondChain, historicalPrices }) => {
|
|
|
91500
91518
|
const { data: inputCurrencyBalance } = useCurrencyBalance(inputToken !== null && inputToken !== void 0 ? inputToken : null, account !== null && account !== void 0 ? account : null, (_d = bondData === null || bondData === void 0 ? void 0 : bondData.chainId) !== null && _d !== void 0 ? _d : null);
|
|
91501
91519
|
// Estimations
|
|
91502
91520
|
const depositAmount = isZap ? zapDepositAmount : inputValue;
|
|
91521
|
+
const youSpendString = `${formatNumber$2(inputValue)} ${getSymbol(inputToken, bondData === null || bondData === void 0 ? void 0 : bondData.chainId)} =
|
|
91522
|
+
$${formatUSDNumber((parseFloat(inputValue) * ((_e = inputTokenPrice === null || inputTokenPrice === void 0 ? void 0 : inputTokenPrice.price) !== null && _e !== void 0 ? _e : 0)).toString())}`;
|
|
91503
91523
|
// Loading State
|
|
91504
91524
|
const [loadingTx, setLoadingTx] = useState(false);
|
|
91505
91525
|
const { addToastError } = usePopups();
|
|
@@ -91513,7 +91533,7 @@ const ProjectView = ({ bondAddress, bondChain, historicalPrices }) => {
|
|
|
91513
91533
|
// Modals
|
|
91514
91534
|
const [onOpenZapModal] = useModal(jsx$2(ZapModal, { outputToken: bondData === null || bondData === void 0 ? void 0 : bondData.lpToken, account: account, chainId: bondData === null || bondData === void 0 ? void 0 : bondData.chainId }), true, true, 'zapModal');
|
|
91515
91535
|
// Approve & Purchase Functions
|
|
91516
|
-
const [approvalState, approveCallback] = useApproval(inputValue, inputToken !== null && inputToken !== void 0 ? inputToken : null, (
|
|
91536
|
+
const [approvalState, approveCallback] = useApproval(inputValue, inputToken !== null && inputToken !== void 0 ? inputToken : null, (_f = (isZap ? SoulZapTokenManager === null || SoulZapTokenManager === void 0 ? void 0 : SoulZapTokenManager[bondData === null || bondData === void 0 ? void 0 : bondData.chainId] : bondData === null || bondData === void 0 ? void 0 : bondData.billAddress)) !== null && _f !== void 0 ? _f : null, account !== null && account !== void 0 ? account : null, (_g = bondData === null || bondData === void 0 ? void 0 : bondData.chainId) !== null && _g !== void 0 ? _g : null);
|
|
91517
91537
|
const handleApprove = () => {
|
|
91518
91538
|
approveCallback().then(() => {
|
|
91519
91539
|
track({
|
|
@@ -91621,7 +91641,7 @@ const ProjectView = ({ bondAddress, bondChain, historicalPrices }) => {
|
|
|
91621
91641
|
p: '20px',
|
|
91622
91642
|
borderRadius: '10px',
|
|
91623
91643
|
mt: '5px',
|
|
91624
|
-
}, className: `project-view
|
|
91644
|
+
}, className: `project-view`, children: [jsx$2(BondModalHeader, { bondData: bondData }), jsx$2(ProjectDescription, { description: bondData.shortDescription }), jsx$2(Estimations, { depositAmount: depositAmount, bondData: bondData, youSpendString: youSpendString, isZap: isZap, fetchingZapQuote: fetchingZapQuote, zapError: zapError }), jsx$2(TokenSelectorPanel, { typedValue: inputValue, setTypedValue: setInputValue, selectedToken: inputToken, handleValueBtn: () => { var _a; return setInputValue((_a = new BigNumber$1(inputCurrencyBalance !== null && inputCurrencyBalance !== void 0 ? inputCurrencyBalance : '0')) === null || _a === void 0 ? void 0 : _a.toString()); }, handleCurrencySelect: handleCurrencySelect, chainId: bondData === null || bondData === void 0 ? void 0 : bondData.chainId, enableZap: supportedByLIFI.includes(bondData === null || bondData === void 0 ? void 0 : bondData.chainId), bondPrincipalToken: bondData === null || bondData === void 0 ? void 0 : bondData.lpToken, tokenBalance: inputCurrencyBalance, selectedTokenPrice: inputTokenPrice === null || inputTokenPrice === void 0 ? void 0 : inputTokenPrice.price }), bondData.type === 'staking' && (jsxs(Flex, { sx: {
|
|
91625
91645
|
p: '5px 10px',
|
|
91626
91646
|
width: '100%',
|
|
91627
91647
|
background: '#8E568F',
|
|
@@ -91631,9 +91651,8 @@ const ProjectView = ({ bondAddress, bondChain, historicalPrices }) => {
|
|
|
91631
91651
|
fontWeight: 400,
|
|
91632
91652
|
justifyContent: 'center',
|
|
91633
91653
|
display: 'block',
|
|
91634
|
-
}, children: ["Tokens bought through this bond will go directly to the", ' ', jsx$2("span", { onClick: () => window.open('https://basepad.finance/earn', '_blank'), style: { textDecoration: 'underline', cursor: 'pointer', color: 'blue' }, children: "$BPAD staking pool" }), ' ', "with a ", daysLeftOnBasepadPool(), " days lock."] })),
|
|
91635
|
-
(!
|
|
91636
|
-
(isXmasStyle && bondData.minTier && (!userTier || userTier >= bondData.minTier))) && (jsx$2(Flex, { className: "button-container get", children: jsxs(Button, { className: "action-button", onClick: () => supportedByLIFI.includes(bondData === null || bondData === void 0 ? void 0 : bondData.chainId) ? handleOpenZapModal() : openExternal(), variant: "secondary", children: ["Get ", getSymbol(bondData === null || bondData === void 0 ? void 0 : bondData.lpToken)] }) })), jsx$2(Flex, { className: "button-container buy", children: !account ? (jsx$2(ConnectButton, {})) : isXmasStyle && bondData.minTier && (!userTier || userTier < bondData.minTier) ? (jsx$2(Button, { className: "action-button", onClick: () => window.open(`https://www.ape.bond/tier-staking`, '_blank'), children: "GET YOUR TIER" })) : userChainId !== bondData.chainId ? (jsx$2(Button, { className: "switch-button", disabled: loadingTx || isConfirming || (bondData === null || bondData === void 0 ? void 0 : bondData.soldOut), onClick: (event) => {
|
|
91654
|
+
}, children: ["Tokens bought through this bond will go directly to the", ' ', jsx$2("span", { onClick: () => window.open('https://basepad.finance/earn', '_blank'), style: { textDecoration: 'underline', cursor: 'pointer', color: 'blue' }, children: "$BPAD staking pool" }), ' ', "with a ", daysLeftOnBasepadPool(), " days lock."] })), minTier && (bondData === null || bondData === void 0 ? void 0 : bondData.minTier) !== undefined && (jsx$2(TagMinTierBond, { userTier: userTier, minTier: bondData === null || bondData === void 0 ? void 0 : bondData.minTier })), jsxs(Flex, { className: "modaltable-container button-container", children: [account &&
|
|
91655
|
+
(!minTier || (minTier && bondData.minTier && (!userTier || userTier >= bondData.minTier))) && (jsx$2(Flex, { className: "button-container get", children: jsxs(Button, { className: "action-button", onClick: () => supportedByLIFI.includes(bondData === null || bondData === void 0 ? void 0 : bondData.chainId) ? handleOpenZapModal() : openExternal(), variant: "secondary", children: ["Get ", getSymbol(bondData === null || bondData === void 0 ? void 0 : bondData.lpToken)] }) })), jsx$2(Flex, { className: "button-container buy", children: !account ? (jsx$2(ConnectButton, {})) : minTier && bondData.minTier && (!userTier || userTier < bondData.minTier) ? (jsx$2(Button, { className: "action-button", onClick: () => window.open(`https://www.ape.bond/tier-staking`, '_blank'), children: "GET YOUR TIER" })) : userChainId !== bondData.chainId ? (jsx$2(Button, { className: "switch-button", disabled: loadingTx || isConfirming || (bondData === null || bondData === void 0 ? void 0 : bondData.soldOut), onClick: (event) => {
|
|
91637
91656
|
event.stopPropagation();
|
|
91638
91657
|
switchChain({ chainId: bondData.chainId });
|
|
91639
91658
|
}, style: { fontSize: '14px', padding: '6px', marginLeft: '0px' }, children: `Switch to ${NETWORK_LABEL[bondData.chainId]}` })) : approvalState === ApprovalState.APPROVED ? (jsx$2(Button, { className: "action-button", load: load || fetchingZapQuote, disabled: load ||
|