@ape.swap/bonds-sdk 2.5.2 → 2.5.3
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/main.js +32 -5
- package/dist/styles.css +2 -2
- package/dist/views/BondModal/NoBonusModal.d.ts +7 -0
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -74072,7 +74072,7 @@ const BondModalHeader = ({ bondData, onDismiss, showProjectInfoButton, }) => {
|
|
|
74072
74072
|
|
|
74073
74073
|
const BondCards = ({ bondData }) => {
|
|
74074
74074
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
74075
|
-
return (jsxs("div", { className: "bonds-cards", children: [jsxs("div", { className: "bond-card-block", style: { color: getDiscountColor(bondData === null || bondData === void 0 ? void 0 : bondData.bonus) }, children: [jsxs("div", { className: "bond-card-title", children: ["Bonus", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: TooltipText.Discount }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: jsx$2("div", { className: "bond-card-tooltip", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), jsx$2("div", { className: "bond-card-content", children: `${(_a = bondData === null || bondData === void 0 ? void 0 : bondData.bonus) === null || _a === void 0 ? void 0 : _a.toFixed(2)}%` })] }), bondData.type !== 'staking' && (jsxs("div", { className: "bond-card-block hide-mobile", children: [jsxs("div", { className: "bond-card-title", children: ["ARR", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: TooltipText.ARR }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: jsx$2("div", { className: "bond-card-tooltip", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), jsx$2("div", { className: "bond-card-content", children: `${((((_b = bondData === null || bondData === void 0 ? void 0 : bondData.bonus) !== 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" }) }) })] }), jsx$2("div", { className: "bond-card-content", children: bondData.type === 'staking'
|
|
74075
|
+
return (jsxs("div", { className: "bonds-cards", children: [jsxs("div", { className: "bond-card-block", style: { color: getDiscountColor(bondData === null || bondData === void 0 ? void 0 : bondData.bonus) }, children: [jsxs("div", { className: "bond-card-title", children: ["Bonus", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: TooltipText.Discount }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: jsx$2("div", { className: "bond-card-tooltip", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), jsx$2("div", { className: "bond-card-content", children: (bondData === null || bondData === void 0 ? void 0 : bondData.bonus) < 0 ? '0%' : `${(_a = bondData === null || bondData === void 0 ? void 0 : bondData.bonus) === null || _a === void 0 ? void 0 : _a.toFixed(2)}%` })] }), bondData.type !== 'staking' && (jsxs("div", { className: "bond-card-block hide-mobile", children: [jsxs("div", { className: "bond-card-title", children: ["ARR", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: TooltipText.ARR }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: jsx$2("div", { className: "bond-card-tooltip", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), jsx$2("div", { className: "bond-card-content", children: `${((((_b = bondData === null || bondData === void 0 ? void 0 : bondData.bonus) !== 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" }) }) })] }), jsx$2("div", { className: "bond-card-content", children: bondData.type === 'staking'
|
|
74076
74076
|
? `${daysLeftOnBasepadPool()} D Lock`
|
|
74077
74077
|
: vestingTime((_d = bondData === null || bondData === void 0 ? void 0 : bondData.vestingTerm) !== null && _d !== void 0 ? _d : 0).days
|
|
74078
74078
|
? `${vestingTime((_e = bondData === null || bondData === void 0 ? void 0 : bondData.vestingTerm) !== null && _e !== void 0 ? _e : 0).days} D`
|
|
@@ -74086,7 +74086,7 @@ const Estimations = ({ bondData, inputValue, inputToken, estimatedOutput, inputT
|
|
|
74086
74086
|
const estimatedInputUSD = parseFloat(inputValue) * (inputTokenPrice !== null && inputTokenPrice !== void 0 ? inputTokenPrice : 0);
|
|
74087
74087
|
const normalPremium = premium(bondData, inputValue);
|
|
74088
74088
|
const premiumString = isZap ? formatUSDNumber((estimatedOutputUSD - estimatedInputUSD).toString()) : normalPremium;
|
|
74089
|
-
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
|
|
74089
|
+
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 ${getPremiumColor(premiumString)}`, children: ["$ ", premiumString] }))] }), jsxs(Flex, { className: "text-container row", children: [jsxs(Flex, { className: "row-container get", children: ["You Get (over ", vestingTime((_b = bondData === null || bondData === void 0 ? void 0 : bondData.vestingTerm) !== null && _b !== void 0 ? _b : 0).days, " days):"] }), isZap && fetchingZapQuote ? (jsx$2(Dots, {})) : isZap && zapError ? ('-') : (jsxs(Flex, { className: "row-container get-val", children: [formatNumber$2(estimatedOutput.toString()), " ", bondData === null || bondData === void 0 ? void 0 : bondData.showcaseTokenName, " = $", ' ', formatUSDNumber(estimatedOutputUSD.toString())] }))] })] }));
|
|
74090
74090
|
};
|
|
74091
74091
|
|
|
74092
74092
|
// Custom HTML sanitizer
|
|
@@ -74218,6 +74218,22 @@ const RestrictedRegionModal = ({ onDismiss }) => {
|
|
|
74218
74218
|
return (jsxs(Modal, { className: "modal", title: "Notice", sx: { maxWidth: '200px' }, children: [jsxs(Flex, { sx: { my: '20px' }, children: ["Unfortunately, this bond is restricted for your region: ", geoData === null || geoData === void 0 ? void 0 : geoData.countryCode, "."] }), jsx$2(Button, { fullWidth: true, onClick: onDismiss, children: "Close" })] }));
|
|
74219
74219
|
};
|
|
74220
74220
|
|
|
74221
|
+
const NoBonusModal = ({ onAcknowledge, showcaseTokenName }) => {
|
|
74222
|
+
const [isOpen, setIsOpen] = useState(true);
|
|
74223
|
+
const [isChecked, setIsChecked] = useState(false);
|
|
74224
|
+
const handleAcknowledge = () => {
|
|
74225
|
+
onAcknowledge();
|
|
74226
|
+
setIsOpen(false);
|
|
74227
|
+
};
|
|
74228
|
+
const handleCancel = () => {
|
|
74229
|
+
setIsOpen(false);
|
|
74230
|
+
};
|
|
74231
|
+
const handleCheckboxChange = () => {
|
|
74232
|
+
setIsChecked(!isChecked);
|
|
74233
|
+
};
|
|
74234
|
+
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" })] })] })));
|
|
74235
|
+
};
|
|
74236
|
+
|
|
74221
74237
|
const BondModal = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond }) => {
|
|
74222
74238
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
74223
74239
|
const SDKConfig = useSDKConfig();
|
|
@@ -74411,6 +74427,17 @@ const BondModal = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond }) =
|
|
|
74411
74427
|
}
|
|
74412
74428
|
}
|
|
74413
74429
|
};
|
|
74430
|
+
const [openNoBonusModal] = useModal(jsx$2(NoBonusModal, { onAcknowledge: handleBothPurchases, showcaseTokenName: bondData === null || bondData === void 0 ? void 0 : bondData.showcaseTokenName }), true, true, 'NoBonusModal');
|
|
74431
|
+
const handleOpenModal = () => {
|
|
74432
|
+
var _a;
|
|
74433
|
+
const bonus = (_a = bondData === null || bondData === void 0 ? void 0 : bondData.bonus) !== null && _a !== void 0 ? _a : 0;
|
|
74434
|
+
if (bonus < 0) {
|
|
74435
|
+
openNoBonusModal();
|
|
74436
|
+
}
|
|
74437
|
+
else {
|
|
74438
|
+
handleBothPurchases();
|
|
74439
|
+
}
|
|
74440
|
+
};
|
|
74414
74441
|
const openExternal = () => {
|
|
74415
74442
|
if ((bondData === null || bondData === void 0 ? void 0 : bondData.chainId) === types.ChainId.LIGHTLINK) {
|
|
74416
74443
|
window.open('https://bridge.lightlink.io/bridge?from=ETHEREUM&to=LIGHTLINK&token=ETH', '_blank');
|
|
@@ -74441,7 +74468,7 @@ const BondModal = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond }) =
|
|
|
74441
74468
|
!inputValue ||
|
|
74442
74469
|
parseFloat(inputValue) === 0 ||
|
|
74443
74470
|
fetchingZapQuote ||
|
|
74444
|
-
zapError, onClick:
|
|
74471
|
+
zapError, onClick: handleOpenModal, children: zapError ? 'something went wrong' : `buy` })) : (jsx$2(Button, { className: "action-button", load: approvalState === ApprovalState.PENDING, disabled: approvalState === ApprovalState.PENDING ||
|
|
74445
74472
|
(bondData === null || bondData === void 0 ? void 0 : bondData.soldOut) ||
|
|
74446
74473
|
!account ||
|
|
74447
74474
|
!inputValue ||
|
|
@@ -74705,7 +74732,7 @@ const BondRow = ({ bond }) => {
|
|
|
74705
74732
|
const tokens = new BigNumber$1(tokensRemaining);
|
|
74706
74733
|
return tokens.times(payoutTokenPrice);
|
|
74707
74734
|
};
|
|
74708
|
-
return (jsxs("div", { className: "bond-row", onClick: handleOpenModal, children: [jsx$2("div", { className: "token-info-container", children: jsx$2(TokenInfoAndName, { bill: bond }) }), jsxs("div", { className: "bond-info-columns", children: [jsx$2("div", { className: `discount-column ${getDiscountColor(bonus)}`, children: bonus !== undefined ? `${bonus === null || bonus === void 0 ? void 0 : bonus.toFixed(2)}%` : '-' }), jsx$2("div", { className: "arr-column", children: calculateARR(bond) !== undefined ? calculateARR(bond) : '-' }), jsx$2("div", { className: "terms-column", children: bond.type === 'staking'
|
|
74735
|
+
return (jsxs("div", { className: "bond-row", onClick: handleOpenModal, children: [jsx$2("div", { className: "token-info-container", children: jsx$2(TokenInfoAndName, { bill: bond }) }), jsxs("div", { className: "bond-info-columns", children: [jsx$2("div", { className: `discount-column ${getDiscountColor(bonus)}`, children: bonus !== undefined ? (bonus < 0 ? '0%' : `${bonus === null || bonus === void 0 ? void 0 : bonus.toFixed(2)}%`) : '-' }), jsx$2("div", { className: "arr-column", children: calculateARR(bond) !== undefined ? calculateARR(bond) : '-' }), jsx$2("div", { className: "terms-column", children: bond.type === 'staking'
|
|
74709
74736
|
? `${daysLeftOnBasepadPool()} D Lock`
|
|
74710
74737
|
: vestingTime((_a = bond === null || bond === void 0 ? void 0 : bond.vestingTerm) !== null && _a !== void 0 ? _a : 0).days
|
|
74711
74738
|
? `${vestingTime((_b = bond === null || bond === void 0 ? void 0 : bond.vestingTerm) !== null && _b !== void 0 ? _b : 0).days} D`
|
|
@@ -74737,7 +74764,7 @@ const HotBondCard = ({ bond }) => {
|
|
|
74737
74764
|
},
|
|
74738
74765
|
});
|
|
74739
74766
|
};
|
|
74740
|
-
return (jsx$2(Flex, { sx: styles$a.desktopCard, className: "hot-bond-card", onClick: handleOpenModal, children: jsxs(Flex, { sx: { flexDirection: 'column', width: '100%' }, children: [jsxs(Flex, { sx: { width: '100%', height: '75px' }, children: [jsx$2(Flex, { sx: { width: '66.66%' }, children: jsx$2(TokenInfoAndName, { bill: bond, isHotBond: true }) }), jsx$2(Flex, { className: "column column-tokenicons", sx: { width: '33.33% !important', justifyContent: 'center !important', alignItems: 'center' }, children: jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(BondInfoTooltip, { earnTokenContract: (_c = (_b = (_a = bond === null || bond === void 0 ? void 0 : bond.earnToken) === null || _a === void 0 ? void 0 : _a.address) === null || _b === void 0 ? void 0 : _b[bond === null || bond === void 0 ? void 0 : bond.chainId]) !== null && _c !== void 0 ? _c : '', earnTokenSymbol: (_e = (_d = bond === null || bond === void 0 ? void 0 : bond.earnToken) === null || _d === void 0 ? void 0 : _d.symbol) !== null && _e !== void 0 ? _e : '', bondContract: (_f = bond === null || bond === void 0 ? void 0 : bond.billAddress) !== null && _f !== void 0 ? _f : '', projectLink: bond === null || bond === void 0 ? void 0 : bond.projectLink, twitter: bond === null || bond === void 0 ? void 0 : bond.twitter, audit: bond === null || bond === void 0 ? void 0 : bond.audit, chain: bond === null || bond === void 0 ? void 0 : bond.chainId }), width: "205px", placement: "bottomRight", transformTip: "translate(11%, 0%)", children: jsx$2(Svg, { icon: "more", width: "20px" }) }) })] }), jsxs(Flex, { sx: { width: '100%', justifyContent: 'space-around' }, children: [jsxs(Flex, { sx: { flexDirection: 'column', alignItems: 'center', width: '100%' }, children: [jsx$2(Flex, { sx: { opacity: 0.6, fontSize: '12px', fontWeight: 400 }, children: "Bonus" }), jsx$2(Flex, { className: `${getDiscountColor(bonus)}`, sx: { width: '100%', justifyContent: 'center' }, children: bonus !== undefined ? `${bonus === null || bonus === void 0 ? void 0 : bonus.toFixed(2)}%` : '-' })] }), jsxs(Flex, { sx: { flexDirection: 'column', alignItems: 'center', width: '100%' }, children: [jsx$2(Flex, { sx: { opacity: 0.6, fontSize: '12px', fontWeight: 400, width: '100%', justifyContent: 'center' }, children: "ARR" }), jsx$2(Flex, { sx: { width: '100%', justifyContent: 'center' }, children: calculateARR(bond) !== undefined ? calculateARR(bond) : '-' })] }), jsxs(Flex, { sx: { flexDirection: 'column', alignItems: 'center', width: '100%' }, children: [jsx$2(Flex, { sx: { opacity: 0.6, fontSize: '12px', fontWeight: 400, width: '100%', justifyContent: 'center' }, children: "Terms" }), jsx$2(Flex, { sx: { width: '100%', justifyContent: 'center' }, children: ((_g = vestingTime(bond === null || bond === void 0 ? void 0 : bond.vestingTerm)) === null || _g === void 0 ? void 0 : _g.days) ? `${(_h = vestingTime(bond === null || bond === void 0 ? void 0 : bond.vestingTerm)) === null || _h === void 0 ? void 0 : _h.days} D` : '-' })] })] })] }) }));
|
|
74767
|
+
return (jsx$2(Flex, { sx: styles$a.desktopCard, className: "hot-bond-card", onClick: handleOpenModal, children: jsxs(Flex, { sx: { flexDirection: 'column', width: '100%' }, children: [jsxs(Flex, { sx: { width: '100%', height: '75px' }, children: [jsx$2(Flex, { sx: { width: '66.66%' }, children: jsx$2(TokenInfoAndName, { bill: bond, isHotBond: true }) }), jsx$2(Flex, { className: "column column-tokenicons", sx: { width: '33.33% !important', justifyContent: 'center !important', alignItems: 'center' }, children: jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(BondInfoTooltip, { earnTokenContract: (_c = (_b = (_a = bond === null || bond === void 0 ? void 0 : bond.earnToken) === null || _a === void 0 ? void 0 : _a.address) === null || _b === void 0 ? void 0 : _b[bond === null || bond === void 0 ? void 0 : bond.chainId]) !== null && _c !== void 0 ? _c : '', earnTokenSymbol: (_e = (_d = bond === null || bond === void 0 ? void 0 : bond.earnToken) === null || _d === void 0 ? void 0 : _d.symbol) !== null && _e !== void 0 ? _e : '', bondContract: (_f = bond === null || bond === void 0 ? void 0 : bond.billAddress) !== null && _f !== void 0 ? _f : '', projectLink: bond === null || bond === void 0 ? void 0 : bond.projectLink, twitter: bond === null || bond === void 0 ? void 0 : bond.twitter, audit: bond === null || bond === void 0 ? void 0 : bond.audit, chain: bond === null || bond === void 0 ? void 0 : bond.chainId }), width: "205px", placement: "bottomRight", transformTip: "translate(11%, 0%)", children: jsx$2(Svg, { icon: "more", width: "20px" }) }) })] }), jsxs(Flex, { sx: { width: '100%', justifyContent: 'space-around' }, children: [jsxs(Flex, { sx: { flexDirection: 'column', alignItems: 'center', width: '100%' }, children: [jsx$2(Flex, { sx: { opacity: 0.6, fontSize: '12px', fontWeight: 400 }, children: "Bonus" }), jsx$2(Flex, { className: `${getDiscountColor(bonus)}`, sx: { width: '100%', justifyContent: 'center' }, children: bonus !== undefined ? (bonus < 0 ? '0%' : `${bonus === null || bonus === void 0 ? void 0 : bonus.toFixed(2)}%`) : '-' })] }), jsxs(Flex, { sx: { flexDirection: 'column', alignItems: 'center', width: '100%' }, children: [jsx$2(Flex, { sx: { opacity: 0.6, fontSize: '12px', fontWeight: 400, width: '100%', justifyContent: 'center' }, children: "ARR" }), jsx$2(Flex, { sx: { width: '100%', justifyContent: 'center' }, children: calculateARR(bond) !== undefined ? calculateARR(bond) : '-' })] }), jsxs(Flex, { sx: { flexDirection: 'column', alignItems: 'center', width: '100%' }, children: [jsx$2(Flex, { sx: { opacity: 0.6, fontSize: '12px', fontWeight: 400, width: '100%', justifyContent: 'center' }, children: "Terms" }), jsx$2(Flex, { sx: { width: '100%', justifyContent: 'center' }, children: ((_g = vestingTime(bond === null || bond === void 0 ? void 0 : bond.vestingTerm)) === null || _g === void 0 ? void 0 : _g.days) ? `${(_h = vestingTime(bond === null || bond === void 0 ? void 0 : bond.vestingTerm)) === null || _h === void 0 ? void 0 : _h.days} D` : '-' })] })] })] }) }));
|
|
74741
74768
|
};
|
|
74742
74769
|
|
|
74743
74770
|
function useHotBondContracts() {
|
package/dist/styles.css
CHANGED