@skip-go/widget 3.9.7 → 3.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -3,7 +3,7 @@ import o, { useState, useMemo, useEffect, useContext, useRef, useDebugValue, cre
|
|
|
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, chains, bridges, venues, transactionStatus, ChainType, getSigningStargateClient, route, executeRoute,
|
|
6
|
+
import { assets, chains, bridges, venues, transactionStatus, ChainType, getSigningStargateClient, route, executeRoute, balances, FeeType, GAS_STATION_CHAIN_IDS, setClientOptions } from "@skip-go/client";
|
|
7
7
|
import { atomWithQuery, atomWithMutation } from "jotai-tanstack-query";
|
|
8
8
|
import pluralize from "pluralize";
|
|
9
9
|
import { track, setUserId, add, init as init$1 } from "@amplitude/analytics-browser";
|
|
@@ -43189,7 +43189,7 @@ function walletConnect(parameters) {
|
|
|
43189
43189
|
const optionalChains = config2.chains.map((x2) => x2.id);
|
|
43190
43190
|
if (!optionalChains.length)
|
|
43191
43191
|
return;
|
|
43192
|
-
const { EthereumProvider } = await import("./index.es-
|
|
43192
|
+
const { EthereumProvider } = await import("./index.es-DI-xtNqN.js");
|
|
43193
43193
|
return await EthereumProvider.init({
|
|
43194
43194
|
...parameters,
|
|
43195
43195
|
disableProviderPing: true,
|
|
@@ -44625,6 +44625,189 @@ const useCopyAddress = () => {
|
|
|
44625
44625
|
isShowingCopyAddressFeedback
|
|
44626
44626
|
};
|
|
44627
44627
|
};
|
|
44628
|
+
const skipAllBalancesRequestAtom = atom$1(void 0);
|
|
44629
|
+
const skipAllBalancesAtom = atomWithQuery((get) => {
|
|
44630
|
+
const params = get(skipAllBalancesRequestAtom);
|
|
44631
|
+
const isInvertingSwap = get(isInvertingSwapAtom);
|
|
44632
|
+
const enabled = params && !isInvertingSwap;
|
|
44633
|
+
return {
|
|
44634
|
+
queryKey: ["skipBalances", params],
|
|
44635
|
+
queryFn: async () => {
|
|
44636
|
+
if (!params) {
|
|
44637
|
+
return { chains: {} };
|
|
44638
|
+
}
|
|
44639
|
+
if (Object.keys((params == null ? void 0 : params.chains) ?? {}).length === 0) {
|
|
44640
|
+
return { chains: {} };
|
|
44641
|
+
}
|
|
44642
|
+
return balances({ ...params, abortDuplicateRequests: true });
|
|
44643
|
+
},
|
|
44644
|
+
enabled,
|
|
44645
|
+
refetchInterval: 1e3 * 60,
|
|
44646
|
+
retry: 1,
|
|
44647
|
+
gcTime: 0,
|
|
44648
|
+
placeholderData: (prevData) => prevData
|
|
44649
|
+
};
|
|
44650
|
+
});
|
|
44651
|
+
const useGetBalance = () => {
|
|
44652
|
+
const { data: skipBalances } = useAtomValue(skipAllBalancesAtom);
|
|
44653
|
+
const getBalance = useCallback(
|
|
44654
|
+
(chainId, denom) => {
|
|
44655
|
+
var _a, _b, _c;
|
|
44656
|
+
if (!chainId || !denom) return;
|
|
44657
|
+
return (_c = (_b = (_a = skipBalances == null ? void 0 : skipBalances.chains) == null ? void 0 : _a[chainId]) == null ? void 0 : _b.denoms) == null ? void 0 : _c[denom];
|
|
44658
|
+
},
|
|
44659
|
+
[skipBalances]
|
|
44660
|
+
);
|
|
44661
|
+
return getBalance;
|
|
44662
|
+
};
|
|
44663
|
+
const filterAtom = atom$1();
|
|
44664
|
+
const filterOutAtom = atom$1();
|
|
44665
|
+
const filterOutUnlessUserHasBalanceAtom = atom$1();
|
|
44666
|
+
const useGroupedAssetByRecommendedSymbol = ({
|
|
44667
|
+
context
|
|
44668
|
+
}) => {
|
|
44669
|
+
const { data: _assets } = useAtomValue(skipAssetsAtom);
|
|
44670
|
+
const getBalance = useGetBalance();
|
|
44671
|
+
const filter2 = useAtomValue(filterAtom);
|
|
44672
|
+
const filterOut = useAtomValue(filterOutAtom);
|
|
44673
|
+
const filterOutUnlessUserHasBalance = useAtomValue(filterOutUnlessUserHasBalanceAtom);
|
|
44674
|
+
const assets2 = useMemo(() => {
|
|
44675
|
+
const allowed = context && (filter2 == null ? void 0 : filter2[context]);
|
|
44676
|
+
const blocked = context && (filterOut == null ? void 0 : filterOut[context]);
|
|
44677
|
+
const blockedUnlessUserHasBalance = context && (filterOutUnlessUserHasBalance == null ? void 0 : filterOutUnlessUserHasBalance[context]);
|
|
44678
|
+
return _assets == null ? void 0 : _assets.filter((asset) => {
|
|
44679
|
+
var _a;
|
|
44680
|
+
const isAllowed = !allowed || Object.entries(allowed).some(([chainId, denoms]) => {
|
|
44681
|
+
var _a2;
|
|
44682
|
+
if (denoms) {
|
|
44683
|
+
return chainId === asset.chainId && denoms.map((x2) => x2.toLowerCase()).includes((_a2 = asset.denom) == null ? void 0 : _a2.toLowerCase());
|
|
44684
|
+
} else {
|
|
44685
|
+
return chainId === asset.chainId;
|
|
44686
|
+
}
|
|
44687
|
+
});
|
|
44688
|
+
const isBlocked = !!blocked && Object.entries(blocked).some(([chainId, denoms]) => {
|
|
44689
|
+
var _a2;
|
|
44690
|
+
if (denoms) {
|
|
44691
|
+
return chainId === asset.chainId && denoms.map((x2) => x2.toLowerCase()).includes((_a2 = asset.denom) == null ? void 0 : _a2.toLowerCase());
|
|
44692
|
+
} else {
|
|
44693
|
+
return chainId === asset.chainId;
|
|
44694
|
+
}
|
|
44695
|
+
});
|
|
44696
|
+
const hasBalance = Number(((_a = getBalance(asset.chainId, asset.denom)) == null ? void 0 : _a.amount) ?? 0) > 0;
|
|
44697
|
+
const isBlockedUnlessUserHasBalance = !!blockedUnlessUserHasBalance && !hasBalance && Object.entries(blockedUnlessUserHasBalance).some(([chainId, denoms]) => {
|
|
44698
|
+
if (denoms) {
|
|
44699
|
+
return chainId === asset.chainId && denoms.map((x2) => x2.toLowerCase()).includes(asset.denom.toLowerCase());
|
|
44700
|
+
} else {
|
|
44701
|
+
return chainId === asset.chainId;
|
|
44702
|
+
}
|
|
44703
|
+
});
|
|
44704
|
+
return isAllowed && !isBlocked && !isBlockedUnlessUserHasBalance;
|
|
44705
|
+
});
|
|
44706
|
+
}, [filter2, context, filterOut, filterOutUnlessUserHasBalance, _assets, getBalance]);
|
|
44707
|
+
const groupedAssetsByRecommendedSymbol = useMemo(() => {
|
|
44708
|
+
if (!assets2) return;
|
|
44709
|
+
const groupedAssets = [];
|
|
44710
|
+
const calculateBalanceSummary = (assets22) => {
|
|
44711
|
+
return assets22.reduce(
|
|
44712
|
+
(accumulator, asset) => {
|
|
44713
|
+
const balance = getBalance(asset.chainId, asset.denom);
|
|
44714
|
+
if (balance) {
|
|
44715
|
+
accumulator.totalAmount += Number(balance.amount);
|
|
44716
|
+
accumulator.formattedTotalAmount += Number(
|
|
44717
|
+
convertTokenAmountToHumanReadableAmount(balance.amount, balance == null ? void 0 : balance.decimals)
|
|
44718
|
+
);
|
|
44719
|
+
accumulator.totalUsd += Number(balance.valueUsd ?? 0);
|
|
44720
|
+
}
|
|
44721
|
+
return accumulator;
|
|
44722
|
+
},
|
|
44723
|
+
{ totalAmount: 0, totalUsd: 0, formattedTotalAmount: 0 }
|
|
44724
|
+
);
|
|
44725
|
+
};
|
|
44726
|
+
assets2.forEach((asset) => {
|
|
44727
|
+
const foundGroup = groupedAssets.find((group) => group.id === asset.recommendedSymbol);
|
|
44728
|
+
if (foundGroup) {
|
|
44729
|
+
foundGroup.assets.push(asset);
|
|
44730
|
+
foundGroup.chains.push({
|
|
44731
|
+
chainId: asset.chainId,
|
|
44732
|
+
chainName: asset.chainName,
|
|
44733
|
+
originChainId: asset.originChainId
|
|
44734
|
+
});
|
|
44735
|
+
} else {
|
|
44736
|
+
groupedAssets.push({
|
|
44737
|
+
id: asset.recommendedSymbol || asset.symbol || asset.denom,
|
|
44738
|
+
name: asset.name,
|
|
44739
|
+
chains: [
|
|
44740
|
+
{
|
|
44741
|
+
chainId: asset.chainId,
|
|
44742
|
+
chainName: asset.chainName,
|
|
44743
|
+
originChainId: asset.originChainId
|
|
44744
|
+
}
|
|
44745
|
+
],
|
|
44746
|
+
assets: [asset],
|
|
44747
|
+
totalAmount: 0,
|
|
44748
|
+
totalUsd: 0,
|
|
44749
|
+
formattedTotalAmount: "0"
|
|
44750
|
+
});
|
|
44751
|
+
}
|
|
44752
|
+
});
|
|
44753
|
+
groupedAssets.forEach((group) => {
|
|
44754
|
+
const balanceSummary = calculateBalanceSummary(group.assets);
|
|
44755
|
+
group.totalAmount = balanceSummary.totalAmount;
|
|
44756
|
+
group.totalUsd = balanceSummary.totalUsd;
|
|
44757
|
+
group.formattedTotalAmount = balanceSummary.formattedTotalAmount.toString();
|
|
44758
|
+
});
|
|
44759
|
+
return groupedAssets;
|
|
44760
|
+
}, [assets2, getBalance]);
|
|
44761
|
+
return groupedAssetsByRecommendedSymbol;
|
|
44762
|
+
};
|
|
44763
|
+
const MAX_NUMBER_OF_IMAGES_TO_CHECK = 6;
|
|
44764
|
+
const GroupedAssetImage = ({
|
|
44765
|
+
groupedAsset,
|
|
44766
|
+
height,
|
|
44767
|
+
width,
|
|
44768
|
+
style
|
|
44769
|
+
}) => {
|
|
44770
|
+
var _a;
|
|
44771
|
+
const [currentImageIndex, setCurrentImageIndex] = useState(0);
|
|
44772
|
+
if (!(groupedAsset == null ? void 0 : groupedAsset.assets) || groupedAsset.assets.length === 0) {
|
|
44773
|
+
return /* @__PURE__ */ jsx(StyledAssetImage, { height, width, src: "", alt: "No asset" });
|
|
44774
|
+
}
|
|
44775
|
+
const allLogoUris = [
|
|
44776
|
+
(_a = groupedAsset.assets.find((asset) => {
|
|
44777
|
+
var _a2;
|
|
44778
|
+
return (_a2 = asset.logoUri) == null ? void 0 : _a2.includes("chain-registry");
|
|
44779
|
+
})) == null ? void 0 : _a.logoUri,
|
|
44780
|
+
...groupedAsset.assets.map((asset) => asset.logoUri)
|
|
44781
|
+
].filter((uri) => !!uri);
|
|
44782
|
+
const dedupedLogoUris = Array.from(new Set(allLogoUris));
|
|
44783
|
+
if (dedupedLogoUris.length === 0) {
|
|
44784
|
+
return /* @__PURE__ */ jsx(StyledAssetImage, { height, width, src: "", alt: "No valid URIs" });
|
|
44785
|
+
}
|
|
44786
|
+
const handleError = (e) => {
|
|
44787
|
+
if (currentImageIndex >= dedupedLogoUris.length - 1 || currentImageIndex >= MAX_NUMBER_OF_IMAGES_TO_CHECK) {
|
|
44788
|
+
e.currentTarget.onerror = null;
|
|
44789
|
+
return;
|
|
44790
|
+
}
|
|
44791
|
+
setCurrentImageIndex((prev2) => prev2 + 1);
|
|
44792
|
+
};
|
|
44793
|
+
return /* @__PURE__ */ jsx(
|
|
44794
|
+
StyledAssetImage,
|
|
44795
|
+
{
|
|
44796
|
+
height,
|
|
44797
|
+
width,
|
|
44798
|
+
src: dedupedLogoUris[currentImageIndex],
|
|
44799
|
+
loading: "lazy",
|
|
44800
|
+
onError: handleError,
|
|
44801
|
+
alt: `${groupedAsset.assets[0].recommendedSymbol || ""} logo`,
|
|
44802
|
+
style
|
|
44803
|
+
}
|
|
44804
|
+
);
|
|
44805
|
+
};
|
|
44806
|
+
const StyledAssetImage = dt.img`
|
|
44807
|
+
border-radius: 50%;
|
|
44808
|
+
object-fit: cover;
|
|
44809
|
+
${({ theme }) => `background: ${theme.secondary.background.hover};`}
|
|
44810
|
+
`;
|
|
44628
44811
|
const SwapExecutionPageRouteDetailedRow = ({
|
|
44629
44812
|
denom,
|
|
44630
44813
|
tokenAmount,
|
|
@@ -44638,7 +44821,7 @@ const SwapExecutionPageRouteDetailedRow = ({
|
|
|
44638
44821
|
statusData,
|
|
44639
44822
|
...props
|
|
44640
44823
|
}) => {
|
|
44641
|
-
var _a, _b
|
|
44824
|
+
var _a, _b;
|
|
44642
44825
|
const theme = nt();
|
|
44643
44826
|
const isMobileScreenSize = useIsMobileScreenSize();
|
|
44644
44827
|
const { copyAddress, isShowingCopyAddressFeedback } = useCopyAddress();
|
|
@@ -44647,6 +44830,10 @@ const SwapExecutionPageRouteDetailedRow = ({
|
|
|
44647
44830
|
chainId,
|
|
44648
44831
|
tokenAmount
|
|
44649
44832
|
});
|
|
44833
|
+
const groupedAssets = useGroupedAssetByRecommendedSymbol({
|
|
44834
|
+
context: void 0
|
|
44835
|
+
});
|
|
44836
|
+
const groupedAsset = groupedAssets == null ? void 0 : groupedAssets.find((i) => i.id === (assetDetails == null ? void 0 : assetDetails.symbol));
|
|
44650
44837
|
const chainAddresses = useAtomValue(chainAddressesAtom);
|
|
44651
44838
|
const shouldRenderEditDestinationWallet = context === "destination" && onClickEditDestinationWallet !== void 0;
|
|
44652
44839
|
const renderingEditDestinationWalletOrExplorerLink = shouldRenderEditDestinationWallet || explorerLink !== void 0;
|
|
@@ -44719,7 +44906,7 @@ const SwapExecutionPageRouteDetailedRow = ({
|
|
|
44719
44906
|
const numberOfTransferEvents = statusData == null ? void 0 : statusData.transferEvents.length;
|
|
44720
44907
|
const latestStatus = (_b = (_a = statusData == null ? void 0 : statusData.transferEvents) == null ? void 0 : _a[(statusData == null ? void 0 : statusData.transferEvents.length) - 1]) == null ? void 0 : _b.status;
|
|
44721
44908
|
return /* @__PURE__ */ jsxs(Row, { gap: 15, align: "center", ...props, children: [
|
|
44722
|
-
|
|
44909
|
+
groupedAsset ? /* @__PURE__ */ jsx(
|
|
44723
44910
|
StyledAnimatedBorder,
|
|
44724
44911
|
{
|
|
44725
44912
|
width: 30,
|
|
@@ -44727,12 +44914,12 @@ const SwapExecutionPageRouteDetailedRow = ({
|
|
|
44727
44914
|
backgroundColor: theme.success.text,
|
|
44728
44915
|
status,
|
|
44729
44916
|
children: /* @__PURE__ */ jsx(
|
|
44730
|
-
|
|
44917
|
+
GroupedAssetImage,
|
|
44731
44918
|
{
|
|
44732
44919
|
height: 30,
|
|
44733
44920
|
width: 30,
|
|
44734
|
-
|
|
44735
|
-
|
|
44921
|
+
style: { borderRadius: 30, boxSizing: "content-box" },
|
|
44922
|
+
groupedAsset
|
|
44736
44923
|
}
|
|
44737
44924
|
)
|
|
44738
44925
|
},
|
|
@@ -44801,10 +44988,6 @@ const PlaceholderIcon$1 = dt.div`
|
|
|
44801
44988
|
const AddressText = dt(SmallText)`
|
|
44802
44989
|
text-transform: lowercase;
|
|
44803
44990
|
`;
|
|
44804
|
-
const StyledChainImage$1 = dt.img`
|
|
44805
|
-
border-radius: 50%;
|
|
44806
|
-
box-sizing: content-box;
|
|
44807
|
-
`;
|
|
44808
44991
|
const StyledAnimatedBorder = ({
|
|
44809
44992
|
backgroundColor,
|
|
44810
44993
|
children,
|
|
@@ -45363,10 +45546,6 @@ const walletInfo = {
|
|
|
45363
45546
|
imgSrc: "https://raw.githubusercontent.com/graz-sh/graz/dev/example/starter/public/assets/wallet-icon-cosmostation.png",
|
|
45364
45547
|
mobile: true
|
|
45365
45548
|
},
|
|
45366
|
-
[WalletType.CAPSULE]: {
|
|
45367
|
-
name: "Capsule",
|
|
45368
|
-
imgSrc: "https://raw.githubusercontent.com/graz-sh/graz/dev/example/starter/public/assets/wallet-icon-capsule.jpg"
|
|
45369
|
-
},
|
|
45370
45549
|
[WalletType.COSMIFRAME]: {
|
|
45371
45550
|
name: "DAO DAO",
|
|
45372
45551
|
imgSrc: "https://raw.githubusercontent.com/graz-sh/graz/dev/example/starter/public/assets/wallet-icon-daodao.png"
|
|
@@ -47005,41 +47184,6 @@ const SkeletonElement = dt.div`
|
|
|
47005
47184
|
const CircleSkeletonElement = dt(SkeletonElement)`
|
|
47006
47185
|
border-radius: 50%;
|
|
47007
47186
|
`;
|
|
47008
|
-
const skipAllBalancesRequestAtom = atom$1(void 0);
|
|
47009
|
-
const skipAllBalancesAtom = atomWithQuery((get) => {
|
|
47010
|
-
const params = get(skipAllBalancesRequestAtom);
|
|
47011
|
-
const isInvertingSwap = get(isInvertingSwapAtom);
|
|
47012
|
-
const enabled = params && !isInvertingSwap;
|
|
47013
|
-
return {
|
|
47014
|
-
queryKey: ["skipBalances", params],
|
|
47015
|
-
queryFn: async () => {
|
|
47016
|
-
if (!params) {
|
|
47017
|
-
return { chains: {} };
|
|
47018
|
-
}
|
|
47019
|
-
if (Object.keys((params == null ? void 0 : params.chains) ?? {}).length === 0) {
|
|
47020
|
-
return { chains: {} };
|
|
47021
|
-
}
|
|
47022
|
-
return balances({ ...params, abortDuplicateRequests: true });
|
|
47023
|
-
},
|
|
47024
|
-
enabled,
|
|
47025
|
-
refetchInterval: 1e3 * 60,
|
|
47026
|
-
retry: 1,
|
|
47027
|
-
gcTime: 0,
|
|
47028
|
-
placeholderData: (prevData) => prevData
|
|
47029
|
-
};
|
|
47030
|
-
});
|
|
47031
|
-
const useGetBalance = () => {
|
|
47032
|
-
const { data: skipBalances } = useAtomValue(skipAllBalancesAtom);
|
|
47033
|
-
const getBalance = useCallback(
|
|
47034
|
-
(chainId, denom) => {
|
|
47035
|
-
var _a, _b, _c;
|
|
47036
|
-
if (!chainId || !denom) return;
|
|
47037
|
-
return (_c = (_b = (_a = skipBalances == null ? void 0 : skipBalances.chains) == null ? void 0 : _a[chainId]) == null ? void 0 : _b.denoms) == null ? void 0 : _c[denom];
|
|
47038
|
-
},
|
|
47039
|
-
[skipBalances]
|
|
47040
|
-
);
|
|
47041
|
-
return getBalance;
|
|
47042
|
-
};
|
|
47043
47187
|
const PRIVILEGED_ASSETS = ["ATOM", "USDC", "USDT", "ETH", "TIA", "OSMO", "NTRN", "INJ"];
|
|
47044
47188
|
const assetSymbolsSortedToTopAtom = atom$1(PRIVILEGED_ASSETS);
|
|
47045
47189
|
const EXCLUDED_TOKEN_COMBINATIONS = [{ id: "SOL", chainIDs: ["solana"] }];
|
|
@@ -47084,9 +47228,6 @@ const useFilteredAssets = ({
|
|
|
47084
47228
|
};
|
|
47085
47229
|
const ibcEurekaHighlightedAssetsAtom = atom$1({});
|
|
47086
47230
|
const hideAssetsUnlessWalletTypeConnectedAtom = atom$1(false);
|
|
47087
|
-
const filterAtom = atom$1();
|
|
47088
|
-
const filterOutAtom = atom$1();
|
|
47089
|
-
const filterOutUnlessUserHasBalanceAtom = atom$1();
|
|
47090
47231
|
const useFilteredChains = ({
|
|
47091
47232
|
selectedGroup,
|
|
47092
47233
|
searchQuery = "",
|
|
@@ -47200,48 +47341,6 @@ const useFilteredChains = ({
|
|
|
47200
47341
|
]);
|
|
47201
47342
|
return filteredChains;
|
|
47202
47343
|
};
|
|
47203
|
-
const MAX_NUMBER_OF_IMAGES_TO_CHECK = 6;
|
|
47204
|
-
const GroupedAssetImage = ({ groupedAsset, height, width }) => {
|
|
47205
|
-
var _a;
|
|
47206
|
-
const [currentImageIndex, setCurrentImageIndex] = useState(0);
|
|
47207
|
-
if (!(groupedAsset == null ? void 0 : groupedAsset.assets) || groupedAsset.assets.length === 0) {
|
|
47208
|
-
return /* @__PURE__ */ jsx(StyledAssetImage, { height, width, src: "", alt: "No asset" });
|
|
47209
|
-
}
|
|
47210
|
-
const allLogoUris = [
|
|
47211
|
-
(_a = groupedAsset.assets.find((asset) => {
|
|
47212
|
-
var _a2;
|
|
47213
|
-
return (_a2 = asset.logoUri) == null ? void 0 : _a2.includes("chain-registry");
|
|
47214
|
-
})) == null ? void 0 : _a.logoUri,
|
|
47215
|
-
...groupedAsset.assets.map((asset) => asset.logoUri)
|
|
47216
|
-
].filter((uri) => !!uri);
|
|
47217
|
-
const dedupedLogoUris = Array.from(new Set(allLogoUris));
|
|
47218
|
-
if (dedupedLogoUris.length === 0) {
|
|
47219
|
-
return /* @__PURE__ */ jsx(StyledAssetImage, { height, width, src: "", alt: "No valid URIs" });
|
|
47220
|
-
}
|
|
47221
|
-
const handleError = (e) => {
|
|
47222
|
-
if (currentImageIndex >= dedupedLogoUris.length - 1 || currentImageIndex >= MAX_NUMBER_OF_IMAGES_TO_CHECK) {
|
|
47223
|
-
e.currentTarget.onerror = null;
|
|
47224
|
-
return;
|
|
47225
|
-
}
|
|
47226
|
-
setCurrentImageIndex((prev2) => prev2 + 1);
|
|
47227
|
-
};
|
|
47228
|
-
return /* @__PURE__ */ jsx(
|
|
47229
|
-
StyledAssetImage,
|
|
47230
|
-
{
|
|
47231
|
-
height,
|
|
47232
|
-
width,
|
|
47233
|
-
src: dedupedLogoUris[currentImageIndex],
|
|
47234
|
-
loading: "lazy",
|
|
47235
|
-
onError: handleError,
|
|
47236
|
-
alt: `${groupedAsset.assets[0].recommendedSymbol || ""} logo`
|
|
47237
|
-
}
|
|
47238
|
-
);
|
|
47239
|
-
};
|
|
47240
|
-
const StyledAssetImage = dt.img`
|
|
47241
|
-
border-radius: 50%;
|
|
47242
|
-
object-fit: cover;
|
|
47243
|
-
${({ theme }) => `background: ${theme.secondary.background.hover};`}
|
|
47244
|
-
`;
|
|
47245
47344
|
const isGroupedAsset = (item) => {
|
|
47246
47345
|
return item.chains !== void 0;
|
|
47247
47346
|
};
|
|
@@ -47481,104 +47580,6 @@ const TinyTriangleIcon = ({
|
|
|
47481
47580
|
children: /* @__PURE__ */ jsx("path", { d: "M4.44881 6.98877L0.420326 0.0112305L8.47729 0.0112305L4.44881 6.98877Z", fill: color })
|
|
47482
47581
|
}
|
|
47483
47582
|
);
|
|
47484
|
-
const useGroupedAssetByRecommendedSymbol = ({
|
|
47485
|
-
context
|
|
47486
|
-
}) => {
|
|
47487
|
-
const { data: _assets } = useAtomValue(skipAssetsAtom);
|
|
47488
|
-
const getBalance = useGetBalance();
|
|
47489
|
-
const filter2 = useAtomValue(filterAtom);
|
|
47490
|
-
const filterOut = useAtomValue(filterOutAtom);
|
|
47491
|
-
const filterOutUnlessUserHasBalance = useAtomValue(filterOutUnlessUserHasBalanceAtom);
|
|
47492
|
-
const assets2 = useMemo(() => {
|
|
47493
|
-
const allowed = filter2 == null ? void 0 : filter2[context];
|
|
47494
|
-
const blocked = filterOut == null ? void 0 : filterOut[context];
|
|
47495
|
-
const blockedUnlessUserHasBalance = filterOutUnlessUserHasBalance == null ? void 0 : filterOutUnlessUserHasBalance[context];
|
|
47496
|
-
return _assets == null ? void 0 : _assets.filter((asset) => {
|
|
47497
|
-
var _a;
|
|
47498
|
-
const isAllowed = !allowed || Object.entries(allowed).some(([chainId, denoms]) => {
|
|
47499
|
-
var _a2;
|
|
47500
|
-
if (denoms) {
|
|
47501
|
-
return chainId === asset.chainId && denoms.map((x2) => x2.toLowerCase()).includes((_a2 = asset.denom) == null ? void 0 : _a2.toLowerCase());
|
|
47502
|
-
} else {
|
|
47503
|
-
return chainId === asset.chainId;
|
|
47504
|
-
}
|
|
47505
|
-
});
|
|
47506
|
-
const isBlocked = !!blocked && Object.entries(blocked).some(([chainId, denoms]) => {
|
|
47507
|
-
var _a2;
|
|
47508
|
-
if (denoms) {
|
|
47509
|
-
return chainId === asset.chainId && denoms.map((x2) => x2.toLowerCase()).includes((_a2 = asset.denom) == null ? void 0 : _a2.toLowerCase());
|
|
47510
|
-
} else {
|
|
47511
|
-
return chainId === asset.chainId;
|
|
47512
|
-
}
|
|
47513
|
-
});
|
|
47514
|
-
const hasBalance = Number(((_a = getBalance(asset.chainId, asset.denom)) == null ? void 0 : _a.amount) ?? 0) > 0;
|
|
47515
|
-
const isBlockedUnlessUserHasBalance = !!blockedUnlessUserHasBalance && !hasBalance && Object.entries(blockedUnlessUserHasBalance).some(([chainId, denoms]) => {
|
|
47516
|
-
if (denoms) {
|
|
47517
|
-
return chainId === asset.chainId && denoms.map((x2) => x2.toLowerCase()).includes(asset.denom.toLowerCase());
|
|
47518
|
-
} else {
|
|
47519
|
-
return chainId === asset.chainId;
|
|
47520
|
-
}
|
|
47521
|
-
});
|
|
47522
|
-
return isAllowed && !isBlocked && !isBlockedUnlessUserHasBalance;
|
|
47523
|
-
});
|
|
47524
|
-
}, [filter2, context, filterOut, filterOutUnlessUserHasBalance, _assets, getBalance]);
|
|
47525
|
-
const groupedAssetsByRecommendedSymbol = useMemo(() => {
|
|
47526
|
-
if (!assets2) return;
|
|
47527
|
-
const groupedAssets = [];
|
|
47528
|
-
const calculateBalanceSummary = (assets22) => {
|
|
47529
|
-
return assets22.reduce(
|
|
47530
|
-
(accumulator, asset) => {
|
|
47531
|
-
const balance = getBalance(asset.chainId, asset.denom);
|
|
47532
|
-
if (balance) {
|
|
47533
|
-
accumulator.totalAmount += Number(balance.amount);
|
|
47534
|
-
accumulator.totalUsd += Number(balance.valueUsd ?? 0);
|
|
47535
|
-
}
|
|
47536
|
-
return accumulator;
|
|
47537
|
-
},
|
|
47538
|
-
{ totalAmount: 0, totalUsd: 0 }
|
|
47539
|
-
);
|
|
47540
|
-
};
|
|
47541
|
-
assets2.forEach((asset) => {
|
|
47542
|
-
const foundGroup = groupedAssets.find((group) => group.id === asset.recommendedSymbol);
|
|
47543
|
-
if (foundGroup) {
|
|
47544
|
-
foundGroup.assets.push(asset);
|
|
47545
|
-
foundGroup.chains.push({
|
|
47546
|
-
chainId: asset.chainId,
|
|
47547
|
-
chainName: asset.chainName,
|
|
47548
|
-
originChainId: asset.originChainId
|
|
47549
|
-
});
|
|
47550
|
-
} else {
|
|
47551
|
-
groupedAssets.push({
|
|
47552
|
-
id: asset.recommendedSymbol || asset.symbol || asset.denom,
|
|
47553
|
-
name: asset.name,
|
|
47554
|
-
chains: [
|
|
47555
|
-
{
|
|
47556
|
-
chainId: asset.chainId,
|
|
47557
|
-
chainName: asset.chainName,
|
|
47558
|
-
originChainId: asset.originChainId
|
|
47559
|
-
}
|
|
47560
|
-
],
|
|
47561
|
-
assets: [asset],
|
|
47562
|
-
totalAmount: 0,
|
|
47563
|
-
totalUsd: 0,
|
|
47564
|
-
formattedTotalAmount: "0",
|
|
47565
|
-
decimals: asset.decimals
|
|
47566
|
-
});
|
|
47567
|
-
}
|
|
47568
|
-
});
|
|
47569
|
-
groupedAssets.forEach((group) => {
|
|
47570
|
-
const balanceSummary = calculateBalanceSummary(group.assets);
|
|
47571
|
-
group.totalAmount = balanceSummary.totalAmount;
|
|
47572
|
-
group.totalUsd = balanceSummary.totalUsd;
|
|
47573
|
-
group.formattedTotalAmount = convertTokenAmountToHumanReadableAmount(
|
|
47574
|
-
balanceSummary.totalAmount,
|
|
47575
|
-
group.decimals
|
|
47576
|
-
);
|
|
47577
|
-
});
|
|
47578
|
-
return groupedAssets;
|
|
47579
|
-
}, [assets2, getBalance]);
|
|
47580
|
-
return groupedAssetsByRecommendedSymbol;
|
|
47581
|
-
};
|
|
47582
47583
|
const SwapPageAssetChainInput = ({
|
|
47583
47584
|
value,
|
|
47584
47585
|
usdValue,
|
|
@@ -48818,7 +48819,6 @@ const SwapExecutionPageRouteSimpleRow = ({
|
|
|
48818
48819
|
explorerLink,
|
|
48819
48820
|
context
|
|
48820
48821
|
}) => {
|
|
48821
|
-
var _a;
|
|
48822
48822
|
const theme = nt();
|
|
48823
48823
|
const isMobileScreenSize = useIsMobileScreenSize();
|
|
48824
48824
|
const { copyAddress, isShowingCopyAddressFeedback } = useCopyAddress();
|
|
@@ -48827,16 +48827,20 @@ const SwapExecutionPageRouteSimpleRow = ({
|
|
|
48827
48827
|
chainId,
|
|
48828
48828
|
tokenAmount
|
|
48829
48829
|
});
|
|
48830
|
+
const groupedAssets = useGroupedAssetByRecommendedSymbol({
|
|
48831
|
+
context: void 0
|
|
48832
|
+
});
|
|
48833
|
+
const groupedAsset = groupedAssets == null ? void 0 : groupedAssets.find((i) => i.id === (assetDetails == null ? void 0 : assetDetails.symbol));
|
|
48830
48834
|
const chainAddresses = useAtomValue(chainAddressesAtom);
|
|
48831
48835
|
const source = useMemo(() => {
|
|
48832
|
-
var
|
|
48836
|
+
var _a, _b;
|
|
48833
48837
|
const chainAddressArray = Object.values(chainAddresses);
|
|
48834
48838
|
switch (context) {
|
|
48835
48839
|
case "source": {
|
|
48836
48840
|
const selected = chainAddressArray[0];
|
|
48837
48841
|
return {
|
|
48838
48842
|
address: selected == null ? void 0 : selected.address,
|
|
48839
|
-
image: (selected == null ? void 0 : selected.source) === "wallet" && ((
|
|
48843
|
+
image: (selected == null ? void 0 : selected.source) === "wallet" && ((_a = selected == null ? void 0 : selected.wallet) == null ? void 0 : _a.walletInfo.logo) || void 0
|
|
48840
48844
|
};
|
|
48841
48845
|
}
|
|
48842
48846
|
case "destination": {
|
|
@@ -48866,14 +48870,13 @@ const SwapExecutionPageRouteSimpleRow = ({
|
|
|
48866
48870
|
height: 50,
|
|
48867
48871
|
backgroundColor: theme.success.text,
|
|
48868
48872
|
status,
|
|
48869
|
-
children:
|
|
48870
|
-
|
|
48873
|
+
children: groupedAsset ? /* @__PURE__ */ jsx(
|
|
48874
|
+
GroupedAssetImage,
|
|
48871
48875
|
{
|
|
48872
48876
|
height: 50,
|
|
48873
48877
|
width: 50,
|
|
48874
48878
|
style: { borderRadius: 50 },
|
|
48875
|
-
|
|
48876
|
-
title: (_a = assetDetails == null ? void 0 : assetDetails.asset) == null ? void 0 : _a.name
|
|
48879
|
+
groupedAsset
|
|
48877
48880
|
}
|
|
48878
48881
|
) : /* @__PURE__ */ jsx(PlaceholderIcon, { children: "?" })
|
|
48879
48882
|
}
|
|
@@ -50875,8 +50878,10 @@ const SwapPage = () => {
|
|
|
50875
50878
|
setChainAddresses({});
|
|
50876
50879
|
setCurrentPage(Routes.SwapExecutionPage);
|
|
50877
50880
|
setUser({ username: sourceAccount == null ? void 0 : sourceAccount.address });
|
|
50878
|
-
|
|
50879
|
-
|
|
50881
|
+
if (sourceAccount == null ? void 0 : sourceAccount.address) {
|
|
50882
|
+
const replay = getReplay();
|
|
50883
|
+
replay == null ? void 0 : replay.start();
|
|
50884
|
+
}
|
|
50880
50885
|
setSwapExecutionState();
|
|
50881
50886
|
};
|
|
50882
50887
|
return /* @__PURE__ */ jsx(
|
|
@@ -51926,6 +51931,7 @@ const TransactionHistoryPageHistoryItem = ({
|
|
|
51926
51931
|
addSuffix: true
|
|
51927
51932
|
}).replace("minutes", "mins").replace("minute", "min").replace("hours", "hrs").replace("hour", "hr").replace("seconds", "secs").replace("second", "sec").replace("months", "mos").replace("month", "mo").replace("years", "yrs").replace("year", "yr");
|
|
51928
51933
|
}, [timestamp, historyStatus]);
|
|
51934
|
+
if (!txHistoryItem.route) return null;
|
|
51929
51935
|
return /* @__PURE__ */ jsxs(StyledHistoryContainer, { showDetails, children: [
|
|
51930
51936
|
/* @__PURE__ */ jsxs(StyledHistoryItemRow, { align: "center", justify: "space-between", onClick: onClickRow, children: [
|
|
51931
51937
|
/* @__PURE__ */ jsxs(Row, { gap: 8, align: "center", children: [
|
|
@@ -51976,7 +51982,7 @@ const RenderAssetAmount = ({
|
|
|
51976
51982
|
return verboseString;
|
|
51977
51983
|
}, [asset, chainName, isMobileScreenSize, sourceAsset]);
|
|
51978
51984
|
return /* @__PURE__ */ jsxs(Row, { gap: 8, children: [
|
|
51979
|
-
/* @__PURE__ */ jsx("img", { height: 35, width: 35, src: assetImage }),
|
|
51985
|
+
/* @__PURE__ */ jsx("img", { height: 35, width: 35, src: assetImage, alt: subtitle }),
|
|
51980
51986
|
/* @__PURE__ */ jsxs(Column, { style: sourceAsset ? { width: 50 } : void 0, children: [
|
|
51981
51987
|
/* @__PURE__ */ jsx(Tooltip, { content: amount, style: { width: "min-content" }, children: /* @__PURE__ */ jsx(Text, { normalTextColor: true, style: { width: "max-content" }, children: formattedAmount }) }),
|
|
51982
51988
|
/* @__PURE__ */ jsx(SmallText, { title: asset == null ? void 0 : asset.chainName, textWrap: "nowrap", overflowEllipsis: true, children: subtitle })
|
|
@@ -52228,16 +52234,13 @@ const initSentry = () => {
|
|
|
52228
52234
|
networkResponseHeaders: ["X-Custom-Header"],
|
|
52229
52235
|
useCompression: false
|
|
52230
52236
|
})
|
|
52231
|
-
]
|
|
52232
|
-
// Session Replay
|
|
52233
|
-
replaysSessionSampleRate: 1,
|
|
52234
|
-
replaysOnErrorSampleRate: 0
|
|
52237
|
+
]
|
|
52235
52238
|
});
|
|
52236
52239
|
isSentryInitialized = true;
|
|
52237
52240
|
};
|
|
52238
52241
|
const name = "@skip-go/widget";
|
|
52239
52242
|
const description = "Swap widget";
|
|
52240
|
-
const version = "3.
|
|
52243
|
+
const version = "3.10.1";
|
|
52241
52244
|
const repository = {
|
|
52242
52245
|
url: "https://github.com/skip-mev/skip-go",
|
|
52243
52246
|
directory: "packages/widget"
|
|
@@ -52332,13 +52335,12 @@ const peerDependencies = {
|
|
|
52332
52335
|
const dependencies = {
|
|
52333
52336
|
"@amplitude/analytics-browser": "^2.11.12",
|
|
52334
52337
|
"@amplitude/plugin-session-replay-browser": "^1.16.5",
|
|
52335
|
-
"@cosmjs/amino": "0.
|
|
52336
|
-
"@cosmjs/cosmwasm-stargate": "0.
|
|
52337
|
-
"@cosmjs/
|
|
52338
|
-
"@cosmjs/math": "
|
|
52339
|
-
"@cosmjs/proto-signing": "0.
|
|
52340
|
-
"@cosmjs/stargate": "0.
|
|
52341
|
-
"@cosmjs/tendermint-rpc": "0.31.3",
|
|
52338
|
+
"@cosmjs/amino": "0.33.1",
|
|
52339
|
+
"@cosmjs/cosmwasm-stargate": "0.33.1",
|
|
52340
|
+
"@cosmjs/encoding": "0.33.1",
|
|
52341
|
+
"@cosmjs/math": "0.33.1",
|
|
52342
|
+
"@cosmjs/proto-signing": "0.33.1",
|
|
52343
|
+
"@cosmjs/stargate": "0.33.1",
|
|
52342
52344
|
"@ebay/nice-modal-react": "^1.2.13",
|
|
52343
52345
|
"@eslint/compat": "^1.1.1",
|
|
52344
52346
|
"@leapwallet/cosmos-social-login-capsule-provider": "^0.0.44",
|
|
@@ -52363,7 +52365,7 @@ const dependencies = {
|
|
|
52363
52365
|
"@walletconnect/solana-adapter": "^0.0.6",
|
|
52364
52366
|
add: "^2.0.6",
|
|
52365
52367
|
bech32: "^2.0.0",
|
|
52366
|
-
graz: "
|
|
52368
|
+
graz: "0.3.2",
|
|
52367
52369
|
jotai: "^2.10.1",
|
|
52368
52370
|
"jotai-effect": "^1.0.2",
|
|
52369
52371
|
"jotai-tanstack-query": "^0.8.6",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as getAugmentedNamespace, c as commonjsGlobal, a as getDefaultExportFromCjs, p as process$1 } from "./index-
|
|
1
|
+
import { g as getAugmentedNamespace, c as commonjsGlobal, a as getDefaultExportFromCjs, p as process$1 } from "./index-16Gtjmg-.js";
|
|
2
2
|
import qg, { PROPOSAL_EXPIRY_MESSAGE } from "@walletconnect/sign-client";
|
|
3
3
|
const global = globalThis || void 0 || self;
|
|
4
4
|
var buffer$1 = {};
|
package/build/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skip-go/widget",
|
|
3
3
|
"description": "Swap widget",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.10.1",
|
|
5
5
|
"repository": {
|
|
6
6
|
"url": "https://github.com/skip-mev/skip-go",
|
|
7
7
|
"directory": "packages/widget"
|
|
@@ -28,13 +28,12 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@amplitude/analytics-browser": "^2.11.12",
|
|
30
30
|
"@amplitude/plugin-session-replay-browser": "^1.16.5",
|
|
31
|
-
"@cosmjs/amino": "0.
|
|
32
|
-
"@cosmjs/cosmwasm-stargate": "0.
|
|
33
|
-
"@cosmjs/
|
|
34
|
-
"@cosmjs/math": "
|
|
35
|
-
"@cosmjs/proto-signing": "0.
|
|
36
|
-
"@cosmjs/stargate": "0.
|
|
37
|
-
"@cosmjs/tendermint-rpc": "0.31.3",
|
|
31
|
+
"@cosmjs/amino": "0.33.1",
|
|
32
|
+
"@cosmjs/cosmwasm-stargate": "0.33.1",
|
|
33
|
+
"@cosmjs/encoding": "0.33.1",
|
|
34
|
+
"@cosmjs/math": "0.33.1",
|
|
35
|
+
"@cosmjs/proto-signing": "0.33.1",
|
|
36
|
+
"@cosmjs/stargate": "0.33.1",
|
|
38
37
|
"@ebay/nice-modal-react": "^1.2.13",
|
|
39
38
|
"@eslint/compat": "^1.1.1",
|
|
40
39
|
"@leapwallet/cosmos-social-login-capsule-provider": "^0.0.44",
|
|
@@ -44,7 +43,7 @@
|
|
|
44
43
|
"@penumbra-zone/transport-dom": "^7.5.0",
|
|
45
44
|
"@r2wc/react-to-web-component": "^2.0.3",
|
|
46
45
|
"@sentry/react": "^8.46.0",
|
|
47
|
-
"@skip-go/client": "1.0
|
|
46
|
+
"@skip-go/client": "1.1.0",
|
|
48
47
|
"@solana/spl-token": "^0.4.8",
|
|
49
48
|
"@solana/wallet-adapter-backpack": "^0.1.14",
|
|
50
49
|
"@solana/wallet-adapter-coinbase": "^0.1.19",
|
|
@@ -59,7 +58,7 @@
|
|
|
59
58
|
"@walletconnect/solana-adapter": "^0.0.6",
|
|
60
59
|
"add": "^2.0.6",
|
|
61
60
|
"bech32": "^2.0.0",
|
|
62
|
-
"graz": "
|
|
61
|
+
"graz": "0.3.2",
|
|
63
62
|
"jotai": "^2.10.1",
|
|
64
63
|
"jotai-effect": "^1.0.2",
|
|
65
64
|
"jotai-tanstack-query": "^0.8.6",
|