@skip-go/widget 3.12.5 → 3.12.7

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