@ape.swap/bonds-sdk 3.0.2 → 3.0.4-test.0

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
@@ -17828,7 +17828,7 @@ const styles$g = {
17828
17828
  left: '50%',
17829
17829
  transform: 'translate(-50%, -50%)',
17830
17830
  width: '380px',
17831
- minWidth: ['95%', 'min(360px, 90%)', '320px'],
17831
+ minWidth: ['95%', 'min(380px, 90%)', '380px'],
17832
17832
  overflowY: ['auto', 'auto', 'auto', 'unset'],
17833
17833
  maxHeight: 'calc(100% - 30px)',
17834
17834
  maxWidth: '95vw',
@@ -22265,7 +22265,6 @@ function formatUSDNumber(input) {
22265
22265
  // Note: Between 1k and 0.01 show 2 decimals
22266
22266
  return parseFloat(number.toFixed(2)).toLocaleString('en-US');
22267
22267
  }
22268
- const youSpend = (inputValue) => formatNumber$2(inputValue);
22269
22268
  const youSpendUSD = (bond, inputValue) => {
22270
22269
  return (parseFloat(inputValue) * parseFloat(bond.principalTokenPrice)).toString();
22271
22270
  };
@@ -22298,8 +22297,6 @@ const getRawBonus = (bond, inputValue) => {
22298
22297
  if (!bond || !inputValue)
22299
22298
  return '0';
22300
22299
  const premiumUSD = parseFloat(youGetUSD(bond, inputValue)) - parseFloat(youSpendUSD(bond, inputValue));
22301
- //TODO: rollback this
22302
- // return formatUSDNumber(premiumUSD.toString())
22303
22300
  return premiumUSD.toString();
22304
22301
  };
22305
22302
  const getFeeAmount = (bond, inputValue) => {
@@ -24721,7 +24718,7 @@ const TooltipText = {
24721
24718
  TokensRemaining: 'This is the amount of remaining tokens for sale in this Bond.',
24722
24719
  MaxBuy: (payoutToken) => `This is the maximum amount of ${payoutToken} you can currently purchase through this Bond.`,
24723
24720
  Premium: 'This is the dollar value of the additional tokens you’ll receive at current market price.',
24724
- Fee: 'We need a fancy copy here dev',
24721
+ Fee: 'This is the platform fee (2%).',
24725
24722
  };
24726
24723
  const UserBillTooltipText = {
24727
24724
  FullyVested: 'This is the time remaining until all tokens from the bond are available to claim.',
@@ -71973,12 +71970,13 @@ const getSymbol = (token, chainId) => {
71973
71970
  };
71974
71971
 
71975
71972
  const TokenRow = ({ token, chainId, handleTokenSelect, }) => {
71976
- var _a;
71973
+ var _a, _b;
71977
71974
  const symbol = getSymbol(token, chainId);
71978
71975
  const tokenAddress = token === 'NATIVE' ? 'NATIVE' : token.address[chainId];
71979
71976
  const { address } = useAccount();
71980
71977
  const { isLoading, data: tokenBalance } = useCurrencyBalance(token, address !== null && address !== void 0 ? address : null, chainId);
71981
- 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) })) }))] }));
71978
+ const splited = typeof token !== 'string' ? (_a = token === null || token === void 0 ? void 0 : token.symbol) === null || _a === void 0 ? void 0 : _a.split('-') : undefined;
71979
+ 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) })) }))] }));
71982
71980
  };
71983
71981
 
71984
71982
  const TokenSelectorModal = ({ bondPrincipalToken, bondEarnToken, handleCurrencySelect, chainId, onDismiss, }) => {
@@ -72203,6 +72201,7 @@ const useSoulZapTokenQuote = (typedValue, inputCurrency, outputToken, chainId, a
72203
72201
  const { data: response, isLoading, error, } = useQuery({
72204
72202
  queryKey: [QUERY_KEYS.ZAP_TOKEN_QUOTE, queryKey],
72205
72203
  queryFn: fetchZapDetails,
72204
+ refetchInterval: 20000,
72206
72205
  enabled: !!queryKey,
72207
72206
  retry: 1,
72208
72207
  });
@@ -73374,7 +73373,7 @@ const AccordionText = ({ isVisible = false }) => {
73374
73373
  };
73375
73374
 
73376
73375
  const useSoulZapBondQuote = (typedValue, inputCurrency, bond, account) => {
73377
- 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;
73376
+ 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;
73378
73377
  const debouncedInput = useDebounce(typedValue, 400);
73379
73378
  const [slippage] = useSlippage();
73380
73379
  const principalToken = bond === null || bond === void 0 ? void 0 : bond.lpToken;
@@ -73468,9 +73467,10 @@ const useSoulZapBondQuote = (typedValue, inputCurrency, bond, account) => {
73468
73467
  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);
73469
73468
  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;
73470
73469
  });
73471
- const { data: response, isLoading, error, } = useQuery({
73470
+ const { data: response, isLoading, isFetching, error, } = useQuery({
73472
73471
  queryKey: [QUERY_KEYS.ZAP_TOKEN_QUOTE, queryKey],
73473
73472
  queryFn: fetchZapDetails,
73473
+ refetchInterval: 20000,
73474
73474
  enabled: !!queryKey,
73475
73475
  retry: 1,
73476
73476
  });
@@ -73499,7 +73499,11 @@ const useSoulZapBondQuote = (typedValue, inputCurrency, bond, account) => {
73499
73499
  const isWrap = inputCurrency === 'NATIVE' &&
73500
73500
  ((_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());
73501
73501
  const estimatedDepositAmountToReturn = isWrap ? typedValue : estimatedDepositAmount.toString();
73502
- return [isLoading, response, estimatedDepositAmountToReturn, zapError];
73502
+ const trueBondPrice = (_11 = response === null || response === void 0 ? void 0 : response.protocolQuote) === null || _11 === void 0 ? void 0 : _11.trueBondPrice;
73503
+ const zapLoading = isLoading || isFetching;
73504
+ if (zapLoading)
73505
+ return [true, undefined, '', false, undefined];
73506
+ return [zapLoading, response, estimatedDepositAmountToReturn, zapError, trueBondPrice];
73503
73507
  };
73504
73508
 
73505
73509
  const useSendReferenceId = () => {
@@ -73548,19 +73552,15 @@ const BondCards = ({ bondData }) => {
73548
73552
  : `${((((_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')] })] })] }));
73549
73553
  };
73550
73554
 
73551
- const Estimations = ({ bondData, inputValue, inputToken, depositAmount, inputTokenPrice, isZap, fetchingZapQuote, zapError, }) => {
73552
- var _a, _b, _c, _d, _e;
73553
- const rawPayoutAmount = getRawPayoutAmount(bondData, depositAmount);
73555
+ const Estimations = ({ depositAmount, bondData, youSpendString, isZap, fetchingZapQuote, zapError, }) => {
73556
+ var _a, _b, _c, _d;
73554
73557
  // Estimations
73555
- const rawEstimatedOutputUSD = rawPayoutAmount * parseFloat((_a = bondData === null || bondData === void 0 ? void 0 : bondData.payoutTokenPrice) !== null && _a !== void 0 ? _a : '0');
73556
- const estimatedInputUSD = parseFloat(inputValue) * (inputTokenPrice !== null && inputTokenPrice !== void 0 ? inputTokenPrice : 0);
73557
- const rawBonus = getRawBonus(bondData, depositAmount);
73558
- const bonusString = isZap ? (rawEstimatedOutputUSD - estimatedInputUSD).toString() : rawBonus;
73558
+ const bonusString = getRawBonus(bondData, depositAmount);
73559
73559
  const fee = getFeeAmount(bondData, depositAmount);
73560
- const feeUSD = fee * parseFloat((_b = bondData === null || bondData === void 0 ? void 0 : bondData.payoutTokenPrice) !== null && _b !== void 0 ? _b : '0');
73560
+ const feeUSD = fee * parseFloat((_a = bondData === null || bondData === void 0 ? void 0 : bondData.payoutTokenPrice) !== null && _a !== void 0 ? _a : '0');
73561
73561
  const estimatedOutputAmount = getPayoutAmount(bondData, depositAmount);
73562
- const estimatedOutputUSD = estimatedOutputAmount * parseFloat((_c = bondData === null || bondData === void 0 ? void 0 : bondData.payoutTokenPrice) !== null && _c !== void 0 ? _c : '0');
73563
- 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())] }))] })] }));
73562
+ const estimatedOutputUSD = estimatedOutputAmount * parseFloat((_b = bondData === null || bondData === void 0 ? void 0 : bondData.payoutTokenPrice) !== null && _b !== void 0 ? _b : '0');
73563
+ 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())] }))] })] }));
73564
73564
  };
73565
73565
 
73566
73566
  // Custom HTML sanitizer
@@ -74129,8 +74129,37 @@ const TagXmasFlashBond = ({ userTier, minTier }) => {
74129
74129
  }, children: ["This is a special ", jsx$2("span", { style: { fontWeight: 700 }, children: "Christmas Flash Bond." }), !userTier || (minTier !== undefined && userTier < minTier) ? (jsxs(Fragment$1, { children: [' ', "You need to achieve", ' ', jsxs("span", { style: { fontWeight: 700 }, children: [TIERS_NAMES[minTier], " Ape Tier"] }), " to be elegible!"] })) : (jsxs(Fragment$1, { children: [' ', "You are eligible to buy it thanks to your", ' ', jsxs("span", { style: { fontWeight: 700 }, children: [TIERS_NAMES[userTier], " Ape Tier!"] }), ' '] }))] }));
74130
74130
  };
74131
74131
 
74132
+ const NewRateModal = ({ bond, zapTrueBondPrice, depositAmount, youSpendString, isZap, fetchingZapQuote, zapError, handleZap, onDismiss, }) => {
74133
+ var _a, _b, _c, _d, _e;
74134
+ const tokenSymbol = (_a = bond === null || bond === void 0 ? void 0 : bond.earnToken) === null || _a === void 0 ? void 0 : _a.symbol;
74135
+ const oldBonus = (_b = bond === null || bond === void 0 ? void 0 : bond.bonusWithFee) !== null && _b !== void 0 ? _b : 0;
74136
+ const fee = (_c = bond === null || bond === void 0 ? void 0 : bond.feeInPayout) !== null && _c !== void 0 ? _c : 0;
74137
+ const earnTokenPrice = parseFloat((_d = bond === null || bond === void 0 ? void 0 : bond.payoutTokenPrice) !== null && _d !== void 0 ? _d : '0');
74138
+ const lpPrice = parseFloat((_e = bond === null || bond === void 0 ? void 0 : bond.principalTokenPrice) !== null && _e !== void 0 ? _e : '0');
74139
+ const trueBillPriceMinusFee = new BigNumber$1(zapTrueBondPrice !== null && zapTrueBondPrice !== void 0 ? zapTrueBondPrice : '0').times((100 + fee) / 100);
74140
+ const priceUSDMinusFee = getBalanceNumber(trueBillPriceMinusFee) * lpPrice;
74141
+ const discountWithoutFee = ((earnTokenPrice - priceUSDMinusFee) / earnTokenPrice) * 100;
74142
+ const zapBonusWithFee = discountWithoutFee > 0 ? (discountWithoutFee / (100 - discountWithoutFee)) * 100 : 0;
74143
+ 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 attempting to buy has reduced", ' ', jsxs(Text, { sx: { color: 'error' }, children: [(zapBonusWithFee - oldBonus).toFixed(6), "%"] }), "."] }), jsxs(Flex, { sx: {
74144
+ p: '8px 4px 4px 4px',
74145
+ borderRadius: '8px',
74146
+ width: '100%',
74147
+ alignItems: 'center',
74148
+ }, 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(6), "% ", tokenSymbol] })] })] }), jsx$2(Flex, { sx: { width: '15px', height: '15px', ml: '19px', 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(6), "% ", 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: {
74149
+ width: '100%',
74150
+ fontSize: '14px',
74151
+ fontWeight: 500,
74152
+ color: 'textDisabledButton',
74153
+ justifyContent: 'flex-start',
74154
+ mb: '10px',
74155
+ }, children: "Please confirm the new rate!" }), jsx$2(Button, { fullWidth: true, onClick: () => {
74156
+ handleZap();
74157
+ onDismiss && onDismiss();
74158
+ }, disabled: fetchingZapQuote, load: fetchingZapQuote, children: fetchingZapQuote ? 'Loading' : 'Buy' })] }) }));
74159
+ };
74160
+
74132
74161
  const BondModal = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond }) => {
74133
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
74162
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
74134
74163
  const SDKConfig = useSDKConfig();
74135
74164
  const { data: geoData } = useGeoFencing();
74136
74165
  // State
@@ -74147,19 +74176,21 @@ const BondModal = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond }) =
74147
74176
  const { data: userEscrowWeight } = useGetUserEscrowWeight(account);
74148
74177
  const userTier = getUserTier(userEscrowWeight !== null && userEscrowWeight !== void 0 ? userEscrowWeight : '0');
74149
74178
  // State
74150
- 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]);
74179
+ 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()); });
74151
74180
  const isXmasStyle = (bondData === null || bondData === void 0 ? void 0 : bondData.minTier) ? bondData.minTier : null;
74152
74181
  const [buyTxHash, setBuyTxHash] = useState();
74153
74182
  const [inputValue, setInputValue] = useState('');
74154
- 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');
74183
+ 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]);
74155
74184
  // Data
74156
74185
  const inputToken = useTokenFromZapList(inputTokenString, bondData === null || bondData === void 0 ? void 0 : bondData.chainId, bondData === null || bondData === void 0 ? void 0 : bondData.lpToken);
74157
- 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());
74158
- const [fetchingZapQuote, zapData, zapDepositAmount, zapError] = useSoulZapBondQuote(inputValue, inputToken, bondData, account);
74186
+ 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());
74187
+ const [fetchingZapQuote, zapData, zapDepositAmount, zapError, zapTrueBondPrice] = useSoulZapBondQuote(inputValue, inputToken, bondData, account);
74159
74188
  const inputTokenPrice = useCurrencyPrice(inputToken !== null && inputToken !== void 0 ? inputToken : null, bondChain);
74160
- 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);
74189
+ 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);
74161
74190
  // Estimations
74162
74191
  const depositAmount = isZap ? zapDepositAmount : inputValue;
74192
+ const youSpendString = `${formatNumber$2(inputValue)} ${getSymbol(inputToken, bondData === null || bondData === void 0 ? void 0 : bondData.chainId)} =
74193
+ $${formatUSDNumber((parseFloat(inputValue) * ((_g = inputTokenPrice === null || inputTokenPrice === void 0 ? void 0 : inputTokenPrice.price) !== null && _g !== void 0 ? _g : 0)).toString())}`;
74163
74194
  // Loading State
74164
74195
  const [loadingTx, setLoadingTx] = useState(false);
74165
74196
  const { addToastError } = usePopups();
@@ -74309,6 +74340,9 @@ const BondModal = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond }) =
74309
74340
  '0x94A283756B70c2A77bc58Ae0E2615Caf14310186'.toLowerCase(),
74310
74341
  '0x6639D4acAe77967c253C75cBfEd7C612682E2704'.toLowerCase(),
74311
74342
  ];
74343
+ 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');
74344
+ console.log(rateChanged);
74345
+ 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);
74312
74346
  const handleBothPurchases = () => {
74313
74347
  var _a, _b;
74314
74348
  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 : '')) {
@@ -74317,7 +74351,12 @@ const BondModal = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond }) =
74317
74351
  else {
74318
74352
  setLoadingTx(true);
74319
74353
  if (isZap) {
74320
- handleZapCallback().finally(() => setLoadingTx(false));
74354
+ if (rateChanged) {
74355
+ openNewRateModal();
74356
+ }
74357
+ else {
74358
+ handleZapCallback().finally(() => setLoadingTx(false));
74359
+ }
74321
74360
  }
74322
74361
  else {
74323
74362
  handleBuyCallback().finally(() => setLoadingTx(false));
@@ -74346,7 +74385,20 @@ const BondModal = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond }) =
74346
74385
  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');
74347
74386
  }
74348
74387
  };
74349
- return (jsx$2(Modal, { className: `modal ${isXmasStyle ? 'xmas-style' : ''}`, 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: isXmasStyle && bondData.minTier && (!userTier || userTier < bondData.minTier) ? true : false }), bondData.type === 'staking' && (jsxs(Flex, { sx: {
74388
+ // Effects
74389
+ const [hasChecked, setHasChecked] = useState(false);
74390
+ useEffect(() => {
74391
+ var _a, _b, _c;
74392
+ if (inputCurrencyBalance !== 'undefined' &&
74393
+ inputCurrencyBalance === '0' &&
74394
+ (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()) &&
74395
+ !hasChecked) {
74396
+ setHasChecked(true);
74397
+ setInputTokenString('NATIVE');
74398
+ console.log('change to native');
74399
+ }
74400
+ }, [inputCurrencyBalance]);
74401
+ return (jsx$2(Modal, { className: `modal ${isXmasStyle ? 'xmas-style' : ''}`, 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: isXmasStyle && bondData.minTier && (!userTier || userTier < bondData.minTier) ? true : false }), bondData.type === 'staking' && (jsxs(Flex, { sx: {
74350
74402
  p: '5px 10px',
74351
74403
  width: '100%',
74352
74404
  background: '#8E568F',
@@ -74357,7 +74409,7 @@ const BondModal = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond }) =
74357
74409
  justifyContent: 'center',
74358
74410
  display: 'block',
74359
74411
  }, 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."] })), isXmasStyle && (bondData === null || bondData === void 0 ? void 0 : bondData.minTier) !== undefined && (jsx$2(TagXmasFlashBond, { userTier: userTier, minTier: bondData.minTier })), jsxs(Flex, { className: "modaltable-container button-container", children: [account &&
74360
- (!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) => {
74412
+ (!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", 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, {})) : 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: "action-button", disabled: loadingTx || isConfirming || (bondData === null || bondData === void 0 ? void 0 : bondData.soldOut), onClick: (event) => {
74361
74413
  event.stopPropagation();
74362
74414
  switchChain({ chainId: bondData.chainId });
74363
74415
  }, 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 ||
@@ -74370,8 +74422,8 @@ const BondModal = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond }) =
74370
74422
  (bondData === null || bondData === void 0 ? void 0 : bondData.soldOut) ||
74371
74423
  !account ||
74372
74424
  !inputValue ||
74373
- 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) -
74374
- 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) => {
74425
+ 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) -
74426
+ 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) => {
74375
74427
  event.stopPropagation();
74376
74428
  switchChain({ chainId: bondData.chainId });
74377
74429
  }, 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 ||
@@ -74391,7 +74443,7 @@ const BondModal = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond }) =
74391
74443
  width: '100%',
74392
74444
  justifyContent: 'center',
74393
74445
  flexDirection: ['column', 'column', 'column', 'row'],
74394
- }, 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: {
74446
+ }, 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: {
74395
74447
  width: '100%',
74396
74448
  justifyContent: ['space-between', 'space-between', 'space-between', 'space-around'],
74397
74449
  }, 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: {
@@ -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
@@ -215,7 +215,6 @@
215
215
  z-index: 1001;
216
216
  width: 100%;
217
217
  max-width: 700px;
218
- min-width: 700px;
219
218
  }
220
219
 
221
220
  .modaltable-container {
@@ -546,9 +545,10 @@
546
545
  justify-content: center;
547
546
  align-items: center;
548
547
  cursor: pointer;
548
+ width: 35%;
549
+ min-width: 130px;
549
550
  }
550
551
  .button-container.get .action-button {
551
- width: 275px;
552
552
  margin-right: 10px;
553
553
  }
554
554
 
@@ -556,7 +556,7 @@
556
556
  justify-content: center;
557
557
  align-items: center;
558
558
  cursor: pointer;
559
- width: 100%;
559
+ width: 65%;
560
560
  }
561
561
  .button-container.buy .action-button {
562
562
  width: 100%;
@@ -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.2",
6
+ "version": "3.0.4-test.0",
7
7
  "module": "dist/main.js",
8
8
  "type": "module",
9
9
  "types": "dist/main.d.ts",