@skip-go/widget 3.12.4 → 3.12.6

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.
@@ -4890,6 +4890,7 @@ function getSimpleStatus(state) {
4890
4890
  case "GO_FAST_TRANSFER_SENT":
4891
4891
  case "STARGATE_TRANSFER_SENT":
4892
4892
  case "LAYER_ZERO_TRANSFER_SENT":
4893
+ case "LAYER_ZERO_TRANSFER_WAITING_FOR_COMPOSE":
4893
4894
  return "pending";
4894
4895
  case "TRANSFER_SUCCESS":
4895
4896
  case "AXELAR_TRANSFER_SUCCESS":
@@ -45294,7 +45295,7 @@ function walletConnect(parameters) {
45294
45295
  const optionalChains = config2.chains.map((x2) => x2.id);
45295
45296
  if (!optionalChains.length)
45296
45297
  return;
45297
- const { EthereumProvider } = await import("./index.es-DJQaePo-.js");
45298
+ const { EthereumProvider } = await import("./index.es-CYingXuF.js");
45298
45299
  return await EthereumProvider.init({
45299
45300
  ...parameters,
45300
45301
  disableProviderPing: true,
@@ -48399,7 +48400,7 @@ const getFeeDetail = (estimatedFee) => {
48399
48400
  const totalUsd = Number(estimatedFee.usdAmount);
48400
48401
  return {
48401
48402
  assetAmount: Number(humanReadableAmount),
48402
- formattedAssetAmount: `${humanReadableAmount} ${estimatedFee.originAsset.symbol}`,
48403
+ formattedAssetAmount: `${formatDisplayAmount(humanReadableAmount)} ${estimatedFee.originAsset.symbol}`,
48403
48404
  formattedUsdAmount: formatUSD(totalUsd.toString())
48404
48405
  };
48405
48406
  };
@@ -49188,7 +49189,9 @@ const SwapPageAssetChainInput = ({
49188
49189
  priceChangePercentage,
49189
49190
  isWaitingToUpdateInputValue,
49190
49191
  badPriceWarning,
49191
- disabled
49192
+ disabled,
49193
+ feeAmountUsd,
49194
+ feeWarning
49192
49195
  }) => {
49193
49196
  var _a;
49194
49197
  const theme = nt();
@@ -49272,6 +49275,7 @@ const SwapPageAssetChainInput = ({
49272
49275
  }
49273
49276
  return theme.error.text;
49274
49277
  }, [priceChangePercentage, theme.error.text, theme.primary.text.normal, theme.success.text]);
49278
+ const feeColor = feeWarning ? theme.error.text : theme.primary.text.lowContrast;
49275
49279
  const displayedValue = formatNumberWithCommas(value || "");
49276
49280
  const isLargeNumber = shouldReduceFontSize(value);
49277
49281
  const [isAssetButtonHovered, setIsAssetButtonHovered] = useState(false);
@@ -49339,29 +49343,34 @@ const SwapPageAssetChainInput = ({
49339
49343
  )
49340
49344
  ] }),
49341
49345
  /* @__PURE__ */ jsxs(Row, { justify: "space-between", align: "center", children: [
49342
- priceChangePercentage ? /* @__PURE__ */ jsxs(Row, { align: "center", gap: 6, children: [
49343
- /* @__PURE__ */ jsx(
49344
- SmallTextButton,
49345
- {
49346
- color: priceChangeColor,
49347
- onMouseEnter: () => setShowPriceChangePercentage(true),
49348
- onMouseLeave: () => setShowPriceChangePercentage(false),
49349
- children: usdValue && formatUSD(usdValue)
49350
- }
49351
- ),
49352
- /* @__PURE__ */ jsx(
49353
- TinyTriangleIcon,
49354
- {
49355
- color: priceChangeColor,
49356
- direction: (priceChangePercentage ?? 0) > 0 ? "up" : "down",
49357
- style: { scale: showPriceChangePercentage ? "1" : "0.7" }
49358
- }
49359
- ),
49360
- showPriceChangePercentage && /* @__PURE__ */ jsxs(SmallText, { color: priceChangeColor, children: [
49361
- priceChangePercentage,
49362
- "%"
49363
- ] })
49364
- ] }) : /* @__PURE__ */ jsx(SmallText, { children: usdValue && formatUSD(usdValue) }),
49346
+ /* @__PURE__ */ jsxs(Row, { align: "center", gap: 8, children: [
49347
+ priceChangePercentage ? /* @__PURE__ */ jsxs(Row, { align: "center", gap: 6, children: [
49348
+ /* @__PURE__ */ jsx(
49349
+ SmallTextButton,
49350
+ {
49351
+ onMouseEnter: () => setShowPriceChangePercentage(true),
49352
+ onMouseLeave: () => setShowPriceChangePercentage(false),
49353
+ children: usdValue && formatUSD(usdValue)
49354
+ }
49355
+ ),
49356
+ /* @__PURE__ */ jsx(
49357
+ TinyTriangleIcon,
49358
+ {
49359
+ color: priceChangeColor,
49360
+ direction: (priceChangePercentage ?? 0) > 0 ? "up" : "down",
49361
+ style: { scale: showPriceChangePercentage ? "1" : "0.7" }
49362
+ }
49363
+ ),
49364
+ showPriceChangePercentage && /* @__PURE__ */ jsxs(SmallText, { color: priceChangeColor, children: [
49365
+ priceChangePercentage,
49366
+ "%"
49367
+ ] })
49368
+ ] }) : /* @__PURE__ */ jsx(SmallText, { children: usdValue && formatUSD(usdValue) }),
49369
+ feeAmountUsd && /* @__PURE__ */ jsx(Row, { align: "center", gap: 4, children: /* @__PURE__ */ jsxs(SmallText, { color: feeColor, children: [
49370
+ feeAmountUsd,
49371
+ " in fees"
49372
+ ] }) })
49373
+ ] }),
49365
49374
  (assetDetails == null ? void 0 : assetDetails.chainName) ? /* @__PURE__ */ jsx(
49366
49375
  StyledOnChainGhostButton,
49367
49376
  {
@@ -50059,10 +50068,6 @@ const EstimatedDuration = ({ seconds }) => {
50059
50068
  const formatted = seconds ? convertSecondsToMinutesOrHours(seconds) : null;
50060
50069
  return formatted ? /* @__PURE__ */ jsx(Row, { gap: 4, align: "flex-end", children: formatted }) : null;
50061
50070
  };
50062
- const Fee = ({ amount }) => amount ? /* @__PURE__ */ jsxs(Row, { gap: 4, align: "flex-end", children: [
50063
- "Fee: ",
50064
- amount
50065
- ] }) : null;
50066
50071
  const SettingsButton = ({ highlight, changed }) => /* @__PURE__ */ jsxs(StyledSettingsContainer$1, { align: "flex-end", gap: 3, highlightSettings: highlight, children: [
50067
50072
  /* @__PURE__ */ jsxs(CogIconWrapper, { children: [
50068
50073
  /* @__PURE__ */ jsx(CogIcon, {}),
@@ -50082,18 +50087,14 @@ const SwapPageFooterItems = ({
50082
50087
  content,
50083
50088
  showRouteInfo = false,
50084
50089
  showEstimatedTime = false,
50085
- highlightSettings = false,
50086
- showFee = false
50090
+ highlightSettings = false
50087
50091
  }) => {
50088
- var _a;
50089
50092
  const { data: route2, isLoading } = useAtomValue(skipRouteAtom);
50090
50093
  const routePreference = useAtomValue(routePreferenceAtom);
50091
50094
  const settingsChanged = useSettingsChanged();
50092
50095
  const isMobile2 = useIsMobileScreenSize();
50093
50096
  const isGoFast = useIsGoFast(route2);
50094
50097
  const estimatedSeconds = route2 == null ? void 0 : route2.estimatedRouteDurationSeconds;
50095
- const fees2 = useMemo(() => route2 ? getFeeList(route2) : [], [route2]);
50096
- const totalFees = (_a = getTotalFees(fees2)) == null ? void 0 : _a.formattedUsdAmount;
50097
50098
  const signaturesRequired = (route2 == null ? void 0 : route2.txsRequired) ?? 1;
50098
50099
  const leftContent = () => {
50099
50100
  if (content) return content;
@@ -50103,7 +50104,6 @@ const SwapPageFooterItems = ({
50103
50104
  /* @__PURE__ */ jsx(SettingsButton, { highlight: highlightSettings, changed: settingsChanged }),
50104
50105
  /* @__PURE__ */ jsx(EstimatedDuration, { seconds: estimatedSeconds })
50105
50106
  ] }),
50106
- showFee && /* @__PURE__ */ jsx(Fee, { amount: totalFees }),
50107
50107
  !isMobile2 && signaturesRequired > 1 && /* @__PURE__ */ jsx(SignatureRequired, { count: signaturesRequired }),
50108
50108
  !isMobile2 && signaturesRequired <= 1 && isGoFast && /* @__PURE__ */ jsx(RoutePreferenceLabel, { preference: routePreference })
50109
50109
  ] });
@@ -50178,7 +50178,6 @@ const useSettingsDrawer = () => {
50178
50178
  disabled: isRouteError || isWaitingForNewRoute || route2 === void 0,
50179
50179
  showRouteInfo: true,
50180
50180
  showEstimatedTime: true,
50181
- showFee: true,
50182
50181
  onClick: openSettingsDrawer,
50183
50182
  ...props
50184
50183
  }
@@ -52547,7 +52546,7 @@ const useConnectToMissingCosmosChain = () => {
52547
52546
  return { isAskingToApproveConnection };
52548
52547
  };
52549
52548
  const SwapPage = () => {
52550
- var _a;
52549
+ var _a, _b;
52551
52550
  const { SettingsFooter, drawerOpen } = useSettingsDrawer();
52552
52551
  useAtom(onRouteUpdatedEffect);
52553
52552
  useAtom(preloadSigningStargateClientEffect);
@@ -52693,6 +52692,12 @@ const SwapPage = () => {
52693
52692
  }
52694
52693
  return calculatePercentageChange(route2.usdAmountIn, route2.usdAmountOut);
52695
52694
  }, [isWaitingForNewRoute, route2 == null ? void 0 : route2.usdAmountIn, route2 == null ? void 0 : route2.usdAmountOut]);
52695
+ const fees2 = useMemo(() => route2 ? getFeeList(route2) : [], [route2]);
52696
+ const totalFeeUsd = (_a = getTotalFees(fees2)) == null ? void 0 : _a.formattedUsdAmount;
52697
+ const feeWarning = useMemo(() => {
52698
+ if (!(route2 == null ? void 0 : route2.usdAmountIn) || !(route2 == null ? void 0 : route2.usdAmountOut)) return false;
52699
+ return parseFloat(route2.usdAmountOut) <= parseFloat(route2.usdAmountIn) * 0.9;
52700
+ }, [route2 == null ? void 0 : route2.usdAmountIn, route2 == null ? void 0 : route2.usdAmountOut]);
52696
52701
  const swapButton = useMemo(() => {
52697
52702
  var _a2;
52698
52703
  const computeFontSize = (label) => label.length > 36 ? 18 : 24;
@@ -52752,7 +52757,7 @@ const SwapPage = () => {
52752
52757
  return /* @__PURE__ */ jsx(MainButton, { label, disabled: true, icon: ICONS.swap, fontSize: computeFontSize(label) });
52753
52758
  }
52754
52759
  const onClick = () => {
52755
- var _a3, _b;
52760
+ var _a3, _b2;
52756
52761
  track("swap page: continue button - clicked", {
52757
52762
  route: route2,
52758
52763
  type: isSwapOperation ? "swap" : "send",
@@ -52797,7 +52802,7 @@ const SwapPage = () => {
52797
52802
  });
52798
52803
  return;
52799
52804
  }
52800
- if (((_b = route2 == null ? void 0 : route2.warning) == null ? void 0 : _b.type) === "LOW_INFO_WARNING") {
52805
+ if (((_b2 = route2 == null ? void 0 : route2.warning) == null ? void 0 : _b2.type) === "LOW_INFO_WARNING") {
52801
52806
  track("warning page: low info", { route: route2 });
52802
52807
  setError({
52803
52808
  errorWarningType: ErrorWarningType.LowInfoWarning,
@@ -52901,7 +52906,9 @@ const SwapPage = () => {
52901
52906
  usdValue: route2 == null ? void 0 : route2.usdAmountOut,
52902
52907
  value: destinationAsset == null ? void 0 : destinationAsset.amount,
52903
52908
  priceChangePercentage: Number(priceChangePercentage),
52904
- badPriceWarning: ((_a = route2 == null ? void 0 : route2.warning) == null ? void 0 : _a.type) === "BAD_PRICE_WARNING",
52909
+ badPriceWarning: ((_b = route2 == null ? void 0 : route2.warning) == null ? void 0 : _b.type) === "BAD_PRICE_WARNING",
52910
+ feeAmountUsd: totalFeeUsd,
52911
+ feeWarning,
52905
52912
  onChangeValue: (v2) => {
52906
52913
  track("swap page: destination asset amount input - changed", { amount: v2 });
52907
52914
  setDestinationAssetAmount(v2);
@@ -54091,7 +54098,7 @@ const initSentry = () => {
54091
54098
  };
54092
54099
  const name = "@skip-go/widget";
54093
54100
  const description = "Swap widget";
54094
- const version = "3.12.4";
54101
+ const version = "3.12.6";
54095
54102
  const repository = {
54096
54103
  url: "https://github.com/skip-mev/skip-go",
54097
54104
  directory: "packages/widget"
@@ -1,4 +1,4 @@
1
- import { g as getAugmentedNamespace, c as commonjsGlobal, a as getDefaultExportFromCjs, p as process$1 } from "./index-BbqLTTYa.js";
1
+ import { g as getAugmentedNamespace, c as commonjsGlobal, a as getDefaultExportFromCjs, p as process$1 } from "./index-CeNWWMqi.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-BbqLTTYa.js";
1
+ import { W, d, l, o, r, s } from "./index-CeNWWMqi.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.4",
4
+ "version": "3.12.6",
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.2",
45
+ "@skip-go/client": "1.3.3",
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",