@ape.swap/bonds-sdk 2.3.1 → 2.3.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
CHANGED
|
@@ -18326,6 +18326,7 @@ var types = {};
|
|
|
18326
18326
|
(_c[LiquidityDex.PancakeSwapV2] = {
|
|
18327
18327
|
factory: '0xcA143Ce32Fe78f1f7019d7d551a6402fC5350c73',
|
|
18328
18328
|
protocol: Protocols.V2,
|
|
18329
|
+
router: '0x10ED43C718714eb63d5aA57B78B54704E256024E',
|
|
18329
18330
|
}),
|
|
18330
18331
|
(_c[LiquidityDex.ApeSwapV3] = {
|
|
18331
18332
|
factory: '0x7Bc382DdC5928964D7af60e7e2f6299A1eA6F48d',
|
|
@@ -18841,6 +18842,7 @@ const QUERY_KEYS = {
|
|
|
18841
18842
|
CHAIN_FILTER_OPTION: 'ApeBond-SDK-chainFilterOption',
|
|
18842
18843
|
FAVORITE_TOKENS: 'ApeBond-SDK-favoriteTokens',
|
|
18843
18844
|
POP_UPS: 'ApeBond-SDK-popUps',
|
|
18845
|
+
GEO_FENCING: 'ApeBond-SDK-geoFencing',
|
|
18844
18846
|
};
|
|
18845
18847
|
|
|
18846
18848
|
function useCookie(key, defaultValue) {
|
|
@@ -49038,7 +49040,7 @@ const PRICE_GETTER_ADDRESSES = {
|
|
|
49038
49040
|
[types.ChainId.LINEA]: '0x35b1eadAbaDD0Edd26076247f3dEdF9E15De8D5D',
|
|
49039
49041
|
[types.ChainId.LIGHTLINK]: '0xC22Db8dDe3A3591fFB02be868Ce2901d30671FE4',
|
|
49040
49042
|
[types.ChainId.IOTA]: '0xC22Db8dDe3A3591fFB02be868Ce2901d30671FE4',
|
|
49041
|
-
[types.ChainId.BASE]: '
|
|
49043
|
+
[types.ChainId.BASE]: '0xE29C74B4DD05A268B5FFaadeF4fdbAa1de6FDe84',
|
|
49042
49044
|
[types.ChainId.AVAX]: '0x70005Da62E17041977f7F99f91098b125CcDE1a7',
|
|
49043
49045
|
};
|
|
49044
49046
|
const MULTICALL_V2 = {
|
|
@@ -74176,9 +74178,32 @@ const ImageAndShortDescription = ({ bondData, onDismiss }) => {
|
|
|
74176
74178
|
}) })] }), 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 }) })] }));
|
|
74177
74179
|
};
|
|
74178
74180
|
|
|
74181
|
+
// Fetch country code to check if the region is allowed
|
|
74182
|
+
const fetchLocation = (apiv2URL) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
74183
|
+
const resp = yield axios.get(`${apiv2URL}/check`);
|
|
74184
|
+
const { isRestrictedRegion, countryCode } = resp === null || resp === void 0 ? void 0 : resp.data;
|
|
74185
|
+
return { isRestrictedRegion, countryCode };
|
|
74186
|
+
});
|
|
74187
|
+
function useGeoFencing() {
|
|
74188
|
+
const apiv2URL = useURLByEnvironment('apiV2');
|
|
74189
|
+
return useQuery({
|
|
74190
|
+
queryKey: [QUERY_KEYS.GEO_FENCING],
|
|
74191
|
+
queryFn: () => fetchLocation(apiv2URL),
|
|
74192
|
+
staleTime: Infinity,
|
|
74193
|
+
refetchOnMount: false,
|
|
74194
|
+
refetchOnWindowFocus: false,
|
|
74195
|
+
});
|
|
74196
|
+
}
|
|
74197
|
+
|
|
74198
|
+
const RestrictedRegionModal = ({ onDismiss }) => {
|
|
74199
|
+
const { data: geoData } = useGeoFencing();
|
|
74200
|
+
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" })] }));
|
|
74201
|
+
};
|
|
74202
|
+
|
|
74179
74203
|
const BondModal = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond }) => {
|
|
74180
74204
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
74181
74205
|
const SDKConfig = useSDKConfig();
|
|
74206
|
+
const { data: geoData } = useGeoFencing();
|
|
74182
74207
|
// State
|
|
74183
74208
|
const [modalVariant, setModalVariant] = useState(SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.modalVariant);
|
|
74184
74209
|
const [accordionVisible, setAccordionVisible] = useState(false);
|
|
@@ -74346,13 +74371,26 @@ const BondModal = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond }) =
|
|
|
74346
74371
|
}
|
|
74347
74372
|
}
|
|
74348
74373
|
});
|
|
74374
|
+
const [openGeofencingModal] = useModal(jsx$2(RestrictedRegionModal, {}));
|
|
74375
|
+
const blockedBondsForAE = [
|
|
74376
|
+
'0x0719CCaF2f07f59b23DB7d80E3d2791A0836bdfD'.toLowerCase(),
|
|
74377
|
+
'0xBc48794a04777E7170bD5633E8b728f8a0945971'.toLowerCase(),
|
|
74378
|
+
'0x94A283756B70c2A77bc58Ae0E2615Caf14310186'.toLowerCase(),
|
|
74379
|
+
'0x6639D4acAe77967c253C75cBfEd7C612682E2704'.toLowerCase(),
|
|
74380
|
+
];
|
|
74349
74381
|
const handleBothPurchases = () => {
|
|
74350
|
-
|
|
74351
|
-
if (
|
|
74352
|
-
|
|
74382
|
+
var _a, _b;
|
|
74383
|
+
if ((geoData === null || geoData === void 0 ? void 0 : geoData.countryCode) === 'AE' && blockedBondsForAE.includes((_b = (_a = bondData === null || bondData === void 0 ? void 0 : bondData.billAddress) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== null && _b !== void 0 ? _b : '')) {
|
|
74384
|
+
openGeofencingModal();
|
|
74353
74385
|
}
|
|
74354
74386
|
else {
|
|
74355
|
-
|
|
74387
|
+
setLoadingTx(true);
|
|
74388
|
+
if (isZap) {
|
|
74389
|
+
handleZapCallback().finally(() => setLoadingTx(false));
|
|
74390
|
+
}
|
|
74391
|
+
else {
|
|
74392
|
+
handleBuyCallback().finally(() => setLoadingTx(false));
|
|
74393
|
+
}
|
|
74356
74394
|
}
|
|
74357
74395
|
};
|
|
74358
74396
|
const openExternal = () => {
|
|
@@ -74452,7 +74490,6 @@ const ModalHandler = ({ onDismiss, bondAddress, bondChain, }) => {
|
|
|
74452
74490
|
const { data: userBonds, refetch } = useUserBonds();
|
|
74453
74491
|
const userBill = userBonds === null || userBonds === void 0 ? void 0 : userBonds.find((bond) => bond.id === billId);
|
|
74454
74492
|
useEffect(() => {
|
|
74455
|
-
console.log(billId);
|
|
74456
74493
|
if (billId) {
|
|
74457
74494
|
console.log('BillId detected, Refetching user bonds');
|
|
74458
74495
|
refetch();
|
|
@@ -74779,7 +74816,7 @@ const BondRowsByChain = ({ bonds, hideTitles }) => {
|
|
|
74779
74816
|
const SDKConfig = useSDKConfig();
|
|
74780
74817
|
const validatedChains = (_a = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.chains) === null || _a === void 0 ? void 0 : _a.filter((chain) => MAINNET_CHAINS.includes(chain));
|
|
74781
74818
|
return (jsx$2(Flex$1, { className: "bondrowsbychain", children: validatedChains === null || validatedChains === void 0 ? void 0 : validatedChains.map((chain) => {
|
|
74782
|
-
return (jsx$2(BondRowsWithTitle, { chain: chain, bonds: bonds, hideTitles: hideTitles, showHotBonds: SDKConfig.useHotBonds ? chain === types.ChainId.BASE || chain === types.ChainId.MAINNET : false }, chain));
|
|
74819
|
+
return (jsx$2(BondRowsWithTitle, { chain: chain, bonds: bonds, hideTitles: hideTitles, showHotBonds: hideTitles ? false : SDKConfig.useHotBonds ? chain === types.ChainId.BASE || chain === types.ChainId.MAINNET : false }, chain));
|
|
74783
74820
|
}) }));
|
|
74784
74821
|
};
|
|
74785
74822
|
|
|
@@ -74953,6 +74990,7 @@ const BondsMenu = ({ searchQuery, setSearchQuery, setChainFilterOption, chainFil
|
|
|
74953
74990
|
const Bonds = () => {
|
|
74954
74991
|
// Fetch data
|
|
74955
74992
|
useHotBonds();
|
|
74993
|
+
useGeoFencing();
|
|
74956
74994
|
const { favTokens } = useFavoriteTokens();
|
|
74957
74995
|
const { data: bondData, refetch: refetchBondsData } = useBondsData();
|
|
74958
74996
|
const { data: allBonds } = useBondsList();
|
|
@@ -90721,6 +90759,7 @@ const SalesTable = ({ allSales }) => {
|
|
|
90721
90759
|
const receivedUsdAmount = ((_a = sale === null || sale === void 0 ? void 0 : sale.payout) !== null && _a !== void 0 ? _a : 0) * (sale === null || sale === void 0 ? void 0 : sale.payoutTokenPrice);
|
|
90722
90760
|
const discount = 100 - (sale.dollarValue * 100) / receivedUsdAmount;
|
|
90723
90761
|
const isUserTheBuyer = (buyer === null || buyer === void 0 ? void 0 : buyer.toLowerCase()) === (account === null || account === void 0 ? void 0 : account.toLowerCase());
|
|
90762
|
+
const payoutToken = sale.payoutToken === 'LL.e' ? 'LL' : sale.payoutToken;
|
|
90724
90763
|
return (jsxs(Flex, { sx: {
|
|
90725
90764
|
width: '100%',
|
|
90726
90765
|
background: 'white3',
|
|
@@ -90731,7 +90770,7 @@ const SalesTable = ({ allSales }) => {
|
|
|
90731
90770
|
alignItems: 'center',
|
|
90732
90771
|
justifyContent: 'space-between',
|
|
90733
90772
|
fontSize: '12px',
|
|
90734
|
-
}, children: [jsxs(Flex, { sx: { width: '170px', alignItems: 'center' }, children: [jsx$2(Flex, { sx: { width: '30px', justifyContent: 'center' }, children: index + 4 }), jsx$2(TokenImage, { symbol:
|
|
90773
|
+
}, children: [jsxs(Flex, { sx: { width: '170px', alignItems: 'center' }, children: [jsx$2(Flex, { sx: { width: '30px', justifyContent: 'center' }, children: index + 4 }), jsx$2(TokenImage, { symbol: payoutToken, chain: sale.chainId, size: 28 }), jsx$2(Flex, { sx: { ml: '10px' }, children: sale.payoutToken })] }), jsx$2(Flex, { sx: { width: '120px', justifyContent: 'center' }, children: formatUTCDate(new Date(sale.createdAt * 1000)) }), jsx$2(Flex, { sx: { width: '160px', justifyContent: 'center', position: 'relative' }, children: jsxs(Flex, { sx: { position: 'relative' }, children: [buyer === null || buyer === void 0 ? void 0 : buyer.slice(0, 4), "...", buyer === null || buyer === void 0 ? void 0 : buyer.slice((buyer === null || buyer === void 0 ? void 0 : buyer.length) - 4, buyer === null || buyer === void 0 ? void 0 : buyer.length), isUserTheBuyer && jsx$2(Flex, { sx: styles$1.youCard, children: "You" })] }) }), jsxs(Flex, { sx: { width: '110px', justifyContent: 'center' }, children: ["$", sale.dollarValue.toFixed(2)] }), jsxs(Flex, { sx: { width: '110px', justifyContent: 'center' }, children: ["$", receivedUsdAmount === null || receivedUsdAmount === void 0 ? void 0 : receivedUsdAmount.toFixed(2)] }), jsxs(Flex, { sx: { width: '85px', justifyContent: 'center', color: discount > 0 ? 'success' : 'error' }, children: [discount.toFixed(2), "%"] })] }, sale.transactionHash));
|
|
90735
90774
|
}) })] }));
|
|
90736
90775
|
};
|
|
90737
90776
|
|