@ape.swap/bonds-sdk 3.0.11 → 3.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/uikit-sdk/TabNav/index.d.ts +8 -0
- package/dist/main.d.ts +2 -2
- package/dist/main.js +151 -139
- package/dist/styles.css +0 -2
- package/dist/views/{BondModal/BondModal.d.ts → BuyBond/BuyBond.d.ts} +3 -3
- package/dist/views/BuyBond/BuyBondModal.d.ts +4 -0
- package/dist/views/BuyBond/index.d.ts +7 -0
- package/dist/views/SingleBond/SingleBond.d.ts +4 -1
- package/dist/views/SingleBond/SoldOutBuyBondPlaceholder.d.ts +8 -0
- package/dist/views/SingleBond/index.d.ts +4 -1
- package/dist/views/YourBonds/YourBonds.d.ts +3 -1
- package/package.json +1 -1
- package/dist/views/BondModal/index.d.ts +0 -7
- /package/dist/views/{BondModal → BuyBond}/components/BondCards.d.ts +0 -0
- /package/dist/views/{BondModal → BuyBond}/components/BondModalHeader.d.ts +0 -0
- /package/dist/views/{BondModal → BuyBond}/components/BondModalHeaderAlt.d.ts +0 -0
- /package/dist/views/{BondModal → BuyBond}/components/BondModalMinTierHeader.d.ts +0 -0
- /package/dist/views/{BondModal → BuyBond}/components/Estimations.d.ts +0 -0
- /package/dist/views/{BondModal → BuyBond}/components/ExpandedViewButton.d.ts +0 -0
- /package/dist/views/{BondModal → BuyBond}/components/ImageAndShortDescription.d.ts +0 -0
- /package/dist/views/{BondModal → BuyBond}/components/NewRateModal/NewRateModal.d.ts +0 -0
- /package/dist/views/{BondModal → BuyBond}/components/NoBonusModal/NoBonusModal.d.ts +0 -0
- /package/dist/views/{BondModal → BuyBond}/components/ProjectDescription.d.ts +0 -0
package/dist/main.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import Bonds from './views/Bonds';
|
|
2
2
|
import YourBonds from './views/YourBonds';
|
|
3
|
-
import
|
|
3
|
+
import BuyBondModal from './views/BuyBond';
|
|
4
4
|
import FullBondsView from './views/FullBondsView';
|
|
5
5
|
import ProjectView from './views/ProjectView';
|
|
6
6
|
import { generateImageFromTemplate } from './views/YourBondsModal/components/LinkShare/utils';
|
|
7
7
|
import { ChainId } from '@ape.swap/apeswap-lists';
|
|
8
8
|
import SingleBond from './views/SingleBond';
|
|
9
|
-
export { Bonds,
|
|
9
|
+
export { Bonds, BuyBondModal, YourBonds, FullBondsView, ProjectView, generateImageFromTemplate, ChainId, SingleBond };
|
package/dist/main.js
CHANGED
|
@@ -18028,8 +18028,9 @@ var types = {};
|
|
|
18028
18028
|
(function (BillVersion) {
|
|
18029
18029
|
BillVersion['V1'] = 'V1';
|
|
18030
18030
|
BillVersion['V2'] = 'V2';
|
|
18031
|
-
BillVersion['FixedPrice'] = 'FixedPrice';
|
|
18032
18031
|
BillVersion['V3'] = 'V3';
|
|
18032
|
+
BillVersion['V4'] = 'V4';
|
|
18033
|
+
BillVersion['FixedPrice'] = 'FixedPrice';
|
|
18033
18034
|
BillVersion['TieredSale'] = 'TieredSale';
|
|
18034
18035
|
BillVersion['FlashTieredSale'] = 'FlashTieredSale';
|
|
18035
18036
|
})((exports.BillVersion || (exports.BillVersion = {})));
|
|
@@ -21953,15 +21954,6 @@ function formatUSDNumber(input) {
|
|
|
21953
21954
|
const youSpendUSD = (bond, inputValue) => {
|
|
21954
21955
|
return (parseFloat(inputValue) * parseFloat(bond.principalTokenPrice)).toString();
|
|
21955
21956
|
};
|
|
21956
|
-
// receives depositAmount and returns the payoutTokens the user will receive. IT DOES NOT SUBTRACT FEE
|
|
21957
|
-
const getRawPayoutAmount = (bond, inputValue) => {
|
|
21958
|
-
var _a;
|
|
21959
|
-
if (!inputValue || !bond)
|
|
21960
|
-
return 0;
|
|
21961
|
-
const bigValue = new BigNumber$1(inputValue).times(new BigNumber$1(10).pow(18));
|
|
21962
|
-
const billValue = bigValue.div(new BigNumber$1((_a = bond.trueBillPrice) !== null && _a !== void 0 ? _a : 0));
|
|
21963
|
-
return billValue.toNumber();
|
|
21964
|
-
};
|
|
21965
21957
|
// receives depositAmount and returns the payoutTokens the user will receive. IT DOES SUBTRACT FEE
|
|
21966
21958
|
const getPayoutAmount = (bond, inputValue) => {
|
|
21967
21959
|
var _a;
|
|
@@ -71198,7 +71190,7 @@ const YourBondsMenu = ({ chainFilterOption, setChainFilterOption, filterOptions,
|
|
|
71198
71190
|
return (jsxs("div", { className: "bonds-menu", children: [jsx$2(BondFilters, { chainFilterOption: chainFilterOption !== null && chainFilterOption !== void 0 ? chainFilterOption : ['All Chains'], setChainFilterOption: setChainFilterOption, filterOptions: filterOptions, filterOption: filterOption, setFilterOption: setFilterOption, onHandleQueryChange: () => setInputValue('') }), jsxs("div", { className: "table-header-container", children: [jsx$2("div", { className: "search-container", children: jsx$2(Flex$1, { sx: { width: '100%', maxWidth: '300px' }, children: jsx$2(Input, { className: "search-input", value: inputValue, onChange: (event) => setInputValue(event.target.value), variant: "search", sx: { fontWeight: 600, background: 'white2', height: '30px', fontSize: '14px', color: 'white' }, width: '100%', placeholder: 'Search...' }) }) }), jsxs("div", { className: "headers-container", children: [jsxs("div", { className: "your-bonds-table-headers", onClick: () => handleSort('claimable'), children: ["CLAIMABLE", jsx$2(Flex$1, { sx: { ml: '5px' }, children: jsx$2(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) })] }), jsxs("div", { className: "your-bonds-table-headers", onClick: () => handleSort('pending'), children: ["PENDING", jsx$2(Flex$1, { sx: { ml: '5px' }, children: jsx$2(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) })] }), jsxs("div", { className: "your-bonds-table-headers", onClick: () => handleSort('terms'), children: ["TERMS", jsx$2(Flex$1, { sx: { ml: '5px' }, children: jsx$2(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) })] }), jsx$2(Flex$1, { className: "claim-all-button-container", children: SDKConfig.referenceId === 'apebond' && jsx$2(ClaimAll, {}) })] })] })] }));
|
|
71199
71191
|
};
|
|
71200
71192
|
|
|
71201
|
-
const YourBonds = () => {
|
|
71193
|
+
const YourBonds = ({ showOnly }) => {
|
|
71202
71194
|
// Hooks
|
|
71203
71195
|
const { address: account } = useAccount();
|
|
71204
71196
|
const { data: userBonds, isFetched: userBondsFetched } = useUserBonds();
|
|
@@ -71224,6 +71216,13 @@ const YourBonds = () => {
|
|
|
71224
71216
|
return [];
|
|
71225
71217
|
let bondsToReturn = userBonds;
|
|
71226
71218
|
// Handle Filtering //
|
|
71219
|
+
// Filter Single Token View
|
|
71220
|
+
if (showOnly) {
|
|
71221
|
+
bondsToReturn = bondsToReturn === null || bondsToReturn === void 0 ? void 0 : bondsToReturn.filter((bond) => {
|
|
71222
|
+
var _a, _b, _c;
|
|
71223
|
+
return ((_c = (_b = (_a = bond === null || bond === void 0 ? void 0 : bond.bond) === null || _a === void 0 ? void 0 : _a.earnToken) === null || _b === void 0 ? void 0 : _b.symbol) === null || _c === void 0 ? void 0 : _c.toLowerCase()) === showOnly.toLowerCase();
|
|
71224
|
+
});
|
|
71225
|
+
}
|
|
71227
71226
|
// Filter by search query
|
|
71228
71227
|
if (inputValue !== '') {
|
|
71229
71228
|
bondsToReturn = bondsToReturn === null || bondsToReturn === void 0 ? void 0 : bondsToReturn.filter((bond) => {
|
|
@@ -71290,7 +71289,7 @@ const YourBonds = () => {
|
|
|
71290
71289
|
const handleFilterOption = useCallback((newOption) => {
|
|
71291
71290
|
setFilterOption(newOption);
|
|
71292
71291
|
}, []);
|
|
71293
|
-
return (jsxs(Flex$1, { className: "yourbonds table-container", children: [jsx$2(YourBondsMenu, { chainFilterOption: chainFilterOption, setChainFilterOption: setChainFilterOption, filterOptions: filterOptions, filterOption: filterOption, setFilterOption: handleFilterOption, setInputValue: setInputValue, inputValue: inputValue, handleSort: handleSort }), !account ? (jsx$2(PlaceholderMonkey, { text: 'You are not connected' })) : bondsToRender && (bondsToRender === null || bondsToRender === void 0 ? void 0 : bondsToRender.length) > 0 ? (bondsToRender === null || bondsToRender === void 0 ? void 0 : bondsToRender.map((bill) => jsx$2(UserBondRow, { bill: bill }, bill.id))) : inputValue !== '' || !chainFilterOption.includes('All Chains') ? (jsx$2(PlaceholderMonkey, { text: 'No results, change filters!' })) : userBondsFetched && (userBonds === null || userBonds === void 0 ? void 0 : userBonds.length) === 0 ? (jsxs(Flex$1, { sx: { flexDirection: 'column', justifyContent: 'center', alignItems: 'center', width: '100%', mt: '30px' }, children: [jsx$2(Svg, { icon: "placeholderMonkey" }), jsx$2(Flex$1, { sx: { mt: '15px' }, children:
|
|
71292
|
+
return (jsxs(Flex$1, { className: "yourbonds table-container", children: [!showOnly && (jsx$2(YourBondsMenu, { chainFilterOption: chainFilterOption, setChainFilterOption: setChainFilterOption, filterOptions: filterOptions, filterOption: filterOption, setFilterOption: handleFilterOption, setInputValue: setInputValue, inputValue: inputValue, handleSort: handleSort })), !account ? (jsx$2(PlaceholderMonkey, { text: 'You are not connected' })) : bondsToRender && (bondsToRender === null || bondsToRender === void 0 ? void 0 : bondsToRender.length) > 0 ? (bondsToRender === null || bondsToRender === void 0 ? void 0 : bondsToRender.map((bill) => jsx$2(UserBondRow, { bill: bill }, bill.id))) : inputValue !== '' || !chainFilterOption.includes('All Chains') ? (jsx$2(PlaceholderMonkey, { text: 'No results, change filters!' })) : userBondsFetched && (userBonds === null || userBonds === void 0 ? void 0 : userBonds.length) === 0 ? (jsxs(Flex$1, { sx: { flexDirection: 'column', justifyContent: 'center', alignItems: 'center', width: '100%', mt: '30px' }, children: [jsx$2(Svg, { icon: "placeholderMonkey" }), jsx$2(Flex$1, { sx: { mt: '15px' }, children: showOnly ? `You do not own any ${showOnly.toUpperCase()} Bonds.` : 'You do not own any Bonds' })] })) : (jsx$2(Flex$1, { className: "yourbonds-spinner", children: jsx$2(Spinner, { size: 100 }) }))] }));
|
|
71294
71293
|
};
|
|
71295
71294
|
|
|
71296
71295
|
// This basically returns the 2 tags with the higher active bond count
|
|
@@ -72991,13 +72990,6 @@ const ZapModal = ({ onDismiss, outputToken, account, chainId }) => {
|
|
|
72991
72990
|
: 'BUY' })) }), jsx$2(Flex, { sx: { marginTop: '10px', justifyContent: 'center' }, children: jsx$2(Link, { href: "https://docs.ape.bond/apebond/products-and-features/zap", target: "_blank", rel: "noopener noreferrer", sx: { textDecoration: 'none' }, children: jsxs(Text, { style: { fontSize: '12px', lineHeight: '18px', fontWeight: 400, borderBottom: '1px solid' }, children: ["Learn more", '>'] }) }) })] })] }));
|
|
72992
72991
|
};
|
|
72993
72992
|
|
|
72994
|
-
const AccordionText = ({ isVisible = false }) => {
|
|
72995
|
-
if (!isVisible) {
|
|
72996
|
-
return null;
|
|
72997
|
-
}
|
|
72998
|
-
return (jsxs(Fragment$1, { children: [jsx$2(Flex, { className: "accordion-title", children: "Bonds at Seedify are an exciting new product!" }), jsx$2(AnimatePresence, { children: jsx$2(motion.div, { initial: { height: 0 }, animate: { height: 'fit-content' }, transition: { opacity: { duration: 0.2 } }, exit: { height: 0 }, sx: { overflow: 'hidden', width: '100%' }, children: jsxs(Flex, { className: "accordion-body", sx: { flexDirection: 'column' }, children: [jsx$2(Flex, { sx: { mt: '10px' }, children: "Are you a strong believer in a project? Do you want to buy project tokens at a discount compared to the market? If so, you've arrived at the right place!" }), jsx$2(Flex, { sx: { mt: '10px' }, children: "Bonds allow you to purchase project tokens at a discounted price with a short-term linear vesting. Its a perfect solution for projects you're planning to buy and hold tokens of!" }), jsx$2(Flex, { sx: { mt: '10px' }, children: "When you buy a Bond, you essentially are given an NFT (which you can transfer across your wallets). Whichever wallet owns the NFT will be able to Claim tokens of that project post-purchase until vesting period ends. Bonds at Seedify can range their vesting from 7 Days to 90 Days, with 30 Days being the standard." })] }) }) })] }));
|
|
72999
|
-
};
|
|
73000
|
-
|
|
73001
72993
|
const useSoulZapBondQuote = (typedValue, inputCurrency, bond, account) => {
|
|
73002
72994
|
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;
|
|
73003
72995
|
const debouncedInput = useDebounce(typedValue, 400);
|
|
@@ -73588,7 +73580,7 @@ const BondModalHeader = ({ bondData, onDismiss, showProjectInfoButton, }) => {
|
|
|
73588
73580
|
},
|
|
73589
73581
|
});
|
|
73590
73582
|
};
|
|
73591
|
-
return (jsxs(Flex, { className: "modaltable-container title-container", sx: { flexDirection: 'column', justifyContent: 'center', alignItems: 'start' }, children: [jsxs(Flex, { className: "slipagge-close-icon", sx: { width: '100%', height: '30px', mb: ['10px', '10px', '10px', '0px']
|
|
73583
|
+
return (jsxs(Flex, { className: "modaltable-container title-container", sx: { flexDirection: 'column', justifyContent: 'center', alignItems: 'start' }, children: [jsxs(Flex, { className: "slipagge-close-icon", sx: { width: '100%', height: '30px', mb: ['10px', '10px', '10px', '0px'] }, children: [jsx$2(Flex, { sx: { display: ['flex', 'flex', 'flex', 'none', 'none'] }, children: jsx$2(BondModalMinTierHeader, { minTier: minTier }) }), jsx$2(Flex, { sx: { flexDirection: 'column', position: 'absolute', right: '0px' }, children: onDismiss ? (jsxs(Fragment$1, { children: [showProjectInfoButton && jsx$2(ExpandedViewButton, { handleNavigation: handleProjectViewNavigation }), jsx$2(IconButton, { icon: "close", color: "text", variant: "transparent", onClick: handleClose }), jsx$2(Flex, { sx: { py: '3px' }, onClick: onOpenSlippageModal, children: jsx$2(Svg, { icon: "cog", width: "16px" }) })] })) : (jsx$2(Flex, { sx: { py: '3px', mt: '10px' }, onClick: onOpenSlippageModal, children: jsx$2(Svg, { icon: "cog", width: "16px" }) })) })] }), jsxs(Flex, { sx: { width: '100%' }, children: [jsx$2(Flex, { className: "title-container bondicon", children: jsx$2(TokenImage, { symbol: (_a = bondData.showcaseTokenName) !== null && _a !== void 0 ? _a : bondData.earnToken.symbol, size: 50, chain: bondData.chainId }) }), jsxs(Flex, { className: "title-container bondname", children: [bondData === null || bondData === void 0 ? void 0 : bondData.showcaseTokenName, jsx$2(ListTag, { text: (_b = bondData === null || bondData === void 0 ? void 0 : bondData.tags) === null || _b === void 0 ? void 0 : _b[0] })] }), jsxs(Flex, { className: "title-container price-container", sx: { flexDirection: 'column', paddingLeft: '20px' }, children: [jsxs(Flex, { className: "price-container price", children: ["$", earnTokenPrice(bondData)] }), jsxs(Flex, { className: "price-container discounted", children: ["$", discountEarnTokenPrice(bondData)] })] }), jsx$2(Flex, { sx: { display: ['none', 'none', 'none', 'flex', 'flex'], ml: '10px' }, children: jsx$2(BondModalMinTierHeader, { minTier: minTier }) })] })] }));
|
|
73592
73584
|
};
|
|
73593
73585
|
|
|
73594
73586
|
const BondCards = ({ bondData }) => {
|
|
@@ -73646,7 +73638,7 @@ const Estimations = ({ depositAmount, bondData, youSpendString, isZap, fetchingZ
|
|
|
73646
73638
|
const feeUSD = fee * parseFloat((_a = bondData === null || bondData === void 0 ? void 0 : bondData.payoutTokenPrice) !== null && _a !== void 0 ? _a : '0');
|
|
73647
73639
|
const estimatedOutputAmount = getPayoutAmount(bondData, depositAmount);
|
|
73648
73640
|
const estimatedOutputUSD = estimatedOutputAmount * parseFloat((_b = bondData === null || bondData === void 0 ? void 0 : bondData.payoutTokenPrice) !== null && _b !== void 0 ? _b : '0');
|
|
73649
|
-
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())] }))] })] }));
|
|
73641
|
+
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())] }))] })] }));
|
|
73650
73642
|
};
|
|
73651
73643
|
|
|
73652
73644
|
// Custom HTML sanitizer
|
|
@@ -73694,68 +73686,6 @@ const ProjectDescription = ({ description }) => {
|
|
|
73694
73686
|
}, onClick: () => setIsOpen(true), children: ["View More ", '>'] }))] }), jsx$2(Flex, { sx: { display: ['none', 'none', 'none', 'flex'] }, children: jsx$2(SafeHTMLComponent, { html: description !== null && description !== void 0 ? description : '' }) })] }));
|
|
73695
73687
|
};
|
|
73696
73688
|
|
|
73697
|
-
const BondModalHeaderAlt = ({ bondData, onDismiss, showProjectInfoButton, }) => {
|
|
73698
|
-
var _a, _b, _c, _d, _e, _f;
|
|
73699
|
-
const [onOpenSlippageModal] = useModal(jsx$2(SlippageModal, {}));
|
|
73700
|
-
const handleClose = () => {
|
|
73701
|
-
if (typeof window !== 'undefined') {
|
|
73702
|
-
window.history.pushState({}, '', `/bonds`);
|
|
73703
|
-
}
|
|
73704
|
-
onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss();
|
|
73705
|
-
};
|
|
73706
|
-
// const handleProjectViewNavigation = () => {
|
|
73707
|
-
// window.open(`${window.location.origin}/bonds/${bondData.billAddress}/${bondData.chainId}`, '_self')
|
|
73708
|
-
// track({
|
|
73709
|
-
// event: 'projectInfoClick',
|
|
73710
|
-
// chain: bondData.chainId,
|
|
73711
|
-
// data: {
|
|
73712
|
-
// cat: 'Modal',
|
|
73713
|
-
// bond: bondData.earnToken.symbol,
|
|
73714
|
-
// bondChain: bondData.chainId,
|
|
73715
|
-
// },
|
|
73716
|
-
// })
|
|
73717
|
-
// }
|
|
73718
|
-
return (jsx$2(Flex, { className: "modaltable-container title-container", children: jsx$2(Flex, { className: "slipagge-close-icons", sx: { flexDirection: 'row' }, children: onDismiss ? (jsxs(Fragment$1, { children: [jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(BondInfoTooltip, { earnTokenContract: (_c = (_b = (_a = bondData === null || bondData === void 0 ? void 0 : bondData.earnToken) === null || _a === void 0 ? void 0 : _a.address) === null || _b === void 0 ? void 0 : _b[bondData === null || bondData === void 0 ? void 0 : bondData.chainId]) !== null && _c !== void 0 ? _c : '', earnTokenSymbol: (_e = (_d = bondData === null || bondData === void 0 ? void 0 : bondData.earnToken) === null || _d === void 0 ? void 0 : _d.symbol) !== null && _e !== void 0 ? _e : '', bondContract: (_f = bondData.billAddress) !== null && _f !== void 0 ? _f : '', projectLink: bondData === null || bondData === void 0 ? void 0 : bondData.projectLink, twitter: bondData === null || bondData === void 0 ? void 0 : bondData.twitter, audit: bondData === null || bondData === void 0 ? void 0 : bondData.audit, chain: bondData === null || bondData === void 0 ? void 0 : bondData.chainId }), width: "205px", placement: "bottomRight", transformTip: "translate(7%, -2%)", children: jsx$2(Flex, { className: "more-icon", sx: { opacity: 0.8 }, children: jsx$2(Svg, { icon: "more", width: "25px" }) }) }), jsx$2(Flex, { sx: { pr: '10px' }, onClick: onOpenSlippageModal, children: jsx$2(Svg, { icon: "cog", width: "16px" }) }), jsx$2(IconButton, { icon: "close", color: "text", variant: "transparent", onClick: handleClose })] })) : (jsx$2(Flex, { sx: {}, onClick: onOpenSlippageModal, children: jsx$2(Svg, { icon: "cog", width: "16px" }) })) }) }));
|
|
73719
|
-
};
|
|
73720
|
-
|
|
73721
|
-
const ImageAndShortDescription = ({ bondData, onDismiss }) => {
|
|
73722
|
-
var _a;
|
|
73723
|
-
const SDKConfig = useSDKConfig();
|
|
73724
|
-
// Swiper logic for the alt view
|
|
73725
|
-
const [activeSlide, setActiveSlide] = useState(0);
|
|
73726
|
-
const { swiper, setSwiper } = useSwiper();
|
|
73727
|
-
const imagesLength = 3;
|
|
73728
|
-
const handleSlide = (event) => {
|
|
73729
|
-
const slideNumber = getDotPos(event.activeIndex, imagesLength);
|
|
73730
|
-
setActiveSlide(slideNumber);
|
|
73731
|
-
};
|
|
73732
|
-
const slideTo = (index) => {
|
|
73733
|
-
setActiveSlide(index);
|
|
73734
|
-
swiper === null || swiper === void 0 ? void 0 : swiper.slideTo(index);
|
|
73735
|
-
};
|
|
73736
|
-
return (jsxs(Flex, { sx: { maxWidth: ['unset', 'unset', 'unset', '500px'], flexDirection: 'column', alignItems: 'center' }, children: [jsxs(Flex, { sx: {
|
|
73737
|
-
flexDirection: 'column',
|
|
73738
|
-
width: '100%',
|
|
73739
|
-
alignItems: 'center',
|
|
73740
|
-
overflow: 'hidden',
|
|
73741
|
-
position: 'relative',
|
|
73742
|
-
}, children: [jsxs(Swiper, { id: "hotbondsSweper", onSwiper: setSwiper, slidesPerView: "auto", centeredSlides: true, lazy: true, preloadImages: false, onSlideChange: handleSlide, style: { width: '100%', overflow: 'visible' }, children: [jsx$2(SwiperSlide, { style: {
|
|
73743
|
-
width: '100%',
|
|
73744
|
-
display: 'flex',
|
|
73745
|
-
justifyContent: 'center',
|
|
73746
|
-
}, children: jsx$2("img", { className: "project-image", src: "https://placehold.co/400x200" }) }, 0), jsx$2(SwiperSlide, { style: {
|
|
73747
|
-
width: '100%',
|
|
73748
|
-
display: 'flex',
|
|
73749
|
-
justifyContent: 'center',
|
|
73750
|
-
}, children: jsx$2("img", { className: "project-image", src: "https://placehold.co/400x200" }) }, 1), jsx$2(SwiperSlide, { style: {
|
|
73751
|
-
width: '100%',
|
|
73752
|
-
display: 'flex',
|
|
73753
|
-
justifyContent: 'center',
|
|
73754
|
-
}, children: jsx$2("img", { className: "project-image", src: "https://placehold.co/400x200" }) }, 2)] }), jsx$2(Flex, { sx: { position: 'absolute', bottom: ['15px', '15px', '15px', '20px'], left: 'calc(50% - 28,5px)', zIndex: 2 }, children: [...Array(imagesLength)].map((_, i) => {
|
|
73755
|
-
return jsx$2(SwiperDots, { isActive: i === activeSlide, onClick: () => slideTo(i) }, i);
|
|
73756
|
-
}) })] }), jsxs(Flex, { sx: { alignItems: 'center', display: ['flex', 'flex', 'flex', 'none'], p: '10px', width: '100%' }, children: [jsxs(Flex, { sx: { width: ['50%', '50%', '50%', '100%'], alignItems: 'center' }, children: [jsx$2(Flex, { sx: { mr: '5px' }, children: jsx$2(TokenImage, { symbol: (_a = bondData.showcaseTokenName) !== null && _a !== void 0 ? _a : bondData.earnToken.symbol, size: 30, chain: bondData.chainId }) }), jsxs("h2", { className: "modal-tokenname-chainicon", sx: { margin: '0px' }, children: [bondData === null || bondData === void 0 ? void 0 : bondData.showcaseTokenName, ' '] })] }), jsx$2(Flex, { className: "modal-marketprice-header", sx: { justifyContent: 'flex-end', alignItems: 'center' }, children: jsxs("span", { className: "modal-marketprice", children: ["Market Price: $", earnTokenPrice(bondData)] }) }), jsx$2(Flex, { className: "bondmodal-header-alt", sx: { mb: '10px' }, children: jsx$2(BondModalHeaderAlt, { bondData: bondData, onDismiss: onDismiss, showProjectInfoButton: (SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.referenceId) === 'apebond' }) })] }), jsx$2(Flex, { className: "description-container paragraph-spaced", sx: { px: '10px', opacity: 0.7, mt: ['0', '0', '0', '10px'] }, children: jsx$2(ProjectDescription, { description: bondData === null || bondData === void 0 ? void 0 : bondData.shortDescription }) })] }));
|
|
73757
|
-
};
|
|
73758
|
-
|
|
73759
73689
|
// Fetch country code to check if the region is allowed
|
|
73760
73690
|
const fetchLocation = (apiv2URL) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
73761
73691
|
const resp = yield axios.get(`${apiv2URL}/check`);
|
|
@@ -73838,13 +73768,10 @@ const NoBonusModal = ({ onAcknowledge, showcaseTokenName }) => {
|
|
|
73838
73768
|
return (isOpen && (jsxs(Modal, { className: "nobonus-modal", title: "Warning", onClose: handleAcknowledge, children: [jsxs("p", { children: ["You're buying ", showcaseTokenName, " at a higher price than the market, which will result in receiving fewer tokens compared to swapping via an exchange."] }), jsx$2("p", { children: "You will not receive any bonus tokens when buying this bond." }), jsxs(Flex, { className: "nobonus-checkbox-row", sx: { flexDirection: 'row', gap: '8px', pb: '20px' }, children: [jsx$2(Flex, { className: "nobonus-checkbox", children: jsx$2(Checkbox, { onChange: handleCheckboxChange }) }), jsx$2(Flex, { className: "nobonus-checkbox-text", children: "I understand and want to proceed." })] }), jsxs(Flex, { className: "nobonus-actions", sx: { flexDirection: 'row', gap: '8px' }, children: [jsx$2(Button, { classname: "nobonus-cancel", onClick: handleCancel, sx: { width: '100%', justifyContent: 'center' }, variant: "secondary", children: "Cancel" }), jsx$2(Button, { className: "nobonus-buy", onClick: handleAcknowledge, disabled: !isChecked, sx: { width: '100%', justifyContent: 'center' }, children: "Buy" })] })] })));
|
|
73839
73769
|
};
|
|
73840
73770
|
|
|
73841
|
-
const
|
|
73842
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k
|
|
73771
|
+
const BuyBond = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond }) => {
|
|
73772
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
73843
73773
|
const SDKConfig = useSDKConfig();
|
|
73844
73774
|
const { data: geoData } = useGeoFencing();
|
|
73845
|
-
// State
|
|
73846
|
-
const [modalVariant, setModalVariant] = useState(SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.modalVariant);
|
|
73847
|
-
const [accordionVisible, setAccordionVisible] = useState(false);
|
|
73848
73775
|
// Hooks
|
|
73849
73776
|
const userChainId = useChainId();
|
|
73850
73777
|
const { address: account } = useAccount();
|
|
@@ -74077,48 +74004,24 @@ const BondModal = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond }) =
|
|
|
74077
74004
|
console.log('change to native');
|
|
74078
74005
|
}
|
|
74079
74006
|
}, [inputCurrencyBalance]);
|
|
74080
|
-
return
|
|
74081
|
-
|
|
74082
|
-
|
|
74083
|
-
|
|
74084
|
-
|
|
74085
|
-
|
|
74086
|
-
|
|
74087
|
-
|
|
74088
|
-
|
|
74089
|
-
|
|
74090
|
-
|
|
74091
|
-
|
|
74092
|
-
|
|
74093
|
-
|
|
74094
|
-
|
|
74095
|
-
|
|
74096
|
-
|
|
74097
|
-
|
|
74098
|
-
(bondData === null || bondData === void 0 ? void 0 : bondData.soldOut) ||
|
|
74099
|
-
!account ||
|
|
74100
|
-
!inputValue ||
|
|
74101
|
-
parseFloat(inputValue) === 0, onClick: handleApprove, children: "enable" })) })] }), jsx$2(Flex, { sx: { width: '100%', margin: ['0', '0', '0', '10px 0'] }, children: jsx$2("hr", { className: "fading-hr" }) }), jsxs(Flex, { sx: { width: '100%', fontSize: '14px', display: ['none', 'none', 'none', 'flex'] }, children: [jsxs(Flex, { sx: { width: '50%', flexDirection: 'column', opacity: 0.8 }, children: ["Market Price: $", formatUSDNumber((getRawPayoutAmount(bondData, inputValue) * lodashExports.toNumber(earnTokenPrice(bondData))).toString()), jsx$2("hr", { className: "fading-hr" }), jsx$2("span", { className: "text-highlight flex-inline", children: "Our price: " }), jsxs("span", { className: "flex-inline", children: ["$", formatUSDNumber((lodashExports.toNumber(inputValue) * lodashExports.toNumber(bondData.principalTokenPrice)).toString()), ' '] }), jsxs("span", { className: "text-highlight flex-inline", children: ["(discount rate ", bondData === null || bondData === void 0 ? void 0 : bondData.discount.toFixed(2), "%)"] })] }), jsx$2(Flex, { sx: { width: '50px', alignItems: 'center', justifyContent: 'center' }, children: "vs." }), jsxs(Flex, { sx: { width: '50%', flexDirection: 'column', opacity: 0.8 }, children: ["If purchased from market:", ' ', formatNumber$2((lodashExports.toNumber(inputValue) / lodashExports.toNumber(earnTokenPrice(bondData))).toFixed(0)), ' ', bondData.earnToken.symbol, jsx$2("hr", { className: "fading-hr" }), jsx$2("span", { className: "text-highlight flex-inline", children: "Amount you will get:" }), ' ', formatNumber$2(getRawPayoutAmount(bondData, inputValue).toFixed(0)), ' ', jsx$2("span", { className: "flex-inline", children: bondData.earnToken.symbol })] })] }), jsxs(Flex, { sx: {
|
|
74102
|
-
width: '100%',
|
|
74103
|
-
fontSize: '14px',
|
|
74104
|
-
display: ['flex', 'flex', 'flex', 'none'],
|
|
74105
|
-
flexDirection: 'column',
|
|
74106
|
-
}, children: [jsxs(Flex, { sx: { opacity: 0.8 }, children: ["Market Price: $", formatUSDNumber((getRawPayoutAmount(bondData, inputValue) * lodashExports.toNumber(earnTokenPrice(bondData))).toString())] }), jsxs(Flex, { sx: { opacity: 0.8 }, children: ["If purchased from market:", ' ', formatNumber$2((lodashExports.toNumber(inputValue) / lodashExports.toNumber(earnTokenPrice(bondData))).toFixed(0)), ' ', bondData.earnToken.symbol] }), jsxs(Flex, { sx: { mt: '10px' }, children: [jsx$2("span", { className: "text-highlight flex-inline", children: "Our price: " }), jsxs("span", { className: "flex-inline", children: ["$", formatUSDNumber((lodashExports.toNumber(inputValue) * lodashExports.toNumber(bondData.principalTokenPrice)).toString()), ' '] }), jsxs("span", { className: "text-highlight flex-inline", children: ["(discount rate ", bondData === null || bondData === void 0 ? void 0 : bondData.discount.toFixed(2), "%)"] })] }), jsxs(Flex, { sx: { mt: '10px' }, children: [jsx$2("span", { className: "text-highlight flex-inline", children: "Amount you will get:" }), ' ', formatNumber$2(getRawPayoutAmount(bondData, inputValue).toFixed(0)), ' ', jsx$2("span", { className: "flex-inline", children: bondData.earnToken.symbol })] })] })] })] })] }), jsxs(Flex, { className: "footer-details", children: [jsxs(Flex, { sx: { width: '100%', flexDirection: 'row', justifyContent: 'space-around' }, children: [jsxs(Flex, { sx: {
|
|
74107
|
-
width: '100%',
|
|
74108
|
-
justifyContent: 'center',
|
|
74109
|
-
flexDirection: ['column', 'column', 'column', 'row'],
|
|
74110
|
-
}, children: [jsx$2(Flex, { className: "modal-footer-header", children: "Vesting start Date:\u00A0" }), jsxs(Flex, { children: [' ', new Intl.DateTimeFormat('en-GB', { day: '2-digit', month: 'short', year: 'numeric' }).format(new Date())] })] }), jsxs(Flex, { sx: {
|
|
74111
|
-
width: '100%',
|
|
74112
|
-
justifyContent: 'center',
|
|
74113
|
-
flexDirection: ['column', 'column', 'column', 'row'],
|
|
74114
|
-
}, 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: {
|
|
74115
|
-
width: '100%',
|
|
74116
|
-
justifyContent: ['space-between', 'space-between', 'space-between', 'space-around'],
|
|
74117
|
-
}, 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: {
|
|
74118
|
-
justifyContent: 'center',
|
|
74119
|
-
cursor: 'pointer',
|
|
74120
|
-
alignItems: 'center',
|
|
74121
|
-
}, onClick: () => setAccordionVisible(!accordionVisible), className: "modal-expander", children: ["What are bonds? \u00A0 ", jsx$2(Svg, { icon: "caret", direction: accordionVisible ? 'up' : 'down' })] })] })] })] }), accordionVisible && (jsx$2(Flex, { className: "modaltable-container accordion-container", children: jsx$2(AccordionText, { isVisible: accordionVisible }) }))] })) })) }));
|
|
74007
|
+
return bondData ? (jsx$2(Flex, { className: "modal-content", children: 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) }), 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) => {
|
|
74008
|
+
event.stopPropagation();
|
|
74009
|
+
switchChain({ chainId: bondData.chainId });
|
|
74010
|
+
}, 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 ||
|
|
74011
|
+
(bondData === null || bondData === void 0 ? void 0 : bondData.soldOut) ||
|
|
74012
|
+
!account ||
|
|
74013
|
+
!inputValue ||
|
|
74014
|
+
parseFloat(inputValue) === 0 ||
|
|
74015
|
+
fetchingZapQuote ||
|
|
74016
|
+
zapError, onClick: handleOpenModal, children: zapError ? 'something went wrong' : `buy` })) : (jsx$2(Button, { className: "action-button", load: approvalState === ApprovalState.PENDING, disabled: approvalState === ApprovalState.PENDING ||
|
|
74017
|
+
(bondData === null || bondData === void 0 ? void 0 : bondData.soldOut) ||
|
|
74018
|
+
!account ||
|
|
74019
|
+
!inputValue ||
|
|
74020
|
+
parseFloat(inputValue) === 0, onClick: handleApprove, children: "enable" })) })] })] }) })) : (jsx$2(Fragment$1, {}));
|
|
74021
|
+
};
|
|
74022
|
+
|
|
74023
|
+
const BuyBondModal = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond }) => {
|
|
74024
|
+
return (jsx$2(Modal, { className: "modal", onDismiss: onDismiss, sx: { width: '400px' }, children: jsx$2(Flex, { sx: { width: '100%', maxWidth: '700px', mt: '-10px' }, children: jsx$2(BuyBond, { onDismiss: onDismiss, bondAddress: bondAddress, bondChain: bondChain, handlePurchasedBond: handlePurchasedBond }) }) }));
|
|
74122
74025
|
};
|
|
74123
74026
|
|
|
74124
74027
|
/*
|
|
@@ -74159,7 +74062,7 @@ const ModalHandler = ({ onDismiss, bondAddress, bondChain, }) => {
|
|
|
74159
74062
|
refetch();
|
|
74160
74063
|
}
|
|
74161
74064
|
}, [billId]);
|
|
74162
|
-
return billId ? (jsx$2(YourBondsModal, { userBill: userBill, onDismiss: onDismiss })) : (jsx$2(
|
|
74065
|
+
return billId ? (jsx$2(YourBondsModal, { userBill: userBill, onDismiss: onDismiss })) : (jsx$2(BuyBondModal, { bondAddress: bondAddress, bondChain: bondChain, handlePurchasedBond: setBuyTxHash, onDismiss: () => {
|
|
74163
74066
|
window.history.pushState({}, '', `${locationPath !== '/bonds' ? locationPath : '/bonds'}`);
|
|
74164
74067
|
onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss();
|
|
74165
74068
|
} }));
|
|
@@ -74303,7 +74206,7 @@ const HotBondCard = ({ bond }) => {
|
|
|
74303
74206
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
74304
74207
|
const { bonus } = bond;
|
|
74305
74208
|
// Modal
|
|
74306
|
-
const [openBuyModal] = useModal(jsx$2(
|
|
74209
|
+
const [openBuyModal] = useModal(jsx$2(BuyBondModal, { bondAddress: bond.billAddress, bondChain: bond.chainId }), true, true, `buyBondModal-${bond.billAddress}-${bond.chainId}`);
|
|
74307
74210
|
const handleOpenModal = () => {
|
|
74308
74211
|
openBuyModal();
|
|
74309
74212
|
track({
|
|
@@ -75507,9 +75410,9 @@ const YourBondsWithProviders = (props) => {
|
|
|
75507
75410
|
return (jsx$2(Providers, { theme: props.theme, children: jsx$2(YourBonds, {}) }));
|
|
75508
75411
|
};
|
|
75509
75412
|
|
|
75510
|
-
const
|
|
75413
|
+
const BuyBondModalWithProviders = (props) => {
|
|
75511
75414
|
useSDKConfig(props);
|
|
75512
|
-
return (jsx$2(Providers, { theme: props.theme, children: jsx$2(
|
|
75415
|
+
return (jsx$2(Providers, { theme: props.theme, children: jsx$2(BuyBondModal, Object.assign({}, props)) }));
|
|
75513
75416
|
};
|
|
75514
75417
|
|
|
75515
75418
|
const FullBondsViewWithProviders = (props) => {
|
|
@@ -91162,7 +91065,7 @@ const ProjectView = ({ bondAddress, bondChain, historicalPrices }) => {
|
|
|
91162
91065
|
p: '20px',
|
|
91163
91066
|
borderRadius: '10px',
|
|
91164
91067
|
mt: '5px',
|
|
91165
|
-
}, className: `project-view`, children: [jsx$2(BondModalHeader, { bondData: bondData }), jsx$2(ProjectDescription, { description: bondData.shortDescription }), jsx$2(Estimations, { depositAmount: depositAmount, bondData: bondData, youSpendString: youSpendString, isZap: isZap, fetchingZapQuote: fetchingZapQuote, zapError: zapError }), jsx$2(TokenSelectorPanel, { typedValue: inputValue, setTypedValue: setInputValue, selectedToken: inputToken, handleValueBtn: () => { var _a; return setInputValue((_a = new BigNumber$1(inputCurrencyBalance !== null && inputCurrencyBalance !== void 0 ? inputCurrencyBalance : '0')) === null || _a === void 0 ? void 0 : _a.toString()); }, handleCurrencySelect: handleCurrencySelect, chainId: bondData === null || bondData === void 0 ? void 0 : bondData.chainId, enableZap: supportedByLIFI.includes(bondData === null || bondData === void 0 ? void 0 : bondData.chainId), bondPrincipalToken: bondData === null || bondData === void 0 ? void 0 : bondData.lpToken, tokenBalance: inputCurrencyBalance, selectedTokenPrice: inputTokenPrice === null || inputTokenPrice === void 0 ? void 0 : inputTokenPrice.price }), minTier && (bondData === null || bondData === void 0 ? void 0 : bondData.minTier) !== undefined && (jsx$2(TagMinTierBond, { userTier: userTier, minTier: bondData === null || bondData === void 0 ? void 0 : bondData.minTier })), jsxs(Flex, { className: "modaltable-container button-container", children: [account &&
|
|
91068
|
+
}, className: `project-view`, children: [jsx$2(Flex, { sx: { mt: '-20px' }, children: jsx$2(BondModalHeader, { bondData: bondData }) }), jsx$2(ProjectDescription, { description: bondData.shortDescription }), jsx$2(Estimations, { depositAmount: depositAmount, bondData: bondData, youSpendString: youSpendString, isZap: isZap, fetchingZapQuote: fetchingZapQuote, zapError: zapError }), jsx$2(TokenSelectorPanel, { typedValue: inputValue, setTypedValue: setInputValue, selectedToken: inputToken, handleValueBtn: () => { var _a; return setInputValue((_a = new BigNumber$1(inputCurrencyBalance !== null && inputCurrencyBalance !== void 0 ? inputCurrencyBalance : '0')) === null || _a === void 0 ? void 0 : _a.toString()); }, handleCurrencySelect: handleCurrencySelect, chainId: bondData === null || bondData === void 0 ? void 0 : bondData.chainId, enableZap: supportedByLIFI.includes(bondData === null || bondData === void 0 ? void 0 : bondData.chainId), bondPrincipalToken: bondData === null || bondData === void 0 ? void 0 : bondData.lpToken, tokenBalance: inputCurrencyBalance, selectedTokenPrice: inputTokenPrice === null || inputTokenPrice === void 0 ? void 0 : inputTokenPrice.price }), minTier && (bondData === null || bondData === void 0 ? void 0 : bondData.minTier) !== undefined && (jsx$2(TagMinTierBond, { userTier: userTier, minTier: bondData === null || bondData === void 0 ? void 0 : bondData.minTier })), jsxs(Flex, { className: "modaltable-container button-container", children: [account &&
|
|
91166
91069
|
(!minTier || (minTier && bondData.minTier && (!userTier || userTier >= bondData.minTier))) && (jsx$2(Flex, { className: "button-container get", children: jsxs(Button, { className: "action-button", onClick: () => supportedByLIFI.includes(bondData === null || bondData === void 0 ? void 0 : bondData.chainId) ? handleOpenZapModal() : openExternal(), variant: "secondary", children: ["Get ", getSymbol(bondData === null || bondData === void 0 ? void 0 : bondData.lpToken)] }) })), jsx$2(Flex, { className: "button-container buy", children: !account ? (jsx$2(ConnectButton, {})) : minTier && bondData.minTier && (!userTier || userTier < bondData.minTier) ? (jsx$2(Button, { className: "action-button", onClick: () => window.open(`https://www.ape.bond/tier-staking`, '_blank'), children: "GET YOUR TIER" })) : userChainId !== bondData.chainId ? (jsx$2(Button, { className: "switch-button", disabled: loadingTx || isConfirming || (bondData === null || bondData === void 0 ? void 0 : bondData.soldOut), onClick: (event) => {
|
|
91167
91070
|
event.stopPropagation();
|
|
91168
91071
|
switchChain({ chainId: bondData.chainId });
|
|
@@ -91184,14 +91087,123 @@ const ProjectViewWithProviders = (props) => {
|
|
|
91184
91087
|
return (jsx$2(Providers, { theme: props.theme, children: jsx$2(ProjectView, Object.assign({}, props)) }));
|
|
91185
91088
|
};
|
|
91186
91089
|
|
|
91187
|
-
const
|
|
91188
|
-
|
|
91090
|
+
const TabNav = ({ tabOptions, activeTab, onChangeActiveTab }) => {
|
|
91091
|
+
const translateX = activeTab === tabOptions[0] ? '0%' : '100%';
|
|
91092
|
+
return (jsxs(Flex, { sx: {
|
|
91093
|
+
flexDirection: 'row',
|
|
91094
|
+
width: '100%',
|
|
91095
|
+
marginTop: '5px',
|
|
91096
|
+
position: 'relative',
|
|
91097
|
+
justifyContent: 'space-between',
|
|
91098
|
+
}, children: [tabOptions.map((tab, index) => (jsx$2(Flex, { onClick: () => onChangeActiveTab && onChangeActiveTab(tab), sx: {
|
|
91099
|
+
flexDirection: 'column',
|
|
91100
|
+
justifyContent: 'center',
|
|
91101
|
+
alignItems: 'center',
|
|
91102
|
+
cursor: 'pointer',
|
|
91103
|
+
fontWeight: activeTab === tab ? 700 : 500,
|
|
91104
|
+
color: activeTab === tab ? 'text' : 'textDisabled',
|
|
91105
|
+
transition: 'all 0.3s ease-out',
|
|
91106
|
+
width: '100%',
|
|
91107
|
+
my: '10px',
|
|
91108
|
+
}, children: tab }, tab))), jsx$2(Flex, { sx: {
|
|
91109
|
+
position: 'absolute',
|
|
91110
|
+
width: '100%',
|
|
91111
|
+
bottom: 0,
|
|
91112
|
+
background: 'textDisabled',
|
|
91113
|
+
height: '3px',
|
|
91114
|
+
borderRadius: 'normal',
|
|
91115
|
+
} }), jsx$2(Flex, { sx: {
|
|
91116
|
+
position: 'absolute',
|
|
91117
|
+
width: '50%', // 50% width
|
|
91118
|
+
bottom: 0,
|
|
91119
|
+
background: 'text', // Line color
|
|
91120
|
+
height: '3px',
|
|
91121
|
+
borderRadius: 'normal',
|
|
91122
|
+
transition: 'transform 0.3s ease-out', // Add smooth transition
|
|
91123
|
+
transform: `translateX(${translateX})`, // Dynamically move left/right
|
|
91124
|
+
} })] }));
|
|
91125
|
+
};
|
|
91126
|
+
|
|
91127
|
+
const SoldOutBuyBondPlaceholder = ({ bond }) => {
|
|
91128
|
+
var _a, _b, _c, _d, _e, _f;
|
|
91129
|
+
const SDKConfig = useSDKConfig();
|
|
91130
|
+
// Hooks
|
|
91131
|
+
const { address: account } = useAccount();
|
|
91132
|
+
const { data: userEscrowWeight } = useGetUserEscrowWeight(account);
|
|
91133
|
+
const userTier = getUserTier(userEscrowWeight !== null && userEscrowWeight !== void 0 ? userEscrowWeight : '0');
|
|
91134
|
+
// State
|
|
91135
|
+
const bondData = bond;
|
|
91136
|
+
const minTier = (bondData === null || bondData === void 0 ? void 0 : bondData.minTier) !== undefined ? bondData.minTier : null;
|
|
91137
|
+
const [inputValue, setInputValue] = useState('');
|
|
91138
|
+
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]);
|
|
91139
|
+
// Data
|
|
91140
|
+
const inputToken = useTokenFromZapList(inputTokenString, bondData === null || bondData === void 0 ? void 0 : bondData.chainId, bondData === null || bondData === void 0 ? void 0 : bondData.lpToken);
|
|
91141
|
+
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());
|
|
91142
|
+
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);
|
|
91143
|
+
return bondData ? (jsx$2(Flex, { className: "modal-content", children: jsxs(Flex, { className: "modaltable-container", children: [jsxs(Flex, { sx: {
|
|
91144
|
+
position: 'absolute',
|
|
91145
|
+
width: 'calc(100% + 40px)',
|
|
91146
|
+
height: 'calc(100% + 20px)',
|
|
91147
|
+
top: '0',
|
|
91148
|
+
left: '-20px',
|
|
91149
|
+
overflow: 'hidden',
|
|
91150
|
+
borderRadius: 'normal',
|
|
91151
|
+
}, children: [jsx$2(Flex, { sx: {
|
|
91152
|
+
position: 'absolute',
|
|
91153
|
+
width: '100%',
|
|
91154
|
+
height: '100%',
|
|
91155
|
+
zIndex: 999,
|
|
91156
|
+
backgroundColor: 'rgba(255,255,255,0.1)',
|
|
91157
|
+
backdropFilter: 'blur(1px)',
|
|
91158
|
+
WebkitBackdropFilter: 'blur(1px)', // Ensure compatibility with Safari
|
|
91159
|
+
} }), jsx$2(Flex, { sx: {
|
|
91160
|
+
position: 'absolute',
|
|
91161
|
+
top: '50px',
|
|
91162
|
+
left: '-50px',
|
|
91163
|
+
backgroundColor: 'error',
|
|
91164
|
+
color: 'white',
|
|
91165
|
+
padding: '5px 20px',
|
|
91166
|
+
fontSize: '14px',
|
|
91167
|
+
fontWeight: 'bold',
|
|
91168
|
+
transform: 'rotate(-45deg)',
|
|
91169
|
+
zIndex: 1000, // Ensure it appears above other elements
|
|
91170
|
+
boxShadow: '0 2px 4px rgba(0,0,0,0.2)',
|
|
91171
|
+
width: '220px',
|
|
91172
|
+
justifyContent: 'center',
|
|
91173
|
+
}, children: "SOLD OUT" })] }), jsx$2(BondModalHeader, { bondData: bondData,
|
|
91174
|
+
// onDismiss={onDismiss}
|
|
91175
|
+
showProjectInfoButton: (SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.referenceId) === 'apebond' }), jsx$2(ProjectDescription, { description: bondData.shortDescription }), jsx$2(BondCards, { bondData: Object.assign(Object.assign({}, bondData), { bonusWithFee: -1 }) }), jsx$2(Estimations, { depositAmount: '0',
|
|
91176
|
+
/*@ts-ignore*/
|
|
91177
|
+
bondData: bondData, youSpendString: '0', isZap: isZap, fetchingZapQuote: false, zapError: false }), jsx$2(TokenSelectorPanel, { typedValue: inputValue, setTypedValue: setInputValue, selectedToken: inputToken, handleValueBtn: () => null, handleCurrencySelect: () => null, 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: 0, inputDisabled: true }), 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", variant: "secondary", fullWidth: true, disabled: true, children: ["Get ", getSymbol(bondData === null || bondData === void 0 ? void 0 : bondData.lpToken)] }) })), jsx$2(Flex, { className: "button-container buy", children: jsx$2(Button, { className: "action-button", fullWidth: true, disabled: true, children: "Buy" }) })] })] }) })) : (jsx$2(Fragment$1, {}));
|
|
91178
|
+
};
|
|
91179
|
+
|
|
91180
|
+
const SingleBond = ({ tokenSymbol }) => {
|
|
91181
|
+
// Data Hooks
|
|
91182
|
+
const { data: bonds, isFetched } = useBondsData();
|
|
91183
|
+
const { data: allBonds } = useBondsList();
|
|
91184
|
+
// State
|
|
91185
|
+
const [activeTab, setActiveTab] = useState('Buy Bond');
|
|
91186
|
+
// Data
|
|
91187
|
+
const filteredBonds = bonds === null || bonds === void 0 ? void 0 : bonds.filter((bond) => tokenSymbol === null || tokenSymbol === void 0 ? void 0 : tokenSymbol.some((symbol) => { var _a; return ((_a = bond.earnToken.symbol) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === symbol.toLowerCase(); }));
|
|
91188
|
+
const soldOutBonds = allBonds === null || allBonds === void 0 ? void 0 : allBonds.filter((bond) => tokenSymbol === null || tokenSymbol === void 0 ? void 0 : tokenSymbol.some((symbol) => { var _a; return ((_a = bond.earnToken.symbol) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === symbol.toLowerCase(); }));
|
|
91189
|
+
const activeBond = filteredBonds === null || filteredBonds === void 0 ? void 0 : filteredBonds[0];
|
|
91190
|
+
const soldOutBond = soldOutBonds === null || soldOutBonds === void 0 ? void 0 : soldOutBonds[0];
|
|
91191
|
+
const bondAddress = activeBond === null || activeBond === void 0 ? void 0 : activeBond.billAddress;
|
|
91192
|
+
const bondChain = activeBond === null || activeBond === void 0 ? void 0 : activeBond.chainId;
|
|
91193
|
+
return (jsx$2(Flex, { sx: { flexDirection: 'column' }, children: jsxs(Flex, { sx: {
|
|
91194
|
+
flexDirection: 'column',
|
|
91195
|
+
}, children: [jsx$2(Flex, { sx: { width: '100%', justifyContent: 'center', mb: '15px' }, children: jsx$2(TabNav, { activeTab: activeTab, tabOptions: ['Buy Bond', 'Your Bonds'], onChangeActiveTab: (newValue) => setActiveTab(newValue) }) }), activeTab === 'Buy Bond' ? (jsx$2(Flex, { sx: {
|
|
91196
|
+
background: activeTab === 'Buy Bond' && 'white2',
|
|
91197
|
+
borderRadius: 'normal',
|
|
91198
|
+
p: '0 20px 20px 20px',
|
|
91199
|
+
mx: '10px',
|
|
91200
|
+
}, children: activeBond ? (jsx$2(BuyBond, { bondAddress: bondAddress, bondChain: bondChain })) : soldOutBond && isFetched ? (jsx$2(SoldOutBuyBondPlaceholder, { bond: soldOutBond })) : isFetched ? (jsx$2(Flex, { sx: { justifyContent: 'center', width: '100%', pt: '20px' }, children: "No bond" })) : (jsx$2(Flex, { className: "yourbonds-spinner", children: jsx$2(Spinner, { size: 100 }) })) })) : (jsx$2(YourBonds, { showOnly: tokenSymbol === null || tokenSymbol === void 0 ? void 0 : tokenSymbol[0] }))] }) }));
|
|
91189
91201
|
};
|
|
91190
91202
|
|
|
91191
91203
|
const SingleBondWithProviders = (props) => {
|
|
91192
91204
|
useSDKConfig(props);
|
|
91193
|
-
return (jsx$2(Providers, { theme: props.theme, children: jsx$2(SingleBond, {}) }));
|
|
91205
|
+
return (jsx$2(Providers, { theme: props.theme, children: jsx$2(SingleBond, Object.assign({}, props)) }));
|
|
91194
91206
|
};
|
|
91195
91207
|
|
|
91196
91208
|
var ChainId = types.ChainId;
|
|
91197
|
-
export {
|
|
91209
|
+
export { BondsWithProviders as Bonds, BuyBondModalWithProviders as BuyBondModal, ChainId, FullBondsViewWithProviders as FullBondsView, ProjectViewWithProviders as ProjectView, SingleBondWithProviders as SingleBond, YourBondsWithProviders as YourBonds, generateImageFromTemplate };
|
package/dist/styles.css
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export interface
|
|
2
|
+
export interface BuyBondProps {
|
|
3
3
|
onDismiss?: () => void;
|
|
4
4
|
bondAddress?: string;
|
|
5
5
|
bondChain?: number;
|
|
6
6
|
handlePurchasedBond?: (hash: string) => void;
|
|
7
7
|
}
|
|
8
|
-
declare const
|
|
9
|
-
export default
|
|
8
|
+
declare const BuyBond: React.FC<BuyBondProps>;
|
|
9
|
+
export default BuyBond;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BuyBondProps } from './BuyBond';
|
|
3
|
+
import { SDKProps } from '../../state/useSDKConfig';
|
|
4
|
+
interface Props extends SDKProps, BuyBondProps {
|
|
5
|
+
}
|
|
6
|
+
declare const BuyBondModalWithProviders: React.FC<Props>;
|
|
7
|
+
export default BuyBondModalWithProviders;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BillsConfig } from '@ape.swap/apeswap-lists';
|
|
3
|
+
export interface SoldOutProps {
|
|
4
|
+
onDismiss?: () => void;
|
|
5
|
+
bond: BillsConfig;
|
|
6
|
+
}
|
|
7
|
+
declare const SoldOutBuyBondPlaceholder: React.FC<SoldOutProps>;
|
|
8
|
+
export default SoldOutBuyBondPlaceholder;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { SDKProps } from '../../state/useSDKConfig';
|
|
3
|
-
|
|
3
|
+
import { SingleBondProps } from './SingleBond';
|
|
4
|
+
interface Props extends SDKProps, SingleBondProps {
|
|
5
|
+
}
|
|
6
|
+
declare const SingleBondWithProviders: React.FC<Props>;
|
|
4
7
|
export default SingleBondWithProviders;
|
package/package.json
CHANGED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { BondModalProps } from './BondModal';
|
|
3
|
-
import { SDKProps } from '../../state/useSDKConfig';
|
|
4
|
-
interface Props extends SDKProps, BondModalProps {
|
|
5
|
-
}
|
|
6
|
-
declare const BondModalWithProviders: React.FC<Props>;
|
|
7
|
-
export default BondModalWithProviders;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|