@skip-go/widget 3.12.9 → 3.12.11-alpha.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.
@@ -45486,7 +45486,7 @@ function walletConnect(parameters) {
45486
45486
  const optionalChains = config2.chains.map((x2) => x2.id);
45487
45487
  if (!optionalChains.length)
45488
45488
  return;
45489
- const { EthereumProvider } = await import("./index.es-CQh3oq2n.js");
45489
+ const { EthereumProvider } = await import("./index.es-BAMGhIE-.js");
45490
45490
  return await EthereumProvider.init({
45491
45491
  ...parameters,
45492
45492
  disableProviderPing: true,
@@ -48069,16 +48069,17 @@ const useGetAccount = () => {
48069
48069
  const getAccount = useCallback(
48070
48070
  // if checkChainType is true, it only check wallet connected no chainId is dependent
48071
48071
  (chainId, checkChainType, chainType) => {
48072
- var _a;
48073
48072
  if (!chainId) return;
48074
- chainType ?? (chainType = (_a = chains2 == null ? void 0 : chains2.find((c) => c.chainId === chainId)) == null ? void 0 : _a.chainType);
48073
+ const chain = chains2 == null ? void 0 : chains2.find((c) => c.chainId === chainId);
48074
+ chainType ?? (chainType = chain == null ? void 0 : chain.chainType);
48075
48075
  if (connectedAddress && connectedAddress[chainId]) {
48076
48076
  return {
48077
48077
  address: connectedAddress[chainId],
48078
48078
  chainType,
48079
48079
  wallet: {
48080
48080
  name: "injected",
48081
- prettyName: "injected"
48081
+ prettyName: "injected",
48082
+ logo: chain == null ? void 0 : chain.logoUri
48082
48083
  }
48083
48084
  };
48084
48085
  }
@@ -48108,16 +48109,16 @@ const useGetAccount = () => {
48108
48109
  if (!evmAccount.address) return;
48109
48110
  if (!evmAccount.connector) return;
48110
48111
  const getLogo = () => {
48111
- var _a2, _b, _c;
48112
- if (((_a2 = evmAccount == null ? void 0 : evmAccount.connector) == null ? void 0 : _a2.id) === "walletConnect") {
48112
+ var _a, _b, _c;
48113
+ if (((_a = evmAccount == null ? void 0 : evmAccount.connector) == null ? void 0 : _a.id) === "walletConnect") {
48113
48114
  return (evmWallet == null ? void 0 : evmWallet.logo) ?? walletConnectLogo;
48114
48115
  }
48115
48116
  if ((_b = evmAccount == null ? void 0 : evmAccount.connector) == null ? void 0 : _b.id.includes("keplr")) {
48116
48117
  return getCosmosWalletInfo(WalletType.KEPLR).imgSrc;
48117
48118
  }
48118
48119
  return (_c = connectors.find((item) => {
48119
- var _a3;
48120
- return item.id === ((_a3 = evmAccount.connector) == null ? void 0 : _a3.id);
48120
+ var _a2;
48121
+ return item.id === ((_a2 = evmAccount.connector) == null ? void 0 : _a2.id);
48121
48122
  })) == null ? void 0 : _c.icon;
48122
48123
  };
48123
48124
  return {
@@ -48636,7 +48637,7 @@ function getTotalFees(fees2) {
48636
48637
  return {
48637
48638
  assetAmount: totalAsset,
48638
48639
  formattedAssetAmount: `${totalAsset.toFixed(6)} ${symbol}`,
48639
- formattedUsdAmount: totalUsd > 0 ? formatUSD(totalUsd.toString()) : void 0
48640
+ formattedUsdAmount: totalUsd > 0 ? formatUSD(totalUsd.toString()) : "< $0.01"
48640
48641
  };
48641
48642
  }
48642
48643
  const QuestionMarkIcon = ({
@@ -49386,7 +49387,7 @@ const SwapPageAssetChainInput = ({
49386
49387
  isWaitingToUpdateInputValue,
49387
49388
  badPriceWarning,
49388
49389
  disabled,
49389
- feeAmountUsd,
49390
+ feeLabel,
49390
49391
  feeWarning
49391
49392
  }) => {
49392
49393
  var _a;
@@ -49562,10 +49563,7 @@ const SwapPageAssetChainInput = ({
49562
49563
  "%"
49563
49564
  ] })
49564
49565
  ] }) : /* @__PURE__ */ jsx(SmallText, { children: usdValue && formatUSD(usdValue) }),
49565
- feeAmountUsd && /* @__PURE__ */ jsx(Row, { align: "center", gap: 4, children: /* @__PURE__ */ jsxs(SmallText, { color: feeColor, children: [
49566
- feeAmountUsd,
49567
- " in fees"
49568
- ] }) })
49566
+ usdValue && feeLabel && /* @__PURE__ */ jsx(Row, { align: "center", gap: 4, children: /* @__PURE__ */ jsx(SmallText, { color: feeColor, children: feeLabel }) })
49569
49567
  ] }),
49570
49568
  (assetDetails == null ? void 0 : assetDetails.chainName) ? /* @__PURE__ */ jsx(
49571
49569
  StyledOnChainGhostButton,
@@ -50711,6 +50709,7 @@ const SwapExecutionPageRouteSimpleRow = ({
50711
50709
  case "source": {
50712
50710
  const selected = chainAddressArray[0];
50713
50711
  return {
50712
+ source: selected == null ? void 0 : selected.source,
50714
50713
  address: selected == null ? void 0 : selected.address,
50715
50714
  image: (selected == null ? void 0 : selected.source) === "wallet" && ((_a = selected == null ? void 0 : selected.wallet) == null ? void 0 : _a.walletInfo.logo) || void 0
50716
50715
  };
@@ -50718,6 +50717,7 @@ const SwapExecutionPageRouteSimpleRow = ({
50718
50717
  case "destination": {
50719
50718
  const selected = chainAddressArray[chainAddressArray.length - 1];
50720
50719
  return {
50720
+ source: selected == null ? void 0 : selected.source,
50721
50721
  address: selected == null ? void 0 : selected.address,
50722
50722
  image: (selected == null ? void 0 : selected.source) === "wallet" && ((_b = selected == null ? void 0 : selected.wallet) == null ? void 0 : _b.walletInfo.logo) || void 0
50723
50723
  };
@@ -50726,10 +50726,11 @@ const SwapExecutionPageRouteSimpleRow = ({
50726
50726
  }, [chainAddresses, context]);
50727
50727
  const walletImage = useCroppedImage(source.image);
50728
50728
  const renderWalletImage = useMemo(() => {
50729
+ if (source.source === "injected") return;
50729
50730
  if (!source.address) return;
50730
50731
  if (walletImage) return /* @__PURE__ */ jsx("img", { height: 12, width: 12, src: walletImage });
50731
50732
  return /* @__PURE__ */ jsx(SkeletonElement, { height: 12, width: 12 });
50732
- }, [source.address, walletImage]);
50733
+ }, [source.address, source.source, walletImage]);
50733
50734
  const renderExplorerLink = useMemo(() => {
50734
50735
  if (!explorerLink) return;
50735
50736
  if (isMobileScreenSize) {
@@ -51242,9 +51243,8 @@ const useAutoSetAddress = () => {
51242
51243
  requiredChainAddresses.forEach(async (chainId, index) => {
51243
51244
  var _a2, _b2;
51244
51245
  const chain = chains2 == null ? void 0 : chains2.find((c) => c.chainId === chainId);
51245
- if (!chain) {
51246
- return;
51247
- }
51246
+ if (!chain) return;
51247
+ const chainType = chain.chainType;
51248
51248
  const showSetAddressModal = () => {
51249
51249
  const isSignRequired = signRequiredChains == null ? void 0 : signRequiredChains.includes(chainId);
51250
51250
  NiceModal.show(Modals.SetAddressModal, {
@@ -51254,14 +51254,37 @@ const useAutoSetAddress = () => {
51254
51254
  });
51255
51255
  };
51256
51256
  if (chainAddresses[index].source === WalletSource.Input) return;
51257
+ const isInjectedWallet = connectedAddress == null ? void 0 : connectedAddress[chainId];
51258
+ if (isInjectedWallet) {
51259
+ setChainAddresses((prev2) => {
51260
+ return {
51261
+ ...prev2,
51262
+ [index]: {
51263
+ chainId,
51264
+ address: connectedAddress == null ? void 0 : connectedAddress[chainId],
51265
+ chainType,
51266
+ source: WalletSource.Injected,
51267
+ wallet: {
51268
+ walletName: "injected",
51269
+ walletPrettyName: "injected",
51270
+ walletChainType: chainType,
51271
+ walletInfo: {
51272
+ logo: chain.logoUri
51273
+ }
51274
+ }
51275
+ }
51276
+ };
51277
+ });
51278
+ setIsLoading(false);
51279
+ return;
51280
+ }
51257
51281
  try {
51258
- const chainType = chain.chainType;
51259
51282
  const wallets = createWallets[chainType](chainId);
51260
51283
  const walletName = (_a2 = sourceWallet[chainType]) == null ? void 0 : _a2.walletName;
51261
51284
  const wallet = wallets.find((w2) => w2.walletName === walletName);
51262
51285
  const isSignRequired = signRequiredChains == null ? void 0 : signRequiredChains.includes(chainId);
51263
51286
  const response = await ((_b2 = wallet == null ? void 0 : wallet.getAddress) == null ? void 0 : _b2.call(wallet, { signRequired: isSignRequired }));
51264
- const isInjectedWallet = connectedAddress == null ? void 0 : connectedAddress[chainId];
51287
+ const isInjectedWallet2 = connectedAddress == null ? void 0 : connectedAddress[chainId];
51265
51288
  const address = (connectedAddress == null ? void 0 : connectedAddress[chainId]) ?? (response == null ? void 0 : response.address);
51266
51289
  if (!address) {
51267
51290
  throw new Error(
@@ -51286,7 +51309,7 @@ const useAutoSetAddress = () => {
51286
51309
  chainId,
51287
51310
  address,
51288
51311
  chainType,
51289
- source: isInjectedWallet ? WalletSource.Injected : WalletSource.Wallet,
51312
+ source: isInjectedWallet2 ? WalletSource.Injected : WalletSource.Wallet,
51290
51313
  wallet: wallet ? {
51291
51314
  walletName: wallet == null ? void 0 : wallet.walletName,
51292
51315
  walletPrettyName: wallet == null ? void 0 : wallet.walletPrettyName,
@@ -52533,7 +52556,7 @@ const ConnectedWalletContent = () => {
52533
52556
  align: "center",
52534
52557
  gap: 8,
52535
52558
  children: [
52536
- walletImage ? /* @__PURE__ */ jsx("img", { style: { objectFit: "cover" }, src: walletImage, height: 16, width: 16 }) : /* @__PURE__ */ jsx(SkeletonElement, { height: 16, width: 16 }),
52559
+ sourceAccount.wallet.name !== "injected" && (walletImage ? /* @__PURE__ */ jsx("img", { style: { objectFit: "cover" }, src: walletImage, height: 16, width: 16 }) : /* @__PURE__ */ jsx(SkeletonElement, { height: 16, width: 16 })),
52537
52560
  isLoading ? /* @__PURE__ */ jsx(
52538
52561
  "div",
52539
52562
  {
@@ -52743,7 +52766,7 @@ const useConnectToMissingCosmosChain = () => {
52743
52766
  return { isAskingToApproveConnection };
52744
52767
  };
52745
52768
  const SwapPage = () => {
52746
- var _a, _b;
52769
+ var _a;
52747
52770
  const { SettingsFooter, drawerOpen } = useSettingsDrawer();
52748
52771
  useAtom(onRouteUpdatedEffect);
52749
52772
  useAtom(preloadSigningStargateClientEffect);
@@ -52890,7 +52913,14 @@ const SwapPage = () => {
52890
52913
  return calculatePercentageChange(route2.usdAmountIn, route2.usdAmountOut);
52891
52914
  }, [isWaitingForNewRoute, route2 == null ? void 0 : route2.usdAmountIn, route2 == null ? void 0 : route2.usdAmountOut]);
52892
52915
  const fees2 = useMemo(() => route2 ? getFeeList(route2) : [], [route2]);
52893
- const totalFeeUsd = (_a = getTotalFees(fees2)) == null ? void 0 : _a.formattedUsdAmount;
52916
+ const feeLabel = useMemo(() => {
52917
+ var _a2;
52918
+ const formattedUsdAmount = (_a2 = getTotalFees(fees2)) == null ? void 0 : _a2.formattedUsdAmount;
52919
+ if (formattedUsdAmount) {
52920
+ return `${formattedUsdAmount} in fees`;
52921
+ }
52922
+ return "no fees";
52923
+ }, [fees2]);
52894
52924
  const feeWarning = useMemo(() => {
52895
52925
  if (!(route2 == null ? void 0 : route2.usdAmountIn) || !(route2 == null ? void 0 : route2.usdAmountOut)) return false;
52896
52926
  return parseFloat(route2.usdAmountOut) <= parseFloat(route2.usdAmountIn) * 0.9;
@@ -52954,7 +52984,7 @@ const SwapPage = () => {
52954
52984
  return /* @__PURE__ */ jsx(MainButton, { label, disabled: true, icon: ICONS.swap, fontSize: computeFontSize(label) });
52955
52985
  }
52956
52986
  const onClick = () => {
52957
- var _a3, _b2;
52987
+ var _a3, _b;
52958
52988
  track("swap page: continue button - clicked", {
52959
52989
  route: route2,
52960
52990
  type: isSwapOperation ? "swap" : "send",
@@ -52999,7 +53029,7 @@ const SwapPage = () => {
52999
53029
  });
53000
53030
  return;
53001
53031
  }
53002
- if (((_b2 = route2 == null ? void 0 : route2.warning) == null ? void 0 : _b2.type) === "LOW_INFO_WARNING") {
53032
+ if (((_b = route2 == null ? void 0 : route2.warning) == null ? void 0 : _b.type) === "LOW_INFO_WARNING") {
53003
53033
  track("warning page: low info", { route: route2 });
53004
53034
  setError({
53005
53035
  errorWarningType: ErrorWarningType.LowInfoWarning,
@@ -53103,8 +53133,8 @@ const SwapPage = () => {
53103
53133
  usdValue: route2 == null ? void 0 : route2.usdAmountOut,
53104
53134
  value: destinationAsset == null ? void 0 : destinationAsset.amount,
53105
53135
  priceChangePercentage: Number(priceChangePercentage),
53106
- badPriceWarning: ((_b = route2 == null ? void 0 : route2.warning) == null ? void 0 : _b.type) === "BAD_PRICE_WARNING",
53107
- feeAmountUsd: totalFeeUsd,
53136
+ badPriceWarning: ((_a = route2 == null ? void 0 : route2.warning) == null ? void 0 : _a.type) === "BAD_PRICE_WARNING",
53137
+ feeLabel,
53108
53138
  feeWarning,
53109
53139
  onChangeValue: (v2) => {
53110
53140
  track("swap page: destination asset amount input - changed", { amount: v2 });
@@ -54295,7 +54325,7 @@ const initSentry = () => {
54295
54325
  };
54296
54326
  const name = "@skip-go/widget";
54297
54327
  const description = "Swap widget";
54298
- const version = "3.12.9";
54328
+ const version = "3.12.11-alpha.0";
54299
54329
  const repository = {
54300
54330
  url: "https://github.com/skip-mev/skip-go",
54301
54331
  directory: "packages/widget"
@@ -54312,9 +54342,7 @@ const scripts = {
54312
54342
  "build:web-component": "NODE_OPTIONS=--max-old-space-size=32384 webpack --config webpack.config.js",
54313
54343
  "publish:web-component": "npm run build:web-component && cd web-component && npm publish && cd ..",
54314
54344
  prepack: "yarn run pre",
54315
- postpack: "yarn run post",
54316
54345
  pre: "npm run build && node scripts/prepublish.cjs",
54317
- post: "git checkout -- package.json",
54318
54346
  "generate-chains": "node scripts/generate-chains.cjs",
54319
54347
  "update-registries": "yarn up @initia/initia-registry chain-registry",
54320
54348
  test: "yarn playwright test",
@@ -1,4 +1,4 @@
1
- import { g as getAugmentedNamespace, c as commonjsGlobal, a as getDefaultExportFromCjs, p as process$1 } from "./index-piWd6Ztl.js";
1
+ import { g as getAugmentedNamespace, c as commonjsGlobal, a as getDefaultExportFromCjs, p as process$1 } from "./index-WwrLRy4v.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, s } from "./index-piWd6Ztl.js";
1
+ import { W, d, l, o, r, s } from "./index-WwrLRy4v.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.12.9",
4
+ "version": "3.12.11-alpha.0",
5
5
  "repository": {
6
6
  "url": "https://github.com/skip-mev/skip-go",
7
7
  "directory": "packages/widget"
@@ -42,7 +42,7 @@
42
42
  "@penumbra-zone/transport-dom": "^7.5.0",
43
43
  "@r2wc/react-to-web-component": "^2.0.3",
44
44
  "@sentry/react": "^8.46.0",
45
- "@skip-go/client": "1.3.6",
45
+ "@skip-go/client": "1.3.7",
46
46
  "@solana/spl-token": "^0.4.8",
47
47
  "@solana/wallet-adapter-ledger": "^0.9.25",
48
48
  "@solana/wallet-adapter-react": "^0.15.39",