@ape.swap/bonds-sdk 3.0.25 → 3.0.27
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/README.md
CHANGED
|
@@ -58,6 +58,7 @@ const MyBondsComponent = () => {
|
|
|
58
58
|
useHotBonds={true}
|
|
59
59
|
theme={{
|
|
60
60
|
"radii": "10px",
|
|
61
|
+
customFont: 'Poppins',
|
|
61
62
|
"colors": {
|
|
62
63
|
"primaryButton": "#6560C5",
|
|
63
64
|
"white1": "#0E0D16",
|
|
@@ -128,6 +129,8 @@ https://sdk.ape.bond/
|
|
|
128
129
|
|
|
129
130
|
Once you are happy with the styles, make sure to copy the output styles object and paste it under the `theme` param on the SDK component you will be using.
|
|
130
131
|
|
|
132
|
+
To use a custom font in the theme, include the `customFont` property with the name of your desired font family. Please note that you will need to manually download the font and embed it in your project using a `<script>` or `<link>` tag in your HTML file.
|
|
133
|
+
|
|
131
134
|
Bear in mind, that the components of the SDK will use the width and height provided by the parent component.
|
|
132
135
|
|
|
133
136
|
---
|
package/dist/main.js
CHANGED
|
@@ -17956,6 +17956,7 @@ var types = {};
|
|
|
17956
17956
|
ChainId[(ChainId['CROSSFI'] = 4158)] = 'CROSSFI';
|
|
17957
17957
|
ChainId[(ChainId['SONIC'] = 146)] = 'SONIC';
|
|
17958
17958
|
ChainId[(ChainId['MONAD_TESTNET'] = 10143)] = 'MONAD_TESTNET';
|
|
17959
|
+
ChainId[(ChainId['SOL'] = 7565164)] = 'SOL';
|
|
17959
17960
|
})((ChainId = exports.ChainId || (exports.ChainId = {})));
|
|
17960
17961
|
var LiquidityDex
|
|
17961
17962
|
;(function (LiquidityDex) {
|
|
@@ -18935,7 +18936,7 @@ const defaultUrls = {
|
|
|
18935
18936
|
const useSDKConfig = (config) => {
|
|
18936
18937
|
const { data } = useQuery({
|
|
18937
18938
|
queryKey: [QUERY_KEYS.SDK_CONFIG],
|
|
18938
|
-
initialData: Object.assign(Object.assign({ useHotBonds: true, useRainbowKit: false, useTiers: false }, config), { urls: Object.assign(Object.assign({}, defaultUrls), config === null || config === void 0 ? void 0 : config.urls), highestCompatibleVersion: '2.1.
|
|
18939
|
+
initialData: Object.assign(Object.assign({ useHotBonds: true, useRainbowKit: false, useTiers: false }, config), { urls: Object.assign(Object.assign({}, defaultUrls), config === null || config === void 0 ? void 0 : config.urls), highestCompatibleVersion: '2.1.1' }),
|
|
18939
18940
|
});
|
|
18940
18941
|
return data;
|
|
18941
18942
|
};
|
|
@@ -60904,7 +60905,7 @@ const getBillNftBatchData = (apiV2URL, billNftIds, billNftAddress, chainId) => _
|
|
|
60904
60905
|
return null;
|
|
60905
60906
|
}
|
|
60906
60907
|
// Make a GET request to the API to retrieve the batch data for the specified bill NFT IDs
|
|
60907
|
-
const response = yield axios.get(`${apiV2URL}/bills/batch/${chainId}/${billNftAddress}/?billIds[]=${billNftIds.join('&billIds[]=')}
|
|
60908
|
+
const response = yield axios.get(`${apiV2URL}/bills/batch/${chainId}/${billNftAddress}/?billIds[]=${billNftIds.join('&billIds[]=')}`, { timeout: 3000 });
|
|
60908
60909
|
// If the response status code is 500, return null
|
|
60909
60910
|
const billNftDataResp = yield response.data;
|
|
60910
60911
|
if (billNftDataResp.statusCode === 500) {
|
|
@@ -62280,7 +62281,7 @@ const TransferModal = ({ onDismiss, userBill }) => {
|
|
|
62280
62281
|
const { lpToken, earnToken } = (_a = userBill === null || userBill === void 0 ? void 0 : userBill.bond) !== null && _a !== void 0 ? _a : {};
|
|
62281
62282
|
const pending = chainId &&
|
|
62282
62283
|
((_e = getBalanceNumber(new BigNumber$1((_b = userBill === null || userBill === void 0 ? void 0 : userBill.payout) !== null && _b !== void 0 ? _b : 0), (_d = (_c = earnToken === null || earnToken === void 0 ? void 0 : earnToken.decimals) === null || _c === void 0 ? void 0 : _c[chainId]) !== null && _d !== void 0 ? _d : 18)) === null || _e === void 0 ? void 0 : _e.toFixed(4));
|
|
62283
|
-
return (jsxs(Modal, { onDismiss: onDismiss, title: "Transfer Bond", zIndex: 130, children: [jsx$2(Flex, { sx: { mt: '20px' }, children: jsx$2(Text, { sx: { fontWeight: 700 }, children: " Transferring: " }) }), jsxs(Flex, { sx: { flexDirection: 'column', alignItems: 'center', mt: '30px', mr: '10px' }, children: [jsxs(Text, { sx: { fontWeight: 700, fontSize: '25px' }, children: [lpToken === null || lpToken === void 0 ? void 0 : lpToken.symbol, " #", userBill === null || userBill === void 0 ? void 0 : userBill.id] }), jsxs(Flex, { sx: { mt: '5px' }, children: [jsxs(Flex, { sx: { flexDirection: 'column', mr: '20px' }, children: [jsx$2(Text, { sx: { textAlign: 'center', width: '100%', fontSize: '12px', opacity: 0.6 }, children: "Vesting time" }), getPendingVestingString(userBill)] }), jsxs(Flex, { sx: { flexDirection: 'column', ml: '20px' }, children: [jsx$2(Text, { sx: { textAlign: 'center', width: '100%', fontSize: '12px', opacity: 0.6 }, children: "Pending" }), jsxs(Flex, { children: [jsx$2(TokenImage, { symbol: (_g = (_f = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _f === void 0 ? void 0 : _f.showcaseTokenName) !== null && _g !== void 0 ? _g : (_j = (_h = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _h === void 0 ? void 0 : _h.earnToken) === null || _j === void 0 ? void 0 : _j.symbol, size: 20, chain: (_k = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _k === void 0 ? void 0 : _k.chainId }), jsx$2(Text, { sx: { fontWeight: 700, ml: '5px' }, children: pending })] })] })] })] }), jsxs(Flex, { sx: { flexDirection: 'column', mt: '30px' }, children: [jsx$2(Text, { sx: { fontWeight: 700 }, children: "Receiving Address:" }), jsx$2(Input, { mt: "10px", size: "lg", placeholder: 'Paste the address here', value: toAddress, onChange: (e) => setToAddress(e.target.value), style: { width: '345px', border: 'none' } })] }), jsx$2(Flex, { sx: { mt: '15px' }, children: jsxs(Text, { sx: { lineHeight: '18px', fontSize: '12px', color: 'rgba(223, 65, 65, 1)' }, children: [jsx$2(Text, { sx: { display: 'block', width: '100%', fontWeight: 700, fontSize: '13px', color: 'rgba(223, 65, 65, 1)' }, children: "WARNING" }), "When transfering the NFT all pending rewards will also be transfered to the receiver address."] }) }), jsxs(Flex, { onClick: () => setConfirmSend((prev) => !prev), sx: { mt: '20px', cursor: 'pointer', alignItems: 'center' }, children: [jsx$2(Checkbox, { checked: confirmSend
|
|
62284
|
+
return (jsxs(Modal, { onDismiss: onDismiss, title: "Transfer Bond", zIndex: 130, children: [jsx$2(Flex, { sx: { mt: '20px' }, children: jsx$2(Text, { sx: { fontWeight: 700 }, children: " Transferring: " }) }), jsxs(Flex, { sx: { flexDirection: 'column', alignItems: 'center', mt: '30px', mr: '10px' }, children: [jsxs(Text, { sx: { fontWeight: 700, fontSize: '25px' }, children: [lpToken === null || lpToken === void 0 ? void 0 : lpToken.symbol, " #", userBill === null || userBill === void 0 ? void 0 : userBill.id] }), jsxs(Flex, { sx: { mt: '5px' }, children: [jsxs(Flex, { sx: { flexDirection: 'column', mr: '20px' }, children: [jsx$2(Text, { sx: { textAlign: 'center', width: '100%', fontSize: '12px', opacity: 0.6 }, children: "Vesting time" }), getPendingVestingString(userBill)] }), jsxs(Flex, { sx: { flexDirection: 'column', ml: '20px' }, children: [jsx$2(Text, { sx: { textAlign: 'center', width: '100%', fontSize: '12px', opacity: 0.6 }, children: "Pending" }), jsxs(Flex, { children: [jsx$2(TokenImage, { symbol: (_g = (_f = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _f === void 0 ? void 0 : _f.showcaseTokenName) !== null && _g !== void 0 ? _g : (_j = (_h = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _h === void 0 ? void 0 : _h.earnToken) === null || _j === void 0 ? void 0 : _j.symbol, size: 20, chain: (_k = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _k === void 0 ? void 0 : _k.chainId }), jsx$2(Text, { sx: { fontWeight: 700, ml: '5px' }, children: pending })] })] })] })] }), jsxs(Flex, { sx: { flexDirection: 'column', mt: '30px' }, children: [jsx$2(Text, { sx: { fontWeight: 700 }, children: "Receiving Address:" }), jsx$2(Input, { mt: "10px", size: "lg", placeholder: 'Paste the address here', value: toAddress, onChange: (e) => setToAddress(e.target.value), style: { width: '345px', border: 'none' } })] }), jsx$2(Flex, { sx: { mt: '15px' }, children: jsxs(Text, { sx: { lineHeight: '18px', fontSize: '12px', color: 'rgba(223, 65, 65, 1)' }, children: [jsx$2(Text, { sx: { display: 'block', width: '100%', fontWeight: 700, fontSize: '13px', color: 'rgba(223, 65, 65, 1)' }, children: "WARNING" }), "When transfering the NFT all pending rewards will also be transfered to the receiver address."] }) }), jsxs(Flex, { onClick: () => setConfirmSend((prev) => !prev), sx: { mt: '20px', cursor: 'pointer', alignItems: 'center' }, children: [jsx$2(Checkbox, { checked: confirmSend }), jsx$2(Text, { sx: { ml: '10px', fontSize: '12px', fontWeight: 500, lineHeight: '18px' }, children: "I understand the new wallet gains ownership of all unclaimed assets." })] }), jsx$2(Flex, { sx: { justifyContent: 'center', mt: '15px' }, children: jsx$2(TransferAction, { userBill: userBill, toAddress: toAddress, disabled: !confirmSend || !toAddress }) })] }));
|
|
62284
62285
|
};
|
|
62285
62286
|
var TransferBondModal = React__default.memo(TransferModal);
|
|
62286
62287
|
|
|
@@ -69642,6 +69643,7 @@ const getBatchTokensExternal = (params) => __awaiter$9(void 0, void 0, void 0, f
|
|
|
69642
69643
|
}
|
|
69643
69644
|
catch (_a) {
|
|
69644
69645
|
console.log(`Failed to get price from api for chain ${chainId}.`);
|
|
69646
|
+
return [];
|
|
69645
69647
|
}
|
|
69646
69648
|
});
|
|
69647
69649
|
function getTokenPricesV3FromPriceGetter(tokensToCall, chain) {
|
|
@@ -70693,8 +70695,35 @@ const LinkShare = ({ bondNFTData, userBill, chainId, }) => {
|
|
|
70693
70695
|
return (jsx$2(Flex$1, { sx: styles$b.containerLinksShare, children: bondNFTData && bondNFTData.data && (jsxs(Fragment$1, { children: [jsx$2(Link, { href: "https://app.fuul.xyz/incentives/apebond", target: "_blank", className: `fade-out ${hideTag ? 'hidden' : ''}`, children: jsx$2(Flex$1, { sx: styles$b.tagShareBond, children: "Share your Bonds and earn rewards!" }) }), jsx$2(Flex$1, { sx: styles$b.linkShareButton, onClick: () => handleShare(`https://twitter.com/intent/tweet?text=${text}&url=${shareUrl}`, 'x'), children: isLoading[0] ? jsx$2(Spinner, { size: 16 }) : jsx$2(Svg, { icon: "twitter", width: 24 }) }), jsx$2(Flex$1, { sx: styles$b.linkShareButton, onClick: () => handleShare(`https://warpcast.com/~/compose?text=${text}&embeds[]=${shareUrl}`, 'farcaster'), children: isLoading[1] ? jsx$2(Spinner, { size: 16 }) : jsx$2(Svg, { icon: "Farcaster", width: 16 }) })] })) }));
|
|
70694
70696
|
};
|
|
70695
70697
|
|
|
70698
|
+
// Custom HTML sanitizer
|
|
70699
|
+
function sanitizeHTML(html) {
|
|
70700
|
+
var _a;
|
|
70701
|
+
const tagWhitelist = ['a', 'br', 'span']; // Allowed tags
|
|
70702
|
+
const attrWhitelist = ['target', 'rel', 'style', 'href']; // Allowed attributes
|
|
70703
|
+
const doc = new DOMParser().parseFromString(html, 'text/html');
|
|
70704
|
+
const elements = doc.body.querySelectorAll('*');
|
|
70705
|
+
for (const el of elements) {
|
|
70706
|
+
// Remove elements that are not in the whitelist
|
|
70707
|
+
if (!tagWhitelist.includes(el.tagName.toLowerCase())) {
|
|
70708
|
+
(_a = el === null || el === void 0 ? void 0 : el.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(el);
|
|
70709
|
+
continue;
|
|
70710
|
+
}
|
|
70711
|
+
// Loop through the element's attributes and remove those that are not in the whitelist
|
|
70712
|
+
Array.from(el.attributes).forEach((attr) => {
|
|
70713
|
+
if (!attrWhitelist.includes(attr.name.toLowerCase())) {
|
|
70714
|
+
el.removeAttribute(attr.name);
|
|
70715
|
+
}
|
|
70716
|
+
});
|
|
70717
|
+
}
|
|
70718
|
+
return doc.body.innerHTML;
|
|
70719
|
+
}
|
|
70720
|
+
const SafeHTMLComponent = ({ html }) => {
|
|
70721
|
+
const sanitizedHTML = sanitizeHTML(html);
|
|
70722
|
+
return jsx$2("div", { dangerouslySetInnerHTML: { __html: sanitizedHTML } });
|
|
70723
|
+
};
|
|
70724
|
+
|
|
70696
70725
|
const YourBondsModal = ({ onDismiss, userBill }) => {
|
|
70697
|
-
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;
|
|
70726
|
+
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;
|
|
70698
70727
|
// Hooks
|
|
70699
70728
|
const chainId = useChainId();
|
|
70700
70729
|
const { switchChain } = useSwitchChain();
|
|
@@ -70797,11 +70826,16 @@ const YourBondsModal = ({ onDismiss, userBill }) => {
|
|
|
70797
70826
|
fontSize: ['10px', '10px', '10px', '12px'],
|
|
70798
70827
|
fontWeight: [500, 500, 500, 400],
|
|
70799
70828
|
paddingLeft: '10px',
|
|
70800
|
-
}, children: `($${(claimable(userBill) * ((_4 = earnTokenPrice === null || earnTokenPrice === void 0 ? void 0 : earnTokenPrice.price) !== null && _4 !== void 0 ? _4 : 0)).toFixed(2)})` })] })] })] })] }),
|
|
70829
|
+
}, children: `($${(claimable(userBill) * ((_4 = earnTokenPrice === null || earnTokenPrice === void 0 ? void 0 : earnTokenPrice.price) !== null && _4 !== void 0 ? _4 : 0)).toFixed(2)})` })] })] })] })] }), ((_5 = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _5 === void 0 ? void 0 : _5.warningCard) && (jsx$2(Flex$1, { sx: {
|
|
70830
|
+
width: '100%',
|
|
70831
|
+
background: '#DE62F366',
|
|
70832
|
+
justifyContent: 'center',
|
|
70833
|
+
borderRadius: 'normal',
|
|
70834
|
+
}, children: jsx$2(Text, { sx: { fontSize: '12px', fontWeight: 400, p: '2px 10px' }, children: jsx$2(SafeHTMLComponent, { html: (_6 = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _6 === void 0 ? void 0 : _6.warningCard }) }) })), jsxs(Flex$1, { className: "yourbondinfo button-container", children: [jsx$2(Flex$1, { className: "button-container claim", children: userBill && chainId !== (userBill === null || userBill === void 0 ? void 0 : userBill.bond.chainId) ? (jsxs(Button, { className: "switch-button", disabled: claimable(userBill) === 0 || load, onClick: (event) => {
|
|
70801
70835
|
var _a;
|
|
70802
70836
|
event.stopPropagation();
|
|
70803
70837
|
switchChain({ chainId: (_a = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _a === void 0 ? void 0 : _a.chainId });
|
|
70804
|
-
}, children: ["Switch to ", NETWORK_LABEL[(
|
|
70838
|
+
}, children: ["Switch to ", NETWORK_LABEL[(_7 = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _7 === void 0 ? void 0 : _7.chainId]] })) : (jsx$2(Button, { className: "claim-button", disabled: claimable(userBill) === 0 || load || !userBill || isPendingCliff, load: load, onClick: (event) => {
|
|
70805
70839
|
event.stopPropagation();
|
|
70806
70840
|
handleClaim(userBill === null || userBill === void 0 ? void 0 : userBill.id, userBill === null || userBill === void 0 ? void 0 : userBill.address);
|
|
70807
70841
|
}, children: isPendingCliff
|
|
@@ -71419,7 +71453,7 @@ const ChainOptionsButtons = ({ selectedChain, setSelectedChain, setViewAllChains
|
|
|
71419
71453
|
|
|
71420
71454
|
const ClaimAllModal = () => {
|
|
71421
71455
|
var _a, _b;
|
|
71422
|
-
const { chainId } = useAccount();
|
|
71456
|
+
const { chainId, address: account } = useAccount();
|
|
71423
71457
|
const { switchChain } = useSwitchChain();
|
|
71424
71458
|
const SDKConfig = useSDKConfig();
|
|
71425
71459
|
const chains = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.chains;
|
|
@@ -71452,8 +71486,6 @@ const ClaimAllModal = () => {
|
|
|
71452
71486
|
try {
|
|
71453
71487
|
bondsOfSelectedChain === null || bondsOfSelectedChain === void 0 ? void 0 : bondsOfSelectedChain.map((purchasedBond) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
71454
71488
|
const address = purchasedBond.bond.contractAddress[purchasedBond.bond.chainId];
|
|
71455
|
-
console.log(purchasedBond);
|
|
71456
|
-
console.log(address);
|
|
71457
71489
|
track({
|
|
71458
71490
|
event: 'bond',
|
|
71459
71491
|
chain: purchasedBond.bond.chainId,
|
|
@@ -71464,12 +71496,12 @@ const ClaimAllModal = () => {
|
|
|
71464
71496
|
},
|
|
71465
71497
|
});
|
|
71466
71498
|
return writeContractAsync({
|
|
71467
|
-
address
|
|
71499
|
+
address,
|
|
71468
71500
|
abi: BOND_ABI,
|
|
71469
71501
|
functionName: 'batchRedeem',
|
|
71470
71502
|
args: [purchasedBond.userOwnedBills.map((b) => b.id)],
|
|
71471
71503
|
chain: chainId,
|
|
71472
|
-
account
|
|
71504
|
+
account,
|
|
71473
71505
|
});
|
|
71474
71506
|
}));
|
|
71475
71507
|
}
|
|
@@ -76461,33 +76493,6 @@ const Estimations = ({ depositAmount, bondData, youSpendString, isZap, fetchingZ
|
|
|
76461
76493
|
} }), jsxs(Flex, { className: "row-container premium", sx: { zIndex: 1 }, children: [jsx$2("img", { src: `/images/launch/${tierName === null || tierName === void 0 ? void 0 : tierName.toLowerCase()}.png`, alt: "minTier", style: { width: '21px', height: '21px', marginRight: '3px', zIndex: 1 } }), jsx$2(Flex, { sx: { color: 'success', mr: '3px', fontWeight: 700 }, children: boostMap[userTier] }), "Boost:", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: TooltipText.Boost }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, 0%)", 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 premium-positive`, children: ["$ ", formatUSDNumber(boostAmount.toString())] }))] })), !!bondData.feeInPayout && (jsxs(Flex, { className: "text-container row", children: [jsxs(Flex, { className: "row-container premium", children: ["Fee:", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsxs(Flex, { children: ["This is the platform fee (", bondData.feeInPayout, "%)."] }), 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`, 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$1(estimatedOutputAmount.toString()), " ", bondData === null || bondData === void 0 ? void 0 : bondData.showcaseTokenName, " = $", ' ', formatUSDNumber(estimatedOutputUSD.toString())] }))] })] }));
|
|
76462
76494
|
};
|
|
76463
76495
|
|
|
76464
|
-
// Custom HTML sanitizer
|
|
76465
|
-
function sanitizeHTML(html) {
|
|
76466
|
-
var _a;
|
|
76467
|
-
const tagWhitelist = ['a', 'br', 'span']; // Allowed tags
|
|
76468
|
-
const attrWhitelist = ['target', 'rel', 'style', 'href']; // Allowed attributes
|
|
76469
|
-
const doc = new DOMParser().parseFromString(html, 'text/html');
|
|
76470
|
-
const elements = doc.body.querySelectorAll('*');
|
|
76471
|
-
for (const el of elements) {
|
|
76472
|
-
// Remove elements that are not in the whitelist
|
|
76473
|
-
if (!tagWhitelist.includes(el.tagName.toLowerCase())) {
|
|
76474
|
-
(_a = el === null || el === void 0 ? void 0 : el.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(el);
|
|
76475
|
-
continue;
|
|
76476
|
-
}
|
|
76477
|
-
// Loop through the element's attributes and remove those that are not in the whitelist
|
|
76478
|
-
Array.from(el.attributes).forEach((attr) => {
|
|
76479
|
-
if (!attrWhitelist.includes(attr.name.toLowerCase())) {
|
|
76480
|
-
el.removeAttribute(attr.name);
|
|
76481
|
-
}
|
|
76482
|
-
});
|
|
76483
|
-
}
|
|
76484
|
-
return doc.body.innerHTML;
|
|
76485
|
-
}
|
|
76486
|
-
const SafeHTMLComponent = ({ html }) => {
|
|
76487
|
-
const sanitizedHTML = sanitizeHTML(html);
|
|
76488
|
-
return jsx$2("div", { dangerouslySetInnerHTML: { __html: sanitizedHTML } });
|
|
76489
|
-
};
|
|
76490
|
-
|
|
76491
76496
|
var ABTestKeys;
|
|
76492
76497
|
(function (ABTestKeys) {
|
|
76493
76498
|
ABTestKeys["BOND_DESCRIPTION"] = "bondDescription";
|
|
@@ -76926,7 +76931,7 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, isPro
|
|
|
76926
76931
|
justifyContent: 'center',
|
|
76927
76932
|
mt: '15px',
|
|
76928
76933
|
borderRadius: 'normal',
|
|
76929
|
-
}, children: jsx$2(Text, { sx: { fontSize: '12px', fontWeight: 400, p: '2px 10px' }, children: bondData === null || bondData === void 0 ? void 0 : bondData.warningCard }) })), jsxs(Flex, { className: "modaltable-container button-container", children: [account && (jsx$2(Flex, { className: "button-container get", children: jsx$2(Button, { className: "action-button", onClick: () => bondData.billVersion === types.BillVersion.V4 && SDKConfig.useTiers
|
|
76934
|
+
}, children: jsx$2(Text, { sx: { fontSize: '12px', fontWeight: 400, p: '2px 10px' }, children: jsx$2(SafeHTMLComponent, { html: bondData === null || bondData === void 0 ? void 0 : bondData.warningCard }) }) })), jsxs(Flex, { className: "modaltable-container button-container", children: [account && (jsx$2(Flex, { className: "button-container get", children: jsx$2(Button, { className: "action-button", onClick: () => bondData.billVersion === types.BillVersion.V4 && SDKConfig.useTiers
|
|
76930
76935
|
? window.open('http://ape.bond/tier-staking', '_blank')
|
|
76931
76936
|
: supportedByLIFI.includes(bondData === null || bondData === void 0 ? void 0 : bondData.chainId)
|
|
76932
76937
|
? handleOpenZapModal()
|
|
@@ -77071,9 +77076,9 @@ const ProgressBarWrapper = ({ title, value, style, showTooltip, toolTipPlacement
|
|
|
77071
77076
|
var ProgressBarWrapper$1 = React__default.memo(ProgressBarWrapper);
|
|
77072
77077
|
|
|
77073
77078
|
const BondRow = ({ bond }) => {
|
|
77074
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
77079
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
77075
77080
|
const isMobile = useIsMobile();
|
|
77076
|
-
|
|
77081
|
+
useSDKConfig();
|
|
77077
77082
|
const locationPath = window.location.pathname.replace('/', '');
|
|
77078
77083
|
const billAddress = 'billAddress' in bond
|
|
77079
77084
|
? bond.billAddress
|
|
@@ -77118,23 +77123,7 @@ const BondRow = ({ bond }) => {
|
|
|
77118
77123
|
const tokens = new BigNumber$1(tokensRemaining);
|
|
77119
77124
|
return tokens.times(payoutTokenPrice);
|
|
77120
77125
|
};
|
|
77121
|
-
return (jsxs("div", { className: `bond-row ${isGoldRush ? 'gold-rush' : ''}`, onClick: handleOpenModal, sx: { borderRadius: 'normal' }, children: [jsx$2("div", { className: "gold-ribbon" }), jsx$2("div", { className: "token-info-container", sx: { width: ['50%', '50%', '50%', '30%'] }, children: jsx$2(TokenInfoAndName, { bill: bond, isGoldBond: isGoldRush }) }), jsxs("div", { className: "bond-info-columns", sx: { width: ['50%', '50%', '50%', '60%'] }, children: [jsx$2("div", { className: `discount-column`, children: 'trueBondPrices' in bond ? (((_b = (_a = findHighestTrueBondPrice(TIERS_WEIGHT[types.LaunchBondTiers.Legend], bond)) === null || _a === void 0 ? void 0 : _a.bonusWithFee) !== null && _b !== void 0 ? _b : 0) > 0 ? (jsx$2(BonusComponent, { bond: bond, tooltipPosition: isMobile ? 'bottomRight' : 'bottomLeft' })) : (jsx$2(TooltipBubble, { className: "tooltip-bubble", body: 'This bond is currently on cooldown and has no bonus. Please check back soon.', width: "205px", placement: "bottomRight", transformTip: "translate(10%, 0%)", children: jsx$2(Svg, { icon: "Timer", width: "20px", color: "#81CFEA" }) }))) : ('-') }),
|
|
77122
|
-
p: '3px 6px',
|
|
77123
|
-
border: '1px solid var(--theme-ui-colors-primaryButton)',
|
|
77124
|
-
borderRadius: 'normal',
|
|
77125
|
-
background: 'transparent',
|
|
77126
|
-
position: 'relative',
|
|
77127
|
-
overflow: 'hidden',
|
|
77128
|
-
}, children: [jsx$2(Flex, { sx: {
|
|
77129
|
-
position: 'absolute',
|
|
77130
|
-
width: '100%',
|
|
77131
|
-
height: '100%',
|
|
77132
|
-
top: 0,
|
|
77133
|
-
left: 0,
|
|
77134
|
-
zIndex: 1,
|
|
77135
|
-
background: 'primaryButton',
|
|
77136
|
-
opacity: 0.3,
|
|
77137
|
-
} }), jsxs(Flex, { sx: { width: '100%', zIndex: 2, alignItems: 'center' }, children: [jsx$2("img", { src: `/images/launch/legend.png`, alt: "minTier", style: { width: '21px', height: '21px', marginRight: '3px', zIndex: 1 } }), jsx$2(Flex, { sx: { fontSize: '14px', mr: '3px' }, children: "Up to" }), jsx$2(Flex, { children: calculateARR(bond, SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.useTiers) })] })] })) : (calculateARR(bond, SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.useTiers))) : (jsx$2(TooltipBubble, { className: "tooltip-bubble", body: 'This bond is currently on cooldown and has no bonus. Please check back soon.', width: "205px", placement: "bottomRight", transformTip: "translate(10%, 0%)", children: jsx$2(Svg, { icon: "Timer", width: "20px", color: "#81CFEA" }) }))) : ('-') }), jsxs("div", { className: "terms-column", children: [getVestingTermsString(bond), bond.vestingCliff && (jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: getVestingTermsTooltipString(bond) }), width: "180px", placement: "bottomRight", transformTip: "translate(13%, 0%)", children: jsx$2(Flex, { sx: { opacity: 0.6, ml: '6px' }, children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) }))] }), jsx$2("div", { className: "tokens-remaining-column", children: jsx$2(ProgressBarWrapper$1, { title: '', value: jsx$2(ProgressBar, { value: remainingPercentage(bond) }), style: {
|
|
77126
|
+
return (jsxs("div", { className: `bond-row ${isGoldRush ? 'gold-rush' : ''}`, onClick: handleOpenModal, sx: { borderRadius: 'normal' }, children: [jsx$2("div", { className: "gold-ribbon" }), jsx$2("div", { className: "token-info-container", sx: { width: ['50%', '50%', '50%', '30%'] }, children: jsx$2(TokenInfoAndName, { bill: bond, isGoldBond: isGoldRush }) }), jsxs("div", { className: "bond-info-columns", sx: { width: ['50%', '50%', '50%', '60%'] }, children: [jsx$2("div", { className: `discount-column`, children: 'trueBondPrices' in bond ? (((_b = (_a = findHighestTrueBondPrice(TIERS_WEIGHT[types.LaunchBondTiers.Legend], bond)) === null || _a === void 0 ? void 0 : _a.bonusWithFee) !== null && _b !== void 0 ? _b : 0) > 0 ? (jsx$2(BonusComponent, { bond: bond, tooltipPosition: isMobile ? 'bottomRight' : 'bottomLeft' })) : (jsx$2(TooltipBubble, { className: "tooltip-bubble", body: 'This bond is currently on cooldown and has no bonus. Please check back soon.', width: "205px", placement: "bottomRight", transformTip: "translate(10%, 0%)", children: jsx$2(Svg, { icon: "Timer", width: "20px", color: "#81CFEA" }) }))) : ('-') }), jsxs("div", { className: "terms-column", children: [getVestingTermsString(bond), bond.vestingCliff && (jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: getVestingTermsTooltipString(bond) }), width: "180px", placement: "bottomRight", transformTip: "translate(13%, 0%)", children: jsx$2(Flex, { sx: { opacity: 0.6, ml: '6px' }, children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) }))] }), jsx$2("div", { className: "tokens-remaining-column", children: jsx$2(ProgressBarWrapper$1, { title: '', value: jsx$2(ProgressBar, { value: remainingPercentage(bond) }), style: {
|
|
77138
77127
|
width: '127px',
|
|
77139
77128
|
height: '25px',
|
|
77140
77129
|
flexDirection: 'column',
|
|
@@ -77143,7 +77132,7 @@ const BondRow = ({ bond }) => {
|
|
|
77143
77132
|
}, showTooltip: true, toolTip: `${remainingTokensFormat(bond)} ${bond.earnToken.symbol} (${formatDollar({
|
|
77144
77133
|
num: remainingTokensUsd(bond).toNumber(),
|
|
77145
77134
|
isPrice: true,
|
|
77146
|
-
})})` }) }), jsx$2("div", { className: "tooltip-column", children: jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(BondInfoTooltip, { earnTokenContract: (
|
|
77135
|
+
})})` }) }), jsx$2("div", { className: "tooltip-column", children: jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(BondInfoTooltip, { earnTokenContract: (_e = (_d = (_c = bond === null || bond === void 0 ? void 0 : bond.earnToken) === null || _c === void 0 ? void 0 : _c.address) === null || _d === void 0 ? void 0 : _d[bond === null || bond === void 0 ? void 0 : bond.chainId]) !== null && _e !== void 0 ? _e : '', earnTokenSymbol: (_g = (_f = bond === null || bond === void 0 ? void 0 : bond.earnToken) === null || _f === void 0 ? void 0 : _f.symbol) !== null && _g !== void 0 ? _g : '', bondContract: billAddress !== null && billAddress !== void 0 ? billAddress : '', 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(7%, -2%)", children: jsx$2(Flex, { className: "more-icon", sx: { opacity: 0.8 }, children: jsx$2(Svg, { icon: "more", width: "25px" }) }) }) })] })] }, billAddress));
|
|
77147
77136
|
};
|
|
77148
77137
|
|
|
77149
77138
|
const HotBondCard = ({ bond }) => {
|
|
@@ -77464,7 +77453,7 @@ const BondsMenu = ({ searchQuery, setSearchQuery, setChainFilterOption, chainFil
|
|
|
77464
77453
|
height: '30px',
|
|
77465
77454
|
fontSize: '14px',
|
|
77466
77455
|
color: 'white',
|
|
77467
|
-
}, placeholder: 'Search...' }), jsx$2(FavIcon, { filterOption: filterOption, setFilterOption: setFilterOption })] }) }), jsxs("div", { className: "headers-container", children: [jsxs("div", { className: "discount-header", onClick: () => onSort('bonus'), children: ["BONUS", jsx$2(Flex$1, { sx: { ml: '5px', mb: '3px' }, children: jsx$2(Svg, { icon: "sort", width: 10, color: "textDisabledButton" }) })] }), jsxs("div", { className: "
|
|
77456
|
+
}, placeholder: 'Search...' }), jsx$2(FavIcon, { filterOption: filterOption, setFilterOption: setFilterOption })] }) }), jsxs("div", { className: "headers-container", children: [jsxs("div", { className: "discount-header", onClick: () => onSort('bonus'), children: ["BONUS", jsx$2(Flex$1, { sx: { ml: '5px', mb: '3px' }, children: jsx$2(Svg, { icon: "sort", width: 10, color: "textDisabledButton" }) })] }), jsxs("div", { className: "terms-header", onClick: () => onSort('terms'), children: ["TERMS", jsx$2(Flex$1, { sx: { ml: '5px', mb: '3px' }, children: jsx$2(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) })] }), jsxs("div", { className: "tokens-remaining-header", onClick: () => onSort('tokensRemaining'), children: ["TOKENS REMAINING", jsx$2(Flex$1, { sx: { ml: '5px', mb: '3px' }, children: jsx$2(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) })] }), jsx$2("div", { className: "tooltip-header" })] })] })] }));
|
|
77468
77457
|
};
|
|
77469
77458
|
|
|
77470
77459
|
const Bonds = () => {
|
|
@@ -78385,6 +78374,11 @@ const Providers = ({ children, theme }) => {
|
|
|
78385
78374
|
if ((themeToUse === null || themeToUse === void 0 ? void 0 : themeToUse.radii) && (theme === null || theme === void 0 ? void 0 : theme.radii)) {
|
|
78386
78375
|
themeToUse.radii = { normal: theme === null || theme === void 0 ? void 0 : theme.radii };
|
|
78387
78376
|
}
|
|
78377
|
+
if ((themeToUse === null || themeToUse === void 0 ? void 0 : themeToUse.fonts) && (theme === null || theme === void 0 ? void 0 : theme.customFont)) {
|
|
78378
|
+
themeToUse.fonts = {
|
|
78379
|
+
body: `${theme === null || theme === void 0 ? void 0 : theme.customFont}, sans-serif`,
|
|
78380
|
+
};
|
|
78381
|
+
}
|
|
78388
78382
|
return (jsx$2(ThemeUIProvider, { theme: themeToUse, children: jsx$2(ModalProvider, { children: jsx$2(Popups, { children: children }) }) }));
|
|
78389
78383
|
};
|
|
78390
78384
|
|
|
@@ -9,5 +9,4 @@ export interface TokenPrices {
|
|
|
9
9
|
}
|
|
10
10
|
export default function useTokenPrices(): UseQueryResult<TokenPrices[]>;
|
|
11
11
|
export declare const getTokenPrices: (apeswapListsURL: string, chains: number[]) => Promise<TokenPrices[]>;
|
|
12
|
-
export declare const getDexScreenerChainName: (chainId: ChainId) => string | undefined;
|
|
13
12
|
export declare function getTokenPricesV3FromPriceGetter(tokensToCall: Record<string, Token>, chain: ChainId): Promise<any>;
|
package/dist/styles.css
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { BondsData } from '../../types/bonds';
|
|
1
|
+
import { BondsData, TrueBondPrices } from '../../types/bonds';
|
|
2
2
|
/**
|
|
3
3
|
* Finds the highest TrueBondPrices element where userPoints is higher than points in the array.
|
|
4
4
|
* @param userPoints - The user's points as a string representing a BigNumber.
|
|
5
5
|
* @param bondData - Bond Data containing an array of TrueBondPrices to analyze.
|
|
6
6
|
* @returns The highest TrueBondPrices element where userPoints is higher than the item's points, or `undefined` if none matches.
|
|
7
7
|
*/
|
|
8
|
-
export declare const findHighestTrueBondPrice: (userPoints?: string | null, bondData?: BondsData) =>
|
|
8
|
+
export declare const findHighestTrueBondPrice: (userPoints?: string | null, bondData?: BondsData) => TrueBondPrices;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Ape Bond SDK",
|
|
4
4
|
"author": "Ape Bond",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"version": "3.0.
|
|
6
|
+
"version": "3.0.27",
|
|
7
7
|
"module": "dist/main.js",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"types": "dist/main.d.ts",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"yalc": "^1.0.0-pre.53"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@ape.swap/apeswap-lists": "4.
|
|
60
|
+
"@ape.swap/apeswap-lists": "4.3.0",
|
|
61
61
|
"@emotion/react": "11.11.4",
|
|
62
62
|
"bignumber.js": "^9.1.2",
|
|
63
63
|
"chart.js": "4.2.0",
|