@skip-go/widget 3.12.3 → 3.12.4

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, { useContext, useState, useMemo, useEffect, 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, balances, FeeType, GAS_STATION_CHAIN_IDS, setClientOptions } from "@skip-go/client";
6
+ import { assets, chains, bridges, venues, transactionStatus, ChainType, getSigningStargateClient, route, executeRoute, balances, BridgeType, 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, init as init$1, add } from "@amplitude/analytics-browser";
@@ -45294,7 +45294,7 @@ function walletConnect(parameters) {
45294
45294
  const optionalChains = config2.chains.map((x2) => x2.id);
45295
45295
  if (!optionalChains.length)
45296
45296
  return;
45297
- const { EthereumProvider } = await import("./index.es-DrM_N5rw.js");
45297
+ const { EthereumProvider } = await import("./index.es-DJQaePo-.js");
45298
45298
  return await EthereumProvider.init({
45299
45299
  ...parameters,
45300
45300
  disableProviderPing: true,
@@ -48391,78 +48391,47 @@ const usdFormatter = new Intl.NumberFormat("en-US", {
48391
48391
  currency: "USD",
48392
48392
  maximumFractionDigits: 2
48393
48393
  });
48394
- const computeOpFee = (op) => {
48395
- if (op.type === OperationType.goFastTransfer && op.fee) {
48396
- const {
48397
- feeAsset: feeAsset2,
48398
- sourceChainFeeAmount,
48399
- destinationChainFeeAmount,
48400
- bpsFeeAmount,
48401
- sourceChainFeeUsd,
48402
- destinationChainFeeUsd,
48403
- bpsFeeUsd
48404
- } = op.fee;
48405
- const totalAmt = [sourceChainFeeAmount, destinationChainFeeAmount, bpsFeeAmount].reduce((s, a) => s + Number(a), 0).toString();
48406
- const totalUsd = [sourceChainFeeUsd, destinationChainFeeUsd, bpsFeeUsd].reduce(
48407
- (s, u) => s + Number(u),
48408
- 0
48409
- );
48410
- const human2 = convertTokenAmountToHumanReadableAmount(totalAmt, feeAsset2.decimals);
48411
- return {
48412
- assetAmount: Number(human2),
48413
- formattedAssetAmount: `${human2} ${feeAsset2.symbol}`,
48414
- formattedUsdAmount: formatUSD(totalUsd.toString())
48415
- };
48416
- }
48417
- const { feeAmount, feeAsset, usdFeeAmount } = op;
48418
- if (!feeAmount || !(feeAsset == null ? void 0 : feeAsset.decimals)) return;
48419
- const human = convertTokenAmountToHumanReadableAmount(feeAmount, feeAsset.decimals);
48420
- return {
48421
- assetAmount: Number(human),
48422
- formattedAssetAmount: `${human} ${feeAsset.symbol}`,
48423
- formattedUsdAmount: usdFeeAmount ? formatUSD(usdFeeAmount) : void 0
48424
- };
48425
- };
48426
- function computeSmartRelayFee(estimatedFees) {
48427
- const relay = estimatedFees.filter((f2) => f2.feeType === FeeType.SMART_RELAY);
48428
- if (!relay.length) return;
48429
- const totalAmt = relay.reduce((s, f2) => s + Number(f2.amount), 0).toString();
48430
- const totalUsd = relay.reduce((s, f2) => s + Number(f2.usdAmount), 0);
48431
- const { originAsset } = relay[0];
48432
- const decimals = originAsset.decimals ?? 6;
48433
- const human = convertTokenAmountToHumanReadableAmount(totalAmt, decimals);
48394
+ const getFeeDetail = (estimatedFee) => {
48395
+ const humanReadableAmount = convertTokenAmountToHumanReadableAmount(
48396
+ estimatedFee.amount ?? 0,
48397
+ estimatedFee.originAsset.decimals
48398
+ );
48399
+ const totalUsd = Number(estimatedFee.usdAmount);
48434
48400
  return {
48435
- assetAmount: Number(human),
48436
- formattedAssetAmount: `${human} ${originAsset.symbol}`,
48401
+ assetAmount: Number(humanReadableAmount),
48402
+ formattedAssetAmount: `${humanReadableAmount} ${estimatedFee.originAsset.symbol}`,
48437
48403
  formattedUsdAmount: formatUSD(totalUsd.toString())
48438
48404
  };
48439
- }
48405
+ };
48406
+ const BRIDGE_ID_TO_LABEL_MAP = {
48407
+ [BridgeType.IBC]: "IBC",
48408
+ [BridgeType.AXELAR]: "Axelar",
48409
+ [BridgeType.HYPERLANE]: "Hyperlane",
48410
+ [BridgeType.GO_FAST]: "Go-Fast",
48411
+ [BridgeType.OPINIT]: "OpInit",
48412
+ [BridgeType.CCTP]: "CCTP",
48413
+ [BridgeType.EUREKA]: "IBC Eureka",
48414
+ [BridgeType.STARGATE]: "Stargate",
48415
+ [BridgeType.LAYER_ZERO]: "Layer Zero"
48416
+ };
48440
48417
  function getFeeList(route2) {
48441
- const fees2 = [];
48442
- if (!route2.operations) return fees2;
48443
- const clientOps = getClientOperations(route2.operations);
48444
- clientOps.forEach((op) => {
48445
- const fee = computeOpFee(op);
48446
- if (!fee) return;
48447
- let label = "Bridge Fee";
48448
- switch (op.type) {
48449
- case OperationType.axelarTransfer:
48450
- label = "Axelar Bridging Fee";
48451
- break;
48452
- case OperationType.hyperlaneTransfer:
48453
- label = "Hyperlane Bridging Fee";
48454
- break;
48455
- case OperationType.goFastTransfer:
48456
- label = "Go-Fast Transfer Fee";
48457
- break;
48418
+ if (!route2.estimatedFees || route2.estimatedFees.length === 0) {
48419
+ return [];
48420
+ }
48421
+ return route2.estimatedFees.map((fee) => {
48422
+ if (fee.feeType === FeeType.SMART_RELAY) {
48423
+ return {
48424
+ label: "Smart Relay Fee",
48425
+ fee: getFeeDetail(fee)
48426
+ };
48458
48427
  }
48459
- fees2.push({ label, fee });
48428
+ const label = fee.bridgeId ? `${BRIDGE_ID_TO_LABEL_MAP[fee.bridgeId]} Bridging Fee` : "Bridging Fee";
48429
+ const feeDetail = getFeeDetail(fee);
48430
+ return {
48431
+ label,
48432
+ fee: feeDetail
48433
+ };
48460
48434
  });
48461
- const smartFee = computeSmartRelayFee(route2.estimatedFees || []);
48462
- if (smartFee) {
48463
- fees2.push({ label: "Smart Relay Fee", fee: smartFee });
48464
- }
48465
- return fees2;
48466
48435
  }
48467
48436
  function getTotalFees(fees2) {
48468
48437
  if (!fees2.length) return;
@@ -49332,7 +49301,7 @@ const SwapPageAssetChainInput = ({
49332
49301
  onMouseEnter: () => setIsAssetButtonHovered(true),
49333
49302
  onMouseLeave: () => setIsAssetButtonHovered(false),
49334
49303
  children: [
49335
- (assetDetails == null ? void 0 : assetDetails.assetImage) && assetDetails.symbol ? /* @__PURE__ */ jsxs(StyledAssetLabel, { align: "center", justify: "center", gap: 7, children: [
49304
+ assetDetails.symbol ? /* @__PURE__ */ jsxs(StyledAssetLabel, { align: "center", justify: "center", gap: 7, children: [
49336
49305
  /* @__PURE__ */ jsx(GroupedAssetImage, { height: 23, width: 23, groupedAsset }),
49337
49306
  /* @__PURE__ */ jsx(Text, { useWindowsTextHack: true, children: assetDetails.symbol }),
49338
49307
  isMobileScreenSize && /* @__PURE__ */ jsx(
@@ -54122,7 +54091,7 @@ const initSentry = () => {
54122
54091
  };
54123
54092
  const name = "@skip-go/widget";
54124
54093
  const description = "Swap widget";
54125
- const version = "3.12.3";
54094
+ const version = "3.12.4";
54126
54095
  const repository = {
54127
54096
  url: "https://github.com/skip-mev/skip-go",
54128
54097
  directory: "packages/widget"
@@ -54574,7 +54543,7 @@ const CosmosProvider = ({ children }) => {
54574
54543
  {
54575
54544
  grazOptions: {
54576
54545
  chains: isTestnet ? testnetChains : mainnetChains,
54577
- autoReconnect: false,
54546
+ autoReconnect: true,
54578
54547
  walletDefaultOptions: {
54579
54548
  sign: {
54580
54549
  preferNoSetFee: true,
@@ -1,4 +1,4 @@
1
- import { g as getAugmentedNamespace, c as commonjsGlobal, a as getDefaultExportFromCjs, p as process$1 } from "./index-BkuAy8zJ.js";
1
+ import { g as getAugmentedNamespace, c as commonjsGlobal, a as getDefaultExportFromCjs, p as process$1 } from "./index-BbqLTTYa.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-BkuAy8zJ.js";
1
+ import { W, d, l, o, r, s } from "./index-BbqLTTYa.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.3",
4
+ "version": "3.12.4",
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.1",
45
+ "@skip-go/client": "1.3.2",
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",