@ape.swap/bonds-sdk 2.0.2 → 2.0.4-testseed.1
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ChainId } from '@ape.swap/apeswap-lists';
|
|
2
2
|
export declare const supportedByLIFI: ChainId[];
|
|
3
3
|
export declare const APESWAP_LIST_REPO = "https://raw.githubusercontent.com/ApeSwapFinance/apeswap-token-lists/staging";
|
|
4
|
-
export declare const STRAPI_URL = "https://
|
|
5
|
-
export declare const SOUL_ZAP_API = "https://
|
|
4
|
+
export declare const STRAPI_URL = "https://strapi-api.ape.bond";
|
|
5
|
+
export declare const SOUL_ZAP_API = "https://zap-api.ape.bond/zap?batch=1";
|
package/dist/main.js
CHANGED
|
@@ -18517,8 +18517,8 @@ const supportedByLIFI = [
|
|
|
18517
18517
|
];
|
|
18518
18518
|
// we should be good just by using staging on this, as it is only used for token images
|
|
18519
18519
|
const APESWAP_LIST_REPO = `https://raw.githubusercontent.com/ApeSwapFinance/apeswap-token-lists/staging`;
|
|
18520
|
-
const STRAPI_URL = `https://
|
|
18521
|
-
const SOUL_ZAP_API = `https://
|
|
18520
|
+
const STRAPI_URL = `https://strapi-api.ape.bond`;
|
|
18521
|
+
const SOUL_ZAP_API = `https://zap-api.ape.bond/zap?batch=1`;
|
|
18522
18522
|
|
|
18523
18523
|
const TokenImage = ({ symbol, symbol2, size, chain, }) => {
|
|
18524
18524
|
var _a, _b;
|
|
@@ -73077,6 +73077,17 @@ const ProjectDescription = ({ description }) => {
|
|
|
73077
73077
|
}, 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 : '' }) })] }));
|
|
73078
73078
|
};
|
|
73079
73079
|
|
|
73080
|
+
const BondModalHeaderAlt = ({ bondData, onDismiss, showProjectInfoButton, }) => {
|
|
73081
|
+
const [onOpenSlippageModal] = useModal(jsx$2(SlippageModal, {}));
|
|
73082
|
+
const handleClose = () => {
|
|
73083
|
+
if (typeof window !== 'undefined') {
|
|
73084
|
+
window.history.pushState({}, '', `/bonds`);
|
|
73085
|
+
}
|
|
73086
|
+
onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss();
|
|
73087
|
+
};
|
|
73088
|
+
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(Flex, { sx: { mb: '-5px', 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" }) })) }) }));
|
|
73089
|
+
};
|
|
73090
|
+
|
|
73080
73091
|
const BondModal = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond,
|
|
73081
73092
|
// ??
|
|
73082
73093
|
accordionTitle = 'What are Bonds?', accordionBody = 'Body', accordionVisible = false, }) => {
|
|
@@ -73268,7 +73279,7 @@ accordionTitle = 'What are Bonds?', accordionBody = 'Body', accordionVisible = f
|
|
|
73268
73279
|
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');
|
|
73269
73280
|
}
|
|
73270
73281
|
};
|
|
73271
|
-
return (jsx$2(Modal, { className: "modal", onDismiss: onDismiss, children: modalVariant === 'standard' ? (jsx$2(Fragment$1, { children: bondData && (jsxs(Flex, { className: "modal-content", children: [typeof window !== 'undefined' && window.location.origin === 'http://localhost:
|
|
73282
|
+
return (jsx$2(Modal, { className: "modal", onDismiss: onDismiss, children: modalVariant === 'standard' ? (jsx$2(Fragment$1, { children: bondData && (jsxs(Flex, { className: "modal-content", children: [typeof window !== 'undefined' && window.location.origin === 'http://localhost:5174' && (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, estimatedOutput: estimatedOutput, 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, handleMaxBtn: () => { 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 }), jsxs(Flex, { className: "modaltable-container button-container", children: [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, {})) : userChainId !== bondData.chainId ? (jsx$2(Button, { className: "switch-button", disabled: loadingTx || isConfirming || (bondData === null || bondData === void 0 ? void 0 : bondData.soldOut), onClick: (event) => {
|
|
73272
73283
|
event.stopPropagation();
|
|
73273
73284
|
switchChain({ chainId: bondData.chainId });
|
|
73274
73285
|
}, 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 ||
|
|
@@ -73281,7 +73292,7 @@ accordionTitle = 'What are Bonds?', accordionBody = 'Body', accordionVisible = f
|
|
|
73281
73292
|
(bondData === null || bondData === void 0 ? void 0 : bondData.soldOut) ||
|
|
73282
73293
|
!account ||
|
|
73283
73294
|
!inputValue ||
|
|
73284
|
-
parseFloat(inputValue) === 0, onClick: handleApprove, children: "enable" })) })] }), accordionVisible && (jsx$2(Flex, { className: "modaltable-container accordion-container", children: jsx$2(AccordionText, { title: accordionTitle, body: accordionBody, isVisible: accordionVisible }) }))] })] })) })) : (jsx$2(Fragment$1, { children: bondData && (jsxs(Flex, { className: "modal-content font-small gpt", children: [typeof window !== 'undefined' && window.location.origin === 'http://localhost:
|
|
73295
|
+
parseFloat(inputValue) === 0, onClick: handleApprove, children: "enable" })) })] }), accordionVisible && (jsx$2(Flex, { className: "modaltable-container accordion-container", children: jsx$2(AccordionText, { title: accordionTitle, body: accordionBody, isVisible: accordionVisible }) }))] })] })) })) : (jsx$2(Fragment$1, { children: bondData && (jsxs(Flex, { className: "modal-content font-small gpt", children: [typeof window !== 'undefined' && window.location.origin === 'http://localhost:5174' && (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" })] })), jsx$2(Flex, { className: "bondmodal-header-alt", sx: { mb: '20px' }, children: jsx$2(BondModalHeaderAlt, { bondData: bondData, onDismiss: onDismiss, showProjectInfoButton: (SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.referenceId) === 'apebond' }) }), jsxs(Flex, { className: "modaltable-container", sx: { flexDirection: 'row', gap: '20px' }, children: [jsxs(Flex, { sx: { width: '500px', flexDirection: 'column' }, children: [jsx$2("img", { src: "https://placehold.co/400x200" }), jsx$2(Flex, { className: "modaltable-container description-container paragraph-spaced", sx: { marginTop: '20px' }, children: bondData === null || bondData === void 0 ? void 0 : bondData.shortDescription })] }), jsxs(Flex, { sx: { flexDirection: 'column', width: '600px' }, children: [jsxs(Flex, { sx: { alignItems: 'center' }, children: [jsx$2(Flex, { sx: { minWidth: '300px' }, children: jsxs("h2", { sx: { margin: '0px' }, 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, { sx: { justifyContent: 'space-between', flexGrow: 1 }, children: [jsx$2(TokenImage, { symbol: (_l = bondData.showcaseTokenName) !== null && _l !== void 0 ? _l : bondData.earnToken.symbol, size: 20 }), jsx$2("span", { children: bondData.earnToken.symbol }), " ", jsx$2("span", { children: "|" }), ' ', jsxs("span", { children: ["Market Price: $", earnTokenPrice(bondData)] })] })] }), jsxs(Flex, { sx: { flexDirection: 'column', marginTop: '20px' }, children: [jsx$2(TokenSelectorPanel, { typedValue: inputValue, setTypedValue: setInputValue, selectedToken: inputToken, handleMaxBtn: () => { 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: true, bondPrincipalToken: bondData === null || bondData === void 0 ? void 0 : bondData.lpToken, tokenBalance: inputCurrencyBalance, selectedTokenPrice: inputTokenPrice === null || inputTokenPrice === void 0 ? void 0 : inputTokenPrice.price }), jsxs(Flex, { sx: { justifyContent: 'space-between', alignItems: 'center' }, children: [jsxs(Flex, { children: ["You will receive:", jsx$2(Flex, { sx: { marginLeft: '15px', marginRight: '5px' }, children: jsx$2(TokenImage, { symbol: (_m = bondData.showcaseTokenName) !== null && _m !== void 0 ? _m : bondData.earnToken.symbol, size: 20 }) }), (lodashExports.toNumber(inputValue) / lodashExports.toNumber(earnTokenPrice(bondData))).toFixed(0), ' ', bondData.earnToken.symbol, " + \u00A0", (youGet(bondData, inputValue) -
|
|
73285
73296
|
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) => {
|
|
73286
73297
|
event.stopPropagation();
|
|
73287
73298
|
switchChain({ chainId: bondData.chainId });
|
|
@@ -73650,8 +73661,7 @@ const BondRowsByChain = ({ bonds, hideTitles }) => {
|
|
|
73650
73661
|
const getUserApiStats = (account) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
73651
73662
|
if (!account)
|
|
73652
73663
|
return null;
|
|
73653
|
-
const { data } = yield axios.get(`
|
|
73654
|
-
https://bonds-dashboard-api-deaf0d7d55b7.herokuapp.com/collector/userSalesInfo/purchased/${account}`);
|
|
73664
|
+
const { data } = yield axios.get(`https://dashboard-api.ape.bond/collector/userSalesInfo/purchased/${account}`);
|
|
73655
73665
|
return data;
|
|
73656
73666
|
});
|
|
73657
73667
|
function useUserApiStats() {
|
|
@@ -74867,7 +74877,7 @@ const NavPanel = ({ contractAddress }) => {
|
|
|
74867
74877
|
justifyContent: 'space-between',
|
|
74868
74878
|
alignItems: 'center',
|
|
74869
74879
|
mb: ['15px', '15px', '15px', '0px'],
|
|
74870
|
-
}, children: [jsxs(Flex, { onClick: () => window.open(`${window.location.origin}/bonds`, '_self'), sx: { cursor: 'pointer' }, children: ['< ', jsx$2(Flex, { sx: { ml: '4px' }, children: "All Bonds" })] }), jsx$2(Flex, { children: jsxs(Flex, { sx: { p: '5px 10px', background: 'white3', borderRadius: 'small', cursor: 'pointer' }, onClick: () => window.open(`https://
|
|
74880
|
+
}, children: [jsxs(Flex, { onClick: () => window.open(`${window.location.origin}/bonds`, '_self'), sx: { cursor: 'pointer' }, children: ['< ', jsx$2(Flex, { sx: { ml: '4px' }, children: "All Bonds" })] }), jsx$2(Flex, { children: jsxs(Flex, { sx: { p: '5px 10px', background: 'white3', borderRadius: 'small', cursor: 'pointer' }, onClick: () => window.open(`https://dashboard.ape.bond/bond/${contractAddress}`, '_blank', 'noreferrer'), children: ["View insights", jsx$2(Flex, { sx: { ml: '3px' }, children: jsx$2(Svg, { icon: "insight" }) })] }) })] }));
|
|
74871
74881
|
};
|
|
74872
74882
|
|
|
74873
74883
|
const styles$3 = {
|
|
@@ -89387,8 +89397,7 @@ const styles$2 = {
|
|
|
89387
89397
|
};
|
|
89388
89398
|
|
|
89389
89399
|
const getBondApiStats = (contractAddress) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
89390
|
-
const { data } = yield axios.get(`
|
|
89391
|
-
https://bonds-dashboard-api-deaf0d7d55b7.herokuapp.com/collector/salesInfo/bond/${contractAddress}/0`);
|
|
89400
|
+
const { data } = yield axios.get(`https://dashboard-api.ape.bond/collector/salesInfo/bond/${contractAddress}/0`);
|
|
89392
89401
|
return data;
|
|
89393
89402
|
});
|
|
89394
89403
|
function useGetBondApiStats(contractAddress) {
|
|
@@ -89466,7 +89475,7 @@ const BondStats = ({ selectedBond }) => {
|
|
|
89466
89475
|
});
|
|
89467
89476
|
}
|
|
89468
89477
|
}, [bondStats]);
|
|
89469
|
-
return (jsxs(Flex, { sx: styles$2.bondStatsContainer, children: [jsxs(Flex, { sx: styles$2.titleContainer, children: [jsx$2(Flex, { sx: { fontSize: '22px' }, children: "Bond Stats" }), jsxs(Link, { href: `https://
|
|
89478
|
+
return (jsxs(Flex, { sx: styles$2.bondStatsContainer, children: [jsxs(Flex, { sx: styles$2.titleContainer, children: [jsx$2(Flex, { sx: { fontSize: '22px' }, children: "Bond Stats" }), jsxs(Link, { href: `https://dashboard.ape.bond/bond/${selectedBond.billAddress}`, sx: styles$2.link, target: "_blank", rel: "noopener noreferrer", children: ["View More ", '>'] })] }), jsxs(Flex, { sx: styles$2.chartsContainer, children: [jsxs(Flex, { sx: styles$2.salesChart, children: [jsx$2(Flex, { sx: { width: '150px' }, children: jsx$2(MenuSelect, { selectedOption: chartOption, setOption: setChartOption, options: chartOptions }) }), jsx$2(Flex, { sx: { width: '100%', height: '100%', minHeight: '225px' }, children: chartOption === 'amount' ? (jsx$2(Line, { options: options, data: salesAmountChartData })) : (jsx$2(Line, { options: options, data: salesCountChartData })) })] }), (bondStats === null || bondStats === void 0 ? void 0 : bondStats.percentageSold) && (jsxs(Flex, { sx: styles$2.percentageSoldChart, children: [jsxs(Flex, { sx: { mb: '10px' }, children: [selectedBond.earnToken.symbol, " Sold"] }), jsx$2(Knob, { value: bondStats === null || bondStats === void 0 ? void 0 : bondStats.percentageSold, size: 176, valueTemplate: `${(_f = bondStats === null || bondStats === void 0 ? void 0 : bondStats.percentageSold) === null || _f === void 0 ? void 0 : _f.toFixed()}%`, valueColor: "#6560C5", rangeColor: "rgba(250, 250, 250, 0.05)", textColor: "#f6f6f6" }), jsxs(Flex, { sx: { fontSize: '14px', fontWeight: 500, color: 'textDisabledButton' }, children: [soldTokens, " / ", maxTotalPayout === null || maxTotalPayout === void 0 ? void 0 : maxTotalPayout.toLocaleString(), " ", selectedBond.earnToken.symbol] })] }))] })] }));
|
|
89470
89479
|
};
|
|
89471
89480
|
|
|
89472
89481
|
const styles$1 = {
|
|
@@ -90297,7 +90306,7 @@ const PriceChart = ({ selectedBond, historicalPrices, }) => {
|
|
|
90297
90306
|
};
|
|
90298
90307
|
|
|
90299
90308
|
const ProjectView = ({ bondAddress, bondChain, historicalPrices }) => {
|
|
90300
|
-
var _a, _b, _c, _d, _e, _f
|
|
90309
|
+
var _a, _b, _c, _d, _e, _f;
|
|
90301
90310
|
const { data: bonds } = useBondsData();
|
|
90302
90311
|
const bondData = bonds === null || bonds === void 0 ? void 0 : bonds.find((bond) => {
|
|
90303
90312
|
var _a;
|
|
@@ -90313,13 +90322,20 @@ const ProjectView = ({ bondAddress, bondChain, historicalPrices }) => {
|
|
|
90313
90322
|
const sendReferenceId = useSendReferenceId();
|
|
90314
90323
|
const [buyTxHash, setBuyTxHash] = useState();
|
|
90315
90324
|
const [inputValue, setInputValue] = useState('');
|
|
90316
|
-
const [inputTokenString, setInputTokenString] = useState(
|
|
90325
|
+
const [inputTokenString, setInputTokenString] = useState('');
|
|
90326
|
+
useEffect(() => {
|
|
90327
|
+
var _a, _b;
|
|
90328
|
+
const inputTokenStr = (_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];
|
|
90329
|
+
if (!inputTokenString && bondData && inputTokenStr) {
|
|
90330
|
+
setInputTokenString(inputTokenStr);
|
|
90331
|
+
}
|
|
90332
|
+
}, [bondData]);
|
|
90317
90333
|
// Data
|
|
90318
90334
|
const inputToken = useTokenFromZapList(inputTokenString, bondData === null || bondData === void 0 ? void 0 : bondData.chainId, bondData === null || bondData === void 0 ? void 0 : bondData.lpToken);
|
|
90319
|
-
const isZap = (inputTokenString === null || inputTokenString === void 0 ? void 0 : inputTokenString.toLowerCase()) !== ((
|
|
90335
|
+
const isZap = (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());
|
|
90320
90336
|
const [fetchingZapQuote, zapData, zapEstimatedOutput, zapError] = useSoulZapBondQuote(inputValue, inputToken, bondData, account);
|
|
90321
90337
|
const inputTokenPrice = useCurrencyPrice(inputToken !== null && inputToken !== void 0 ? inputToken : null, parseInt(bondChain));
|
|
90322
|
-
const { data: inputCurrencyBalance } = useCurrencyBalance(inputToken !== null && inputToken !== void 0 ? inputToken : null, account !== null && account !== void 0 ? account : null, (
|
|
90338
|
+
const { data: inputCurrencyBalance } = useCurrencyBalance(inputToken !== null && inputToken !== void 0 ? inputToken : null, account !== null && account !== void 0 ? account : null, (_d = bondData === null || bondData === void 0 ? void 0 : bondData.chainId) !== null && _d !== void 0 ? _d : null);
|
|
90323
90339
|
// Estimations
|
|
90324
90340
|
const normalEstimatedOutput = youGet(bondData, inputValue);
|
|
90325
90341
|
const estimatedOutput = isZap ? zapEstimatedOutput : normalEstimatedOutput;
|
|
@@ -90336,7 +90352,7 @@ const ProjectView = ({ bondAddress, bondChain, historicalPrices }) => {
|
|
|
90336
90352
|
// Modals
|
|
90337
90353
|
const [onOpenZapModal] = useModal(jsx$2(ZapModal, { outputToken: bondData === null || bondData === void 0 ? void 0 : bondData.lpToken, account: account, chainId: bondData === null || bondData === void 0 ? void 0 : bondData.chainId }), true, true, 'zapModal');
|
|
90338
90354
|
// Approve & Purchase Functions
|
|
90339
|
-
const [approvalState, approveCallback] = useApproval(inputValue, inputToken !== null && inputToken !== void 0 ? inputToken : null, (
|
|
90355
|
+
const [approvalState, approveCallback] = useApproval(inputValue, inputToken !== null && inputToken !== void 0 ? inputToken : null, (_e = (isZap ? SoulZapTokenManager === null || SoulZapTokenManager === void 0 ? void 0 : SoulZapTokenManager[bondData === null || bondData === void 0 ? void 0 : bondData.chainId] : bondData === null || bondData === void 0 ? void 0 : bondData.billAddress)) !== null && _e !== void 0 ? _e : null, account !== null && account !== void 0 ? account : null, (_f = bondData === null || bondData === void 0 ? void 0 : bondData.chainId) !== null && _f !== void 0 ? _f : null);
|
|
90340
90356
|
const handleApprove = () => {
|
|
90341
90357
|
approveCallback().then(() => {
|
|
90342
90358
|
track({
|
|
@@ -90419,6 +90435,18 @@ const ProjectView = ({ bondAddress, bondChain, historicalPrices }) => {
|
|
|
90419
90435
|
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');
|
|
90420
90436
|
}
|
|
90421
90437
|
};
|
|
90438
|
+
const handleOpenZapModal = () => {
|
|
90439
|
+
var _a;
|
|
90440
|
+
onOpenZapModal();
|
|
90441
|
+
track({
|
|
90442
|
+
event: 'getTokenClick',
|
|
90443
|
+
chain: bondData === null || bondData === void 0 ? void 0 : bondData.chainId,
|
|
90444
|
+
data: {
|
|
90445
|
+
bond: bondData === null || bondData === void 0 ? void 0 : bondData.earnToken.symbol,
|
|
90446
|
+
token: (_a = bondData === null || bondData === void 0 ? void 0 : bondData.lpToken) === null || _a === void 0 ? void 0 : _a.symbol,
|
|
90447
|
+
},
|
|
90448
|
+
});
|
|
90449
|
+
};
|
|
90422
90450
|
return (jsxs(Flex, { sx: styles$4.mainViewContainer, children: [jsx$2(RecommendationCards, {}), jsx$2(NavPanel, { contractAddress: bondData === null || bondData === void 0 ? void 0 : bondData.billAddress }), bondData ? (jsx$2(Fragment$1, { children: jsxs(Flex, { sx: { width: '100%', flexDirection: 'column', mt: '10px' }, children: [jsx$2(Flex, { sx: {
|
|
90423
90451
|
width: '100%',
|
|
90424
90452
|
display: ['none', 'none', 'none', 'block'],
|
|
@@ -90432,7 +90460,7 @@ const ProjectView = ({ bondAddress, bondChain, historicalPrices }) => {
|
|
|
90432
90460
|
p: '20px',
|
|
90433
90461
|
borderRadius: '10px',
|
|
90434
90462
|
mt: '5px',
|
|
90435
|
-
}, children: [jsx$2(BondModalHeader, { bondData: bondData }), jsx$2(ProjectDescription, { description: bondData.shortDescription }), jsx$2(Estimations, { bondData: bondData, inputValue: inputValue, inputToken: inputToken, estimatedOutput: estimatedOutput, 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, handleMaxBtn: () => { 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 }), jsxs(Flex, { className: "modaltable-container button-container", children: [jsx$2(Flex, { className: "button-container get", children: jsxs(Button, { className: "action-button", onClick: () =>
|
|
90463
|
+
}, children: [jsx$2(BondModalHeader, { bondData: bondData }), jsx$2(ProjectDescription, { description: bondData.shortDescription }), jsx$2(Estimations, { bondData: bondData, inputValue: inputValue, inputToken: inputToken, estimatedOutput: estimatedOutput, 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, handleMaxBtn: () => { 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 }), jsxs(Flex, { className: "modaltable-container button-container", children: [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, {})) : userChainId !== bondData.chainId ? (jsx$2(Button, { className: "switch-button", disabled: loadingTx || isConfirming || (bondData === null || bondData === void 0 ? void 0 : bondData.soldOut), onClick: (event) => {
|
|
90436
90464
|
event.stopPropagation();
|
|
90437
90465
|
switchChain({ chainId: bondData.chainId });
|
|
90438
90466
|
}, 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 ||
|
|
@@ -90441,7 +90469,7 @@ const ProjectView = ({ bondAddress, bondChain, historicalPrices }) => {
|
|
|
90441
90469
|
!inputValue ||
|
|
90442
90470
|
parseFloat(inputValue) === 0 ||
|
|
90443
90471
|
fetchingZapQuote ||
|
|
90444
|
-
zapError, onClick: handleBothPurchases, children: zapError ? 'something went wrong' : `buy
|
|
90472
|
+
zapError, onClick: handleBothPurchases, children: zapError ? 'something went wrong' : `buy` })) : (jsx$2(Button, { className: "action-button", load: approvalState === ApprovalState.PENDING, disabled: approvalState === ApprovalState.PENDING ||
|
|
90445
90473
|
(bondData === null || bondData === void 0 ? void 0 : bondData.soldOut) ||
|
|
90446
90474
|
!account ||
|
|
90447
90475
|
!inputValue ||
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BondsData } from '../../../types/bonds';
|
|
3
|
+
declare const BondModalHeaderAlt: ({ bondData, onDismiss, showProjectInfoButton, }: {
|
|
4
|
+
bondData: BondsData;
|
|
5
|
+
onDismiss?: () => void;
|
|
6
|
+
showProjectInfoButton?: boolean;
|
|
7
|
+
}) => React.JSX.Element;
|
|
8
|
+
export default BondModalHeaderAlt;
|