@skip-go/widget 3.12.3 → 3.12.5

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";
@@ -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-DrM_N5rw.js");
45298
+ const { EthereumProvider } = await import("./index.es-DGe-RoNu.js");
45298
45299
  return await EthereumProvider.init({
45299
45300
  ...parameters,
45300
45301
  disableProviderPing: true,
@@ -48391,78 +48392,47 @@ const usdFormatter = new Intl.NumberFormat("en-US", {
48391
48392
  currency: "USD",
48392
48393
  maximumFractionDigits: 2
48393
48394
  });
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);
48395
+ const getFeeDetail = (estimatedFee) => {
48396
+ const humanReadableAmount = convertTokenAmountToHumanReadableAmount(
48397
+ estimatedFee.amount ?? 0,
48398
+ estimatedFee.originAsset.decimals
48399
+ );
48400
+ const totalUsd = Number(estimatedFee.usdAmount);
48434
48401
  return {
48435
- assetAmount: Number(human),
48436
- formattedAssetAmount: `${human} ${originAsset.symbol}`,
48402
+ assetAmount: Number(humanReadableAmount),
48403
+ formattedAssetAmount: `${humanReadableAmount} ${estimatedFee.originAsset.symbol}`,
48437
48404
  formattedUsdAmount: formatUSD(totalUsd.toString())
48438
48405
  };
48439
- }
48406
+ };
48407
+ const BRIDGE_ID_TO_LABEL_MAP = {
48408
+ [BridgeType.IBC]: "IBC",
48409
+ [BridgeType.AXELAR]: "Axelar",
48410
+ [BridgeType.HYPERLANE]: "Hyperlane",
48411
+ [BridgeType.GO_FAST]: "Go-Fast",
48412
+ [BridgeType.OPINIT]: "OpInit",
48413
+ [BridgeType.CCTP]: "CCTP",
48414
+ [BridgeType.EUREKA]: "IBC Eureka",
48415
+ [BridgeType.STARGATE]: "Stargate",
48416
+ [BridgeType.LAYER_ZERO]: "Layer Zero"
48417
+ };
48440
48418
  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;
48419
+ if (!route2.estimatedFees || route2.estimatedFees.length === 0) {
48420
+ return [];
48421
+ }
48422
+ return route2.estimatedFees.map((fee) => {
48423
+ if (fee.feeType === FeeType.SMART_RELAY) {
48424
+ return {
48425
+ label: "Smart Relay Fee",
48426
+ fee: getFeeDetail(fee)
48427
+ };
48458
48428
  }
48459
- fees2.push({ label, fee });
48429
+ const label = fee.bridgeId ? `${BRIDGE_ID_TO_LABEL_MAP[fee.bridgeId]} Bridging Fee` : "Bridging Fee";
48430
+ const feeDetail = getFeeDetail(fee);
48431
+ return {
48432
+ label,
48433
+ fee: feeDetail
48434
+ };
48460
48435
  });
48461
- const smartFee = computeSmartRelayFee(route2.estimatedFees || []);
48462
- if (smartFee) {
48463
- fees2.push({ label: "Smart Relay Fee", fee: smartFee });
48464
- }
48465
- return fees2;
48466
48436
  }
48467
48437
  function getTotalFees(fees2) {
48468
48438
  if (!fees2.length) return;
@@ -49332,7 +49302,7 @@ const SwapPageAssetChainInput = ({
49332
49302
  onMouseEnter: () => setIsAssetButtonHovered(true),
49333
49303
  onMouseLeave: () => setIsAssetButtonHovered(false),
49334
49304
  children: [
49335
- (assetDetails == null ? void 0 : assetDetails.assetImage) && assetDetails.symbol ? /* @__PURE__ */ jsxs(StyledAssetLabel, { align: "center", justify: "center", gap: 7, children: [
49305
+ assetDetails.symbol ? /* @__PURE__ */ jsxs(StyledAssetLabel, { align: "center", justify: "center", gap: 7, children: [
49336
49306
  /* @__PURE__ */ jsx(GroupedAssetImage, { height: 23, width: 23, groupedAsset }),
49337
49307
  /* @__PURE__ */ jsx(Text, { useWindowsTextHack: true, children: assetDetails.symbol }),
49338
49308
  isMobileScreenSize && /* @__PURE__ */ jsx(
@@ -54122,7 +54092,7 @@ const initSentry = () => {
54122
54092
  };
54123
54093
  const name = "@skip-go/widget";
54124
54094
  const description = "Swap widget";
54125
- const version = "3.12.3";
54095
+ const version = "3.12.5";
54126
54096
  const repository = {
54127
54097
  url: "https://github.com/skip-mev/skip-go",
54128
54098
  directory: "packages/widget"
@@ -54574,7 +54544,7 @@ const CosmosProvider = ({ children }) => {
54574
54544
  {
54575
54545
  grazOptions: {
54576
54546
  chains: isTestnet ? testnetChains : mainnetChains,
54577
- autoReconnect: false,
54547
+ autoReconnect: true,
54578
54548
  walletDefaultOptions: {
54579
54549
  sign: {
54580
54550
  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-NF5xbldM.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-NF5xbldM.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.5",
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",