@skip-go/widget 3.14.7 → 3.14.9
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/build/{add-rGvXB0a_.js → add-BUbVowqb.js} +1 -1
- package/build/{all-wallets-CWfjangq.js → all-wallets-CeeujO1Q.js} +1 -1
- package/build/{app-store-BJS96QLx.js → app-store-B7PYbfvl.js} +1 -1
- package/build/{apple-CG7qw4Vt.js → apple-NZFK-h_M.js} +1 -1
- package/build/{arrow-bottom-TkM_KpJ3.js → arrow-bottom-1iNaiuN-.js} +1 -1
- package/build/{arrow-bottom-circle-DhQ2lph6.js → arrow-bottom-circle-C56W6P-B.js} +1 -1
- package/build/{arrow-left-DTU7rdA_.js → arrow-left-DwaIplhZ.js} +1 -1
- package/build/{arrow-right-_LxcbgXW.js → arrow-right-qS2KmunK.js} +1 -1
- package/build/{arrow-top-CewUhs6w.js → arrow-top-BxiQ8Ld9.js} +1 -1
- package/build/{bank-CdFxK5l5.js → bank-VKZ36xGE.js} +1 -1
- package/build/{basic-XLgqbizR.js → basic-NhRzh0v7.js} +2 -2
- package/build/{browser-CkZk2GnR.js → browser-BMche1S9.js} +1 -1
- package/build/{card-pLevsL2G.js → card-BX4P4gXq.js} +1 -1
- package/build/{checkmark-DAtrTc8P.js → checkmark-BgJYCBq1.js} +1 -1
- package/build/{checkmark-bold-Bi3rgU7w.js → checkmark-bold-C6i8l3bY.js} +1 -1
- package/build/{chevron-bottom-BkembWRL.js → chevron-bottom-BHQdObde.js} +1 -1
- package/build/{chevron-left-DRMFhLyd.js → chevron-left-92F-yqQt.js} +1 -1
- package/build/{chevron-right-BtFOTd4y.js → chevron-right-jkBm5YXT.js} +1 -1
- package/build/{chevron-top-DdLbvIvu.js → chevron-top-IszDLmW1.js} +1 -1
- package/build/{chrome-store-C7d9sDLo.js → chrome-store-WM9uyyv5.js} +1 -1
- package/build/{clock-DfB-EQTa.js → clock-DFkEd-25.js} +1 -1
- package/build/{close-DLGkg8mZ.js → close-LSgxJIGw.js} +1 -1
- package/build/{coinPlaceholder-DJFYibZ3.js → coinPlaceholder-dhlzHFyJ.js} +1 -1
- package/build/{compass-D1m9U-wA.js → compass-D1v782Yn.js} +1 -1
- package/build/{copy-RKqS6nJw.js → copy-CG6vyu0-.js} +1 -1
- package/build/{core-BcGQTQjl.js → core-Chsl1Oq3.js} +4 -4
- package/build/{cursor-BPRTqnSk.js → cursor-BEABe8ls.js} +1 -1
- package/build/{cursor-transparent-DZJcnsHR.js → cursor-transparent-CIunEWR9.js} +1 -1
- package/build/{desktop-U_ut_R1_.js → desktop-Dkea83Z9.js} +1 -1
- package/build/{disconnect-BLxJzmPk.js → disconnect-6Er2XR6A.js} +1 -1
- package/build/{discord-BRXQmgsq.js → discord-lNEXOil5.js} +1 -1
- package/build/{etherscan-DF8J6SkW.js → etherscan-aBnYIMu7.js} +1 -1
- package/build/{exclamation-triangle-12HSlabF.js → exclamation-triangle-DqYlpsYb.js} +1 -1
- package/build/{extension-Cnwa6fYX.js → extension-C39a-nGR.js} +1 -1
- package/build/{external-link-B9spbel6.js → external-link-C-TTc5Ei.js} +1 -1
- package/build/{facebook-DjRft_8z.js → facebook-L_4S4VT_.js} +1 -1
- package/build/{farcaster-CkLpx8At.js → farcaster-BL_whYJf.js} +1 -1
- package/build/{filters-DY4QDKHN.js → filters-BEDbCy61.js} +1 -1
- package/build/{github-CZdlC-wN.js → github-CkqcPh6m.js} +1 -1
- package/build/{google-D9Lzj79L.js → google-DFREXdIi.js} +1 -1
- package/build/{help-circle-PO0tFIt1.js → help-circle-fe0dK0aC.js} +1 -1
- package/build/{id-IXFr7XrU.js → id-DwA2H_fN.js} +1 -1
- package/build/{image-DhQTQpsu.js → image-B-xr8ICs.js} +1 -1
- package/build/{index-BHKyIHpf.js → index-D-WY26gk.js} +275 -101
- package/build/{index-CEt55LHy.js → index-DVJMQBeB.js} +78 -78
- package/build/{index.es-BEfNQQ0w.js → index.es-D_5e1T63.js} +2 -2
- package/build/index.js +1 -1
- package/build/{info-circle-x1NpOaXo.js → info-circle-DLFvI3Rc.js} +1 -1
- package/build/{info-haQI3Tm4.js → info-kgRQ1aAD.js} +1 -1
- package/build/{lightbulb-DCcwNe6E.js → lightbulb-CKQ5KLZU.js} +1 -1
- package/build/{mail-CkG38q06.js → mail-0D5_LC-D.js} +1 -1
- package/build/{mobile-C80JT3V4.js → mobile-D7GjoPr1.js} +1 -1
- package/build/{more-scVObeFY.js → more-2PowURJf.js} +1 -1
- package/build/{network-placeholder-svESjcy_.js → network-placeholder-C0Xdbr-t.js} +1 -1
- package/build/{nftPlaceholder-CbQZJobY.js → nftPlaceholder-r4g9tmmE.js} +1 -1
- package/build/{off-PfTUVodh.js → off-DU62Ny_z.js} +1 -1
- package/build/{play-store-DRQmjgiM.js → play-store-C0-NJsT0.js} +1 -1
- package/build/{plus-C1DmTfd3.js → plus-A7s7Ogsb.js} +1 -1
- package/build/{qr-code-B5WGRKQe.js → qr-code-qwbZjqLc.js} +1 -1
- package/build/{recycle-horizontal-BAuZtDWX.js → recycle-horizontal-JpIm8FmG.js} +1 -1
- package/build/{refresh-CanVb6Ad.js → refresh-C9V1u4dD.js} +1 -1
- package/build/{reown-logo-jvSXbGrb.js → reown-logo-CQwaIBAR.js} +1 -1
- package/build/{search-glMpSx1Z.js → search-G6WAxdeT.js} +1 -1
- package/build/{send-CfLvfeV4.js → send-DsW-tnbf.js} +1 -1
- package/build/{swapHorizontal-CRs8lOVr.js → swapHorizontal-UGxz_Oh7.js} +1 -1
- package/build/{swapHorizontalBold-Cfmpnhnx.js → swapHorizontalBold-CuqLSiI6.js} +1 -1
- package/build/{swapHorizontalMedium-D2vaUWbv.js → swapHorizontalMedium-DVTfp4iT.js} +1 -1
- package/build/{swapHorizontalRoundedBold-Bj2j3s1b.js → swapHorizontalRoundedBold-D6JDj1a_.js} +1 -1
- package/build/{swapVertical-CJ5he7_U.js → swapVertical-YliVaE04.js} +1 -1
- package/build/{telegram-BysprQtd.js → telegram-BEc3rrJk.js} +1 -1
- package/build/{three-dots-GO7wLffL.js → three-dots-D9z73G-E.js} +1 -1
- package/build/{twitch-Dwms_wur.js → twitch-BgRbPVvz.js} +1 -1
- package/build/{twitterIcon-DBEF184y.js → twitterIcon-gX50Ixga.js} +1 -1
- package/build/{verify-BL4Vv6LN.js → verify-Bjj78dbV.js} +1 -1
- package/build/{verify-filled-CpLJCzPX.js → verify-filled-DbwEJkiu.js} +1 -1
- package/build/{w3m-modal-BqlnaZWK.js → w3m-modal-CXs7PkXE.js} +2 -2
- package/build/{wallet-B3wK2waU.js → wallet-D3OLzKGL.js} +1 -1
- package/build/{wallet-placeholder-D5Wf3BaU.js → wallet-placeholder-DznVNNHw.js} +1 -1
- package/build/{walletconnect-B-RrGXlD.js → walletconnect-HDgs5HUj.js} +1 -1
- package/build/{warning-circle-DhtIeAMb.js → warning-circle-Bg7YOOWC.js} +1 -1
- package/build/{x-Cs4WOw3P.js → x-C70jPcNJ.js} +1 -1
- package/package.json +2 -2
|
@@ -3,7 +3,7 @@ import o, { useState, useMemo, useEffect, useContext, useDebugValue, createEleme
|
|
|
3
3
|
import { Scope } from "react-shadow-scope";
|
|
4
4
|
import { atom as atom$1, useAtomValue, useAtom, useSetAtom, createStore, Provider } from "jotai";
|
|
5
5
|
import NiceModal, { useModal } from "@ebay/nice-modal-react";
|
|
6
|
-
import { assets,
|
|
6
|
+
import { chains, assets, venues, bridges, ChainType, getSigningStargateClient, route, balances, getRouteWithGasOnReceive, executeMultipleRoutes, executeRoute, BridgeType, FeeType, subscribeToRouteStatus, setClientOptions } from "@skip-go/client";
|
|
7
7
|
import { atomWithQuery, atomWithMutation } from "jotai-tanstack-query";
|
|
8
8
|
import pluralize from "pluralize";
|
|
9
9
|
import { track, init, add, setUserId } from "@amplitude/analytics-browser";
|
|
@@ -2185,7 +2185,7 @@ const textProps = lt`
|
|
|
2185
2185
|
${({ textWrap }) => textWrap && `text-wrap: ${textWrap}`};
|
|
2186
2186
|
${({ monospace: monospace2 }) => monospace2 && "font-family: 'ABCDiatype-mono', monospace; letter-spacing: 0"};
|
|
2187
2187
|
${({ mainButtonColor, theme }) => mainButtonColor && `color: ${theme.brandTextColor}`};
|
|
2188
|
-
${({ capitalize }) =>
|
|
2188
|
+
${({ capitalize: capitalize2 }) => capitalize2 && lt`
|
|
2189
2189
|
&::first-letter {
|
|
2190
2190
|
text-transform: capitalize;
|
|
2191
2191
|
}
|
|
@@ -2540,6 +2540,148 @@ const endpointOptions = {
|
|
|
2540
2540
|
}
|
|
2541
2541
|
};
|
|
2542
2542
|
const prodApiUrl = `${appUrl}/api/skip`;
|
|
2543
|
+
function atomWithStorageNoCrossTabSync(storageKey, initialValue) {
|
|
2544
|
+
const defaultStorage2 = {
|
|
2545
|
+
getItem: (key) => {
|
|
2546
|
+
if (typeof window === "undefined") return;
|
|
2547
|
+
const storedValue = localStorage.getItem(key);
|
|
2548
|
+
if (!storedValue) return initialValue;
|
|
2549
|
+
try {
|
|
2550
|
+
return JSON.parse(storedValue);
|
|
2551
|
+
} catch (_error) {
|
|
2552
|
+
return initialValue;
|
|
2553
|
+
}
|
|
2554
|
+
},
|
|
2555
|
+
setItem: (key, newValue) => {
|
|
2556
|
+
if (typeof window === "undefined") return;
|
|
2557
|
+
localStorage.setItem(key, JSON.stringify(newValue));
|
|
2558
|
+
},
|
|
2559
|
+
removeItem: (key) => {
|
|
2560
|
+
if (typeof window === "undefined") return;
|
|
2561
|
+
localStorage.removeItem(key);
|
|
2562
|
+
}
|
|
2563
|
+
};
|
|
2564
|
+
return atomWithStorage(storageKey, initialValue, defaultStorage2, { getOnInit: true });
|
|
2565
|
+
}
|
|
2566
|
+
async function getIndexedDB(dbName, storeName) {
|
|
2567
|
+
return new Promise((resolve, reject) => {
|
|
2568
|
+
if (typeof window === "undefined") {
|
|
2569
|
+
reject(new Error("IndexedDB not available"));
|
|
2570
|
+
return;
|
|
2571
|
+
}
|
|
2572
|
+
const checkRequest = indexedDB.open(dbName);
|
|
2573
|
+
checkRequest.onerror = () => reject(checkRequest.error);
|
|
2574
|
+
checkRequest.onsuccess = () => {
|
|
2575
|
+
const existingDb = checkRequest.result;
|
|
2576
|
+
const existingStores = Array.from(existingDb.objectStoreNames);
|
|
2577
|
+
if (existingStores.includes(storeName)) {
|
|
2578
|
+
resolve(existingDb);
|
|
2579
|
+
return;
|
|
2580
|
+
}
|
|
2581
|
+
existingDb.close();
|
|
2582
|
+
const currentVersion = existingDb.version;
|
|
2583
|
+
const upgradeRequest = indexedDB.open(dbName, currentVersion + 1);
|
|
2584
|
+
upgradeRequest.onerror = () => reject(upgradeRequest.error);
|
|
2585
|
+
upgradeRequest.onsuccess = () => resolve(upgradeRequest.result);
|
|
2586
|
+
upgradeRequest.onupgradeneeded = (event) => {
|
|
2587
|
+
const db = event.target.result;
|
|
2588
|
+
if (!db.objectStoreNames.contains(storeName)) {
|
|
2589
|
+
db.createObjectStore(storeName, { keyPath: "key" });
|
|
2590
|
+
}
|
|
2591
|
+
};
|
|
2592
|
+
};
|
|
2593
|
+
checkRequest.onupgradeneeded = (event) => {
|
|
2594
|
+
const db = event.target.result;
|
|
2595
|
+
if (!db.objectStoreNames.contains(storeName)) {
|
|
2596
|
+
db.createObjectStore(storeName, { keyPath: "key" });
|
|
2597
|
+
}
|
|
2598
|
+
};
|
|
2599
|
+
});
|
|
2600
|
+
}
|
|
2601
|
+
async function getIndexedDBItem(key, options) {
|
|
2602
|
+
try {
|
|
2603
|
+
const dbName = options.dbName;
|
|
2604
|
+
const storeName = options.storeName;
|
|
2605
|
+
const db = await getIndexedDB(dbName, storeName);
|
|
2606
|
+
return new Promise((resolve, reject) => {
|
|
2607
|
+
const transaction = db.transaction([storeName], "readonly");
|
|
2608
|
+
const store = transaction.objectStore(storeName);
|
|
2609
|
+
const request = store.get(key);
|
|
2610
|
+
request.onerror = () => reject(request.error);
|
|
2611
|
+
request.onsuccess = () => {
|
|
2612
|
+
const result = request.result;
|
|
2613
|
+
if (!result) {
|
|
2614
|
+
resolve(null);
|
|
2615
|
+
return;
|
|
2616
|
+
}
|
|
2617
|
+
resolve(result.data);
|
|
2618
|
+
};
|
|
2619
|
+
});
|
|
2620
|
+
} catch (error) {
|
|
2621
|
+
console.warn("IndexedDB getItem failed:", error);
|
|
2622
|
+
return null;
|
|
2623
|
+
}
|
|
2624
|
+
}
|
|
2625
|
+
async function setIndexedDBItem(key, value, options) {
|
|
2626
|
+
try {
|
|
2627
|
+
const dbName = options.dbName;
|
|
2628
|
+
const storeName = options.storeName;
|
|
2629
|
+
const db = await getIndexedDB(dbName, storeName);
|
|
2630
|
+
return new Promise((resolve, reject) => {
|
|
2631
|
+
const transaction = db.transaction([storeName], "readwrite");
|
|
2632
|
+
const store = transaction.objectStore(storeName);
|
|
2633
|
+
const cachedData = {
|
|
2634
|
+
data: value,
|
|
2635
|
+
timestamp: Date.now()
|
|
2636
|
+
};
|
|
2637
|
+
const request = store.put({ key, ...cachedData });
|
|
2638
|
+
request.onerror = () => reject(request.error);
|
|
2639
|
+
request.onsuccess = () => resolve();
|
|
2640
|
+
});
|
|
2641
|
+
} catch (error) {
|
|
2642
|
+
console.warn("IndexedDB setItem failed:", error);
|
|
2643
|
+
}
|
|
2644
|
+
}
|
|
2645
|
+
async function removeIndexedDBItem(key, options) {
|
|
2646
|
+
try {
|
|
2647
|
+
const dbName = options.dbName;
|
|
2648
|
+
const storeName = options.storeName;
|
|
2649
|
+
const db = await getIndexedDB(dbName, storeName);
|
|
2650
|
+
return new Promise((resolve, reject) => {
|
|
2651
|
+
const transaction = db.transaction([storeName], "readwrite");
|
|
2652
|
+
const store = transaction.objectStore(storeName);
|
|
2653
|
+
const request = store.delete(key);
|
|
2654
|
+
request.onerror = () => reject(request.error);
|
|
2655
|
+
request.onsuccess = () => resolve();
|
|
2656
|
+
});
|
|
2657
|
+
} catch (error) {
|
|
2658
|
+
console.warn("IndexedDB removeItem failed:", error);
|
|
2659
|
+
}
|
|
2660
|
+
}
|
|
2661
|
+
async function clearIndexedDB(options) {
|
|
2662
|
+
try {
|
|
2663
|
+
const dbName = options.dbName;
|
|
2664
|
+
const storeName = options.storeName;
|
|
2665
|
+
const db = await getIndexedDB(dbName, storeName);
|
|
2666
|
+
return new Promise((resolve, reject) => {
|
|
2667
|
+
const transaction = db.transaction([storeName], "readwrite");
|
|
2668
|
+
const store = transaction.objectStore(storeName);
|
|
2669
|
+
const request = store.clear();
|
|
2670
|
+
request.onerror = () => reject(request.error);
|
|
2671
|
+
request.onsuccess = () => resolve();
|
|
2672
|
+
});
|
|
2673
|
+
} catch (error) {
|
|
2674
|
+
console.warn("IndexedDB clear failed:", error);
|
|
2675
|
+
}
|
|
2676
|
+
}
|
|
2677
|
+
function createIndexedDBStorage(options) {
|
|
2678
|
+
return {
|
|
2679
|
+
getItem: (key) => getIndexedDBItem(key, options),
|
|
2680
|
+
setItem: (key, value) => setIndexedDBItem(key, value, options),
|
|
2681
|
+
removeItem: (key) => removeIndexedDBItem(key, options),
|
|
2682
|
+
clear: () => clearIndexedDB(options)
|
|
2683
|
+
};
|
|
2684
|
+
}
|
|
2543
2685
|
const defaultSkipClientConfig = {
|
|
2544
2686
|
apiUrl: prodApiUrl,
|
|
2545
2687
|
endpointOptions
|
|
@@ -2565,30 +2707,39 @@ const flattenData = (data, chains2) => {
|
|
|
2565
2707
|
return flattenedData;
|
|
2566
2708
|
};
|
|
2567
2709
|
const onlyTestnetsAtom = atom$1(void 0);
|
|
2568
|
-
const
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2710
|
+
const { getItem, setItem } = createIndexedDBStorage({
|
|
2711
|
+
dbName: "skip-go-widget",
|
|
2712
|
+
storeName: "data-cache"
|
|
2713
|
+
});
|
|
2714
|
+
const getCachedDataWhileQuerying = ({
|
|
2715
|
+
queryKey,
|
|
2716
|
+
cacheKey,
|
|
2717
|
+
queryFn,
|
|
2718
|
+
options = {}
|
|
2719
|
+
}) => {
|
|
2572
2720
|
return {
|
|
2573
|
-
queryKey
|
|
2721
|
+
queryKey,
|
|
2574
2722
|
queryFn: async () => {
|
|
2575
|
-
const
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
}
|
|
2582
|
-
|
|
2723
|
+
const cachedData = await getItem(cacheKey);
|
|
2724
|
+
if (cachedData !== null) {
|
|
2725
|
+
queryFn().then(async (newData2) => {
|
|
2726
|
+
await setItem(cacheKey, newData2);
|
|
2727
|
+
});
|
|
2728
|
+
return cachedData;
|
|
2729
|
+
}
|
|
2730
|
+
const newData = await queryFn();
|
|
2731
|
+
await setItem(cacheKey, newData);
|
|
2732
|
+
return newData;
|
|
2583
2733
|
},
|
|
2584
|
-
enabled:
|
|
2734
|
+
enabled: (options == null ? void 0 : options.enabled) ?? true
|
|
2585
2735
|
};
|
|
2586
|
-
}
|
|
2736
|
+
};
|
|
2587
2737
|
const skipChainsAtom = atomWithQuery((get) => {
|
|
2588
2738
|
const { apiUrl, apiKey, cacheDurationMs } = get(skipClientConfigAtom);
|
|
2589
2739
|
const onlyTestnets = get(onlyTestnetsAtom);
|
|
2590
|
-
return {
|
|
2740
|
+
return getCachedDataWhileQuerying({
|
|
2591
2741
|
queryKey: ["skipChains", { onlyTestnets, apiUrl, apiKey, cacheDurationMs }],
|
|
2742
|
+
cacheKey: `skip-chains-${onlyTestnets ? "testnet" : "mainnet"}`,
|
|
2592
2743
|
queryFn: async () => {
|
|
2593
2744
|
const response = await chains({
|
|
2594
2745
|
includeEvm: true,
|
|
@@ -2598,24 +2749,52 @@ const skipChainsAtom = atomWithQuery((get) => {
|
|
|
2598
2749
|
});
|
|
2599
2750
|
return response;
|
|
2600
2751
|
},
|
|
2601
|
-
enabled: onlyTestnets !== void 0 && apiUrl !== void 0
|
|
2602
|
-
};
|
|
2752
|
+
options: { enabled: onlyTestnets !== void 0 && apiUrl !== void 0 }
|
|
2753
|
+
});
|
|
2754
|
+
});
|
|
2755
|
+
const skipAssetsAtom = atomWithQuery((get) => {
|
|
2756
|
+
const { apiUrl, apiKey, cacheDurationMs } = get(skipClientConfigAtom);
|
|
2757
|
+
const chains2 = get(skipChainsAtom);
|
|
2758
|
+
const onlyTestnets = get(onlyTestnetsAtom);
|
|
2759
|
+
return getCachedDataWhileQuerying({
|
|
2760
|
+
queryKey: ["skipAssets", onlyTestnets, { onlyTestnets, apiUrl, apiKey, cacheDurationMs }],
|
|
2761
|
+
cacheKey: `skip-assets-${onlyTestnets ? "testnet" : "mainnet"}`,
|
|
2762
|
+
queryFn: async () => {
|
|
2763
|
+
const response = await assets({
|
|
2764
|
+
includeEvmAssets: true,
|
|
2765
|
+
includeCw20Assets: true,
|
|
2766
|
+
includeSvmAssets: true,
|
|
2767
|
+
onlyTestnets,
|
|
2768
|
+
abortDuplicateRequests: true
|
|
2769
|
+
});
|
|
2770
|
+
return flattenData(response, chains2.data);
|
|
2771
|
+
},
|
|
2772
|
+
options: { enabled: onlyTestnets !== void 0 && apiUrl !== void 0 }
|
|
2773
|
+
});
|
|
2603
2774
|
});
|
|
2604
2775
|
const skipBridgesAtom = atomWithQuery((get) => {
|
|
2605
2776
|
const { apiUrl, apiKey, cacheDurationMs } = get(skipClientConfigAtom);
|
|
2606
|
-
return {
|
|
2777
|
+
return getCachedDataWhileQuerying({
|
|
2607
2778
|
queryKey: ["skipBridges", { apiUrl, apiKey, cacheDurationMs }],
|
|
2608
|
-
|
|
2609
|
-
|
|
2779
|
+
cacheKey: "skip-bridges",
|
|
2780
|
+
queryFn: async () => {
|
|
2781
|
+
return await bridges();
|
|
2782
|
+
}
|
|
2783
|
+
});
|
|
2610
2784
|
});
|
|
2611
2785
|
const skipSwapVenuesAtom = atomWithQuery((get) => {
|
|
2612
2786
|
const { apiUrl, apiKey, cacheDurationMs } = get(skipClientConfigAtom);
|
|
2613
2787
|
const onlyTestnets = get(onlyTestnetsAtom);
|
|
2614
|
-
return {
|
|
2615
|
-
queryKey: ["
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2788
|
+
return getCachedDataWhileQuerying({
|
|
2789
|
+
queryKey: ["skipSwapVenues", onlyTestnets, { onlyTestnets, apiUrl, apiKey, cacheDurationMs }],
|
|
2790
|
+
cacheKey: `skip-swap-venues-${onlyTestnets ? "testnet" : "mainnet"}`,
|
|
2791
|
+
queryFn: async () => {
|
|
2792
|
+
return await venues({
|
|
2793
|
+
onlyTestnets
|
|
2794
|
+
});
|
|
2795
|
+
},
|
|
2796
|
+
options: { enabled: onlyTestnets !== void 0 && apiUrl !== void 0 }
|
|
2797
|
+
});
|
|
2619
2798
|
});
|
|
2620
2799
|
var RoutePreference = /* @__PURE__ */ ((RoutePreference2) => {
|
|
2621
2800
|
RoutePreference2["FASTEST"] = "Fastest";
|
|
@@ -4186,6 +4365,7 @@ const formatDisplayAmount = (input, options = {}) => {
|
|
|
4186
4365
|
num = input;
|
|
4187
4366
|
}
|
|
4188
4367
|
const abs2 = Math.abs(num);
|
|
4368
|
+
const absRounded = Math.abs(Number(num.toFixed(decimals)));
|
|
4189
4369
|
const THRESHOLD = 10 ** -decimals;
|
|
4190
4370
|
if (abs2 > 0 && abs2 < THRESHOLD) {
|
|
4191
4371
|
const thresholdStr = THRESHOLD.toFixed(decimals);
|
|
@@ -4196,10 +4376,17 @@ const formatDisplayAmount = (input, options = {}) => {
|
|
|
4196
4376
|
{ value: 1e6, symbol: "M" },
|
|
4197
4377
|
{ value: 1e3, symbol: "K" }
|
|
4198
4378
|
];
|
|
4199
|
-
for (
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4379
|
+
for (let i = 0; i < scales.length; i++) {
|
|
4380
|
+
const { value, symbol } = scales[i];
|
|
4381
|
+
if (absRounded >= value) {
|
|
4382
|
+
const scaled = num / value;
|
|
4383
|
+
let formattedNumber = Number(scaled.toFixed(2));
|
|
4384
|
+
if (formattedNumber >= 1e3) {
|
|
4385
|
+
const next2 = scales[i - 1];
|
|
4386
|
+
formattedNumber = Number((num / next2.value).toFixed(2));
|
|
4387
|
+
return `${formattedNumber.toString().replace(/\.?0+$/, "")}${next2.symbol}`;
|
|
4388
|
+
}
|
|
4389
|
+
return `${formattedNumber.toString().replace(/\.?0+$/, "")}${symbol}`;
|
|
4203
4390
|
}
|
|
4204
4391
|
}
|
|
4205
4392
|
}
|
|
@@ -4740,29 +4927,6 @@ function atomWithDebounce(delayMilliseconds = 250) {
|
|
|
4740
4927
|
};
|
|
4741
4928
|
}
|
|
4742
4929
|
const callbacksAtom = atom$1();
|
|
4743
|
-
function atomWithStorageNoCrossTabSync(storageKey, initialValue) {
|
|
4744
|
-
const defaultStorage2 = {
|
|
4745
|
-
getItem: (key) => {
|
|
4746
|
-
if (typeof window === "undefined") return;
|
|
4747
|
-
const storedValue = localStorage.getItem(key);
|
|
4748
|
-
if (!storedValue) return initialValue;
|
|
4749
|
-
try {
|
|
4750
|
-
return JSON.parse(storedValue);
|
|
4751
|
-
} catch (_error) {
|
|
4752
|
-
return initialValue;
|
|
4753
|
-
}
|
|
4754
|
-
},
|
|
4755
|
-
setItem: (key, newValue) => {
|
|
4756
|
-
if (typeof window === "undefined") return;
|
|
4757
|
-
localStorage.setItem(key, JSON.stringify(newValue));
|
|
4758
|
-
},
|
|
4759
|
-
removeItem: (key) => {
|
|
4760
|
-
if (typeof window === "undefined") return;
|
|
4761
|
-
localStorage.removeItem(key);
|
|
4762
|
-
}
|
|
4763
|
-
};
|
|
4764
|
-
return atomWithStorage(storageKey, initialValue, defaultStorage2, { getOnInit: true });
|
|
4765
|
-
}
|
|
4766
4930
|
const walletConnectAtom = atom$1({
|
|
4767
4931
|
options: {
|
|
4768
4932
|
projectId: "ff1b9e9bd6329cfb07642bd7f4d11a8c",
|
|
@@ -47763,7 +47927,7 @@ function walletConnect(parameters) {
|
|
|
47763
47927
|
const optionalChains = config2.chains.map((x2) => x2.id);
|
|
47764
47928
|
if (!optionalChains.length)
|
|
47765
47929
|
return;
|
|
47766
|
-
const { EthereumProvider } = await import("./index.es-
|
|
47930
|
+
const { EthereumProvider } = await import("./index.es-D_5e1T63.js").then((n) => n.i);
|
|
47767
47931
|
return await EthereumProvider.init({
|
|
47768
47932
|
...parameters,
|
|
47769
47933
|
disableProviderPing: true,
|
|
@@ -49071,6 +49235,9 @@ const Modal = ({
|
|
|
49071
49235
|
const [wasVisible, setWasVisible] = useState();
|
|
49072
49236
|
const disableShadowDom = useAtomValue(disableShadowDomAtom);
|
|
49073
49237
|
const rootId = useAtomValue(rootIdAtom);
|
|
49238
|
+
const handleModalWheel = (event) => {
|
|
49239
|
+
event.stopPropagation();
|
|
49240
|
+
};
|
|
49074
49241
|
useEffect(() => {
|
|
49075
49242
|
if (wasVisible && !modal.visible) {
|
|
49076
49243
|
onOpenChange == null ? void 0 : onOpenChange(false);
|
|
@@ -49117,6 +49284,7 @@ const Modal = ({
|
|
|
49117
49284
|
open: modal.visible,
|
|
49118
49285
|
"data-root-id": rootId,
|
|
49119
49286
|
blurBackground,
|
|
49287
|
+
onWheel: handleModalWheel,
|
|
49120
49288
|
onAnimationEnd: () => {
|
|
49121
49289
|
if (!modal.visible) {
|
|
49122
49290
|
if (modalRef.current) {
|
|
@@ -52406,16 +52574,30 @@ const AssetAndChainSelectorModal = createModal(
|
|
|
52406
52574
|
selectedAsset,
|
|
52407
52575
|
selectChain,
|
|
52408
52576
|
context,
|
|
52409
|
-
|
|
52577
|
+
onlySelectChain
|
|
52410
52578
|
} = modalProps;
|
|
52411
|
-
const {
|
|
52579
|
+
const {
|
|
52580
|
+
data: assets2,
|
|
52581
|
+
isFetching: isFetchingAssets,
|
|
52582
|
+
isPending: isPendingAssets
|
|
52583
|
+
} = useAtomValue(skipAssetsAtom);
|
|
52412
52584
|
const ibcEurekaHighlightedAssets = useAtomValue(ibcEurekaHighlightedAssetsAtom);
|
|
52413
|
-
const {
|
|
52414
|
-
const isLoading =
|
|
52585
|
+
const { isFetching: isFetchingChains, isPending: isPendingChains } = useAtomValue(skipChainsAtom);
|
|
52586
|
+
const isLoading = isFetchingAssets && isPendingAssets || isFetchingChains && isPendingChains;
|
|
52415
52587
|
const [showSkeleton, setShowSkeleton] = useState(true);
|
|
52416
52588
|
const [searchQuery, setSearchQuery] = useState("");
|
|
52417
52589
|
const [groupedAssetSelected, setGroupedAssetSelected] = useState(null);
|
|
52418
52590
|
const listHeight = useListHeight(ITEM_HEIGHT);
|
|
52591
|
+
const uniqueAssetsBySymbol = useMemo(() => {
|
|
52592
|
+
const seen = /* @__PURE__ */ new Map();
|
|
52593
|
+
assets2 == null ? void 0 : assets2.forEach((asset) => {
|
|
52594
|
+
const chainId = asset.chainId;
|
|
52595
|
+
if (chainId && !seen.has(chainId)) {
|
|
52596
|
+
seen.set(chainId, asset);
|
|
52597
|
+
}
|
|
52598
|
+
});
|
|
52599
|
+
return Array.from(seen.values());
|
|
52600
|
+
}, [assets2]);
|
|
52419
52601
|
const resetInput = () => {
|
|
52420
52602
|
setSearchQuery("");
|
|
52421
52603
|
};
|
|
@@ -52438,14 +52620,18 @@ const AssetAndChainSelectorModal = createModal(
|
|
|
52438
52620
|
);
|
|
52439
52621
|
const groupedAssetsByRecommendedSymbol = useGroupedAssetByRecommendedSymbol({ context });
|
|
52440
52622
|
const selectedGroup = useMemo(() => {
|
|
52441
|
-
if (
|
|
52623
|
+
if (onlySelectChain)
|
|
52624
|
+
return {
|
|
52625
|
+
assets: uniqueAssetsBySymbol
|
|
52626
|
+
};
|
|
52442
52627
|
const asset = (groupedAssetSelected == null ? void 0 : groupedAssetSelected.assets[0]) || selectedAsset;
|
|
52443
52628
|
if (!asset) return;
|
|
52444
52629
|
return groupedAssetsByRecommendedSymbol == null ? void 0 : groupedAssetsByRecommendedSymbol.find(
|
|
52445
52630
|
(group) => group.id === asset.recommendedSymbol
|
|
52446
52631
|
);
|
|
52447
52632
|
}, [
|
|
52448
|
-
|
|
52633
|
+
onlySelectChain,
|
|
52634
|
+
uniqueAssetsBySymbol,
|
|
52449
52635
|
groupedAssetSelected == null ? void 0 : groupedAssetSelected.assets,
|
|
52450
52636
|
selectedAsset,
|
|
52451
52637
|
groupedAssetsByRecommendedSymbol
|
|
@@ -52457,14 +52643,14 @@ const AssetAndChainSelectorModal = createModal(
|
|
|
52457
52643
|
context
|
|
52458
52644
|
});
|
|
52459
52645
|
useEffect(() => {
|
|
52460
|
-
if (!isLoading
|
|
52646
|
+
if (!isLoading) {
|
|
52461
52647
|
setShowSkeleton(false);
|
|
52462
52648
|
}
|
|
52463
52649
|
}, [isLoading, assets2]);
|
|
52464
52650
|
useEffect(() => {
|
|
52465
52651
|
setSearchQuery("");
|
|
52466
52652
|
}, [modal.visible]);
|
|
52467
|
-
const componentName = `${context} ${selectChain ? "chain" : "asset"} modal`;
|
|
52653
|
+
const componentName = `${context} ${selectChain || onlySelectChain ? "chain" : "asset"} modal`;
|
|
52468
52654
|
const handleSearch = (term) => {
|
|
52469
52655
|
track(`${componentName}: search input - changed`, { term });
|
|
52470
52656
|
setSearchQuery(term);
|
|
@@ -52530,7 +52716,7 @@ const AssetAndChainSelectorModal = createModal(
|
|
|
52530
52716
|
searchTerm: searchQuery,
|
|
52531
52717
|
setSearchTerm: setSearchQuery,
|
|
52532
52718
|
onKeyDown,
|
|
52533
|
-
overrideSelectedGroup:
|
|
52719
|
+
overrideSelectedGroup: onlySelectChain
|
|
52534
52720
|
}
|
|
52535
52721
|
),
|
|
52536
52722
|
showSkeleton || !filteredAssets && !filteredChains ? /* @__PURE__ */ jsx(StyledColumn, { height: listHeight, children: Array.from({ length: 8 }, (_2, index) => /* @__PURE__ */ jsx(Skeleton, {}, index)) }) : /* @__PURE__ */ jsx(
|
|
@@ -53622,18 +53808,8 @@ const SwapExecutionSwapIcon = ({
|
|
|
53622
53808
|
)
|
|
53623
53809
|
}
|
|
53624
53810
|
);
|
|
53625
|
-
const
|
|
53626
|
-
|
|
53627
|
-
const { data: chains2 } = useAtomValue(skipChainsAtom);
|
|
53628
|
-
const isGasStationTx = useMemo(() => {
|
|
53629
|
-
if (!chains2 || !route2) return false;
|
|
53630
|
-
const sourceChain = chains2.find((chain) => chain.chainId === route2.sourceAssetChainId);
|
|
53631
|
-
const destChain = chains2.find((chain) => chain.chainId === route2.destAssetChainId);
|
|
53632
|
-
if (!sourceChain || !destChain) return false;
|
|
53633
|
-
const isAxelarTransfer = route2.operations.some((op) => OperationType.axelarTransfer in op);
|
|
53634
|
-
return (sourceChain == null ? void 0 : sourceChain.chainType) === ChainType.Evm && !isAxelarTransfer && GAS_STATION_CHAIN_IDS.includes(destChain == null ? void 0 : destChain.chainId);
|
|
53635
|
-
}, [chains2, route2]);
|
|
53636
|
-
return isGasStationTx;
|
|
53811
|
+
const capitalize = (s) => {
|
|
53812
|
+
return s.charAt(0).toUpperCase() + s.slice(1);
|
|
53637
53813
|
};
|
|
53638
53814
|
const operationTypeToIcon = {
|
|
53639
53815
|
// swap icon
|
|
@@ -53679,7 +53855,6 @@ const SwapExecutionPageRouteDetailed = ({
|
|
|
53679
53855
|
const { data: swapVenues } = useAtomValue(skipSwapVenuesAtom);
|
|
53680
53856
|
const { data: bridges2 } = useAtomValue(skipBridgesAtom);
|
|
53681
53857
|
const { originalRoute } = useAtomValue(swapExecutionStateAtom);
|
|
53682
|
-
const isGasStationTx = useIsGasStationTx();
|
|
53683
53858
|
const status = statusData == null ? void 0 : statusData.transferEvents;
|
|
53684
53859
|
const getBridgeSwapVenue = useCallback(
|
|
53685
53860
|
(operation) => {
|
|
@@ -53690,8 +53865,9 @@ const SwapExecutionPageRouteDetailed = ({
|
|
|
53690
53865
|
const swapVenue = swapVenues == null ? void 0 : swapVenues.find((swapVenue2) => swapVenue2.chainId === swapVenueId);
|
|
53691
53866
|
const imageUrl = (bridge == null ? void 0 : bridge.logoUri) ?? (swapVenue == null ? void 0 : swapVenue.logoUri);
|
|
53692
53867
|
const isSvg = imageUrl == null ? void 0 : imageUrl.endsWith(".svg");
|
|
53868
|
+
const fallbackName = (operation == null ? void 0 : operation.type) ? capitalize(operation.type) : "";
|
|
53693
53869
|
const bridgeOrSwapVenue = {
|
|
53694
|
-
name: (bridge == null ? void 0 : bridge.name) ?? (swapVenue == null ? void 0 : swapVenue.name),
|
|
53870
|
+
name: (bridge == null ? void 0 : bridge.name) ?? (swapVenue == null ? void 0 : swapVenue.name) ?? fallbackName,
|
|
53695
53871
|
image: imageUrl,
|
|
53696
53872
|
isSvg
|
|
53697
53873
|
};
|
|
@@ -53721,14 +53897,13 @@ const SwapExecutionPageRouteDetailed = ({
|
|
|
53721
53897
|
(operation) => {
|
|
53722
53898
|
const simpleOperationType = operationTypeToSimpleOperationType[operation.type];
|
|
53723
53899
|
const bridgeOrSwapVenue = getBridgeSwapVenue(operation);
|
|
53724
|
-
const
|
|
53725
|
-
const tooltipText = isBankSend ? `${simpleOperationType} with BankSend` : `${simpleOperationType} with ${bridgeOrSwapVenue.name}`;
|
|
53900
|
+
const tooltipText = `${simpleOperationType} with ${bridgeOrSwapVenue.name}`;
|
|
53726
53901
|
return /* @__PURE__ */ jsx(StyledOperationTypeAndTooltipContainer, { align: "center", children: /* @__PURE__ */ jsx(
|
|
53727
53902
|
Tooltip,
|
|
53728
53903
|
{
|
|
53729
53904
|
content: /* @__PURE__ */ jsxs(SmallText, { normalTextColor: true, textWrap: "nowrap", children: [
|
|
53730
53905
|
tooltipText,
|
|
53731
|
-
|
|
53906
|
+
bridgeOrSwapVenue.isSvg ? /* @__PURE__ */ jsx(StyledSwapVenueOrBridgeSvg, { svg: bridgeOrSwapVenue.image }) : bridgeOrSwapVenue.image ? /* @__PURE__ */ jsx(
|
|
53732
53907
|
StyledSwapVenueOrBridgeImage,
|
|
53733
53908
|
{
|
|
53734
53909
|
width: "10",
|
|
@@ -53799,8 +53974,7 @@ const SwapExecutionPageRouteDetailed = ({
|
|
|
53799
53974
|
index: 0
|
|
53800
53975
|
}
|
|
53801
53976
|
),
|
|
53802
|
-
renderOperations
|
|
53803
|
-
isGasStationTx && /* @__PURE__ */ jsx(StyledGasStationTxText, { children: "Transactions from EVM to Babylon have gas provided automatically if no gas tokens are found." })
|
|
53977
|
+
renderOperations
|
|
53804
53978
|
] }),
|
|
53805
53979
|
bottomContent
|
|
53806
53980
|
] });
|
|
@@ -53837,13 +54011,6 @@ const StyledOperationTypeAndTooltipContainer = dt(Row)`
|
|
|
53837
54011
|
position: relative;
|
|
53838
54012
|
height: 25px;
|
|
53839
54013
|
`;
|
|
53840
|
-
const StyledGasStationTxText = dt(SmallText)`
|
|
53841
|
-
margin-top: 10px;
|
|
53842
|
-
color: ${({ theme }) => theme.success.text};
|
|
53843
|
-
background: ${({ theme }) => theme.secondary.background.transparent};
|
|
53844
|
-
padding: 12px;
|
|
53845
|
-
border-radius: 6px;
|
|
53846
|
-
`;
|
|
53847
54014
|
const SwapExecutionPageRouteContainer = ({
|
|
53848
54015
|
showDetailed,
|
|
53849
54016
|
...routeProps
|
|
@@ -55346,8 +55513,9 @@ const getEvmGasPriceEstimate = async (chainId) => {
|
|
|
55346
55513
|
return fees2.maxFeePerGas.toString();
|
|
55347
55514
|
};
|
|
55348
55515
|
const useGasFeeTokenAmount = () => {
|
|
55349
|
-
var _a
|
|
55516
|
+
var _a;
|
|
55350
55517
|
const [sourceAsset] = useAtom(sourceAssetAtom);
|
|
55518
|
+
const { data: skipAssets } = useAtomValue(skipAssetsAtom);
|
|
55351
55519
|
const sourceDetails = useGetAssetDetails({
|
|
55352
55520
|
assetDenom: sourceAsset == null ? void 0 : sourceAsset.denom,
|
|
55353
55521
|
amount: sourceAsset == null ? void 0 : sourceAsset.amount,
|
|
@@ -55357,16 +55525,22 @@ const useGasFeeTokenAmount = () => {
|
|
|
55357
55525
|
const cosmosFeeUsed = cosmosFees == null ? void 0 : cosmosFees.find((fee) => fee == null ? void 0 : fee.isSufficient);
|
|
55358
55526
|
const chainType = (_a = sourceDetails == null ? void 0 : sourceDetails.chain) == null ? void 0 : _a.chainType;
|
|
55359
55527
|
const getGasFeeTokenAmount = useCallback(async () => {
|
|
55360
|
-
var _a2,
|
|
55528
|
+
var _a2, _b;
|
|
55361
55529
|
switch (chainType) {
|
|
55362
55530
|
case ChainType.Evm: {
|
|
55363
|
-
const isFeeAsset = ((_a2 = sourceAsset == null ? void 0 : sourceAsset.denom) == null ? void 0 : _a2.includes("-native")) && (sourceAsset == null ? void 0 : sourceAsset.originChainId) === (sourceAsset == null ? void 0 : sourceAsset.chainId);
|
|
55531
|
+
const isFeeAsset = (((_a2 = sourceAsset == null ? void 0 : sourceAsset.denom) == null ? void 0 : _a2.includes("-native")) || ((_b = sourceAsset == null ? void 0 : sourceAsset.denom) == null ? void 0 : _b.includes("0x0000000000000000000000000000000000000000"))) && (sourceAsset == null ? void 0 : sourceAsset.originChainId) === (sourceAsset == null ? void 0 : sourceAsset.chainId);
|
|
55364
55532
|
if (isFeeAsset) {
|
|
55365
|
-
const
|
|
55366
|
-
|
|
55367
|
-
|
|
55533
|
+
const nativeAsset = skipAssets == null ? void 0 : skipAssets.find(
|
|
55534
|
+
(asset) => {
|
|
55535
|
+
var _a3;
|
|
55536
|
+
return (sourceAsset == null ? void 0 : sourceAsset.originChainId) === (sourceAsset == null ? void 0 : sourceAsset.chainId) && ((_a3 = asset.denom) == null ? void 0 : _a3.includes("-native"));
|
|
55537
|
+
}
|
|
55538
|
+
);
|
|
55539
|
+
const gasPriceEstimate = await getEvmGasPriceEstimate((sourceAsset == null ? void 0 : sourceAsset.chainId) ?? "");
|
|
55540
|
+
if (!gasPriceEstimate) {
|
|
55541
|
+
return convertHumanReadableAmountToCryptoAmount(8e-4, nativeAsset == null ? void 0 : nativeAsset.decimals);
|
|
55368
55542
|
}
|
|
55369
|
-
return BigNumber(EVM_GAS_AMOUNT).multipliedBy(
|
|
55543
|
+
return BigNumber(EVM_GAS_AMOUNT).multipliedBy(gasPriceEstimate).toString();
|
|
55370
55544
|
}
|
|
55371
55545
|
return 0;
|
|
55372
55546
|
}
|
|
@@ -55380,10 +55554,10 @@ const useGasFeeTokenAmount = () => {
|
|
|
55380
55554
|
}, [
|
|
55381
55555
|
chainType,
|
|
55382
55556
|
cosmosFeeUsed,
|
|
55557
|
+
skipAssets,
|
|
55383
55558
|
sourceAsset == null ? void 0 : sourceAsset.chainId,
|
|
55384
55559
|
sourceAsset == null ? void 0 : sourceAsset.denom,
|
|
55385
|
-
sourceAsset == null ? void 0 : sourceAsset.originChainId
|
|
55386
|
-
(_b = sourceDetails == null ? void 0 : sourceDetails.asset) == null ? void 0 : _b.decimals
|
|
55560
|
+
sourceAsset == null ? void 0 : sourceAsset.originChainId
|
|
55387
55561
|
]);
|
|
55388
55562
|
const { data: gasFeeTokenAmount } = useQuery({
|
|
55389
55563
|
queryKey: [
|
|
@@ -55783,7 +55957,7 @@ const useConnectToMissingCosmosChain = () => {
|
|
|
55783
55957
|
}, [sourceAsset, wallets, extraChainIdsToConnect, addExtraChainIdsToConnectForWalletType]);
|
|
55784
55958
|
return { isAskingToApproveConnection };
|
|
55785
55959
|
};
|
|
55786
|
-
const version = "3.14.
|
|
55960
|
+
const version = "3.14.9";
|
|
55787
55961
|
const packageJson = {
|
|
55788
55962
|
version
|
|
55789
55963
|
};
|