@skip-go/widget 3.9.6 → 3.10.0

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, FeeType, balances, GAS_STATION_CHAIN_IDS, setClientOptions } from "@skip-go/client";
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";
@@ -5151,10 +5151,10 @@ const _skipRouteAtom = atomWithQuery((get) => {
5151
5151
  const isInvertingSwap = get(isInvertingSwapAtom);
5152
5152
  const error = get(errorAtom);
5153
5153
  const routeConfig = get(routeConfigAtom);
5154
- const routePreference = get(routePreferenceAtom);
5154
+ const swapSettings = get(swapSettingsAtom);
5155
5155
  const queryEnabled = params !== void 0 && (Number(params.amountIn) > 0 || Number(params.amountOut) > 0) && !isInvertingSwap && currentPage === Routes.SwapPage && error === void 0;
5156
5156
  return {
5157
- queryKey: ["skipRoute", params, routeConfig, routePreference],
5157
+ queryKey: ["skipRoute", params, routeConfig, swapSettings],
5158
5158
  queryFn: async () => {
5159
5159
  if (!params) {
5160
5160
  throw new Error("No route request provided");
@@ -5164,7 +5164,7 @@ const _skipRouteAtom = atomWithQuery((get) => {
5164
5164
  ...params,
5165
5165
  smartRelay: true,
5166
5166
  ...routeConfig,
5167
- goFast: routePreference === RoutePreference.FASTEST,
5167
+ goFast: swapSettings.routePreference === RoutePreference.FASTEST,
5168
5168
  abortDuplicateRequests: true
5169
5169
  });
5170
5170
  return response;
@@ -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-B-tlH5iO.js");
43192
+ const { EthereumProvider } = await import("./index.es-D26eUUH4.js");
43193
43193
  return await EthereumProvider.init({
43194
43194
  ...parameters,
43195
43195
  disableProviderPing: true,
@@ -43724,7 +43724,7 @@ const setSwapExecutionStateAtom = atom$1(null, (get, set) => {
43724
43724
  }
43725
43725
  });
43726
43726
  } else {
43727
- track("error page: unexpected error");
43727
+ track("error page: unexpected error", { error, route: route2 });
43728
43728
  set(errorAtom, {
43729
43729
  errorType: ErrorType.Unexpected,
43730
43730
  error,
@@ -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, _c;
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
- (assetDetails == null ? void 0 : assetDetails.assetImage) ? /* @__PURE__ */ jsx(
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
- StyledChainImage$1,
44917
+ GroupedAssetImage,
44731
44918
  {
44732
44919
  height: 30,
44733
44920
  width: 30,
44734
- src: assetDetails.assetImage,
44735
- title: (_c = assetDetails == null ? void 0 : assetDetails.asset) == null ? void 0 : _c.name
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"
@@ -45484,7 +45663,8 @@ const useCreateCosmosWallets = () => {
45484
45663
  track("wallet connected", {
45485
45664
  walletName: wallet,
45486
45665
  chainId: chainIdToConnect,
45487
- chainType: ChainType.Cosmos
45666
+ chainType: ChainType.Cosmos,
45667
+ address
45488
45668
  });
45489
45669
  return { address };
45490
45670
  } catch (e) {
@@ -45779,7 +45959,8 @@ const useCreateEvmWallets = () => {
45779
45959
  track("wallet connected", {
45780
45960
  walletName: connector.name,
45781
45961
  chainId: chainIdToConnect,
45782
- chainType: ChainType.Evm
45962
+ chainType: ChainType.Evm,
45963
+ address: account[0]
45783
45964
  });
45784
45965
  return { address: account[0], logo: (_e2 = walletConnectMetadata == null ? void 0 : walletConnectMetadata.icons) == null ? void 0 : _e2[0] };
45785
45966
  } catch (e) {
@@ -47003,41 +47184,6 @@ const SkeletonElement = dt.div`
47003
47184
  const CircleSkeletonElement = dt(SkeletonElement)`
47004
47185
  border-radius: 50%;
47005
47186
  `;
47006
- const skipAllBalancesRequestAtom = atom$1(void 0);
47007
- const skipAllBalancesAtom = atomWithQuery((get) => {
47008
- const params = get(skipAllBalancesRequestAtom);
47009
- const isInvertingSwap = get(isInvertingSwapAtom);
47010
- const enabled = params && !isInvertingSwap;
47011
- return {
47012
- queryKey: ["skipBalances", params],
47013
- queryFn: async () => {
47014
- if (!params) {
47015
- return { chains: {} };
47016
- }
47017
- if (Object.keys((params == null ? void 0 : params.chains) ?? {}).length === 0) {
47018
- return { chains: {} };
47019
- }
47020
- return balances({ ...params, abortDuplicateRequests: true });
47021
- },
47022
- enabled,
47023
- refetchInterval: 1e3 * 60,
47024
- retry: 1,
47025
- gcTime: 0,
47026
- placeholderData: (prevData) => prevData
47027
- };
47028
- });
47029
- const useGetBalance = () => {
47030
- const { data: skipBalances } = useAtomValue(skipAllBalancesAtom);
47031
- const getBalance = useCallback(
47032
- (chainId, denom) => {
47033
- var _a, _b, _c;
47034
- if (!chainId || !denom) return;
47035
- 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];
47036
- },
47037
- [skipBalances]
47038
- );
47039
- return getBalance;
47040
- };
47041
47187
  const PRIVILEGED_ASSETS = ["ATOM", "USDC", "USDT", "ETH", "TIA", "OSMO", "NTRN", "INJ"];
47042
47188
  const assetSymbolsSortedToTopAtom = atom$1(PRIVILEGED_ASSETS);
47043
47189
  const EXCLUDED_TOKEN_COMBINATIONS = [{ id: "SOL", chainIDs: ["solana"] }];
@@ -47082,9 +47228,6 @@ const useFilteredAssets = ({
47082
47228
  };
47083
47229
  const ibcEurekaHighlightedAssetsAtom = atom$1({});
47084
47230
  const hideAssetsUnlessWalletTypeConnectedAtom = atom$1(false);
47085
- const filterAtom = atom$1();
47086
- const filterOutAtom = atom$1();
47087
- const filterOutUnlessUserHasBalanceAtom = atom$1();
47088
47231
  const useFilteredChains = ({
47089
47232
  selectedGroup,
47090
47233
  searchQuery = "",
@@ -47198,48 +47341,6 @@ const useFilteredChains = ({
47198
47341
  ]);
47199
47342
  return filteredChains;
47200
47343
  };
47201
- const MAX_NUMBER_OF_IMAGES_TO_CHECK = 6;
47202
- const GroupedAssetImage = ({ groupedAsset, height, width }) => {
47203
- var _a;
47204
- const [currentImageIndex, setCurrentImageIndex] = useState(0);
47205
- if (!(groupedAsset == null ? void 0 : groupedAsset.assets) || groupedAsset.assets.length === 0) {
47206
- return /* @__PURE__ */ jsx(StyledAssetImage, { height, width, src: "", alt: "No asset" });
47207
- }
47208
- const allLogoUris = [
47209
- (_a = groupedAsset.assets.find((asset) => {
47210
- var _a2;
47211
- return (_a2 = asset.logoUri) == null ? void 0 : _a2.includes("chain-registry");
47212
- })) == null ? void 0 : _a.logoUri,
47213
- ...groupedAsset.assets.map((asset) => asset.logoUri)
47214
- ].filter((uri) => !!uri);
47215
- const dedupedLogoUris = Array.from(new Set(allLogoUris));
47216
- if (dedupedLogoUris.length === 0) {
47217
- return /* @__PURE__ */ jsx(StyledAssetImage, { height, width, src: "", alt: "No valid URIs" });
47218
- }
47219
- const handleError = (e) => {
47220
- if (currentImageIndex >= dedupedLogoUris.length - 1 || currentImageIndex >= MAX_NUMBER_OF_IMAGES_TO_CHECK) {
47221
- e.currentTarget.onerror = null;
47222
- return;
47223
- }
47224
- setCurrentImageIndex((prev2) => prev2 + 1);
47225
- };
47226
- return /* @__PURE__ */ jsx(
47227
- StyledAssetImage,
47228
- {
47229
- height,
47230
- width,
47231
- src: dedupedLogoUris[currentImageIndex],
47232
- loading: "lazy",
47233
- onError: handleError,
47234
- alt: `${groupedAsset.assets[0].recommendedSymbol || ""} logo`
47235
- }
47236
- );
47237
- };
47238
- const StyledAssetImage = dt.img`
47239
- border-radius: 50%;
47240
- object-fit: cover;
47241
- ${({ theme }) => `background: ${theme.secondary.background.hover};`}
47242
- `;
47243
47344
  const isGroupedAsset = (item) => {
47244
47345
  return item.chains !== void 0;
47245
47346
  };
@@ -47479,104 +47580,6 @@ const TinyTriangleIcon = ({
47479
47580
  children: /* @__PURE__ */ jsx("path", { d: "M4.44881 6.98877L0.420326 0.0112305L8.47729 0.0112305L4.44881 6.98877Z", fill: color })
47480
47581
  }
47481
47582
  );
47482
- const useGroupedAssetByRecommendedSymbol = ({
47483
- context
47484
- }) => {
47485
- const { data: _assets } = useAtomValue(skipAssetsAtom);
47486
- const getBalance = useGetBalance();
47487
- const filter2 = useAtomValue(filterAtom);
47488
- const filterOut = useAtomValue(filterOutAtom);
47489
- const filterOutUnlessUserHasBalance = useAtomValue(filterOutUnlessUserHasBalanceAtom);
47490
- const assets2 = useMemo(() => {
47491
- const allowed = filter2 == null ? void 0 : filter2[context];
47492
- const blocked = filterOut == null ? void 0 : filterOut[context];
47493
- const blockedUnlessUserHasBalance = filterOutUnlessUserHasBalance == null ? void 0 : filterOutUnlessUserHasBalance[context];
47494
- return _assets == null ? void 0 : _assets.filter((asset) => {
47495
- var _a;
47496
- const isAllowed = !allowed || Object.entries(allowed).some(([chainId, denoms]) => {
47497
- var _a2;
47498
- if (denoms) {
47499
- return chainId === asset.chainId && denoms.map((x2) => x2.toLowerCase()).includes((_a2 = asset.denom) == null ? void 0 : _a2.toLowerCase());
47500
- } else {
47501
- return chainId === asset.chainId;
47502
- }
47503
- });
47504
- const isBlocked = !!blocked && Object.entries(blocked).some(([chainId, denoms]) => {
47505
- var _a2;
47506
- if (denoms) {
47507
- return chainId === asset.chainId && denoms.map((x2) => x2.toLowerCase()).includes((_a2 = asset.denom) == null ? void 0 : _a2.toLowerCase());
47508
- } else {
47509
- return chainId === asset.chainId;
47510
- }
47511
- });
47512
- const hasBalance = Number(((_a = getBalance(asset.chainId, asset.denom)) == null ? void 0 : _a.amount) ?? 0) > 0;
47513
- const isBlockedUnlessUserHasBalance = !!blockedUnlessUserHasBalance && !hasBalance && Object.entries(blockedUnlessUserHasBalance).some(([chainId, denoms]) => {
47514
- if (denoms) {
47515
- return chainId === asset.chainId && denoms.map((x2) => x2.toLowerCase()).includes(asset.denom.toLowerCase());
47516
- } else {
47517
- return chainId === asset.chainId;
47518
- }
47519
- });
47520
- return isAllowed && !isBlocked && !isBlockedUnlessUserHasBalance;
47521
- });
47522
- }, [filter2, context, filterOut, filterOutUnlessUserHasBalance, _assets, getBalance]);
47523
- const groupedAssetsByRecommendedSymbol = useMemo(() => {
47524
- if (!assets2) return;
47525
- const groupedAssets = [];
47526
- const calculateBalanceSummary = (assets22) => {
47527
- return assets22.reduce(
47528
- (accumulator, asset) => {
47529
- const balance = getBalance(asset.chainId, asset.denom);
47530
- if (balance) {
47531
- accumulator.totalAmount += Number(balance.amount);
47532
- accumulator.totalUsd += Number(balance.valueUsd ?? 0);
47533
- }
47534
- return accumulator;
47535
- },
47536
- { totalAmount: 0, totalUsd: 0 }
47537
- );
47538
- };
47539
- assets2.forEach((asset) => {
47540
- const foundGroup = groupedAssets.find((group) => group.id === asset.recommendedSymbol);
47541
- if (foundGroup) {
47542
- foundGroup.assets.push(asset);
47543
- foundGroup.chains.push({
47544
- chainId: asset.chainId,
47545
- chainName: asset.chainName,
47546
- originChainId: asset.originChainId
47547
- });
47548
- } else {
47549
- groupedAssets.push({
47550
- id: asset.recommendedSymbol || asset.symbol || asset.denom,
47551
- name: asset.name,
47552
- chains: [
47553
- {
47554
- chainId: asset.chainId,
47555
- chainName: asset.chainName,
47556
- originChainId: asset.originChainId
47557
- }
47558
- ],
47559
- assets: [asset],
47560
- totalAmount: 0,
47561
- totalUsd: 0,
47562
- formattedTotalAmount: "0",
47563
- decimals: asset.decimals
47564
- });
47565
- }
47566
- });
47567
- groupedAssets.forEach((group) => {
47568
- const balanceSummary = calculateBalanceSummary(group.assets);
47569
- group.totalAmount = balanceSummary.totalAmount;
47570
- group.totalUsd = balanceSummary.totalUsd;
47571
- group.formattedTotalAmount = convertTokenAmountToHumanReadableAmount(
47572
- balanceSummary.totalAmount,
47573
- group.decimals
47574
- );
47575
- });
47576
- return groupedAssets;
47577
- }, [assets2, getBalance]);
47578
- return groupedAssetsByRecommendedSymbol;
47579
- };
47580
47583
  const SwapPageAssetChainInput = ({
47581
47584
  value,
47582
47585
  usdValue,
@@ -48816,7 +48819,6 @@ const SwapExecutionPageRouteSimpleRow = ({
48816
48819
  explorerLink,
48817
48820
  context
48818
48821
  }) => {
48819
- var _a;
48820
48822
  const theme = nt();
48821
48823
  const isMobileScreenSize = useIsMobileScreenSize();
48822
48824
  const { copyAddress, isShowingCopyAddressFeedback } = useCopyAddress();
@@ -48825,16 +48827,20 @@ const SwapExecutionPageRouteSimpleRow = ({
48825
48827
  chainId,
48826
48828
  tokenAmount
48827
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));
48828
48834
  const chainAddresses = useAtomValue(chainAddressesAtom);
48829
48835
  const source = useMemo(() => {
48830
- var _a2, _b;
48836
+ var _a, _b;
48831
48837
  const chainAddressArray = Object.values(chainAddresses);
48832
48838
  switch (context) {
48833
48839
  case "source": {
48834
48840
  const selected = chainAddressArray[0];
48835
48841
  return {
48836
48842
  address: selected == null ? void 0 : selected.address,
48837
- image: (selected == null ? void 0 : selected.source) === "wallet" && ((_a2 = selected == null ? void 0 : selected.wallet) == null ? void 0 : _a2.walletInfo.logo) || void 0
48843
+ image: (selected == null ? void 0 : selected.source) === "wallet" && ((_a = selected == null ? void 0 : selected.wallet) == null ? void 0 : _a.walletInfo.logo) || void 0
48838
48844
  };
48839
48845
  }
48840
48846
  case "destination": {
@@ -48864,14 +48870,13 @@ const SwapExecutionPageRouteSimpleRow = ({
48864
48870
  height: 50,
48865
48871
  backgroundColor: theme.success.text,
48866
48872
  status,
48867
- children: assetDetails.assetImage ? /* @__PURE__ */ jsx(
48868
- "img",
48873
+ children: groupedAsset ? /* @__PURE__ */ jsx(
48874
+ GroupedAssetImage,
48869
48875
  {
48870
48876
  height: 50,
48871
48877
  width: 50,
48872
48878
  style: { borderRadius: 50 },
48873
- src: assetDetails.assetImage,
48874
- title: (_a = assetDetails == null ? void 0 : assetDetails.asset) == null ? void 0 : _a.name
48879
+ groupedAsset
48875
48880
  }
48876
48881
  ) : /* @__PURE__ */ jsx(PlaceholderIcon, { children: "?" })
48877
48882
  }
@@ -50688,7 +50693,7 @@ const SwapPage = () => {
50688
50693
  switchEvmchainId(asset == null ? void 0 : asset.chainId);
50689
50694
  setSourceAssetAmount("");
50690
50695
  setDestinationAssetAmount("");
50691
- NiceModal.hide(Modals.AssetAndChainSelectorModal);
50696
+ NiceModal.remove(Modals.AssetAndChainSelectorModal);
50692
50697
  }
50693
50698
  });
50694
50699
  }, [setDestinationAssetAmount, setSourceAsset, setSourceAssetAmount, switchEvmchainId]);
@@ -50703,7 +50708,7 @@ const SwapPage = () => {
50703
50708
  ...asset
50704
50709
  }));
50705
50710
  switchEvmchainId(asset == null ? void 0 : asset.chainId);
50706
- NiceModal.hide(Modals.AssetAndChainSelectorModal);
50711
+ NiceModal.remove(Modals.AssetAndChainSelectorModal);
50707
50712
  },
50708
50713
  selectedAsset: getClientAsset(sourceAsset == null ? void 0 : sourceAsset.denom, sourceAsset == null ? void 0 : sourceAsset.chainId),
50709
50714
  selectChain: true
@@ -50719,7 +50724,7 @@ const SwapPage = () => {
50719
50724
  ...old,
50720
50725
  ...asset
50721
50726
  }));
50722
- NiceModal.hide(Modals.AssetAndChainSelectorModal);
50727
+ NiceModal.remove(Modals.AssetAndChainSelectorModal);
50723
50728
  }
50724
50729
  });
50725
50730
  }, [setDestinationAsset]);
@@ -50733,7 +50738,7 @@ const SwapPage = () => {
50733
50738
  ...old,
50734
50739
  ...asset
50735
50740
  }));
50736
- NiceModal.hide(Modals.AssetAndChainSelectorModal);
50741
+ NiceModal.remove(Modals.AssetAndChainSelectorModal);
50737
50742
  },
50738
50743
  selectedAsset: getClientAsset(destinationAsset == null ? void 0 : destinationAsset.denom, destinationAsset == null ? void 0 : destinationAsset.chainId),
50739
50744
  selectChain: true
@@ -50873,8 +50878,10 @@ const SwapPage = () => {
50873
50878
  setChainAddresses({});
50874
50879
  setCurrentPage(Routes.SwapExecutionPage);
50875
50880
  setUser({ username: sourceAccount == null ? void 0 : sourceAccount.address });
50876
- const replay = getReplay();
50877
- replay == null ? void 0 : replay.start();
50881
+ if (sourceAccount == null ? void 0 : sourceAccount.address) {
50882
+ const replay = getReplay();
50883
+ replay == null ? void 0 : replay.start();
50884
+ }
50878
50885
  setSwapExecutionState();
50879
50886
  };
50880
50887
  return /* @__PURE__ */ jsx(
@@ -51924,6 +51931,7 @@ const TransactionHistoryPageHistoryItem = ({
51924
51931
  addSuffix: true
51925
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");
51926
51933
  }, [timestamp, historyStatus]);
51934
+ if (!txHistoryItem.route) return null;
51927
51935
  return /* @__PURE__ */ jsxs(StyledHistoryContainer, { showDetails, children: [
51928
51936
  /* @__PURE__ */ jsxs(StyledHistoryItemRow, { align: "center", justify: "space-between", onClick: onClickRow, children: [
51929
51937
  /* @__PURE__ */ jsxs(Row, { gap: 8, align: "center", children: [
@@ -51974,7 +51982,7 @@ const RenderAssetAmount = ({
51974
51982
  return verboseString;
51975
51983
  }, [asset, chainName, isMobileScreenSize, sourceAsset]);
51976
51984
  return /* @__PURE__ */ jsxs(Row, { gap: 8, children: [
51977
- /* @__PURE__ */ jsx("img", { height: 35, width: 35, src: assetImage }),
51985
+ /* @__PURE__ */ jsx("img", { height: 35, width: 35, src: assetImage, alt: subtitle }),
51978
51986
  /* @__PURE__ */ jsxs(Column, { style: sourceAsset ? { width: 50 } : void 0, children: [
51979
51987
  /* @__PURE__ */ jsx(Tooltip, { content: amount, style: { width: "min-content" }, children: /* @__PURE__ */ jsx(Text, { normalTextColor: true, style: { width: "max-content" }, children: formattedAmount }) }),
51980
51988
  /* @__PURE__ */ jsx(SmallText, { title: asset == null ? void 0 : asset.chainName, textWrap: "nowrap", overflowEllipsis: true, children: subtitle })
@@ -52226,16 +52234,13 @@ const initSentry = () => {
52226
52234
  networkResponseHeaders: ["X-Custom-Header"],
52227
52235
  useCompression: false
52228
52236
  })
52229
- ],
52230
- // Session Replay
52231
- replaysSessionSampleRate: 1,
52232
- replaysOnErrorSampleRate: 0
52237
+ ]
52233
52238
  });
52234
52239
  isSentryInitialized = true;
52235
52240
  };
52236
52241
  const name = "@skip-go/widget";
52237
52242
  const description = "Swap widget";
52238
- const version = "3.9.6";
52243
+ const version = "3.10.0";
52239
52244
  const repository = {
52240
52245
  url: "https://github.com/skip-mev/skip-go",
52241
52246
  directory: "packages/widget"
@@ -52330,13 +52335,12 @@ const peerDependencies = {
52330
52335
  const dependencies = {
52331
52336
  "@amplitude/analytics-browser": "^2.11.12",
52332
52337
  "@amplitude/plugin-session-replay-browser": "^1.16.5",
52333
- "@cosmjs/amino": "0.31.3",
52334
- "@cosmjs/cosmwasm-stargate": "0.31.3",
52335
- "@cosmjs/launchpad": "*",
52336
- "@cosmjs/math": "^0.31.3",
52337
- "@cosmjs/proto-signing": "0.31.3",
52338
- "@cosmjs/stargate": "0.31.3",
52339
- "@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",
52340
52344
  "@ebay/nice-modal-react": "^1.2.13",
52341
52345
  "@eslint/compat": "^1.1.1",
52342
52346
  "@leapwallet/cosmos-social-login-capsule-provider": "^0.0.44",
@@ -52361,7 +52365,7 @@ const dependencies = {
52361
52365
  "@walletconnect/solana-adapter": "^0.0.6",
52362
52366
  add: "^2.0.6",
52363
52367
  bech32: "^2.0.0",
52364
- graz: "^0.2.6",
52368
+ graz: "0.3.1",
52365
52369
  jotai: "^2.10.1",
52366
52370
  "jotai-effect": "^1.0.2",
52367
52371
  "jotai-tanstack-query": "^0.8.6",
@@ -52410,7 +52414,6 @@ const initAmplitude = () => {
52410
52414
  init$1("14616a575f32087cf0403ab8f3ea3ce0", {
52411
52415
  autocapture: true,
52412
52416
  appVersion: version
52413
- // serverUrl: "https://go.skip.build/api/amplitude"
52414
52417
  });
52415
52418
  isAmplitudeInitialized = true;
52416
52419
  };
@@ -1,4 +1,4 @@
1
- import { g as getAugmentedNamespace, c as commonjsGlobal, a as getDefaultExportFromCjs, p as process$1 } from "./index-DmqeTZFG.js";
1
+ import { g as getAugmentedNamespace, c as commonjsGlobal, a as getDefaultExportFromCjs, p as process$1 } from "./index-BJ7FPDIO.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
@@ -1,4 +1,4 @@
1
- import { W, d, l, o, r } from "./index-DmqeTZFG.js";
1
+ import { W, d, l, o, r } from "./index-BJ7FPDIO.js";
2
2
  export {
3
3
  W as Widget,
4
4
  d as defaultTheme,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@skip-go/widget",
3
3
  "description": "Swap widget",
4
- "version": "3.9.6",
4
+ "version": "3.10.0",
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.31.3",
32
- "@cosmjs/cosmwasm-stargate": "0.31.3",
33
- "@cosmjs/launchpad": "*",
34
- "@cosmjs/math": "^0.31.3",
35
- "@cosmjs/proto-signing": "0.31.3",
36
- "@cosmjs/stargate": "0.31.3",
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.6",
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": "^0.2.6",
61
+ "graz": "0.3.1",
63
62
  "jotai": "^2.10.1",
64
63
  "jotai-effect": "^1.0.2",
65
64
  "jotai-tanstack-query": "^0.8.6",