@ape.swap/bonds-sdk 3.0.4-test.7 → 3.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,6 +8,7 @@ export { default as Modal } from './Modal';
8
8
  export { default as Toggle } from './Toggle';
9
9
  export { default as SwiperDots } from './SwiperDots';
10
10
  export { default as LoadingDots } from './LoadingDots';
11
+ export { default as Checkbox } from './Checkbox';
11
12
  export { Button, IconButton } from './Button';
12
13
  export { Select, SelectItem } from './Select';
13
14
  export { ListTag } from './Tag';
package/dist/main.js CHANGED
@@ -17841,7 +17841,7 @@ const styles$g = {
17841
17841
  left: '50%',
17842
17842
  transform: 'translate(-50%, -50%)',
17843
17843
  width: '380px',
17844
- minWidth: ['95%', 'min(360px, 90%)', '320px'],
17844
+ minWidth: ['95%', 'min(380px, 90%)', '380px'],
17845
17845
  overflowY: ['auto', 'auto', 'auto', 'unset'],
17846
17846
  maxHeight: 'calc(100% - 30px)',
17847
17847
  maxWidth: '95vw',
@@ -22280,7 +22280,6 @@ function formatUSDNumber(input) {
22280
22280
  // Note: Between 1k and 0.01 show 2 decimals
22281
22281
  return parseFloat(number.toFixed(2)).toLocaleString('en-US');
22282
22282
  }
22283
- const youSpend = (inputValue) => formatNumber$2(inputValue);
22284
22283
  const youSpendUSD = (bond, inputValue) => {
22285
22284
  return (parseFloat(inputValue) * parseFloat(bond.principalTokenPrice)).toString();
22286
22285
  };
@@ -22313,8 +22312,6 @@ const getRawBonus = (bond, inputValue) => {
22313
22312
  if (!bond || !inputValue)
22314
22313
  return '0';
22315
22314
  const premiumUSD = parseFloat(youGetUSD(bond, inputValue)) - parseFloat(youSpendUSD(bond, inputValue));
22316
- //TODO: rollback this
22317
- // return formatUSDNumber(premiumUSD.toString())
22318
22315
  return premiumUSD.toString();
22319
22316
  };
22320
22317
  const getFeeAmount = (bond, inputValue) => {
@@ -71965,12 +71962,13 @@ const getSymbol = (token, chainId) => {
71965
71962
  };
71966
71963
 
71967
71964
  const TokenRow = ({ token, chainId, handleTokenSelect, }) => {
71968
- var _a;
71965
+ var _a, _b;
71969
71966
  const symbol = getSymbol(token, chainId);
71970
71967
  const tokenAddress = token === 'NATIVE' ? 'NATIVE' : token.address[chainId];
71971
71968
  const { address } = useAccount();
71972
71969
  const { isLoading, data: tokenBalance } = useCurrencyBalance(token, address !== null && address !== void 0 ? address : null, chainId);
71973
- 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: [jsx$2(TokenImage, { symbol: symbol === null || symbol === void 0 ? void 0 : symbol.toUpperCase(), chain: chainId, size: 30 }), 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: (_a = new BigNumber$1(tokenBalance !== null && tokenBalance !== void 0 ? tokenBalance : '0')) === null || _a === void 0 ? void 0 : _a.toPrecision(5) })) }))] }));
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) })) }))] }));
71974
71972
  };
71975
71973
 
71976
71974
  const TokenSelectorModal = ({ bondPrincipalToken, bondEarnToken, handleCurrencySelect, chainId, onDismiss, }) => {
@@ -72195,6 +72193,7 @@ const useSoulZapTokenQuote = (typedValue, inputCurrency, outputToken, chainId, a
72195
72193
  const { data: response, isLoading, error, } = useQuery({
72196
72194
  queryKey: [QUERY_KEYS.ZAP_TOKEN_QUOTE, queryKey],
72197
72195
  queryFn: fetchZapDetails,
72196
+ refetchInterval: 20000,
72198
72197
  enabled: !!queryKey,
72199
72198
  retry: 1,
72200
72199
  });
@@ -73366,7 +73365,7 @@ const AccordionText = ({ isVisible = false }) => {
73366
73365
  };
73367
73366
 
73368
73367
  const useSoulZapBondQuote = (typedValue, inputCurrency, bond, account) => {
73369
- 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;
73370
73369
  const debouncedInput = useDebounce(typedValue, 400);
73371
73370
  const [slippage] = useSlippage();
73372
73371
  const principalToken = bond === null || bond === void 0 ? void 0 : bond.lpToken;
@@ -73460,9 +73459,10 @@ const useSoulZapBondQuote = (typedValue, inputCurrency, bond, account) => {
73460
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);
73461
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;
73462
73461
  });
73463
- const { data: response, isLoading, error, } = useQuery({
73462
+ const { data: response, isLoading, isFetching, error, } = useQuery({
73464
73463
  queryKey: [QUERY_KEYS.ZAP_TOKEN_QUOTE, queryKey],
73465
73464
  queryFn: fetchZapDetails,
73465
+ refetchInterval: 60000, // i.e. 60 sec
73466
73466
  enabled: !!queryKey,
73467
73467
  retry: 1,
73468
73468
  });
@@ -73491,7 +73491,11 @@ const useSoulZapBondQuote = (typedValue, inputCurrency, bond, account) => {
73491
73491
  const isWrap = inputCurrency === 'NATIVE' &&
73492
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());
73493
73493
  const estimatedDepositAmountToReturn = isWrap ? typedValue : estimatedDepositAmount.toString();
73494
- return [isLoading, response, estimatedDepositAmountToReturn, zapError];
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];
73495
73499
  };
73496
73500
 
73497
73501
  const useSendReferenceId = () => {
@@ -73960,19 +73964,15 @@ const BondCards = ({ bondData }) => {
73960
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')] })] })] }));
73961
73965
  };
73962
73966
 
73963
- const Estimations = ({ bondData, inputValue, inputToken, depositAmount, inputTokenPrice, isZap, fetchingZapQuote, zapError, }) => {
73964
- var _a, _b, _c, _d, _e;
73965
- const rawPayoutAmount = getRawPayoutAmount(bondData, depositAmount);
73967
+ const Estimations = ({ depositAmount, bondData, youSpendString, isZap, fetchingZapQuote, zapError, }) => {
73968
+ var _a, _b, _c, _d;
73966
73969
  // Estimations
73967
- const rawEstimatedOutputUSD = rawPayoutAmount * parseFloat((_a = bondData === null || bondData === void 0 ? void 0 : bondData.payoutTokenPrice) !== null && _a !== void 0 ? _a : '0');
73968
- const estimatedInputUSD = parseFloat(inputValue) * (inputTokenPrice !== null && inputTokenPrice !== void 0 ? inputTokenPrice : 0);
73969
- const rawBonus = getRawBonus(bondData, depositAmount);
73970
- const bonusString = isZap ? (rawEstimatedOutputUSD - estimatedInputUSD).toString() : rawBonus;
73970
+ const bonusString = getRawBonus(bondData, depositAmount);
73971
73971
  const fee = getFeeAmount(bondData, depositAmount);
73972
- const feeUSD = fee * parseFloat((_b = bondData === null || bondData === void 0 ? void 0 : bondData.payoutTokenPrice) !== null && _b !== void 0 ? _b : '0');
73972
+ const feeUSD = fee * parseFloat((_a = bondData === null || bondData === void 0 ? void 0 : bondData.payoutTokenPrice) !== null && _a !== void 0 ? _a : '0');
73973
73973
  const estimatedOutputAmount = getPayoutAmount(bondData, depositAmount);
73974
- const estimatedOutputUSD = estimatedOutputAmount * parseFloat((_c = bondData === null || bondData === void 0 ? void 0 : bondData.payoutTokenPrice) !== null && _c !== void 0 ? _c : '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:" }), 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())] }))] })] }));
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
73976
  };
73977
73977
 
73978
73978
  // Custom HTML sanitizer
@@ -74135,8 +74135,37 @@ const TagMinTierBond = ({ userTier, minTier }) => {
74135
74135
  }, 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!"] })] }));
74136
74136
  };
74137
74137
 
74138
+ const NewRateModal = ({ bond, zapTrueBondPrice, depositAmount, youSpendString, isZap, fetchingZapQuote, zapError, handleZap, onDismiss, }) => {
74139
+ var _a, _b, _c, _d, _e;
74140
+ const tokenSymbol = (_a = bond === null || bond === void 0 ? void 0 : bond.earnToken) === null || _a === void 0 ? void 0 : _a.symbol;
74141
+ const oldBonus = (_b = bond === null || bond === void 0 ? void 0 : bond.bonusWithFee) !== null && _b !== void 0 ? _b : 0;
74142
+ const fee = (_c = bond === null || bond === void 0 ? void 0 : bond.feeInPayout) !== null && _c !== void 0 ? _c : 0;
74143
+ const earnTokenPrice = parseFloat((_d = bond === null || bond === void 0 ? void 0 : bond.payoutTokenPrice) !== null && _d !== void 0 ? _d : '0');
74144
+ const lpPrice = parseFloat((_e = bond === null || bond === void 0 ? void 0 : bond.principalTokenPrice) !== null && _e !== void 0 ? _e : '0');
74145
+ const trueBillPriceMinusFee = new BigNumber$1(zapTrueBondPrice !== null && zapTrueBondPrice !== void 0 ? zapTrueBondPrice : '0').times((100 + fee) / 100);
74146
+ const priceUSDMinusFee = getBalanceNumber(trueBillPriceMinusFee) * lpPrice;
74147
+ const discountWithoutFee = ((earnTokenPrice - priceUSDMinusFee) / earnTokenPrice) * 100;
74148
+ const zapBonusWithFee = discountWithoutFee > 0 ? (discountWithoutFee / (100 - discountWithoutFee)) * 100 : 0;
74149
+ 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: {
74150
+ p: '8px 4px 4px 4px',
74151
+ borderRadius: '8px',
74152
+ width: '100%',
74153
+ alignItems: 'center',
74154
+ }, 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: {
74155
+ width: '100%',
74156
+ fontSize: '14px',
74157
+ fontWeight: 500,
74158
+ color: 'textDisabledButton',
74159
+ justifyContent: 'flex-start',
74160
+ mb: '10px',
74161
+ }, children: "Would you like to confirm the new rate?" }), jsx$2(Button, { fullWidth: true, onClick: () => {
74162
+ handleZap();
74163
+ onDismiss && onDismiss();
74164
+ }, disabled: fetchingZapQuote, load: fetchingZapQuote, children: fetchingZapQuote ? 'Loading' : 'Buy' })] }) }));
74165
+ };
74166
+
74138
74167
  const BondModal = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond }) => {
74139
- 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;
74140
74169
  const SDKConfig = useSDKConfig();
74141
74170
  const { data: geoData } = useGeoFencing();
74142
74171
  // State
@@ -74153,19 +74182,21 @@ const BondModal = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond }) =
74153
74182
  const { data: userEscrowWeight } = useGetUserEscrowWeight(account);
74154
74183
  const userTier = getUserTier(userEscrowWeight !== null && userEscrowWeight !== void 0 ? userEscrowWeight : '0');
74155
74184
  // State
74156
- const bondData = useMemo(() => 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()); }), [bondAddress]);
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()); });
74157
74186
  const minTier = (bondData === null || bondData === void 0 ? void 0 : bondData.minTier) !== undefined ? bondData.minTier : null;
74158
74187
  const [buyTxHash, setBuyTxHash] = useState();
74159
74188
  const [inputValue, setInputValue] = useState('');
74160
- const [inputTokenString, setInputTokenString] = useState((_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.chainId]) !== null && _c !== void 0 ? _c : 'NATIVE');
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]);
74161
74190
  // Data
74162
74191
  const inputToken = useTokenFromZapList(inputTokenString, bondData === null || bondData === void 0 ? void 0 : bondData.chainId, bondData === null || bondData === void 0 ? void 0 : bondData.lpToken);
74163
- const isZap = (inputTokenString === null || inputTokenString === void 0 ? void 0 : inputTokenString.toLowerCase()) !== ((_f = (_e = (_d = bondData === null || bondData === void 0 ? void 0 : bondData.lpToken) === null || _d === void 0 ? void 0 : _d.address) === null || _e === void 0 ? void 0 : _e[bondData === null || bondData === void 0 ? void 0 : bondData.chainId]) === null || _f === void 0 ? void 0 : _f.toLowerCase());
74164
- 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);
74165
74194
  const inputTokenPrice = useCurrencyPrice(inputToken !== null && inputToken !== void 0 ? inputToken : null, bondChain);
74166
- const { data: inputCurrencyBalance } = useCurrencyBalance(inputToken !== null && inputToken !== void 0 ? inputToken : null, account !== null && account !== void 0 ? account : null, (_g = bondData === null || bondData === void 0 ? void 0 : bondData.chainId) !== null && _g !== void 0 ? _g : 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);
74167
74196
  // Estimations
74168
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())}`;
74169
74200
  // Loading State
74170
74201
  const [loadingTx, setLoadingTx] = useState(false);
74171
74202
  const { addToastError } = usePopups();
@@ -74315,6 +74346,9 @@ const BondModal = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond }) =
74315
74346
  '0x94A283756B70c2A77bc58Ae0E2615Caf14310186'.toLowerCase(),
74316
74347
  '0x6639D4acAe77967c253C75cBfEd7C612682E2704'.toLowerCase(),
74317
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
+ console.log(rateChanged);
74351
+ 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);
74318
74352
  const handleBothPurchases = () => {
74319
74353
  var _a, _b;
74320
74354
  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 : '')) {
@@ -74323,7 +74357,12 @@ const BondModal = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond }) =
74323
74357
  else {
74324
74358
  setLoadingTx(true);
74325
74359
  if (isZap) {
74326
- handleZapCallback().finally(() => setLoadingTx(false));
74360
+ if (rateChanged) {
74361
+ openNewRateModal();
74362
+ }
74363
+ else {
74364
+ handleZapCallback().finally(() => setLoadingTx(false));
74365
+ }
74327
74366
  }
74328
74367
  else {
74329
74368
  handleBuyCallback().finally(() => setLoadingTx(false));
@@ -74352,7 +74391,20 @@ const BondModal = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond }) =
74352
74391
  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');
74353
74392
  }
74354
74393
  };
74355
- return (jsx$2(Modal, { className: `modal`, onDismiss: onDismiss, 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, { bondData: bondData, inputValue: inputValue, inputToken: inputToken, depositAmount: depositAmount, inputTokenPrice: inputTokenPrice === null || inputTokenPrice === void 0 ? void 0 : inputTokenPrice.price, 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: {
74394
+ // Effects
74395
+ const [hasChecked, setHasChecked] = useState(false);
74396
+ useEffect(() => {
74397
+ var _a, _b, _c;
74398
+ if (inputCurrencyBalance !== 'undefined' &&
74399
+ inputCurrencyBalance === '0' &&
74400
+ (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()) &&
74401
+ !hasChecked) {
74402
+ setHasChecked(true);
74403
+ setInputTokenString('NATIVE');
74404
+ console.log('change to native');
74405
+ }
74406
+ }, [inputCurrencyBalance]);
74407
+ 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: {
74356
74408
  p: '5px 10px',
74357
74409
  width: '100%',
74358
74410
  background: '#8E568F',
@@ -74362,7 +74414,7 @@ const BondModal = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond }) =
74362
74414
  fontWeight: 400,
74363
74415
  justifyContent: 'center',
74364
74416
  display: 'block',
74365
- }, 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 && 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", 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: "switch-button", disabled: loadingTx || isConfirming || (bondData === null || bondData === void 0 ? void 0 : bondData.soldOut), onClick: (event) => {
74417
+ }, 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 && 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) => {
74366
74418
  event.stopPropagation();
74367
74419
  switchChain({ chainId: bondData.chainId });
74368
74420
  }, 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 ||
@@ -74375,8 +74427,8 @@ const BondModal = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond }) =
74375
74427
  (bondData === null || bondData === void 0 ? void 0 : bondData.soldOut) ||
74376
74428
  !account ||
74377
74429
  !inputValue ||
74378
- 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: (_k = NETWORK_ICONS === null || NETWORK_ICONS === void 0 ? void 0 : NETWORK_ICONS[bondData.chainId]) !== null && _k !== void 0 ? _k : 'question' })] }) }), jsxs(Flex, { className: "modal-marketprice-header", sx: { justifyContent: 'space-between', width: '100%', alignItems: 'center' }, children: [jsx$2(TokenImage, { symbol: (_l = bondData.showcaseTokenName) !== null && _l !== void 0 ? _l : 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: (_m = bondData.showcaseTokenName) !== null && _m !== void 0 ? _m : 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) -
74379
- lodashExports.toNumber(inputValue) / lodashExports.toNumber(earnTokenPrice(bondData))).toFixed(0))] }), jsx$2("span", { className: "text-highlight", children: "\u00A0Additional" })] })] }), jsx$2(Flex, { className: "button-container buy", sx: { justifyContent: 'end' }, children: !account ? (jsx$2(ConnectButton, {})) : userChainId !== bondData.chainId ? (jsx$2(Button, { className: "switch-button button-narrow", disabled: loadingTx || isConfirming || (bondData === null || bondData === void 0 ? void 0 : bondData.soldOut), onClick: (event) => {
74430
+ 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) -
74431
+ 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) => {
74380
74432
  event.stopPropagation();
74381
74433
  switchChain({ chainId: bondData.chainId });
74382
74434
  }, 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 ||
@@ -74396,7 +74448,7 @@ const BondModal = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond }) =
74396
74448
  width: '100%',
74397
74449
  justifyContent: 'center',
74398
74450
  flexDirection: ['column', 'column', 'column', 'row'],
74399
- }, 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((_o = bondData === null || bondData === void 0 ? void 0 : bondData.vestingTerm) !== null && _o !== void 0 ? _o : 0).days * 86400000))] })] })] }), jsx$2("hr", { className: "fading-hr hide-mobile" }), jsxs(Flex, { sx: {
74451
+ }, 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: {
74400
74452
  width: '100%',
74401
74453
  justifyContent: ['space-between', 'space-between', 'space-between', 'space-around'],
74402
74454
  }, 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: {
@@ -74642,7 +74694,7 @@ const BondRow = ({ bond }) => {
74642
74694
  const tokens = new BigNumber$1(tokensRemaining);
74643
74695
  return tokens.times(payoutTokenPrice);
74644
74696
  };
74645
- 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: {
74697
+ return (jsxs("div", { className: `bond-row`, onClick: handleOpenModal, children: [jsx$2("div", { className: "token-info-container", sx: { width: ['100%', '100%', '23%', '30%', '30%', '30%'] }, children: jsx$2(TokenInfoAndName, { bill: bond }) }), jsx$2("div", { className: "min-tiers-container", sx: { width: ['55%', '55%', '17%', '10%', '10%', '10%'] }, children: jsx$2(MinTierRow, { minTier: minTier }) }), jsxs("div", { className: "bond-info-columns", 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: {
74646
74698
  width: '127px',
74647
74699
  height: '25px',
74648
74700
  flexDirection: 'column',
@@ -1,4 +1,4 @@
1
1
  import { Token } from '@ape.swap/apeswap-lists';
2
2
  import { BondsData } from '../../types/bonds';
3
- declare const useSoulZapBondQuote: (typedValue: string, inputCurrency: "NATIVE" | Token | undefined, bond: BondsData | undefined, account?: string) => [loading: boolean, response: any, depositAmount: string, error: boolean];
3
+ declare const useSoulZapBondQuote: (typedValue: string, inputCurrency: "NATIVE" | Token | undefined, bond: BondsData | undefined, account?: string) => [loading: boolean, response: any, depositAmount: string, error: boolean, trueBondPrice: string | undefined];
4
4
  export default useSoulZapBondQuote;
package/dist/styles.css CHANGED
@@ -155,7 +155,6 @@
155
155
  z-index: 1001;
156
156
  width: 100%;
157
157
  max-width: 700px;
158
- min-width: 700px;
159
158
  }
160
159
 
161
160
  .modaltable-container {
@@ -480,9 +479,10 @@
480
479
  justify-content: center;
481
480
  align-items: center;
482
481
  cursor: pointer;
482
+ width: 35%;
483
+ min-width: 130px;
483
484
  }
484
485
  .button-container.get .action-button {
485
- width: 275px;
486
486
  margin-right: 10px;
487
487
  }
488
488
 
@@ -643,6 +643,7 @@ span.flex-inline {
643
643
  display: flex;
644
644
  flex-direction: row;
645
645
  align-items: center;
646
+ width: 60%;
646
647
  justify-content: flex-end;
647
648
  }
648
649
  @media screen and (min-width: 1000px) {
@@ -1,12 +1,9 @@
1
1
  import React from 'react';
2
- import { Token } from '@ape.swap/apeswap-lists';
3
2
  import { BondsData } from '../../../types/bonds';
4
- declare const Estimations: ({ bondData, inputValue, inputToken, depositAmount, inputTokenPrice, isZap, fetchingZapQuote, zapError, }: {
5
- bondData: BondsData;
6
- inputValue: string;
7
- inputToken: Token | "NATIVE" | undefined;
3
+ declare const Estimations: ({ depositAmount, bondData, youSpendString, isZap, fetchingZapQuote, zapError, }: {
8
4
  depositAmount: string;
9
- inputTokenPrice?: number;
5
+ bondData: BondsData;
6
+ youSpendString?: string;
10
7
  isZap?: boolean;
11
8
  fetchingZapQuote?: boolean;
12
9
  zapError?: boolean;
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import { BondsData } from '../../../../types/bonds';
3
+ declare const NewRateModal: ({ bond, zapTrueBondPrice, depositAmount, youSpendString, isZap, fetchingZapQuote, zapError, handleZap, onDismiss, }: {
4
+ bond?: BondsData;
5
+ zapTrueBondPrice?: string;
6
+ depositAmount: string;
7
+ youSpendString?: string;
8
+ isZap?: boolean;
9
+ fetchingZapQuote?: boolean;
10
+ zapError?: boolean;
11
+ handleZap: () => void;
12
+ onDismiss?: () => void;
13
+ }) => React.JSX.Element;
14
+ export default NewRateModal;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Ape Bond SDK",
4
4
  "author": "Ape Bond",
5
5
  "license": "MIT",
6
- "version": "3.0.4-test.7",
6
+ "version": "3.0.6",
7
7
  "module": "dist/main.js",
8
8
  "type": "module",
9
9
  "types": "dist/main.d.ts",