@skip-go/widget 3.12.11 → 3.13.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.
@@ -3,12 +3,10 @@ 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, BridgeType, FeeType, GAS_STATION_CHAIN_IDS, setClientOptions } from "@skip-go/client";
6
+ import { assets, chains, bridges, venues, ChainType, getSigningStargateClient, route, executeRoute, balances, BridgeType, FeeType, GAS_STATION_CHAIN_IDS, subscribeToRouteStatus, setClientOptions } from "@skip-go/client";
7
7
  import { atomWithQuery, atomWithMutation } from "jotai-tanstack-query";
8
8
  import pluralize from "pluralize";
9
- import { track, setUserId, init as init$1, add } from "@amplitude/analytics-browser";
10
- import { setTag, setUser, getReplay, init, breadcrumbsIntegration, dedupeIntegration, functionToStringIntegration, httpContextIntegration, inboundFiltersIntegration, linkedErrorsIntegration, browserSessionIntegration, replayIntegration } from "@sentry/react";
11
- import { useQuery, useMutation, QueryClient, QueryClientProvider } from "@tanstack/react-query";
9
+ import { track, setUserId, init, add } from "@amplitude/analytics-browser";
12
10
  import { atomEffect } from "jotai-effect";
13
11
  import { WalletType, isWalletConnect, useActiveWalletType, useDisconnect, getWallet, checkWallet, connect, useAccount as useAccount$1, getChainInfo as getChainInfo$1, GrazProvider } from "graz";
14
12
  import { createPenumbraClient } from "@penumbra-zone/client";
@@ -19,12 +17,14 @@ import { createConfig, createStorage, useAccount, useConnect, useConnectors, Wag
19
17
  import { ErrorBoundary } from "react-error-boundary";
20
18
  import { createPortal } from "react-dom";
21
19
  import List from "rc-virtual-list";
20
+ import { useMutation, useQuery, QueryClient, QueryClientProvider } from "@tanstack/react-query";
22
21
  import { useWallet, WalletProvider } from "@solana/wallet-adapter-react";
23
22
  import { PublicKey } from "@solana/web3.js";
24
23
  import { CosmWasmClient } from "@cosmjs/cosmwasm-stargate";
25
24
  import { Decimal } from "@cosmjs/math";
26
25
  import { GasPrice, calculateFee } from "@cosmjs/stargate";
27
26
  import { sessionReplayPlugin } from "@amplitude/plugin-session-replay-browser";
27
+ import { v4 } from "uuid";
28
28
  import { LedgerWalletAdapter } from "@solana/wallet-adapter-ledger";
29
29
  import { WalletConnectWalletAdapter } from "@walletconnect/solana-adapter";
30
30
  function getDefaultExportFromCjs$1(x2) {
@@ -4616,9 +4616,6 @@ const UnexpectedErrorPageUnexpected = ({
4616
4616
  const theme = nt();
4617
4617
  const setErrorWarningAtom = useSetAtom(errorWarningAtom);
4618
4618
  const setCurrentPage = useSetAtom(currentPageAtom);
4619
- useEffect(() => {
4620
- setTag("errorMessage", error == null ? void 0 : error.message);
4621
- }, [error == null ? void 0 : error.message]);
4622
4619
  const onClickRetry = () => {
4623
4620
  setErrorWarningAtom(void 0);
4624
4621
  setCurrentPage(Routes.SwapPage);
@@ -4663,336 +4660,6 @@ const UnexpectedErrorPageUnexpected = ({
4663
4660
  )
4664
4661
  ] });
4665
4662
  };
4666
- var OperationType = /* @__PURE__ */ ((OperationType2) => {
4667
- OperationType2["swap"] = "swap";
4668
- OperationType2["evmSwap"] = "evmSwap";
4669
- OperationType2["transfer"] = "transfer";
4670
- OperationType2["axelarTransfer"] = "axelarTransfer";
4671
- OperationType2["cctpTransfer"] = "cctpTransfer";
4672
- OperationType2["hyperlaneTransfer"] = "hyperlaneTransfer";
4673
- OperationType2["opInitTransfer"] = "opInitTransfer";
4674
- OperationType2["bankSend"] = "bankSend";
4675
- OperationType2["goFastTransfer"] = "goFastTransfer";
4676
- OperationType2["stargateTransfer"] = "stargateTransfer";
4677
- OperationType2["eurekaTransfer"] = "eurekaTransfer";
4678
- OperationType2["layerZeroTransfer"] = "layerZeroTransfer";
4679
- return OperationType2;
4680
- })(OperationType || {});
4681
- function getOperationDetailsAndType(operation) {
4682
- const combinedOperation = operation;
4683
- let returnValue = {
4684
- details: {},
4685
- type: void 0
4686
- };
4687
- Object.values(OperationType).find((type2) => {
4688
- var _a;
4689
- const originalDetails = combinedOperation == null ? void 0 : combinedOperation[type2];
4690
- if (originalDetails) {
4691
- const operationDetails = { ...originalDetails };
4692
- switch (type2) {
4693
- case "swap":
4694
- case "evmSwap":
4695
- operationDetails.toChainId = originalDetails.fromChainId;
4696
- break;
4697
- case "axelarTransfer":
4698
- operationDetails.denomIn = ((_a = originalDetails.ibcTransferToAxelar) == null ? void 0 : _a.denomIn) ?? originalDetails.denomIn;
4699
- break;
4700
- case "bankSend": {
4701
- const bankSend = originalDetails;
4702
- operationDetails.denomIn = bankSend.denom;
4703
- operationDetails.denomOut = bankSend.denom;
4704
- operationDetails.fromChainId = bankSend.chainId;
4705
- operationDetails.toChainId = bankSend.chainId;
4706
- break;
4707
- }
4708
- }
4709
- returnValue = {
4710
- details: operationDetails,
4711
- type: type2
4712
- };
4713
- }
4714
- });
4715
- return returnValue;
4716
- }
4717
- function getClientOperation(operation) {
4718
- const { details, type: type2 } = getOperationDetailsAndType(operation);
4719
- return {
4720
- type: type2,
4721
- ...details,
4722
- txIndex: operation.txIndex,
4723
- amountIn: operation.amountIn,
4724
- amountOut: operation.amountOut,
4725
- swapVenues: [
4726
- ...details.swapVenues ?? [],
4727
- ...(details == null ? void 0 : details.swapIn) ? [details == null ? void 0 : details.swapIn.swapVenue] : [],
4728
- ...(details == null ? void 0 : details.swapOut) ? [details == null ? void 0 : details.swapOut.swapVenue] : []
4729
- ]
4730
- };
4731
- }
4732
- function getClientOperations(operations) {
4733
- if (!operations) return [];
4734
- let transferIndex = 0;
4735
- const filteredOperations = filterNeutronSwapFee(operations);
4736
- return filteredOperations.map((operation, index, arr) => {
4737
- const prevOperation = arr[index - 1];
4738
- const signRequired = (() => {
4739
- if (index === 0) {
4740
- return false;
4741
- } else {
4742
- if (operation.txIndex > prevOperation.txIndex) {
4743
- return true;
4744
- }
4745
- return false;
4746
- }
4747
- })();
4748
- const clientOperation = getClientOperation(operation);
4749
- const isSwap = clientOperation.type === "swap" || clientOperation.type === "evmSwap";
4750
- const result = {
4751
- ...clientOperation,
4752
- transferIndex,
4753
- signRequired,
4754
- isSwap
4755
- };
4756
- if (!isSwap) {
4757
- transferIndex++;
4758
- }
4759
- return result;
4760
- });
4761
- }
4762
- function filterNeutronSwapFee(operations) {
4763
- return operations.filter((op, i) => {
4764
- var _a, _b, _c, _d, _e2, _f, _g, _h;
4765
- const clientOperation = getClientOperation(op);
4766
- if (clientOperation.type === "swap" && ((_b = (_a = clientOperation.swapOut) == null ? void 0 : _a.swapVenue) == null ? void 0 : _b.name) === "neutron-astroport" && ((_c = clientOperation.swapOut) == null ? void 0 : _c.swapVenue.chainId) === "neutron-1" && clientOperation.chainId === "neutron-1" && clientOperation.denomOut === "untrn" && clientOperation.fromChainId === "neutron-1" && ((_d = clientOperation.swapOut) == null ? void 0 : _d.swapAmountOut) === "200000") {
4767
- const nextOperation = operations[i + 1];
4768
- if (nextOperation) {
4769
- const nextClientOperation = getClientOperation(nextOperation);
4770
- if (nextClientOperation.type === "swap" && ((_f = (_e2 = nextClientOperation.swapIn) == null ? void 0 : _e2.swapVenue) == null ? void 0 : _f.name) === "neutron-astroport" && ((_h = (_g = nextClientOperation.swapIn) == null ? void 0 : _g.swapVenue) == null ? void 0 : _h.chainId) === "neutron-1" && nextClientOperation.chainId === "neutron-1") {
4771
- return false;
4772
- }
4773
- }
4774
- }
4775
- return true;
4776
- });
4777
- }
4778
- function getClientTransferEvent(transferEvent) {
4779
- const combinedTransferEvent = transferEvent;
4780
- const axelarTransfer = combinedTransferEvent == null ? void 0 : combinedTransferEvent.axelarTransfer;
4781
- const ibcTransfer = combinedTransferEvent == null ? void 0 : combinedTransferEvent.ibcTransfer;
4782
- const cctpTransfer = combinedTransferEvent == null ? void 0 : combinedTransferEvent.cctpTransfer;
4783
- const hyperlaneTransfer = combinedTransferEvent == null ? void 0 : combinedTransferEvent.hyperlaneTransfer;
4784
- const opInitTransfer = combinedTransferEvent == null ? void 0 : combinedTransferEvent.opInitTransfer;
4785
- const goFastTransfer = combinedTransferEvent == null ? void 0 : combinedTransferEvent.goFastTransfer;
4786
- const stargateTransfer = combinedTransferEvent == null ? void 0 : combinedTransferEvent.stargateTransfer;
4787
- const eurekaTransfer = combinedTransferEvent == null ? void 0 : combinedTransferEvent.eurekaTransfer;
4788
- const layerZeroTransfer = combinedTransferEvent == null ? void 0 : combinedTransferEvent.layerZeroTransfer;
4789
- let transferType = "";
4790
- if (axelarTransfer) {
4791
- transferType = "axelarTransfer";
4792
- } else if (ibcTransfer) {
4793
- transferType = "ibcTransfer";
4794
- } else if (cctpTransfer) {
4795
- transferType = "cctpTransfer";
4796
- } else if (hyperlaneTransfer) {
4797
- transferType = "hyperlaneTransfer";
4798
- } else if (opInitTransfer) {
4799
- transferType = "opInitTransfer";
4800
- } else if (goFastTransfer) {
4801
- transferType = "goFastTransfer";
4802
- } else if (stargateTransfer) {
4803
- transferType = "stargateTransfer";
4804
- } else if (eurekaTransfer) {
4805
- transferType = "eurekaTransfer";
4806
- } else if (layerZeroTransfer) {
4807
- transferType = "layerZeroTransfer";
4808
- }
4809
- const getExplorerLink = (type2) => {
4810
- var _a, _b, _c, _d, _e2, _f, _g, _h, _i, _j, _k, _l;
4811
- switch (transferType) {
4812
- case "ibcTransfer":
4813
- if (type2 === "send") {
4814
- return (_a = ibcTransfer.packetTxs.sendTx) == null ? void 0 : _a.explorerLink;
4815
- }
4816
- return (_b = ibcTransfer.packetTxs.receiveTx) == null ? void 0 : _b.explorerLink;
4817
- case "eurekaTransfer":
4818
- if (type2 === "send") {
4819
- return (_c = eurekaTransfer.packetTxs.sendTx) == null ? void 0 : _c.explorerLink;
4820
- }
4821
- return (_d = eurekaTransfer.packetTxs.receiveTx) == null ? void 0 : _d.explorerLink;
4822
- case "goFastTransfer":
4823
- if (type2 === "send") {
4824
- return (_e2 = goFastTransfer.txs.orderSubmittedTx) == null ? void 0 : _e2.explorerLink;
4825
- }
4826
- return (_f = goFastTransfer.txs.orderFilledTx) == null ? void 0 : _f.explorerLink;
4827
- case "axelarTransfer":
4828
- return axelarTransfer == null ? void 0 : axelarTransfer.axelarScanLink;
4829
- default:
4830
- if (type2 === "send") {
4831
- return (_i = (_h = (_g = combinedTransferEvent[transferType]) == null ? void 0 : _g.txs) == null ? void 0 : _h.sendTx) == null ? void 0 : _i.explorerLink;
4832
- }
4833
- return (_l = (_k = (_j = combinedTransferEvent[transferType]) == null ? void 0 : _j.txs) == null ? void 0 : _k.receiveTx) == null ? void 0 : _l.explorerLink;
4834
- }
4835
- };
4836
- const _result = {
4837
- ...ibcTransfer,
4838
- ...axelarTransfer,
4839
- ...cctpTransfer,
4840
- ...hyperlaneTransfer,
4841
- ...stargateTransfer,
4842
- ...hyperlaneTransfer,
4843
- ...opInitTransfer,
4844
- ...goFastTransfer,
4845
- ...stargateTransfer,
4846
- ...eurekaTransfer,
4847
- ...layerZeroTransfer,
4848
- fromExplorerLink: getExplorerLink("send"),
4849
- toExplorerLink: getExplorerLink("receive")
4850
- };
4851
- const status = getSimpleStatus(_result.state);
4852
- const result = {
4853
- ..._result,
4854
- status
4855
- };
4856
- return result;
4857
- }
4858
- function getTransferEventsFromTxStatusResponse(txStatusResponse) {
4859
- if (!txStatusResponse) return [];
4860
- return txStatusResponse == null ? void 0 : txStatusResponse.flatMap((txStatus) => {
4861
- return txStatus.transferSequence.map((transferEvent) => {
4862
- return getClientTransferEvent(transferEvent);
4863
- });
4864
- });
4865
- }
4866
- function getSimpleOverallStatus(state) {
4867
- switch (state) {
4868
- case "STATE_SUBMITTED":
4869
- case "STATE_PENDING":
4870
- return "pending";
4871
- case "STATE_COMPLETED_SUCCESS":
4872
- return "success";
4873
- case "STATE_COMPLETED_ERROR":
4874
- case "STATE_PENDING_ERROR":
4875
- default:
4876
- return "failed";
4877
- }
4878
- }
4879
- function getSimpleStatus(state) {
4880
- switch (state) {
4881
- case "TRANSFER_PENDING":
4882
- case "TRANSFER_RECEIVED":
4883
- case "AXELAR_TRANSFER_PENDING_CONFIRMATION":
4884
- case "AXELAR_TRANSFER_PENDING_RECEIPT":
4885
- case "CCTP_TRANSFER_SENT":
4886
- case "CCTP_TRANSFER_PENDING_CONFIRMATION":
4887
- case "CCTP_TRANSFER_CONFIRMED":
4888
- case "HYPERLANE_TRANSFER_SENT":
4889
- case "OPINIT_TRANSFER_SENT":
4890
- case "GO_FAST_TRANSFER_SENT":
4891
- case "STARGATE_TRANSFER_SENT":
4892
- case "LAYER_ZERO_TRANSFER_SENT":
4893
- case "LAYER_ZERO_TRANSFER_WAITING_FOR_COMPOSE":
4894
- return "pending";
4895
- case "TRANSFER_SUCCESS":
4896
- case "AXELAR_TRANSFER_SUCCESS":
4897
- case "CCTP_TRANSFER_RECEIVED":
4898
- case "HYPERLANE_TRANSFER_RECEIVED":
4899
- case "OPINIT_TRANSFER_RECEIVED":
4900
- case "STARGATE_TRANSFER_RECEIVED":
4901
- case "GO_FAST_TRANSFER_FILLED":
4902
- case "LAYER_ZERO_TRANSFER_RECEIVED":
4903
- return "completed";
4904
- default:
4905
- return "failed";
4906
- }
4907
- }
4908
- const useBroadcastedTxsStatus = ({
4909
- transactionDetails,
4910
- txsRequired,
4911
- enabled
4912
- }) => {
4913
- const [isSettled, setIsSettled] = useState(false);
4914
- const [prevData, setPrevData] = useState(void 0);
4915
- const queryKey = useMemo(
4916
- () => ["txs-status", txsRequired, transactionDetails],
4917
- [transactionDetails, txsRequired]
4918
- );
4919
- const incompleteTxs = useMemo(() => {
4920
- return transactionDetails == null ? void 0 : transactionDetails.filter(
4921
- (tx) => {
4922
- var _a, _b, _c;
4923
- return ((_a = tx.status) == null ? void 0 : _a.state) !== "STATE_COMPLETED_SUCCESS" && ((_b = tx.status) == null ? void 0 : _b.state) !== "STATE_COMPLETED_ERROR" && ((_c = tx.status) == null ? void 0 : _c.state) !== "STATE_ABANDONED";
4924
- }
4925
- );
4926
- }, [transactionDetails]);
4927
- const queryEnabled = useMemo(() => {
4928
- return (incompleteTxs == null ? void 0 : incompleteTxs.length) !== 0 && enabled;
4929
- }, [enabled, incompleteTxs == null ? void 0 : incompleteTxs.length]);
4930
- return useQuery({
4931
- queryKey,
4932
- queryFn: async ({ queryKey: [, txsRequired2, txs] }) => {
4933
- var _a, _b;
4934
- if (!txs || !incompleteTxs) return;
4935
- try {
4936
- const statusResponseMap = /* @__PURE__ */ new Map();
4937
- txs.forEach((tx) => {
4938
- if (tx.status) statusResponseMap.set(tx.txHash, tx.status);
4939
- });
4940
- await Promise.all(
4941
- incompleteTxs.map(async (tx) => {
4942
- const status = await transactionStatus(tx);
4943
- statusResponseMap.set(tx.txHash, status);
4944
- })
4945
- );
4946
- const updatedTransactionDetails = txs.map((tx) => ({
4947
- ...tx,
4948
- status: statusResponseMap.get(tx.txHash) ?? tx.status
4949
- }));
4950
- const validStatuses = updatedTransactionDetails.map((tx) => tx.status).filter((status) => status !== void 0);
4951
- const transferEvents = getTransferEventsFromTxStatusResponse(validStatuses);
4952
- const isFinalState = (state) => {
4953
- return state === "STATE_COMPLETED_SUCCESS" || state === "STATE_COMPLETED_ERROR" || state === "STATE_ABANDONED";
4954
- };
4955
- const isAllSettled = txsRequired2 === validStatuses.length && validStatuses.every((status) => isFinalState(status.state));
4956
- if (isAllSettled) {
4957
- setIsSettled(true);
4958
- }
4959
- const someTxFailed = validStatuses.some(
4960
- (status) => status.state === "STATE_COMPLETED_ERROR" || status.state === "STATE_ABANDONED"
4961
- );
4962
- const lastTx = validStatuses.at(-1);
4963
- const lastTxStatus = (lastTx == null ? void 0 : lastTx.state) ? getSimpleOverallStatus(lastTx.state) : void 0;
4964
- const transferAssetRelease = (_a = validStatuses.reverse().find((tx) => tx.transferAssetRelease)) == null ? void 0 : _a.transferAssetRelease;
4965
- const resData = {
4966
- isSuccess: isAllSettled && !someTxFailed && lastTxStatus === "success",
4967
- lastTxStatus,
4968
- transactionDetails: updatedTransactionDetails,
4969
- isSettled: isAllSettled,
4970
- transferEvents,
4971
- transferAssetRelease
4972
- };
4973
- setPrevData(resData);
4974
- return resData;
4975
- } catch (_error) {
4976
- const validStatuses = (transactionDetails ?? []).map((tx) => tx.status).filter((status) => status !== void 0);
4977
- const transferEvents = getTransferEventsFromTxStatusResponse(validStatuses);
4978
- const transferAssetRelease = (_b = validStatuses.reverse().find((tx) => tx.transferAssetRelease)) == null ? void 0 : _b.transferAssetRelease;
4979
- const fallbackData = {
4980
- isSuccess: false,
4981
- isSettled: true,
4982
- transactionDetails: transactionDetails ?? [],
4983
- lastTxStatus: "failed",
4984
- transferEvents,
4985
- transferAssetRelease
4986
- };
4987
- setPrevData(fallbackData);
4988
- return fallbackData;
4989
- }
4990
- },
4991
- enabled: !isSettled && queryEnabled,
4992
- refetchInterval: 500,
4993
- initialData: prevData
4994
- });
4995
- };
4996
4663
  function atomWithDebounce(delayMilliseconds = 250) {
4997
4664
  const prevTimeoutAtom = atom$1(void 0);
4998
4665
  const _currentValueAtom = atom$1();
@@ -7560,6 +7227,11 @@ const _mainnetChains = [
7560
7227
  coinMinimalDenom: "factory/chihuahua1x4q2vkrz4dfgd9hcw0p5m2f2nuv2uqmt9xr8k2/achihuahuawifhat",
7561
7228
  coinDecimals: 6
7562
7229
  },
7230
+ {
7231
+ coinDenom: "BEER",
7232
+ coinMinimalDenom: "factory/chihuahua1sj9verkuk8aa9jrngnpwup6zjht4vwngjlpemnt9w38ccp0qnlcswvsuzc/beer",
7233
+ coinDecimals: 6
7234
+ },
7563
7235
  {
7564
7236
  coinDenom: "WOOF",
7565
7237
  coinMinimalDenom: "factory/chihuahua13jawsn574rf3f0u5rhu7e8n6sayx5gkw3eddhp/uwoof",
@@ -7703,8 +7375,8 @@ const _mainnetChains = [
7703
7375
  coinDecimals: 6
7704
7376
  }
7705
7377
  ],
7706
- rest: "https://api.cifer.ai",
7707
- rpc: "http://34.128.114.243:26657",
7378
+ rest: "https://lcd.cifer.ai",
7379
+ rpc: "https://rpc.cifer.ai",
7708
7380
  bech32Config: {
7709
7381
  bech32PrefixAccAddr: "cife",
7710
7382
  bech32PrefixAccPub: "cifepub",
@@ -8992,6 +8664,11 @@ const _mainnetChains = [
8992
8664
  coinDenom: "saga",
8993
8665
  coinMinimalDenom: "ibc/B88C39AD6C8550716DFD64C3AD28F355633554821249AC9F8BCC21341641CD18",
8994
8666
  coinDecimals: 6
8667
+ },
8668
+ {
8669
+ coinDenom: "xrp",
8670
+ coinMinimalDenom: "ibc/8464A63954C0350A26C8588E20719F3A0AC8705E4CA0F7450B60C3F16B2D3421",
8671
+ coinDecimals: 18
8995
8672
  }
8996
8673
  ],
8997
8674
  rest: "https://api.elys.network",
@@ -17405,7 +17082,7 @@ const _mainnetChains = [
17405
17082
  coinDecimals: 6
17406
17083
  },
17407
17084
  {
17408
- coinDenom: "xrp",
17085
+ coinDenom: "XRP",
17409
17086
  coinMinimalDenom: "ibc/46EB46DB30D3BBC6F404A9232C09785F36D40DA05C662A8E295712ECBAFF1609",
17410
17087
  coinDecimals: 18
17411
17088
  }
@@ -18530,7 +18207,7 @@ const _mainnetChains = [
18530
18207
  coinDecimals: 6
18531
18208
  }
18532
18209
  ],
18533
- rest: "https://shannon-grove-rest.mainnet.poktroll.com",
18210
+ rest: "https://shannon-grove-api.mainnet.poktroll.com",
18534
18211
  rpc: "https://shannon-grove-rpc.mainnet.poktroll.com",
18535
18212
  bech32Config: {
18536
18213
  bech32PrefixAccAddr: "pokt",
@@ -21853,6 +21530,62 @@ const _mainnetChains = [
21853
21530
  coinType: 118
21854
21531
  }
21855
21532
  },
21533
+ {
21534
+ chainId: "symphony-1",
21535
+ currencies: [
21536
+ {
21537
+ coinDenom: "mld",
21538
+ coinMinimalDenom: "note",
21539
+ coinDecimals: 6
21540
+ },
21541
+ {
21542
+ coinDenom: "husd",
21543
+ coinMinimalDenom: "uusd",
21544
+ coinDecimals: 6
21545
+ },
21546
+ {
21547
+ coinDenom: "hkhd",
21548
+ coinMinimalDenom: "ukhd",
21549
+ coinDecimals: 6
21550
+ },
21551
+ {
21552
+ coinDenom: "hvnd",
21553
+ coinMinimalDenom: "uvnd",
21554
+ coinDecimals: 6
21555
+ }
21556
+ ],
21557
+ rest: "https://symphony.api.nodeshub.online/",
21558
+ rpc: "https://symphony.rpc.nodeshub.online/",
21559
+ bech32Config: {
21560
+ bech32PrefixAccAddr: "symphony",
21561
+ bech32PrefixAccPub: "symphonypub",
21562
+ bech32PrefixValAddr: "symphonyvaloper",
21563
+ bech32PrefixValPub: "symphonyvaloperpub",
21564
+ bech32PrefixConsAddr: "symphonyvalcons",
21565
+ bech32PrefixConsPub: "symphonyvalconspub"
21566
+ },
21567
+ chainName: "symphony",
21568
+ feeCurrencies: [
21569
+ {
21570
+ coinDenom: "mld",
21571
+ coinMinimalDenom: "note",
21572
+ coinDecimals: 6,
21573
+ gasPriceStep: {
21574
+ low: 25e-5,
21575
+ average: 25e-4,
21576
+ high: 4e-3
21577
+ }
21578
+ }
21579
+ ],
21580
+ stakeCurrency: {
21581
+ coinDenom: "mld",
21582
+ coinMinimalDenom: "note",
21583
+ coinDecimals: 6
21584
+ },
21585
+ bip44: {
21586
+ coinType: 118
21587
+ }
21588
+ },
21856
21589
  {
21857
21590
  chainId: "synternet-1",
21858
21591
  currencies: [
@@ -24052,6 +23785,42 @@ const _mainnetChains = [
24052
23785
  coinType: 118
24053
23786
  }
24054
23787
  },
23788
+ {
23789
+ chainId: "xarchain",
23790
+ currencies: [
23791
+ {
23792
+ coinDenom: "stxar",
23793
+ coinMinimalDenom: "stxar",
23794
+ coinDecimals: 0
23795
+ }
23796
+ ],
23797
+ rest: "https://cosmos01-testnet.arcana.network",
23798
+ rpc: "https://cosmos01-testnet.arcana.network:26650",
23799
+ bech32Config: {
23800
+ bech32PrefixAccAddr: "arcana",
23801
+ bech32PrefixAccPub: "arcanapub",
23802
+ bech32PrefixValAddr: "arcanavaloper",
23803
+ bech32PrefixValPub: "arcanavaloperpub",
23804
+ bech32PrefixConsAddr: "arcanavalcons",
23805
+ bech32PrefixConsPub: "arcanavalconspub"
23806
+ },
23807
+ chainName: "xarchain",
23808
+ feeCurrencies: [
23809
+ {
23810
+ coinDenom: "stxar",
23811
+ coinMinimalDenom: "stxar",
23812
+ coinDecimals: 0
23813
+ }
23814
+ ],
23815
+ stakeCurrency: {
23816
+ coinDenom: "stxar",
23817
+ coinMinimalDenom: "stxar",
23818
+ coinDecimals: 0
23819
+ },
23820
+ bip44: {
23821
+ coinType: 118
23822
+ }
23823
+ },
24055
23824
  {
24056
23825
  chainId: "xion-mainnet-1",
24057
23826
  currencies: [
@@ -27650,7 +27419,7 @@ const _testnetChains = [
27650
27419
  }
27651
27420
  },
27652
27421
  {
27653
- chainId: "lumera-testnet-1",
27422
+ chainId: "lumera-testnet-2",
27654
27423
  currencies: [
27655
27424
  {
27656
27425
  coinDenom: "LUME",
@@ -29453,6 +29222,47 @@ const _testnetChains = [
29453
29222
  coinType: 118
29454
29223
  }
29455
29224
  },
29225
+ {
29226
+ chainId: "safro-testnet-1",
29227
+ currencies: [
29228
+ {
29229
+ coinDenom: "saf",
29230
+ coinMinimalDenom: "usaf",
29231
+ coinDecimals: 6
29232
+ }
29233
+ ],
29234
+ rest: "https://rest.testnet.safrochain.com",
29235
+ rpc: "https://rpc.testnet.safrochain.com",
29236
+ bech32Config: {
29237
+ bech32PrefixAccAddr: "addr_safro",
29238
+ bech32PrefixAccPub: "addr_safropub",
29239
+ bech32PrefixValAddr: "addr_safrovaloper",
29240
+ bech32PrefixValPub: "addr_safrovaloperpub",
29241
+ bech32PrefixConsAddr: "addr_safrovalcons",
29242
+ bech32PrefixConsPub: "addr_safrovalconspub"
29243
+ },
29244
+ chainName: "safrochaintestnet",
29245
+ feeCurrencies: [
29246
+ {
29247
+ coinDenom: "saf",
29248
+ coinMinimalDenom: "usaf",
29249
+ coinDecimals: 6,
29250
+ gasPriceStep: {
29251
+ low: 25e-4,
29252
+ average: 0.025,
29253
+ high: 0.04
29254
+ }
29255
+ }
29256
+ ],
29257
+ stakeCurrency: {
29258
+ coinDenom: "saf",
29259
+ coinMinimalDenom: "usaf",
29260
+ coinDecimals: 6
29261
+ },
29262
+ bip44: {
29263
+ coinType: 118
29264
+ }
29265
+ },
29456
29266
  {
29457
29267
  chainId: "ssc-testnet-2",
29458
29268
  currencies: [
@@ -30003,7 +29813,7 @@ const _testnetChains = [
30003
29813
  }
30004
29814
  },
30005
29815
  {
30006
- chainId: "sunrise-test-0.1",
29816
+ chainId: "sunrise-test-da-5",
30007
29817
  currencies: [
30008
29818
  {
30009
29819
  coinDenom: "vrise",
@@ -30014,10 +29824,15 @@ const _testnetChains = [
30014
29824
  coinDenom: "rise",
30015
29825
  coinMinimalDenom: "urise",
30016
29826
  coinDecimals: 6
29827
+ },
29828
+ {
29829
+ coinDenom: "usdrise",
29830
+ coinMinimalDenom: "uusdrise",
29831
+ coinDecimals: 6
30017
29832
  }
30018
29833
  ],
30019
- rest: "https://a-node.sunrise-test-1.cauchye.net:1318",
30020
- rpc: "https://a-node.sunrise-test-1.cauchye.net/",
29834
+ rest: "https://sunrise-test-da-5.cauchye.net:1318",
29835
+ rpc: "https://sunrise-test-da-5.cauchye.net",
30021
29836
  bech32Config: {
30022
29837
  bech32PrefixAccAddr: "sunrise",
30023
29838
  bech32PrefixAccPub: "sunrisepub",
@@ -30029,8 +29844,8 @@ const _testnetChains = [
30029
29844
  chainName: "sunrisetestnet",
30030
29845
  feeCurrencies: [
30031
29846
  {
30032
- coinDenom: "rise",
30033
- coinMinimalDenom: "urise",
29847
+ coinDenom: "usdrise",
29848
+ coinMinimalDenom: "uusdrise",
30034
29849
  coinDecimals: 6,
30035
29850
  gasPriceStep: {
30036
29851
  low: 25e-4,
@@ -30140,62 +29955,6 @@ const _testnetChains = [
30140
29955
  coinType: 118
30141
29956
  }
30142
29957
  },
30143
- {
30144
- chainId: "symphony-testnet-3",
30145
- currencies: [
30146
- {
30147
- coinDenom: "mld",
30148
- coinMinimalDenom: "note",
30149
- coinDecimals: 6
30150
- },
30151
- {
30152
- coinDenom: "husd",
30153
- coinMinimalDenom: "uusd",
30154
- coinDecimals: 6
30155
- },
30156
- {
30157
- coinDenom: "hkhd",
30158
- coinMinimalDenom: "ukhd",
30159
- coinDecimals: 6
30160
- },
30161
- {
30162
- coinDenom: "hvnd",
30163
- coinMinimalDenom: "uvnd",
30164
- coinDecimals: 6
30165
- }
30166
- ],
30167
- rest: "https://symphony.test.api.nodeshub.online/",
30168
- rpc: "https://symphony.test.rpc.nodeshub.online/",
30169
- bech32Config: {
30170
- bech32PrefixAccAddr: "symphony",
30171
- bech32PrefixAccPub: "symphonypub",
30172
- bech32PrefixValAddr: "symphonyvaloper",
30173
- bech32PrefixValPub: "symphonyvaloperpub",
30174
- bech32PrefixConsAddr: "symphonyvalcons",
30175
- bech32PrefixConsPub: "symphonyvalconspub"
30176
- },
30177
- chainName: "symphonytestnet3",
30178
- feeCurrencies: [
30179
- {
30180
- coinDenom: "mld",
30181
- coinMinimalDenom: "note",
30182
- coinDecimals: 6,
30183
- gasPriceStep: {
30184
- low: 25e-4,
30185
- average: 0.025,
30186
- high: 0.04
30187
- }
30188
- }
30189
- ],
30190
- stakeCurrency: {
30191
- coinDenom: "mld",
30192
- coinMinimalDenom: "note",
30193
- coinDecimals: 6
30194
- },
30195
- bip44: {
30196
- coinType: 118
30197
- }
30198
- },
30199
29958
  {
30200
29959
  chainId: "amber-2",
30201
29960
  currencies: [
@@ -32403,6 +32162,16 @@ const _explorers = [
32403
32162
  }
32404
32163
  ]
32405
32164
  },
32165
+ {
32166
+ chainId: "bcx_323-1",
32167
+ explorers: [
32168
+ {
32169
+ kind: "pingpub",
32170
+ url: "https://cosmos.buycex.net",
32171
+ txPage: "https://cosmos.buycex.net/tx/${txHash}"
32172
+ }
32173
+ ]
32174
+ },
32406
32175
  {
32407
32176
  chainId: "canto_7700-1",
32408
32177
  explorers: [
@@ -37964,6 +37733,17 @@ const _explorers = [
37964
37733
  chainId: "sunrise-1",
37965
37734
  explorers: []
37966
37735
  },
37736
+ {
37737
+ chainId: "symphony-1",
37738
+ explorers: [
37739
+ {
37740
+ kind: "VinjanXplorer",
37741
+ url: "https://xplorer.vinjan.xyz/symphony",
37742
+ txPage: "https://xplorer.vinjan.xyz/symphony/tx/${txHash}",
37743
+ accountPage: "https://xplorer.vinjan.xyz/symphony/account/${accountAddress}"
37744
+ }
37745
+ ]
37746
+ },
37967
37747
  {
37968
37748
  chainId: "synternet-1",
37969
37749
  explorers: [
@@ -38251,12 +38031,6 @@ const _explorers = [
38251
38031
  {
38252
38032
  chainId: "umee-1",
38253
38033
  explorers: [
38254
- {
38255
- kind: "mintscan",
38256
- url: "https://www.mintscan.io/umee/",
38257
- txPage: "https://www.mintscan.io/umee/transactions/${txHash}",
38258
- accountPage: "https://www.mintscan.io/umee/accounts/${accountAddress}"
38259
- },
38260
38034
  {
38261
38035
  kind: "ping.pub",
38262
38036
  url: "https://ping.pub/umee",
@@ -38442,6 +38216,15 @@ const _explorers = [
38442
38216
  }
38443
38217
  ]
38444
38218
  },
38219
+ {
38220
+ chainId: "xarchain",
38221
+ explorers: [
38222
+ {
38223
+ kind: "arcana ceries intent explorer",
38224
+ url: "https://explorer.arcana.network"
38225
+ }
38226
+ ]
38227
+ },
38445
38228
  {
38446
38229
  chainId: "xion-mainnet-1",
38447
38230
  explorers: [
@@ -39546,7 +39329,7 @@ const _explorers = [
39546
39329
  ]
39547
39330
  },
39548
39331
  {
39549
- chainId: "lumera-testnet-1",
39332
+ chainId: "lumera-testnet-2",
39550
39333
  explorers: [
39551
39334
  {
39552
39335
  kind: "ping.pub",
@@ -39947,6 +39730,16 @@ const _explorers = [
39947
39730
  }
39948
39731
  ]
39949
39732
  },
39733
+ {
39734
+ chainId: "safro-testnet-1",
39735
+ explorers: [
39736
+ {
39737
+ kind: "bigdipper",
39738
+ url: "https://explorer.testnet.safrochain.com",
39739
+ txPage: "https://explorer.testnet.safrochain.com/transactions/${txHash}"
39740
+ }
39741
+ ]
39742
+ },
39950
39743
  {
39951
39744
  chainId: "ssc-testnet-2",
39952
39745
  explorers: [
@@ -40142,7 +39935,7 @@ const _explorers = [
40142
39935
  ]
40143
39936
  },
40144
39937
  {
40145
- chainId: "sunrise-test-0.1",
39938
+ chainId: "sunrise-test-da-5",
40146
39939
  explorers: []
40147
39940
  },
40148
39941
  {
@@ -40156,10 +39949,15 @@ const _explorers = [
40156
39949
  ]
40157
39950
  },
40158
39951
  {
40159
- chainId: "symphony-testnet-4"
40160
- },
40161
- {
40162
- chainId: "symphony-testnet-3"
39952
+ chainId: "symphony-testnet-4",
39953
+ explorers: [
39954
+ {
39955
+ kind: "VinjanXplorer",
39956
+ url: "https://xplorer.vinjan.xyz/symphony-testnet",
39957
+ txPage: "https://xplorer.vinjan.xyz/symphony-testnet/tx/${txHash}",
39958
+ accountPage: "https://xplorer.vinjan.xyz/symphony-testnet/account/${accountAddress}"
39959
+ }
39960
+ ]
40163
39961
  },
40164
39962
  {
40165
39963
  chainId: "amber-2",
@@ -41372,6 +41170,10 @@ const routePreferenceAtom = atom$1(
41372
41170
  }
41373
41171
  );
41374
41172
  const goFastWarningAtom = atomWithStorageNoCrossTabSync("showGoFastWarning", true);
41173
+ const ROUTE_ERROR_CODE_MAP = {
41174
+ 5: "no route found",
41175
+ 12: "no route found"
41176
+ };
41375
41177
  const initializeDebounceValuesEffect = atomEffect(
41376
41178
  (get, set) => {
41377
41179
  const sourceAsset = get(sourceAssetAtom);
@@ -41467,10 +41269,15 @@ const _skipRouteAtom = atomWithQuery((get) => {
41467
41269
  };
41468
41270
  });
41469
41271
  const skipRouteAtom = atom$1((get) => {
41272
+ var _a;
41470
41273
  const { data, isError, error, isFetching, isPending } = get(_skipRouteAtom);
41471
41274
  const caughtError = data;
41472
41275
  const routeResponse = data;
41473
41276
  if (caughtError == null ? void 0 : caughtError.isError) {
41277
+ const error2 = caughtError.error;
41278
+ if (((_a = caughtError == null ? void 0 : caughtError.error) == null ? void 0 : _a.code) && ROUTE_ERROR_CODE_MAP[caughtError.error.code]) {
41279
+ error2.message = ROUTE_ERROR_CODE_MAP[caughtError.error.code];
41280
+ }
41474
41281
  return {
41475
41282
  data: void 0,
41476
41283
  isError: true,
@@ -41519,6 +41326,7 @@ const setRouteToDefaultRouteAtom = atom$1(null, (get, set, assets2) => {
41519
41326
  });
41520
41327
  var HISTORY_VERSION = /* @__PURE__ */ ((HISTORY_VERSION2) => {
41521
41328
  HISTORY_VERSION2[HISTORY_VERSION2["camelCase"] = 0] = "camelCase";
41329
+ HISTORY_VERSION2[HISTORY_VERSION2["routeDetails"] = 1] = "routeDetails";
41522
41330
  return HISTORY_VERSION2;
41523
41331
  })(HISTORY_VERSION || {});
41524
41332
  const transactionHistoryVersionAtom = atomWithStorage(
@@ -41529,31 +41337,40 @@ const transactionHistoryAtom = atomWithStorage(
41529
41337
  LOCAL_STORAGE_KEYS.transactionHistory,
41530
41338
  []
41531
41339
  );
41340
+ const sortedHistoryItemsAtom = atom$1((get) => {
41341
+ const history = get(transactionHistoryAtom);
41342
+ return history.filter(
41343
+ (historyItem) => historyItem.txsSigned > 0 && historyItem.transactionDetails.some((tx) => tx.txHash)
41344
+ ).sort((a, b) => b.timestamp - a.timestamp);
41345
+ });
41532
41346
  const setTransactionHistoryAtom = atom$1(
41533
41347
  null,
41534
41348
  (get, set, historyItem) => {
41535
41349
  const history = get(transactionHistoryAtom);
41536
- const index = history.findIndex((item) => item.timestamp === historyItem.timestamp);
41350
+ const index = history.findIndex((item) => item.id === historyItem.id);
41537
41351
  const newHistory = [...history];
41538
41352
  if (index !== -1) {
41539
41353
  const oldItem = newHistory[index];
41540
41354
  newHistory[index] = { ...oldItem, ...historyItem };
41541
41355
  } else {
41542
- newHistory.push(historyItem);
41356
+ if (historyItem.id) {
41357
+ set(setCurrentTransactionIdAtom, historyItem.id);
41358
+ newHistory.push(historyItem);
41359
+ }
41543
41360
  }
41544
41361
  set(transactionHistoryAtom, newHistory);
41545
41362
  }
41546
41363
  );
41364
+ const currentTransactionAtom = atom$1((get) => {
41365
+ const { currentTransactionId } = get(swapExecutionStateAtom);
41366
+ const history = get(transactionHistoryAtom);
41367
+ return history.find((historyItem) => historyItem.id === currentTransactionId);
41368
+ });
41547
41369
  const lastTransactionInTimeAtom = atom$1((get) => {
41548
41370
  const history = get(transactionHistoryAtom);
41549
41371
  if (history.length === 0) return;
41550
41372
  const sorted = [...history].sort((a, b) => b.timestamp - a.timestamp);
41551
- const lastTx = sorted[0];
41552
- const originalIndex = history.findIndex((tx) => tx.timestamp === lastTx.timestamp);
41553
- return {
41554
- transactionHistoryItem: lastTx,
41555
- index: originalIndex
41556
- };
41373
+ return sorted.at(0);
41557
41374
  });
41558
41375
  const removeTransactionHistoryItemAtom = atom$1(null, (get, set, timestamp) => {
41559
41376
  const history = get(transactionHistoryAtom);
@@ -41561,6 +41378,118 @@ const removeTransactionHistoryItemAtom = atom$1(null, (get, set, timestamp) => {
41561
41378
  const newHistory = history.filter((item) => item.timestamp !== timestamp);
41562
41379
  set(transactionHistoryAtom, newHistory);
41563
41380
  });
41381
+ var OperationType = /* @__PURE__ */ ((OperationType2) => {
41382
+ OperationType2["swap"] = "swap";
41383
+ OperationType2["evmSwap"] = "evmSwap";
41384
+ OperationType2["transfer"] = "transfer";
41385
+ OperationType2["axelarTransfer"] = "axelarTransfer";
41386
+ OperationType2["cctpTransfer"] = "cctpTransfer";
41387
+ OperationType2["hyperlaneTransfer"] = "hyperlaneTransfer";
41388
+ OperationType2["opInitTransfer"] = "opInitTransfer";
41389
+ OperationType2["bankSend"] = "bankSend";
41390
+ OperationType2["goFastTransfer"] = "goFastTransfer";
41391
+ OperationType2["stargateTransfer"] = "stargateTransfer";
41392
+ OperationType2["eurekaTransfer"] = "eurekaTransfer";
41393
+ OperationType2["layerZeroTransfer"] = "layerZeroTransfer";
41394
+ return OperationType2;
41395
+ })(OperationType || {});
41396
+ function getOperationDetailsAndType(operation) {
41397
+ const combinedOperation = operation;
41398
+ let returnValue = {
41399
+ details: {},
41400
+ type: void 0
41401
+ };
41402
+ Object.values(OperationType).find((type2) => {
41403
+ var _a;
41404
+ const originalDetails = combinedOperation == null ? void 0 : combinedOperation[type2];
41405
+ if (originalDetails) {
41406
+ const operationDetails = { ...originalDetails };
41407
+ switch (type2) {
41408
+ case "swap":
41409
+ case "evmSwap":
41410
+ operationDetails.toChainId = originalDetails.fromChainId;
41411
+ break;
41412
+ case "axelarTransfer":
41413
+ operationDetails.denomIn = ((_a = originalDetails.ibcTransferToAxelar) == null ? void 0 : _a.denomIn) ?? originalDetails.denomIn;
41414
+ break;
41415
+ case "bankSend": {
41416
+ const bankSend = originalDetails;
41417
+ operationDetails.denomIn = bankSend.denom;
41418
+ operationDetails.denomOut = bankSend.denom;
41419
+ operationDetails.fromChainId = bankSend.chainId;
41420
+ operationDetails.toChainId = bankSend.chainId;
41421
+ break;
41422
+ }
41423
+ }
41424
+ returnValue = {
41425
+ details: operationDetails,
41426
+ type: type2
41427
+ };
41428
+ }
41429
+ });
41430
+ return returnValue;
41431
+ }
41432
+ function getClientOperation(operation) {
41433
+ const { details, type: type2 } = getOperationDetailsAndType(operation);
41434
+ return {
41435
+ type: type2,
41436
+ ...details,
41437
+ txIndex: operation.txIndex,
41438
+ amountIn: operation.amountIn,
41439
+ amountOut: operation.amountOut,
41440
+ swapVenues: [
41441
+ ...details.swapVenues ?? [],
41442
+ ...(details == null ? void 0 : details.swapIn) ? [details == null ? void 0 : details.swapIn.swapVenue] : [],
41443
+ ...(details == null ? void 0 : details.swapOut) ? [details == null ? void 0 : details.swapOut.swapVenue] : []
41444
+ ]
41445
+ };
41446
+ }
41447
+ function getClientOperations(operations) {
41448
+ if (!operations) return [];
41449
+ let transferIndex = 0;
41450
+ const filteredOperations = filterNeutronSwapFee(operations);
41451
+ return filteredOperations.map((operation, index, arr) => {
41452
+ const prevOperation = arr[index - 1];
41453
+ const signRequired = (() => {
41454
+ if (index === 0) {
41455
+ return false;
41456
+ } else {
41457
+ if (operation.txIndex > prevOperation.txIndex) {
41458
+ return true;
41459
+ }
41460
+ return false;
41461
+ }
41462
+ })();
41463
+ const clientOperation = getClientOperation(operation);
41464
+ const isSwap = clientOperation.type === "swap" || clientOperation.type === "evmSwap";
41465
+ const result = {
41466
+ ...clientOperation,
41467
+ transferIndex,
41468
+ signRequired,
41469
+ isSwap
41470
+ };
41471
+ if (!isSwap) {
41472
+ transferIndex++;
41473
+ }
41474
+ return result;
41475
+ });
41476
+ }
41477
+ function filterNeutronSwapFee(operations) {
41478
+ return operations.filter((op, i) => {
41479
+ var _a, _b, _c, _d, _e2, _f, _g, _h;
41480
+ const clientOperation = getClientOperation(op);
41481
+ if (clientOperation.type === "swap" && ((_b = (_a = clientOperation.swapOut) == null ? void 0 : _a.swapVenue) == null ? void 0 : _b.name) === "neutron-astroport" && ((_c = clientOperation.swapOut) == null ? void 0 : _c.swapVenue.chainId) === "neutron-1" && clientOperation.chainId === "neutron-1" && clientOperation.denomOut === "untrn" && clientOperation.fromChainId === "neutron-1" && ((_d = clientOperation.swapOut) == null ? void 0 : _d.swapAmountOut) === "200000") {
41482
+ const nextOperation = operations[i + 1];
41483
+ if (nextOperation) {
41484
+ const nextClientOperation = getClientOperation(nextOperation);
41485
+ if (nextClientOperation.type === "swap" && ((_f = (_e2 = nextClientOperation.swapIn) == null ? void 0 : _e2.swapVenue) == null ? void 0 : _f.name) === "neutron-astroport" && ((_h = (_g = nextClientOperation.swapIn) == null ? void 0 : _g.swapVenue) == null ? void 0 : _h.chainId) === "neutron-1" && nextClientOperation.chainId === "neutron-1") {
41486
+ return false;
41487
+ }
41488
+ }
41489
+ }
41490
+ return true;
41491
+ });
41492
+ }
41564
41493
  function isUserRejectedRequestError(input) {
41565
41494
  if (input instanceof Error) {
41566
41495
  if (
@@ -45486,7 +45415,7 @@ function walletConnect(parameters) {
45486
45415
  const optionalChains = config2.chains.map((x2) => x2.id);
45487
45416
  if (!optionalChains.length)
45488
45417
  return;
45489
- const { EthereumProvider } = await import("./index.es-BhgJ58L0.js");
45418
+ const { EthereumProvider } = await import("./index.es-DOVSLdtw.js");
45490
45419
  return await EthereumProvider.init({
45491
45420
  ...parameters,
45492
45421
  disableProviderPing: true,
@@ -45815,6 +45744,7 @@ const createExplorerLink = ({
45815
45744
  };
45816
45745
  const createSkipExplorerLink = (transactionDetails) => {
45817
45746
  var _a, _b;
45747
+ if (!transactionDetails) return "";
45818
45748
  const { get } = jotaiStore;
45819
45749
  const txHashCommaSeperatedList = (_a = transactionDetails == null ? void 0 : transactionDetails.map((txDetails) => txDetails.txHash)) == null ? void 0 : _a.join(",");
45820
45750
  const isTestnet = get(onlyTestnetsAtom);
@@ -45828,30 +45758,20 @@ const swapExecutionStateAtom = atomWithStorageNoCrossTabSync(
45828
45758
  route: void 0,
45829
45759
  clientOperations: [],
45830
45760
  userAddresses: [],
45831
- transactionDetailsArray: [],
45832
- transactionHistoryIndex: 0,
45833
- overallStatus: "unconfirmed",
45834
- isValidatingGasBalance: void 0,
45835
- transactionsSigned: 0,
45836
- timestamp: -1
45761
+ currentTransactionId: void 0
45837
45762
  }
45838
45763
  );
45839
- const setOverallStatusAtom = atom$1(null, (_get, set, status) => {
45840
- set(swapExecutionStateAtom, (state) => ({ ...state, overallStatus: status }));
45841
- });
45842
- const clearIsValidatingGasBalanceAtom = atom$1(null, (_get, set) => {
45843
- set(swapExecutionStateAtom, (state) => ({
45844
- ...state,
45845
- isValidatingGasBalance: void 0
45764
+ const setCurrentTransactionIdAtom = atom$1(null, (_get, set, transactionId) => {
45765
+ set(swapExecutionStateAtom, (prev2) => ({
45766
+ ...prev2,
45767
+ currentTransactionId: transactionId
45846
45768
  }));
45847
45769
  });
45848
45770
  const setSwapExecutionStateAtom = atom$1(null, (get, set) => {
45849
45771
  var _a;
45850
45772
  const { data: route2 } = get(skipRouteAtom);
45851
45773
  const { data: chains2 } = get(skipChainsAtom);
45852
- const transactionHistory = get(transactionHistoryAtom);
45853
45774
  const callbacks = get(callbacksAtom);
45854
- const transactionHistoryIndex = Array.isArray(transactionHistory) ? transactionHistory.length : 0;
45855
45775
  if (!route2) return;
45856
45776
  const {
45857
45777
  requiredChainAddresses,
@@ -45875,46 +45795,43 @@ const setSwapExecutionStateAtom = atom$1(null, (get, set) => {
45875
45795
  transactionDetailsArray: [],
45876
45796
  route: route2,
45877
45797
  clientOperations: getClientOperations(route2.operations),
45878
- transactionHistoryIndex,
45879
- overallStatus: "unconfirmed",
45880
- isValidatingGasBalance: void 0,
45881
- transactionsSigned: 0,
45882
- timestamp: Date.now()
45798
+ currentTransactionId: void 0
45883
45799
  });
45884
45800
  set(submitSwapExecutionCallbacksAtom, {
45885
- onTransactionSignRequested: async (props) => {
45886
- var _a2;
45887
- track("execute route: transaction sign requested", { props });
45888
- (_a2 = callbacks == null ? void 0 : callbacks.onTransactionSignRequested) == null ? void 0 : _a2.call(callbacks, props);
45801
+ onRouteStatusUpdated: async (routeStatus) => {
45802
+ set(setTransactionHistoryAtom, routeStatus);
45889
45803
  },
45890
45804
  onTransactionUpdated: (txInfo) => {
45891
- var _a2;
45892
45805
  track("execute route: transaction updated", { txInfo });
45893
- if (((_a2 = txInfo.status) == null ? void 0 : _a2.status) !== "STATE_COMPLETED") {
45894
- set(setTransactionDetailsAtom, {
45895
- transactionDetails: txInfo
45896
- });
45897
- }
45898
45806
  },
45899
45807
  onApproveAllowance: async ({ status, allowance }) => {
45900
45808
  track("execute route: approve allowance", { status, allowance });
45901
- if (allowance && status === "pending") {
45902
- set(setOverallStatusAtom, "approving");
45903
- }
45809
+ },
45810
+ onTransactionSigned: async (txInfo) => {
45811
+ track("execute route: transaction signed");
45812
+ set(swapExecutionStateAtom, (prev2) => {
45813
+ const clientOperations = prev2.clientOperations;
45814
+ const signRequiredIndex = clientOperations.findIndex((operation) => {
45815
+ return operation.signRequired && (operation.chainId === txInfo.chainId || operation.fromChainId === txInfo.chainId);
45816
+ });
45817
+ if (signRequiredIndex >= 0) {
45818
+ clientOperations[signRequiredIndex].signRequired = false;
45819
+ }
45820
+ return {
45821
+ ...prev2,
45822
+ clientOperations
45823
+ };
45824
+ });
45904
45825
  },
45905
45826
  onTransactionBroadcast: async (txInfo) => {
45906
45827
  var _a2;
45907
45828
  track("execute route: transaction broadcasted", { txInfo });
45908
- setUser({ id: txInfo == null ? void 0 : txInfo.txHash });
45909
45829
  const chain = chains2 == null ? void 0 : chains2.find((chain2) => chain2.chainId === txInfo.chainId);
45910
45830
  const explorerLink = createExplorerLink({
45911
45831
  chainId: txInfo.chainId,
45912
45832
  chainType: chain == null ? void 0 : chain.chainType,
45913
45833
  txHash: txInfo.txHash
45914
45834
  });
45915
- set(setTransactionDetailsAtom, {
45916
- transactionDetails: { ...txInfo, explorerLink, status: void 0 }
45917
- });
45918
45835
  (_a2 = callbacks == null ? void 0 : callbacks.onTransactionBroadcasted) == null ? void 0 : _a2.call(callbacks, {
45919
45836
  chainId: txInfo.chainId,
45920
45837
  txHash: txInfo.txHash,
@@ -45929,8 +45846,11 @@ const setSwapExecutionStateAtom = atom$1(null, (get, set) => {
45929
45846
  },
45930
45847
  onTransactionCompleted: async ({ chainId, txHash, status }) => {
45931
45848
  var _a2;
45932
- track("execute route: transaction completed", { chainId, txHash, status });
45933
- setTag("txCompleted", true);
45849
+ track("execute route: transaction completed", {
45850
+ chainId,
45851
+ txHash,
45852
+ status
45853
+ });
45934
45854
  const chain = chains2 == null ? void 0 : chains2.find((chain2) => chain2.chainId === chainId);
45935
45855
  const explorerLink = createExplorerLink({
45936
45856
  chainId,
@@ -45949,34 +45869,10 @@ const setSwapExecutionStateAtom = atom$1(null, (get, set) => {
45949
45869
  destAssetChainId
45950
45870
  });
45951
45871
  },
45952
- onTransactionSigned: async (txInfo) => {
45953
- track("execute route: transaction signed");
45954
- let transactionsSigned = 0;
45955
- set(swapExecutionStateAtom, (prev2) => {
45956
- transactionsSigned = (prev2.transactionsSigned ?? 0) + 1;
45957
- const clientOperations = prev2.clientOperations;
45958
- const signRequiredIndex = clientOperations.findIndex((operation) => {
45959
- return operation.signRequired && (operation.chainId === txInfo.chainId || operation.fromChainId === txInfo.chainId);
45960
- });
45961
- if (signRequiredIndex >= 0) {
45962
- clientOperations[signRequiredIndex].signRequired = false;
45963
- }
45964
- return {
45965
- ...prev2,
45966
- clientOperations,
45967
- transactionsSigned
45968
- };
45969
- });
45970
- const { timestamp } = get(swapExecutionStateAtom);
45971
- set(setTransactionHistoryAtom, {
45972
- timestamp,
45973
- signatures: transactionsSigned
45974
- });
45975
- set(setOverallStatusAtom, "pending");
45976
- },
45977
45872
  onError: (error) => {
45978
45873
  var _a2, _b, _c;
45979
45874
  const currentPage = get(currentPageAtom);
45875
+ set(setCurrentTransactionIdAtom);
45980
45876
  track("execute route: error", { error, route: route2 });
45981
45877
  (_a2 = callbacks == null ? void 0 : callbacks.onTransactionFailed) == null ? void 0 : _a2.call(callbacks, {
45982
45878
  error: error == null ? void 0 : error.message
@@ -45985,80 +45881,34 @@ const setSwapExecutionStateAtom = atom$1(null, (get, set) => {
45985
45881
  track("expected error page: user rejected request");
45986
45882
  if (currentPage === Routes.SwapExecutionPage) {
45987
45883
  set(errorWarningAtom, {
45988
- errorWarningType: ErrorWarningType.AuthFailed,
45989
- onClickBack: () => {
45990
- set(setOverallStatusAtom, "unconfirmed");
45991
- set(clearIsValidatingGasBalanceAtom);
45992
- }
45884
+ errorWarningType: ErrorWarningType.AuthFailed
45993
45885
  });
45994
45886
  }
45995
45887
  } else if ((_b = error == null ? void 0 : error.message) == null ? void 0 : _b.toLowerCase().includes("relay fee quote has expired")) {
45996
- track("error page: relay fee quote has expired");
45888
+ track("expected error page: relay fee quote has expired");
45997
45889
  set(errorWarningAtom, {
45998
- errorWarningType: ErrorWarningType.ExpiredRelayFeeQuote,
45999
- error,
46000
- onClickBack: () => {
46001
- set(setOverallStatusAtom, "unconfirmed");
46002
- }
45890
+ errorWarningType: ErrorWarningType.ExpiredRelayFeeQuote
46003
45891
  });
46004
45892
  } else if ((_c = error == null ? void 0 : error.message) == null ? void 0 : _c.toLowerCase().includes("insufficient balance for gas")) {
46005
45893
  track("expected error page: insufficient gas balance");
46006
45894
  set(errorWarningAtom, {
46007
45895
  errorWarningType: ErrorWarningType.InsufficientBalanceForGas,
46008
- error,
46009
- onClickBack: () => {
46010
- set(setOverallStatusAtom, "unconfirmed");
46011
- }
45896
+ error
46012
45897
  });
46013
45898
  }
46014
45899
  },
46015
45900
  onValidateGasBalance: async (props) => {
46016
45901
  track("execute route: validate gas balance", { props });
46017
- if (props.status === "pending") {
46018
- set(setValidatingGasBalanceAtom, { status: "pending" });
46019
- } else if (props.status === "completed") {
46020
- set(setValidatingGasBalanceAtom, { status: "completed" });
46021
- set(setOverallStatusAtom, "signing");
46022
- }
46023
45902
  }
46024
45903
  });
46025
45904
  });
46026
- const setValidatingGasBalanceAtom = atom$1(
45905
+ atom$1(
46027
45906
  null,
46028
45907
  (_get, set, isValidatingGasBalance) => {
46029
- set(swapExecutionStateAtom, (state) => ({ ...state, isValidatingGasBalance }));
46030
- }
46031
- );
46032
- const setTransactionDetailsAtom = atom$1(
46033
- null,
46034
- (get, set, { transactionDetails, status }) => {
46035
- const swapExecutionState = get(swapExecutionStateAtom);
46036
- const { transactionDetailsArray, route: route2 } = swapExecutionState;
46037
- const newTransactionDetailsArray = [...transactionDetailsArray];
46038
- const transactionIndexFound = newTransactionDetailsArray.findIndex(
46039
- (transaction) => transaction.txHash.toLowerCase() === transactionDetails.txHash.toLowerCase()
46040
- );
46041
- if (transactionIndexFound !== -1) {
46042
- newTransactionDetailsArray[transactionIndexFound] = {
46043
- ...newTransactionDetailsArray[transactionIndexFound],
46044
- ...transactionDetails
46045
- };
46046
- } else {
46047
- newTransactionDetailsArray.push(transactionDetails);
46048
- }
46049
- set(swapExecutionStateAtom, {
46050
- ...swapExecutionState,
46051
- transactionDetailsArray: newTransactionDetailsArray
46052
- });
46053
- set(setTransactionHistoryAtom, {
46054
- route: route2,
46055
- transactionDetails: newTransactionDetailsArray,
46056
- transferEvents: [],
46057
- isSettled: false,
46058
- isSuccess: false,
46059
- timestamp: swapExecutionState == null ? void 0 : swapExecutionState.timestamp,
46060
- ...status && { status }
46061
- });
45908
+ set(swapExecutionStateAtom, (state) => ({
45909
+ ...state,
45910
+ isValidatingGasBalance
45911
+ }));
46062
45912
  }
46063
45913
  );
46064
45914
  const chainAddressEffectAtom = atomEffect((get, set) => {
@@ -46083,7 +45933,7 @@ const simulateTxAtom = atom$1();
46083
45933
  const batchSignTxsAtom = atom$1(true);
46084
45934
  const skipSubmitSwapExecutionAtom = atomWithMutation((get) => {
46085
45935
  var _a;
46086
- const { route: route2, userAddresses, transactionDetailsArray } = get(swapExecutionStateAtom);
45936
+ const { route: route2, userAddresses } = get(swapExecutionStateAtom);
46087
45937
  const submitSwapExecutionCallbacks = get(submitSwapExecutionCallbacksAtom);
46088
45938
  const simulateTx = get(simulateTxAtom);
46089
45939
  const batchSignTxs = get(batchSignTxsAtom);
@@ -46159,14 +46009,16 @@ const skipSubmitSwapExecutionAtom = atomWithMutation((get) => {
46159
46009
  });
46160
46010
  } catch (error) {
46161
46011
  console.error(error);
46162
- (_a2 = submitSwapExecutionCallbacks == null ? void 0 : submitSwapExecutionCallbacks.onError) == null ? void 0 : _a2.call(submitSwapExecutionCallbacks, error, transactionDetailsArray);
46012
+ const currentTransaction = get(currentTransactionAtom);
46013
+ (_a2 = submitSwapExecutionCallbacks == null ? void 0 : submitSwapExecutionCallbacks.onError) == null ? void 0 : _a2.call(submitSwapExecutionCallbacks, error, currentTransaction == null ? void 0 : currentTransaction.transactionDetails);
46163
46014
  }
46164
46015
  return null;
46165
46016
  },
46166
46017
  onError: (error) => {
46167
46018
  var _a2;
46168
46019
  console.error(error);
46169
- (_a2 = submitSwapExecutionCallbacks == null ? void 0 : submitSwapExecutionCallbacks.onError) == null ? void 0 : _a2.call(submitSwapExecutionCallbacks, error, transactionDetailsArray);
46020
+ const currentTransaction = get(currentTransactionAtom);
46021
+ (_a2 = submitSwapExecutionCallbacks == null ? void 0 : submitSwapExecutionCallbacks.onError) == null ? void 0 : _a2.call(submitSwapExecutionCallbacks, error, currentTransaction == null ? void 0 : currentTransaction.transactionDetails);
46170
46022
  }
46171
46023
  };
46172
46024
  });
@@ -46191,18 +46043,15 @@ const UnexpectedErrorPageTimeout = ({
46191
46043
  const theme = nt();
46192
46044
  const [errorWarning, setErrorWarning] = useAtom(errorWarningAtom);
46193
46045
  const setCurrentPage = useSetAtom(currentPageAtom);
46194
- const { route: route2, transactionDetailsArray } = useAtomValue(swapExecutionStateAtom);
46046
+ const { route: route2 } = useAtomValue(swapExecutionStateAtom);
46195
46047
  const isGoFast = useIsGoFast(route2);
46196
- const { data } = useBroadcastedTxsStatus({
46197
- txsRequired: route2 == null ? void 0 : route2.txsRequired,
46198
- transactionDetails: transactionDetailsArray
46199
- });
46048
+ const lastTransactionInTime = useAtomValue(lastTransactionInTimeAtom);
46200
46049
  useEffect(() => {
46201
- if (errorWarning && (data == null ? void 0 : data.isSettled)) {
46050
+ if (errorWarning && (lastTransactionInTime == null ? void 0 : lastTransactionInTime.status) !== "pending") {
46202
46051
  track("unexpected error page: transaction timeover - transaction settled");
46203
46052
  setErrorWarning(void 0);
46204
46053
  }
46205
- }, [data == null ? void 0 : data.isSettled, errorWarning, setErrorWarning]);
46054
+ }, [errorWarning, lastTransactionInTime == null ? void 0 : lastTransactionInTime.status, setErrorWarning]);
46206
46055
  return /* @__PURE__ */ jsxs(Fragment, { children: [
46207
46056
  /* @__PURE__ */ jsx(
46208
46057
  PageHeader,
@@ -46688,12 +46537,13 @@ const ModalRowItem = ({
46688
46537
  rightContent,
46689
46538
  onClick,
46690
46539
  style,
46691
- eureka
46540
+ eureka,
46541
+ as = "button"
46692
46542
  }) => {
46693
46543
  return /* @__PURE__ */ jsxs(
46694
46544
  StyledModalRowItemContainer,
46695
46545
  {
46696
- as: "button",
46546
+ as,
46697
46547
  align: "center",
46698
46548
  justify: "space-between",
46699
46549
  onClick,
@@ -46707,16 +46557,29 @@ const ModalRowItem = ({
46707
46557
  }
46708
46558
  );
46709
46559
  };
46710
- const StyledModalRowItemContainer = dt(Row)`
46560
+ const StyledModalRowItemContainer = dt(Row).attrs(
46561
+ ({ onClick, as }) => ({
46562
+ ...as === "div" && !!onClick && {
46563
+ role: "button",
46564
+ tabIndex: 0,
46565
+ onKeyDown: (e) => {
46566
+ if (e.key === "Enter") {
46567
+ e.preventDefault();
46568
+ onClick();
46569
+ }
46570
+ }
46571
+ }
46572
+ })
46573
+ )`
46711
46574
  ${removeButtonStyles};
46712
46575
  position: relative;
46713
- width: 100%;
46576
+ width: ${({ as }) => as === "div" ? "-webkit-fill-available" : "100%"};
46714
46577
  height: 60px;
46715
46578
  border-radius: ${({ theme }) => {
46716
46579
  var _a;
46717
46580
  return convertToPxValue((_a = theme.borderRadius) == null ? void 0 : _a.rowItem);
46718
46581
  }};
46719
- padding: 12px 15px;
46582
+ padding: ${({ as }) => as === "div" ? "0 15px" : "12px 15px"};
46720
46583
  margin-top: 5px;
46721
46584
 
46722
46585
  z-index: 0;
@@ -46812,6 +46675,7 @@ const VirtualList = ({
46812
46675
  }) => {
46813
46676
  const theme = nt();
46814
46677
  const [currentlyFocusedElement, setCurrentlyFocusedElement] = useState();
46678
+ const [currentlyFocusedItemKey, setCurrentlyFocusedItemKey] = useState();
46815
46679
  const listHeight = useListHeight(itemHeight);
46816
46680
  const listRef = useRef(null);
46817
46681
  const itemRefs = useRef({});
@@ -46856,10 +46720,11 @@ const VirtualList = ({
46856
46720
  useEffect(() => {
46857
46721
  if (!listRef.current || expandedItemKey == null) return;
46858
46722
  const index = listItems.findIndex((item) => itemKey(item) === expandedItemKey);
46859
- if (index !== -1) {
46723
+ if (index !== -1 && currentlyFocusedItemKey !== expandedItemKey) {
46860
46724
  listRef.current.scrollTo({ index, align: "top" });
46725
+ setCurrentlyFocusedItemKey(expandedItemKey);
46861
46726
  }
46862
- }, [expandedItemKey, listItems, itemKey]);
46727
+ }, [expandedItemKey, listItems, itemKey, currentlyFocusedElement, currentlyFocusedItemKey]);
46863
46728
  if (listItems.length === 0) {
46864
46729
  return /* @__PURE__ */ jsxs(StyledNoResultsContainer, { gap: 10, height: height ?? listHeight, children: [
46865
46730
  empty == null ? void 0 : empty.icon,
@@ -48384,6 +48249,7 @@ const ConnectEcoRow = ({
48384
48249
  return /* @__PURE__ */ jsx(
48385
48250
  ModalRowItem,
48386
48251
  {
48252
+ as: "div",
48387
48253
  style: { marginTop: ITEM_GAP$1, minHeight: `${ITEM_HEIGHT$2}px` },
48388
48254
  onClick: handleConnectClick,
48389
48255
  leftContent: account ? /* @__PURE__ */ jsxs(Row, { align: "center", gap: 10, children: [
@@ -48883,7 +48749,7 @@ const SwapSettingsDrawer = createModal(() => {
48883
48749
  }, [route2]);
48884
48750
  return /* @__PURE__ */ jsxs(StyledSwapPageSettings, { gap: 15, children: [
48885
48751
  /* @__PURE__ */ jsxs(Column, { gap: 10, children: [
48886
- /* @__PURE__ */ jsxs(Row, { justify: "space-between", align: "center", children: [
48752
+ route2 && /* @__PURE__ */ jsxs(Row, { justify: "space-between", align: "center", children: [
48887
48753
  /* @__PURE__ */ jsx(SwapDetailText, { children: "Route" }),
48888
48754
  /* @__PURE__ */ jsx(Row, { align: "center", gap: 5, children: chainsRoute == null ? void 0 : chainsRoute.map((chain, index) => {
48889
48755
  var _a;
@@ -50278,7 +50144,6 @@ const RoutePreferenceLabel = ({ preference }) => {
50278
50144
  };
50279
50145
  const SwapPageFooterItems = ({
50280
50146
  content,
50281
- showRouteInfo = false,
50282
50147
  showEstimatedTime = false,
50283
50148
  highlightSettings = false
50284
50149
  }) => {
@@ -50287,11 +50152,12 @@ const SwapPageFooterItems = ({
50287
50152
  const settingsChanged = useSettingsChanged();
50288
50153
  const isMobile2 = useIsMobileScreenSize();
50289
50154
  const isGoFast = useIsGoFast(route2);
50155
+ const currentTransaction = useAtomValue(currentTransactionAtom);
50290
50156
  const estimatedSeconds = route2 == null ? void 0 : route2.estimatedRouteDurationSeconds;
50291
- const signaturesRequired = (route2 == null ? void 0 : route2.txsRequired) ?? 1;
50157
+ const signaturesRequired = route2 ? (route2 == null ? void 0 : route2.txsRequired) - ((currentTransaction == null ? void 0 : currentTransaction.txsSigned) ?? 0) : 0;
50292
50158
  const leftContent = () => {
50293
50159
  if (content) return content;
50294
- if (isLoading || !showRouteInfo || !route2) return null;
50160
+ if (isLoading) return null;
50295
50161
  return /* @__PURE__ */ jsxs(Row, { align: "flex-end", gap: 10, height: isMobile2 ? void 0 : 13, children: [
50296
50162
  showEstimatedTime && /* @__PURE__ */ jsxs(Fragment, { children: [
50297
50163
  /* @__PURE__ */ jsx(SettingsButton, { highlight: highlightSettings, changed: settingsChanged }),
@@ -50345,7 +50211,6 @@ const settingsDrawerAtom = atom$1(void 0);
50345
50211
  const useSettingsDrawer = () => {
50346
50212
  const [drawerOpen, setDrawerOpen] = useState(false);
50347
50213
  const settingsDrawer = useAtomValue(settingsDrawerAtom);
50348
- const { isError: isRouteError, data: route2 } = useAtomValue(skipRouteAtom);
50349
50214
  const isWaitingForNewRoute = useAtomValue(isWaitingForNewRouteAtom);
50350
50215
  const setShowGoFastErrorAtom = useSetAtom(goFastWarningAtom);
50351
50216
  const SettingsFooter = ({ content, ...props }) => {
@@ -50368,8 +50233,7 @@ const useSettingsDrawer = () => {
50368
50233
  return /* @__PURE__ */ jsx(
50369
50234
  SwapPageFooter,
50370
50235
  {
50371
- disabled: isRouteError || isWaitingForNewRoute || route2 === void 0,
50372
- showRouteInfo: true,
50236
+ disabled: isWaitingForNewRoute,
50373
50237
  showEstimatedTime: true,
50374
50238
  onClick: openSettingsDrawer,
50375
50239
  ...props
@@ -50385,7 +50249,6 @@ const WarningPageGoFast = ({ onClickBack, onClickContinue }) => {
50385
50249
  const theme = nt();
50386
50250
  useEffect(() => {
50387
50251
  setShowGoFastErrorAtom(false);
50388
- setTag("goFastWarning", true);
50389
50252
  }, [setShowGoFastErrorAtom]);
50390
50253
  const handleOnClickBack = () => {
50391
50254
  setErrorWarningAtom(void 0);
@@ -50544,9 +50407,6 @@ const ExpectedErrorPageInsufficientGasBalance = ({
50544
50407
  const theme = nt();
50545
50408
  const setErrorWarningAtom = useSetAtom(errorWarningAtom);
50546
50409
  const setCurrentPage = useSetAtom(currentPageAtom);
50547
- useEffect(() => {
50548
- setTag("errorMessage", error == null ? void 0 : error.message);
50549
- }, [error == null ? void 0 : error.message]);
50550
50410
  const onClickRetry = () => {
50551
50411
  setErrorWarningAtom(void 0);
50552
50412
  setCurrentPage(Routes.SwapPage);
@@ -50592,15 +50452,11 @@ const ExpectedErrorPageInsufficientGasBalance = ({
50592
50452
  ] });
50593
50453
  };
50594
50454
  const ExpectedErrorPageRelayFeeQuoteExpired = ({
50595
- error,
50596
50455
  onClickBack
50597
50456
  }) => {
50598
50457
  const theme = nt();
50599
50458
  const setErrorAtom = useSetAtom(errorWarningAtom);
50600
50459
  const setCurrentPage = useSetAtom(currentPageAtom);
50601
- useEffect(() => {
50602
- setTag("errorMessage", error == null ? void 0 : error.message);
50603
- }, [error == null ? void 0 : error.message]);
50604
50460
  const onClickRetry = () => {
50605
50461
  setErrorAtom(void 0);
50606
50462
  setCurrentPage(Routes.SwapPage);
@@ -50613,7 +50469,7 @@ const ExpectedErrorPageRelayFeeQuoteExpired = ({
50613
50469
  label: "Back",
50614
50470
  icon: ICONS.thinArrow,
50615
50471
  onClick: () => {
50616
- track("error page: relay fee quote expired - header back button clicked");
50472
+ track("expected error page: relay fee quote expired - header back button clicked");
50617
50473
  setErrorAtom(void 0);
50618
50474
  onClickBack == null ? void 0 : onClickBack();
50619
50475
  setCurrentPage(Routes.SwapPage);
@@ -50637,7 +50493,7 @@ const ExpectedErrorPageRelayFeeQuoteExpired = ({
50637
50493
  label: "Retry",
50638
50494
  icon: ICONS.rightArrow,
50639
50495
  onClick: () => {
50640
- track("error page: relay fee quote expired - retry button clicked");
50496
+ track("expected error page: relay fee quote expired - retry button clicked");
50641
50497
  onClickRetry();
50642
50498
  },
50643
50499
  backgroundColor: theme.error.text
@@ -51212,7 +51068,8 @@ const StyledGasStationTxText = dt(SmallText)`
51212
51068
  const useAutoSetAddress = () => {
51213
51069
  var _a, _b, _c;
51214
51070
  const [chainAddresses, setChainAddresses] = useAtom(chainAddressesAtom);
51215
- const { route: route2, overallStatus } = useAtomValue(swapExecutionStateAtom);
51071
+ const { route: route2 } = useAtomValue(swapExecutionStateAtom);
51072
+ const currentTransaction = useAtomValue(currentTransactionAtom);
51216
51073
  const requiredChainAddresses = route2 == null ? void 0 : route2.requiredChainAddresses;
51217
51074
  const { data: chains2 } = useAtomValue(skipChainsAtom);
51218
51075
  const sourceWallet = useAtomValue(walletsAtom);
@@ -51347,7 +51204,7 @@ const useAutoSetAddress = () => {
51347
51204
  );
51348
51205
  useEffect(() => {
51349
51206
  var _a2, _b2, _c2, _d, _e2, _f;
51350
- if (overallStatus !== "unconfirmed") {
51207
+ if (currentTransaction && (currentTransaction == null ? void 0 : currentTransaction.status) !== "unconfirmed") {
51351
51208
  setIsLoading(false);
51352
51209
  return;
51353
51210
  }
@@ -51368,8 +51225,9 @@ const useAutoSetAddress = () => {
51368
51225
  (_a = currentSourceWallets == null ? void 0 : currentSourceWallets.cosmos) == null ? void 0 : _a.id,
51369
51226
  (_b = currentSourceWallets == null ? void 0 : currentSourceWallets.evm) == null ? void 0 : _b.id,
51370
51227
  (_c = currentSourceWallets == null ? void 0 : currentSourceWallets.svm) == null ? void 0 : _c.id,
51228
+ currentTransaction,
51229
+ currentTransaction == null ? void 0 : currentTransaction.status,
51371
51230
  isLoading,
51372
- overallStatus,
51373
51231
  requiredChainAddresses,
51374
51232
  sourceWallet
51375
51233
  ]);
@@ -51382,27 +51240,31 @@ const useAutoSetAddress = () => {
51382
51240
  return { connectRequiredChains, isLoading };
51383
51241
  };
51384
51242
  const useHandleTransactionTimeout = (swapExecutionState) => {
51385
- const { route: route2, transactionDetailsArray } = useAtomValue(swapExecutionStateAtom);
51243
+ const currentTransaction = useAtomValue(currentTransactionAtom);
51244
+ const setCurrentTransactionId = useSetAtom(setCurrentTransactionIdAtom);
51386
51245
  const setError = useSetAtom(errorWarningAtom);
51387
- const setOverallStatus = useSetAtom(setOverallStatusAtom);
51388
51246
  const [transactionTimeoutTimer, setTransactionTimeoutTimer] = useState();
51389
51247
  useEffect(() => {
51390
- if (!(route2 == null ? void 0 : route2.estimatedRouteDurationSeconds) || !(route2 == null ? void 0 : route2.txsRequired)) return;
51391
- if (swapExecutionState === SwapExecutionState.pending && transactionTimeoutTimer === void 0 && route2.txsRequired === transactionDetailsArray.length) {
51392
- const lastTransaction = transactionDetailsArray[transactionDetailsArray.length - 1];
51248
+ var _a, _b, _c;
51249
+ if (!((_a = currentTransaction == null ? void 0 : currentTransaction.route) == null ? void 0 : _a.estimatedRouteDurationSeconds) || !(currentTransaction == null ? void 0 : currentTransaction.txsRequired))
51250
+ return;
51251
+ if (swapExecutionState === SwapExecutionState.pending && transactionTimeoutTimer === void 0 && (currentTransaction == null ? void 0 : currentTransaction.txsRequired) === ((_b = currentTransaction == null ? void 0 : currentTransaction.transactionDetails) == null ? void 0 : _b.length)) {
51393
51252
  const timeoutTimer = setTimeout(
51394
51253
  () => {
51395
- track("unexpected error page: transaction timeover", { route: route2 });
51254
+ var _a2, _b2;
51255
+ track("unexpected error page: transaction timeover", {
51256
+ route: currentTransaction == null ? void 0 : currentTransaction.route
51257
+ });
51396
51258
  setError({
51397
51259
  errorWarningType: ErrorWarningType.Timeout,
51398
51260
  onClickBack: () => {
51399
- setOverallStatus("unconfirmed");
51261
+ setCurrentTransactionId();
51400
51262
  },
51401
- explorerLink: createSkipExplorerLink(transactionDetailsArray),
51402
- txHash: lastTransaction == null ? void 0 : lastTransaction.txHash
51263
+ explorerLink: (currentTransaction == null ? void 0 : currentTransaction.transactionDetails) ? createSkipExplorerLink(currentTransaction.transactionDetails) : "",
51264
+ txHash: ((_b2 = (_a2 = currentTransaction == null ? void 0 : currentTransaction.transactionDetails) == null ? void 0 : _a2.at(-1)) == null ? void 0 : _b2.txHash) ?? ""
51403
51265
  });
51404
51266
  },
51405
- route2.estimatedRouteDurationSeconds * 1e3 * 3
51267
+ ((_c = currentTransaction == null ? void 0 : currentTransaction.route) == null ? void 0 : _c.estimatedRouteDurationSeconds) * 1e3 * 3
51406
51268
  );
51407
51269
  setTransactionTimeoutTimer(timeoutTimer);
51408
51270
  }
@@ -51410,98 +51272,28 @@ const useHandleTransactionTimeout = (swapExecutionState) => {
51410
51272
  clearTimeout(transactionTimeoutTimer);
51411
51273
  };
51412
51274
  }, [
51413
- route2,
51275
+ currentTransaction == null ? void 0 : currentTransaction.route,
51276
+ currentTransaction == null ? void 0 : currentTransaction.transactionDetails,
51277
+ currentTransaction == null ? void 0 : currentTransaction.txsRequired,
51278
+ setCurrentTransactionId,
51414
51279
  setError,
51415
- setOverallStatus,
51416
51280
  swapExecutionState,
51417
- transactionDetailsArray,
51418
51281
  transactionTimeoutTimer
51419
51282
  ]);
51420
51283
  };
51421
- const useSyncTxStatus = ({
51422
- statusData,
51423
- timestamp
51424
- }) => {
51425
- const transferEvents = statusData == null ? void 0 : statusData.transferEvents;
51426
- const setOverallStatus = useSetAtom(setOverallStatusAtom);
51427
- const {
51428
- route: route2,
51429
- transactionDetailsArray,
51430
- overallStatus,
51431
- transactionHistoryIndex: currentTransactionHistoryIndex
51432
- } = useAtomValue(swapExecutionStateAtom);
51433
- const setTransactionHistory = useSetAtom(setTransactionHistoryAtom);
51434
- const transactionHistoryItems = useAtomValue(transactionHistoryAtom);
51435
- const { isPending } = useAtomValue(skipSubmitSwapExecutionAtom);
51436
- const clientOperations = useMemo(() => {
51437
- if (!(route2 == null ? void 0 : route2.operations)) return [];
51438
- return getClientOperations(route2.operations);
51439
- }, [route2 == null ? void 0 : route2.operations]);
51440
- const computedSwapStatus = useMemo(() => {
51441
- if ((statusData == null ? void 0 : statusData.lastTxStatus) === "pending") {
51442
- if (isPending) {
51443
- setOverallStatus("pending");
51444
- }
51445
- return "pending";
51446
- }
51447
- if (!transferEvents) return;
51448
- if (statusData.isSuccess) {
51449
- return "completed";
51450
- }
51451
- if (!statusData.isSuccess && statusData.isSettled) {
51452
- return "failed";
51453
- }
51454
- if (transferEvents == null ? void 0 : transferEvents.find(({ status }) => status === "pending")) {
51455
- return "pending";
51456
- }
51457
- if (transferEvents == null ? void 0 : transferEvents.every(({ status }) => status === "unconfirmed")) {
51458
- return "unconfirmed";
51459
- }
51460
- }, [
51461
- statusData == null ? void 0 : statusData.lastTxStatus,
51462
- statusData == null ? void 0 : statusData.isSettled,
51463
- statusData == null ? void 0 : statusData.isSuccess,
51464
- transferEvents,
51465
- isPending,
51466
- setOverallStatus
51467
- ]);
51468
- useEffect(() => {
51469
- if (computedSwapStatus && timestamp !== void 0) {
51470
- const index = transactionHistoryItems.findIndex(
51471
- (txHistoryItem) => txHistoryItem.timestamp === timestamp
51472
- );
51473
- const oldTxHistoryItem = transactionHistoryItems[index];
51474
- const newTxHistoryItem = {
51475
- ...oldTxHistoryItem,
51476
- ...statusData,
51477
- status: computedSwapStatus
51478
- };
51479
- if (JSON.stringify(newTxHistoryItem) !== JSON.stringify(oldTxHistoryItem)) {
51480
- setTransactionHistory(newTxHistoryItem);
51481
- setOverallStatus(computedSwapStatus);
51482
- }
51483
- }
51484
- }, [
51485
- clientOperations,
51486
- overallStatus,
51487
- computedSwapStatus,
51488
- setOverallStatus,
51489
- transactionDetailsArray.length,
51490
- transactionHistoryItems,
51491
- statusData,
51492
- setTransactionHistory,
51493
- currentTransactionHistoryIndex,
51494
- timestamp
51495
- ]);
51496
- };
51497
51284
  function useSwapExecutionState({
51498
51285
  chainAddresses,
51499
51286
  route: route2,
51500
- overallStatus,
51501
- isValidatingGasBalance,
51502
- signaturesRemaining,
51503
51287
  isLoading
51504
51288
  }) {
51289
+ const currentTransaction = useAtomValue(currentTransactionAtom);
51290
+ const showSignaturesRemaining = useMemo(() => {
51291
+ if (!currentTransaction) return false;
51292
+ if ((currentTransaction == null ? void 0 : currentTransaction.txsRequired) >= 2 && (currentTransaction == null ? void 0 : currentTransaction.txsSigned) !== (currentTransaction == null ? void 0 : currentTransaction.txsRequired)) {
51293
+ return true;
51294
+ }
51295
+ return false;
51296
+ }, [currentTransaction]);
51505
51297
  return useMemo(() => {
51506
51298
  var _a;
51507
51299
  if (isLoading) return SwapExecutionState.pendingGettingAddresses;
@@ -51515,22 +51307,22 @@ function useSwapExecutionState({
51515
51307
  }
51516
51308
  );
51517
51309
  const lastChainAddress = (_a = chainAddresses[requiredChainAddresses.length - 1]) == null ? void 0 : _a.address;
51518
- if (overallStatus === "completed") {
51310
+ if ((currentTransaction == null ? void 0 : currentTransaction.status) === "completed") {
51519
51311
  return SwapExecutionState.confirmed;
51520
51312
  }
51521
- if (overallStatus === "pending" || overallStatus === "failed") {
51522
- if (signaturesRemaining > 0) {
51523
- return SwapExecutionState.signaturesRemaining;
51524
- }
51313
+ if ((currentTransaction == null ? void 0 : currentTransaction.status) === "pending") {
51525
51314
  return SwapExecutionState.pending;
51526
51315
  }
51527
- if (overallStatus === "approving") {
51316
+ if ((currentTransaction == null ? void 0 : currentTransaction.status) === "allowance") {
51528
51317
  return SwapExecutionState.approving;
51529
51318
  }
51530
- if (isValidatingGasBalance && isValidatingGasBalance.status !== "completed") {
51319
+ if ((currentTransaction == null ? void 0 : currentTransaction.status) === "validating") {
51531
51320
  return SwapExecutionState.validatingGasBalance;
51532
51321
  }
51533
- if (overallStatus === "signing") {
51322
+ if ((currentTransaction == null ? void 0 : currentTransaction.status) === "signing") {
51323
+ if (showSignaturesRemaining) {
51324
+ return SwapExecutionState.signaturesRemaining;
51325
+ }
51534
51326
  return SwapExecutionState.waitingForSigning;
51535
51327
  }
51536
51328
  if (!lastChainAddress) {
@@ -51544,9 +51336,8 @@ function useSwapExecutionState({
51544
51336
  isLoading,
51545
51337
  chainAddresses,
51546
51338
  route2 == null ? void 0 : route2.requiredChainAddresses,
51547
- overallStatus,
51548
- isValidatingGasBalance,
51549
- signaturesRemaining
51339
+ currentTransaction == null ? void 0 : currentTransaction.status,
51340
+ showSignaturesRemaining
51550
51341
  ]);
51551
51342
  }
51552
51343
  const LightningIcon = ({
@@ -51781,11 +51572,12 @@ const useHandleTransactionFailed = (error, statusData) => {
51781
51572
  const setErrorWarning = useSetAtom(errorWarningAtom);
51782
51573
  const setCurrentPage = useSetAtom(currentPageAtom);
51783
51574
  const setSourceAsset = useSetAtom(sourceAssetAtom);
51575
+ const setCurrentTransactionId = useSetAtom(setCurrentTransactionIdAtom);
51784
51576
  const setDebouncedSourceAssetAmount = useSetAtom(debouncedSourceAssetAmountAtom);
51785
- const setOverallStatus = useSetAtom(setOverallStatusAtom);
51577
+ const currentTransaction = useAtomValue(currentTransactionAtom);
51786
51578
  const [{ data: assets2 }] = useAtom(skipAssetsAtom);
51787
- const { transactionDetailsArray, route: route2 } = useAtomValue(swapExecutionStateAtom);
51788
- const lastTransaction = transactionDetailsArray.at(-1);
51579
+ const { route: route2 } = useAtomValue(swapExecutionStateAtom);
51580
+ const lastTransaction = currentTransaction == null ? void 0 : currentTransaction.transactionDetails.at(-1);
51789
51581
  const lastTxHash = lastTransaction == null ? void 0 : lastTransaction.txHash;
51790
51582
  const getClientAsset = useCallback(
51791
51583
  (denom, chainId) => {
@@ -51796,7 +51588,7 @@ const useHandleTransactionFailed = (error, statusData) => {
51796
51588
  },
51797
51589
  [assets2]
51798
51590
  );
51799
- const explorerLink = createSkipExplorerLink(transactionDetailsArray);
51591
+ const explorerLink = createSkipExplorerLink(currentTransaction == null ? void 0 : currentTransaction.transactionDetails);
51800
51592
  const handleTransactionFailed = useCallback(() => {
51801
51593
  var _a, _b;
51802
51594
  track("unexpected error page: error occurred", { error, route: route2 });
@@ -51838,7 +51630,9 @@ const useHandleTransactionFailed = (error, statusData) => {
51838
51630
  setErrorWarning({
51839
51631
  errorWarningType: ErrorWarningType.Unexpected,
51840
51632
  error,
51841
- onClickBack: () => setOverallStatus("unconfirmed")
51633
+ onClickBack: () => {
51634
+ setCurrentTransactionId();
51635
+ }
51842
51636
  });
51843
51637
  }
51844
51638
  }, [
@@ -51849,28 +51643,24 @@ const useHandleTransactionFailed = (error, statusData) => {
51849
51643
  lastTxHash,
51850
51644
  route2,
51851
51645
  setCurrentPage,
51646
+ setCurrentTransactionId,
51852
51647
  setDebouncedSourceAssetAmount,
51853
51648
  setErrorWarning,
51854
- setOverallStatus,
51855
51649
  setSourceAsset,
51856
51650
  statusData == null ? void 0 : statusData.transferAssetRelease
51857
51651
  ]);
51858
51652
  useEffect(() => {
51859
- if ((statusData == null ? void 0 : statusData.isSuccess) || !(statusData == null ? void 0 : statusData.isSettled)) return;
51860
- const timeout = setTimeout(() => {
51861
- handleTransactionFailed();
51862
- }, DELAY_EXPECTING_TRANSFER_ASSET_RELEASE);
51863
- if (statusData.transferAssetRelease) {
51864
- clearTimeout(timeout);
51865
- handleTransactionFailed();
51653
+ if ((statusData == null ? void 0 : statusData.status) === "failed" || (statusData == null ? void 0 : statusData.status) === "incomplete") {
51654
+ const timeout = setTimeout(() => {
51655
+ handleTransactionFailed();
51656
+ }, DELAY_EXPECTING_TRANSFER_ASSET_RELEASE);
51657
+ if (statusData == null ? void 0 : statusData.transferAssetRelease) {
51658
+ clearTimeout(timeout);
51659
+ handleTransactionFailed();
51660
+ }
51661
+ return () => clearTimeout(timeout);
51866
51662
  }
51867
- return () => clearTimeout(timeout);
51868
- }, [
51869
- statusData == null ? void 0 : statusData.isSettled,
51870
- statusData == null ? void 0 : statusData.isSuccess,
51871
- statusData == null ? void 0 : statusData.transferAssetRelease,
51872
- handleTransactionFailed
51873
- ]);
51663
+ }, [statusData == null ? void 0 : statusData.transferAssetRelease, handleTransactionFailed, statusData == null ? void 0 : statusData.status, statusData]);
51874
51664
  };
51875
51665
  function usePreventPageUnload(shouldWarn) {
51876
51666
  useEffect(() => {
@@ -51900,48 +51690,31 @@ var SwapExecutionState = /* @__PURE__ */ ((SwapExecutionState2) => {
51900
51690
  return SwapExecutionState2;
51901
51691
  })(SwapExecutionState || {});
51902
51692
  const SwapExecutionPage = () => {
51903
- var _a;
51904
51693
  const setCurrentPage = useSetAtom(currentPageAtom);
51905
- const {
51906
- route: route2,
51907
- clientOperations,
51908
- overallStatus,
51909
- transactionDetailsArray,
51910
- isValidatingGasBalance,
51911
- transactionsSigned
51912
- } = useAtomValue(swapExecutionStateAtom);
51913
- const lastTransactionInTime = useAtomValue(lastTransactionInTimeAtom);
51694
+ const { route: route2, clientOperations } = useAtomValue(swapExecutionStateAtom);
51695
+ const currentTransaction = useAtomValue(currentTransactionAtom);
51914
51696
  const chainAddresses = useAtomValue(chainAddressesAtom);
51915
51697
  const { connectRequiredChains, isLoading } = useAutoSetAddress();
51916
51698
  const [simpleRoute, setSimpleRoute] = useState(true);
51917
51699
  const { mutate: submitExecuteRouteMutation, error } = useAtomValue(skipSubmitSwapExecutionAtom);
51918
- const shouldDisplaySignaturesRemaining = (route2 == null ? void 0 : route2.txsRequired) && route2.txsRequired > 1;
51919
- const signaturesRemaining = shouldDisplaySignaturesRemaining ? route2.txsRequired - transactionsSigned : 0;
51920
- const { data: statusData } = useBroadcastedTxsStatus({
51921
- txsRequired: route2 == null ? void 0 : route2.txsRequired,
51922
- transactionDetails: transactionDetailsArray
51923
- });
51924
- const lastTransaction = transactionDetailsArray.at(-1);
51700
+ const signaturesRemaining = useMemo(() => {
51701
+ if (!currentTransaction) return 0;
51702
+ return currentTransaction.txsRequired - currentTransaction.txsSigned;
51703
+ }, [currentTransaction]);
51704
+ const lastTransaction = currentTransaction == null ? void 0 : currentTransaction.transactionDetails.at(-1);
51925
51705
  const lastTxHash = lastTransaction == null ? void 0 : lastTransaction.txHash;
51926
51706
  const lastTxChainId = lastTransaction == null ? void 0 : lastTransaction.chainId;
51927
- useSyncTxStatus({
51928
- statusData,
51929
- timestamp: (_a = lastTransactionInTime == null ? void 0 : lastTransactionInTime.transactionHistoryItem) == null ? void 0 : _a.timestamp
51930
- });
51931
51707
  const lastOperation = clientOperations[clientOperations.length - 1];
51932
51708
  const swapExecutionState = useSwapExecutionState({
51933
51709
  chainAddresses,
51934
51710
  route: route2,
51935
- overallStatus,
51936
- isValidatingGasBalance,
51937
- signaturesRemaining,
51938
51711
  isLoading
51939
51712
  });
51940
- const isSafeToleave = (route2 == null ? void 0 : route2.txsRequired) === transactionDetailsArray.length;
51713
+ const isSafeToleave = (route2 == null ? void 0 : route2.txsRequired) === (currentTransaction == null ? void 0 : currentTransaction.transactionDetails.length);
51941
51714
  usePreventPageUnload(
51942
51715
  swapExecutionState === 5 || swapExecutionState === 4 || swapExecutionState === 8 || swapExecutionState === 7 || !isSafeToleave
51943
51716
  );
51944
- useHandleTransactionFailed(error, statusData);
51717
+ useHandleTransactionFailed(error, currentTransaction);
51945
51718
  useHandleTransactionTimeout(swapExecutionState);
51946
51719
  const firstOperationStatus = useMemo(() => {
51947
51720
  if (swapExecutionState === 6 || swapExecutionState === 3 || swapExecutionState === 5) {
@@ -51949,18 +51722,18 @@ const SwapExecutionPage = () => {
51949
51722
  }
51950
51723
  }, [swapExecutionState]);
51951
51724
  const secondOperationStatus = useMemo(() => {
51952
- var _a2;
51953
- const status = statusData == null ? void 0 : statusData.transferEvents;
51725
+ var _a;
51726
+ const status = currentTransaction == null ? void 0 : currentTransaction.transferEvents;
51954
51727
  if (swapExecutionState === 6) {
51955
51728
  return "completed";
51956
51729
  }
51957
- if ((_a2 = status == null ? void 0 : status[0]) == null ? void 0 : _a2.status) {
51730
+ if ((_a = status == null ? void 0 : status[0]) == null ? void 0 : _a.status) {
51958
51731
  return status[0].status;
51959
51732
  }
51960
51733
  if (swapExecutionState === 3 || swapExecutionState === 5) {
51961
51734
  return "pending";
51962
51735
  }
51963
- }, [statusData, swapExecutionState]);
51736
+ }, [currentTransaction == null ? void 0 : currentTransaction.transferEvents, swapExecutionState]);
51964
51737
  const onClickEditDestinationWallet = useMemo(() => {
51965
51738
  track("swap execution page: edit destination address button - clicked");
51966
51739
  const loadingStates = [
@@ -51983,7 +51756,7 @@ const SwapExecutionPage = () => {
51983
51756
  };
51984
51757
  }, [swapExecutionState, lastOperation.signRequired, lastOperation.fromChain, route2]);
51985
51758
  const SwapExecutionPageRoute = simpleRoute ? SwapExecutionPageRouteSimple : SwapExecutionPageRouteDetailed;
51986
- const shouldRenderTrackProgressButton = lastTxHash && lastTxChainId && (route2 == null ? void 0 : route2.txsRequired) === transactionDetailsArray.length;
51759
+ const shouldRenderTrackProgressButton = lastTxHash && lastTxChainId && (route2 == null ? void 0 : route2.txsRequired) === (currentTransaction == null ? void 0 : currentTransaction.transactionDetails.length);
51987
51760
  return /* @__PURE__ */ jsxs(Column, { gap: 5, children: [
51988
51761
  /* @__PURE__ */ jsx(
51989
51762
  PageHeader,
@@ -51999,7 +51772,10 @@ const SwapExecutionPage = () => {
51999
51772
  centerButton: shouldRenderTrackProgressButton ? {
52000
51773
  label: "Track progress",
52001
51774
  onClick: () => {
52002
- window.open(createSkipExplorerLink(transactionDetailsArray), "_blank");
51775
+ window.open(
51776
+ createSkipExplorerLink(currentTransaction == null ? void 0 : currentTransaction.transactionDetails),
51777
+ "_blank"
51778
+ );
52003
51779
  track("swap execution page: track progress button - clicked", {
52004
51780
  txHash: lastTxHash
52005
51781
  });
@@ -52022,7 +51798,7 @@ const SwapExecutionPage = () => {
52022
51798
  {
52023
51799
  onClickEditDestinationWallet,
52024
51800
  operations: clientOperations,
52025
- statusData,
51801
+ statusData: currentTransaction,
52026
51802
  swapExecutionState,
52027
51803
  firstOperationStatus,
52028
51804
  secondOperationStatus
@@ -52039,7 +51815,7 @@ const SwapExecutionPage = () => {
52039
51815
  submitExecuteRouteMutation
52040
51816
  }
52041
51817
  ),
52042
- /* @__PURE__ */ jsx(SwapPageFooter, { showRouteInfo: overallStatus === "unconfirmed" })
51818
+ /* @__PURE__ */ jsx(SwapPageFooter, {})
52043
51819
  ] });
52044
51820
  };
52045
51821
  const BridgeIcon = ({
@@ -52607,54 +52383,20 @@ const ConnectedWalletContent = () => {
52607
52383
  );
52608
52384
  };
52609
52385
  const useTxHistory = ({ txHistoryItem }) => {
52610
- var _a, _b;
52611
- const { data: chains2 } = useAtomValue(skipChainsAtom);
52612
- const transactionDetails = txHistoryItem == null ? void 0 : txHistoryItem.transactionDetails;
52613
- const chainIdFound = chains2 == null ? void 0 : chains2.some(
52614
- (chain) => transactionDetails == null ? void 0 : transactionDetails.map((tx) => tx.chainId).includes(chain.chainId ?? "")
52615
- );
52616
- const txsRequired = (_a = txHistoryItem == null ? void 0 : txHistoryItem.route) == null ? void 0 : _a.txsRequired;
52617
- let statusData = {
52618
- isSuccess: false,
52619
- isSettled: false,
52620
- transferEvents: [],
52621
- ...txHistoryItem,
52622
- transactionDetails: transactionDetails ?? []
52623
- };
52624
- const shouldFetchStatus = !(txHistoryItem == null ? void 0 : txHistoryItem.isSettled) && transactionDetails !== void 0 && chainIdFound;
52625
- const { data, isFetching, isPending } = useBroadcastedTxsStatus({
52626
- txsRequired,
52627
- transactionDetails,
52628
- enabled: shouldFetchStatus
52629
- });
52630
- if (data !== void 0) {
52631
- statusData = data;
52632
- }
52633
- useSyncTxStatus({
52634
- statusData,
52635
- timestamp: txHistoryItem == null ? void 0 : txHistoryItem.timestamp
52636
- });
52637
- const explorerLinks = /* @__PURE__ */ new Set();
52638
- (_b = statusData == null ? void 0 : statusData.transferEvents) == null ? void 0 : _b.forEach((transferEvent) => {
52639
- explorerLinks.add(transferEvent.fromExplorerLink);
52640
- explorerLinks.add(transferEvent.toExplorerLink);
52641
- });
52642
- const query = useQuery({
52643
- queryKey: ["tx-history-status", { transactionDetails, txsRequired, statusData }],
52644
- queryFn: () => {
52645
- if ((transactionDetails == null ? void 0 : transactionDetails.length) !== txsRequired) return "incomplete";
52646
- if (isFetching && isPending) return "unconfirmed";
52647
- if ((statusData == null ? void 0 : statusData.isSettled) && (statusData == null ? void 0 : statusData.isSuccess)) return "completed";
52648
- if ((statusData == null ? void 0 : statusData.isSettled) && !(statusData == null ? void 0 : statusData.isSuccess) || !chainIdFound) return "failed";
52649
- return "pending";
52650
- },
52651
- enabled: transactionDetails !== void 0 && txsRequired !== void 0 && statusData !== void 0
52652
- });
52653
- return {
52654
- status: query.data,
52655
- explorerLinks: Array.from(explorerLinks).filter((link) => link),
52656
- transferAssetRelease: (statusData == null ? void 0 : statusData.transferAssetRelease) ?? (txHistoryItem == null ? void 0 : txHistoryItem.transferAssetRelease)
52657
- };
52386
+ const setTransactionHistory = useSetAtom(setTransactionHistoryAtom);
52387
+ const [subscribed, setSubscribed] = useState(false);
52388
+ useEffect(() => {
52389
+ if (!txHistoryItem || subscribed) return;
52390
+ const unsubscribe = subscribeToRouteStatus({
52391
+ routeDetails: txHistoryItem,
52392
+ onRouteStatusUpdated: (routeStatus) => setTransactionHistory(routeStatus)
52393
+ });
52394
+ setSubscribed(true);
52395
+ return () => {
52396
+ unsubscribe();
52397
+ };
52398
+ }, [setTransactionHistory, subscribed, txHistoryItem]);
52399
+ return txHistoryItem;
52658
52400
  };
52659
52401
  const SwapPageHeader = memo(() => {
52660
52402
  const setCurrentPage = useSetAtom(currentPageAtom);
@@ -52713,15 +52455,9 @@ const SwapPageHeader = memo(() => {
52713
52455
  });
52714
52456
  const TrackLatestTxHistoryItemStatus = memo(() => {
52715
52457
  const lastTxHistoryItemInTime = useAtomValue(lastTransactionInTimeAtom);
52716
- const setOverallStatus = useSetAtom(setOverallStatusAtom);
52717
- const { transactionsSigned, transactionDetailsArray } = useAtomValue(swapExecutionStateAtom);
52718
- const { isPending } = useAtomValue(skipSubmitSwapExecutionAtom);
52719
- const { transferAssetRelease } = useTxHistory({
52720
- txHistoryItem: lastTxHistoryItemInTime == null ? void 0 : lastTxHistoryItemInTime.transactionHistoryItem
52458
+ useTxHistory({
52459
+ txHistoryItem: lastTxHistoryItemInTime
52721
52460
  });
52722
- if (transferAssetRelease && transactionsSigned !== transactionDetailsArray.length && !isPending) {
52723
- setOverallStatus("failed");
52724
- }
52725
52461
  return null;
52726
52462
  });
52727
52463
  const noHistoryItemsAtom = atom$1((get) => {
@@ -52729,10 +52465,8 @@ const noHistoryItemsAtom = atom$1((get) => {
52729
52465
  return (txHistoryItems == null ? void 0 : txHistoryItems.length) === 0;
52730
52466
  });
52731
52467
  const isFetchingLastTransactionStatusAtom = atom$1((get) => {
52732
- var _a, _b, _c;
52733
- const { overallStatus, route: route2, transactionsSigned } = get(swapExecutionStateAtom);
52734
52468
  const lastTxHistoryItemInTime = get(lastTransactionInTimeAtom);
52735
- return overallStatus === "pending" && transactionsSigned === (route2 == null ? void 0 : route2.txsRequired) || ((_a = lastTxHistoryItemInTime == null ? void 0 : lastTxHistoryItemInTime.transactionHistoryItem) == null ? void 0 : _a.isSettled) !== true && ((_c = (_b = lastTxHistoryItemInTime == null ? void 0 : lastTxHistoryItemInTime.transactionHistoryItem) == null ? void 0 : _b.route) == null ? void 0 : _c.txsRequired) === 1;
52469
+ return (lastTxHistoryItemInTime == null ? void 0 : lastTxHistoryItemInTime.status) === "pending";
52736
52470
  });
52737
52471
  const useConnectToMissingCosmosChain = () => {
52738
52472
  const sourceAsset = useAtomValue(sourceAssetAtom);
@@ -52932,7 +52666,7 @@ const SwapPage = () => {
52932
52666
  }, [fees2]);
52933
52667
  const feeWarning = useMemo(() => {
52934
52668
  if (!(route2 == null ? void 0 : route2.usdAmountIn) || !(route2 == null ? void 0 : route2.usdAmountOut)) return false;
52935
- return parseFloat(route2.usdAmountOut) <= parseFloat(route2.usdAmountIn) * 0.9;
52669
+ return parseFloat(route2.usdAmountOut) < parseFloat(route2.usdAmountIn) * 0.9;
52936
52670
  }, [route2 == null ? void 0 : route2.usdAmountIn, route2 == null ? void 0 : route2.usdAmountOut]);
52937
52671
  const swapButton = useMemo(() => {
52938
52672
  var _a2;
@@ -53005,11 +52739,6 @@ const SwapPage = () => {
53005
52739
  setError(void 0);
53006
52740
  setChainAddresses({});
53007
52741
  setSwapExecutionState();
53008
- setUser({ username: sourceAccount == null ? void 0 : sourceAccount.address });
53009
- if (sourceAccount == null ? void 0 : sourceAccount.address) {
53010
- const replay = getReplay();
53011
- replay == null ? void 0 : replay.start();
53012
- }
53013
52742
  setCurrentPage(Routes.SwapExecutionPage);
53014
52743
  });
53015
52744
  };
@@ -53190,6 +52919,8 @@ const HistoryArrowIcon = ({
53190
52919
  );
53191
52920
  const statusMap = {
53192
52921
  unconfirmed: "Unconfirmed",
52922
+ allowance: "In Progress",
52923
+ validating: "In Progress",
53193
52924
  signing: "In Progress",
53194
52925
  broadcasted: "In Progress",
53195
52926
  pending: "In Progress",
@@ -53933,118 +53664,128 @@ const FilledWarningIcon = ({
53933
53664
  }
53934
53665
  )
53935
53666
  ] });
53936
- const TransactionHistoryPageHistoryItem = forwardRef(({ txHistoryItem, showDetails, onClickRow }, ref) => {
53937
- const theme = nt();
53938
- const isMobileScreenSize = useIsMobileScreenSize();
53939
- const { status: historyStatus, transferAssetRelease } = useTxHistory({
53940
- txHistoryItem
53941
- });
53942
- const removeTransactionHistoryItem = useSetAtom(removeTransactionHistoryItemAtom);
53943
- const {
53944
- route: {
53945
- amountIn,
53946
- amountOut,
53947
- sourceAssetDenom,
53948
- sourceAssetChainId,
53949
- destAssetDenom,
53950
- destAssetChainId
53951
- } = {},
53952
- timestamp,
53953
- transactionDetails
53954
- } = txHistoryItem;
53955
- const sourceAssetDetails = useGetAssetDetails({
53956
- assetDenom: sourceAssetDenom,
53957
- chainId: sourceAssetChainId,
53958
- tokenAmount: amountIn
53959
- });
53960
- const destinationAssetDetails = useGetAssetDetails({
53961
- assetDenom: destAssetDenom,
53962
- chainId: destAssetChainId,
53963
- tokenAmount: amountOut
53964
- });
53965
- const source = {
53966
- amount: sourceAssetDetails.amount,
53967
- asset: sourceAssetDetails.asset,
53968
- assetImage: sourceAssetDetails.assetImage ?? "",
53969
- chainName: sourceAssetDetails.chainName
53970
- };
53971
- const destination = {
53972
- amount: destinationAssetDetails.amount,
53973
- asset: destinationAssetDetails.asset,
53974
- assetImage: destinationAssetDetails.assetImage ?? "",
53975
- chainName: destinationAssetDetails.chainName
53976
- };
53977
- const renderStatus = useMemo(() => {
53978
- switch (historyStatus) {
53979
- case "unconfirmed":
53980
- case "pending":
53981
- return /* @__PURE__ */ jsx(
53982
- StyledAnimatedBorder,
53983
- {
53984
- width: 10,
53985
- height: 10,
53986
- backgroundColor: theme.primary.text.normal,
53987
- status: "pending"
53988
- }
53989
- );
53990
- case "completed":
53991
- return /* @__PURE__ */ jsx(StyledGreenDot, {});
53992
- case "incomplete":
53993
- case "failed": {
53994
- if (transferAssetRelease) {
53995
- return /* @__PURE__ */ jsx(FilledWarningIcon, { backgroundColor: theme.warning.text });
53996
- } else return /* @__PURE__ */ jsx(XIcon, { color: theme.error.text });
53997
- }
53998
- }
53999
- }, [
54000
- historyStatus,
54001
- theme.primary.text.normal,
54002
- theme.error.text,
54003
- theme.warning.text,
54004
- transferAssetRelease
54005
- ]);
54006
- const absoluteTimeString = useMemo(() => {
54007
- if (isMobileScreenSize) {
54008
- return getMobileDateFormat(new Date(timestamp));
54009
- }
54010
- return new Date(timestamp).toLocaleString();
54011
- }, [isMobileScreenSize, timestamp]);
54012
- const relativeTime = useMemo(() => {
54013
- if (historyStatus === "pending") {
54014
- return "In Progress";
54015
- }
54016
- if (!timestamp) return "";
54017
- return formatDistanceStrict(new Date(timestamp), /* @__PURE__ */ new Date(), {
54018
- addSuffix: true
54019
- }).replace("minutes", "mins").replace("minute", "min").replace("hours", "hrs").replace("hour", "hr").replace("seconds", "secs").replace("second", "sec").replace("months", "mos").replace("month", "mo").replace("years", "yrs").replace("year", "yr");
54020
- }, [timestamp, historyStatus]);
54021
- if (!txHistoryItem.route) return null;
54022
- return /* @__PURE__ */ jsxs(StyledHistoryContainer, { ref, showDetails, children: [
54023
- /* @__PURE__ */ jsxs(StyledHistoryItemRow, { align: "center", justify: "space-between", onClick: onClickRow, children: [
54024
- /* @__PURE__ */ jsxs(Row, { gap: 8, align: "center", children: [
54025
- /* @__PURE__ */ jsx(RenderAssetAmount, { ...source, sourceAsset: true }),
54026
- /* @__PURE__ */ jsx(ThinArrowIcon, { color: theme.primary.text.lowContrast, direction: "right" }),
54027
- /* @__PURE__ */ jsx(RenderAssetAmount, { ...destination })
53667
+ const TransactionHistoryPageHistoryItem = forwardRef(
53668
+ ({
53669
+ txHistoryItem,
53670
+ showDetails,
53671
+ onClickRow,
53672
+ onClickDelete
53673
+ }, ref) => {
53674
+ const theme = nt();
53675
+ const isMobileScreenSize = useIsMobileScreenSize();
53676
+ const historyItem = useTxHistory({
53677
+ txHistoryItem
53678
+ });
53679
+ const removeTransactionHistoryItem = useSetAtom(removeTransactionHistoryItemAtom);
53680
+ const {
53681
+ route: {
53682
+ amountIn,
53683
+ amountOut,
53684
+ sourceAssetDenom,
53685
+ sourceAssetChainId,
53686
+ destAssetDenom,
53687
+ destAssetChainId
53688
+ },
53689
+ timestamp,
53690
+ transactionDetails
53691
+ } = txHistoryItem;
53692
+ const sourceAssetDetails = useGetAssetDetails({
53693
+ assetDenom: sourceAssetDenom,
53694
+ chainId: sourceAssetChainId,
53695
+ tokenAmount: amountIn
53696
+ });
53697
+ const destinationAssetDetails = useGetAssetDetails({
53698
+ assetDenom: destAssetDenom,
53699
+ chainId: destAssetChainId,
53700
+ tokenAmount: amountOut
53701
+ });
53702
+ const source = {
53703
+ amount: sourceAssetDetails.amount,
53704
+ asset: sourceAssetDetails.asset,
53705
+ assetImage: sourceAssetDetails.assetImage ?? "",
53706
+ chainName: sourceAssetDetails.chainName
53707
+ };
53708
+ const destination = {
53709
+ amount: destinationAssetDetails.amount,
53710
+ asset: destinationAssetDetails.asset,
53711
+ assetImage: destinationAssetDetails.assetImage ?? "",
53712
+ chainName: destinationAssetDetails.chainName
53713
+ };
53714
+ const renderStatus = useMemo(() => {
53715
+ switch (historyItem == null ? void 0 : historyItem.status) {
53716
+ case "unconfirmed":
53717
+ case "pending":
53718
+ return /* @__PURE__ */ jsx(
53719
+ StyledAnimatedBorder,
53720
+ {
53721
+ width: 10,
53722
+ height: 10,
53723
+ backgroundColor: theme.primary.text.normal,
53724
+ status: "pending"
53725
+ }
53726
+ );
53727
+ case "completed":
53728
+ return /* @__PURE__ */ jsx(StyledGreenDot, {});
53729
+ case "incomplete":
53730
+ case "failed": {
53731
+ if (historyItem == null ? void 0 : historyItem.transferAssetRelease) {
53732
+ return /* @__PURE__ */ jsx(FilledWarningIcon, { backgroundColor: theme.warning.text });
53733
+ } else return /* @__PURE__ */ jsx(XIcon, { color: theme.error.text });
53734
+ }
53735
+ }
53736
+ }, [
53737
+ historyItem == null ? void 0 : historyItem.status,
53738
+ historyItem == null ? void 0 : historyItem.transferAssetRelease,
53739
+ theme.primary.text.normal,
53740
+ theme.error.text,
53741
+ theme.warning.text
53742
+ ]);
53743
+ const absoluteTimeString = useMemo(() => {
53744
+ if (isMobileScreenSize) {
53745
+ return getMobileDateFormat(new Date(timestamp));
53746
+ }
53747
+ return new Date(timestamp).toLocaleString();
53748
+ }, [isMobileScreenSize, timestamp]);
53749
+ const relativeTime = useMemo(() => {
53750
+ if ((historyItem == null ? void 0 : historyItem.status) === "pending") {
53751
+ return "In Progress";
53752
+ }
53753
+ if (!timestamp) return "";
53754
+ return formatDistanceStrict(new Date(timestamp), /* @__PURE__ */ new Date(), {
53755
+ addSuffix: true
53756
+ }).replace("minutes", "mins").replace("minute", "min").replace("hours", "hrs").replace("hour", "hr").replace("seconds", "secs").replace("second", "sec").replace("months", "mos").replace("month", "mo").replace("years", "yrs").replace("year", "yr");
53757
+ }, [historyItem == null ? void 0 : historyItem.status, timestamp]);
53758
+ if (!txHistoryItem.route) return null;
53759
+ return /* @__PURE__ */ jsxs(StyledHistoryContainer, { ref, showDetails, children: [
53760
+ /* @__PURE__ */ jsxs(StyledHistoryItemRow, { align: "center", justify: "space-between", onClick: onClickRow, children: [
53761
+ /* @__PURE__ */ jsxs(Row, { gap: 8, align: "center", children: [
53762
+ /* @__PURE__ */ jsx(RenderAssetAmount, { ...source, sourceAsset: true }),
53763
+ /* @__PURE__ */ jsx(ThinArrowIcon, { color: theme.primary.text.lowContrast, direction: "right" }),
53764
+ /* @__PURE__ */ jsx(RenderAssetAmount, { ...destination })
53765
+ ] }),
53766
+ /* @__PURE__ */ jsxs(Row, { align: "center", gap: 6, children: [
53767
+ /* @__PURE__ */ jsx(SmallText, { children: relativeTime }),
53768
+ /* @__PURE__ */ jsx(Row, { width: 20, align: "center", justify: "center", children: renderStatus })
53769
+ ] })
54028
53770
  ] }),
54029
- /* @__PURE__ */ jsxs(Row, { align: "center", gap: 6, children: [
54030
- /* @__PURE__ */ jsx(SmallText, { children: relativeTime }),
54031
- /* @__PURE__ */ jsx(Row, { width: 20, align: "center", justify: "center", children: renderStatus })
54032
- ] })
54033
- ] }),
54034
- showDetails && /* @__PURE__ */ jsx(
54035
- TransactionHistoryPageHistoryItemDetails,
54036
- {
54037
- status: historyStatus,
54038
- transactionDetails,
54039
- sourceChainName: sourceAssetDetails.chainName ?? "--",
54040
- destinationChainName: destinationAssetDetails.chainName ?? "--",
54041
- absoluteTimeString,
54042
- onClickDelete: () => removeTransactionHistoryItem(txHistoryItem.timestamp),
54043
- transferAssetRelease
54044
- }
54045
- )
54046
- ] });
54047
- });
53771
+ showDetails && /* @__PURE__ */ jsx(
53772
+ TransactionHistoryPageHistoryItemDetails,
53773
+ {
53774
+ status: historyItem == null ? void 0 : historyItem.status,
53775
+ transactionDetails,
53776
+ sourceChainName: sourceAssetDetails.chainName ?? "--",
53777
+ destinationChainName: destinationAssetDetails.chainName ?? "--",
53778
+ absoluteTimeString,
53779
+ onClickDelete: () => {
53780
+ removeTransactionHistoryItem(txHistoryItem.timestamp);
53781
+ onClickDelete == null ? void 0 : onClickDelete();
53782
+ },
53783
+ transferAssetRelease: historyItem == null ? void 0 : historyItem.transferAssetRelease
53784
+ }
53785
+ )
53786
+ ] });
53787
+ }
53788
+ );
54048
53789
  TransactionHistoryPageHistoryItem.displayName = "TransactionHistoryPageHistoryItem";
54049
53790
  const RenderAssetAmount = ({
54050
53791
  amount,
@@ -54099,15 +53840,11 @@ const StyledGreenDot = dt.div`
54099
53840
  border-radius: 50%;
54100
53841
  `;
54101
53842
  const TransactionHistoryPage = () => {
54102
- var _a, _b, _c;
53843
+ var _a, _b;
54103
53844
  const theme = nt();
54104
53845
  const setCurrentPage = useSetAtom(currentPageAtom);
54105
53846
  const [itemIndexToShowDetail, setItemIndexToShowDetail] = useState(void 0);
54106
- const txHistory = useAtomValue(transactionHistoryAtom);
54107
- const historyList = useMemo(
54108
- () => txHistory.sort((a, b) => b.timestamp - a.timestamp),
54109
- [txHistory]
54110
- );
53847
+ const sortedHistoryItems = useAtomValue(sortedHistoryItemsAtom);
54111
53848
  return /* @__PURE__ */ jsxs(Column, { gap: 5, children: [
54112
53849
  /* @__PURE__ */ jsx(
54113
53850
  PageHeader,
@@ -54125,7 +53862,7 @@ const TransactionHistoryPage = () => {
54125
53862
  /* @__PURE__ */ jsx(StyledContainer, { gap: 5, children: /* @__PURE__ */ jsx(
54126
53863
  VirtualList,
54127
53864
  {
54128
- listItems: historyList,
53865
+ listItems: sortedHistoryItems,
54129
53866
  height: 262,
54130
53867
  empty: {
54131
53868
  details: "No transactions yet",
@@ -54144,18 +53881,15 @@ const TransactionHistoryPage = () => {
54144
53881
  item
54145
53882
  });
54146
53883
  setItemIndexToShowDetail((prev2) => prev2 === index ? void 0 : index);
54147
- }
53884
+ },
53885
+ onClickDelete: () => setItemIndexToShowDetail(void 0)
54148
53886
  }
54149
53887
  ),
54150
- itemKey: (item) => {
54151
- var _a2;
54152
- return (_a2 = item.timestamp) == null ? void 0 : _a2.toString();
54153
- },
54154
- expandedItemKey: itemIndexToShowDetail ? (_c = (_b = historyList[itemIndexToShowDetail]) == null ? void 0 : _b.timestamp) == null ? void 0 : _c.toString() : void 0
53888
+ itemKey: (item) => item.id,
53889
+ expandedItemKey: itemIndexToShowDetail ? (_b = sortedHistoryItems[itemIndexToShowDetail]) == null ? void 0 : _b.id : void 0
54155
53890
  },
54156
- txHistory.length
54157
- ) }),
54158
- /* @__PURE__ */ jsx(SwapPageFooter, {})
53891
+ sortedHistoryItems.length
53892
+ ) })
54159
53893
  ] });
54160
53894
  };
54161
53895
  const StyledContainer = dt(Column)`
@@ -54304,37 +54038,19 @@ const useInitDefaultRoute = (defaultRoute) => {
54304
54038
  setRouteToDefaultRoute(assets2);
54305
54039
  }, [assets2, defaultRoute, setDefaultRoute, setRouteToDefaultRoute]);
54306
54040
  };
54307
- let isSentryInitialized = false;
54308
- const initSentry = () => {
54309
- if (isSentryInitialized) return;
54310
- init({
54311
- dsn: "https://10ce608bdd1c68a13d3849d6b242333c@o4504768725909504.ingest.us.sentry.io/4508485201231872",
54312
- tunnel: "https://go.skip.build/api/sentry",
54313
- defaultIntegrations: false,
54314
- integrations: [
54315
- breadcrumbsIntegration(),
54316
- dedupeIntegration(),
54317
- functionToStringIntegration(),
54318
- httpContextIntegration(),
54319
- inboundFiltersIntegration(),
54320
- linkedErrorsIntegration(),
54321
- browserSessionIntegration(),
54322
- replayIntegration({
54323
- maskAllText: false,
54324
- maskAllInputs: false,
54325
- blockAllMedia: false,
54326
- networkDetailAllowUrls: [/^https:\/\/go\.skip\.build\//],
54327
- networkRequestHeaders: ["X-Custom-Header"],
54328
- networkResponseHeaders: ["X-Custom-Header"],
54329
- useCompression: false
54330
- })
54331
- ]
54332
- });
54333
- isSentryInitialized = true;
54041
+ const useMobileRouteConfig = () => {
54042
+ const isMobile2 = useIsMobileScreenSize();
54043
+ const setRouteConfig = useSetAtom(routeConfigAtom);
54044
+ useEffect(() => {
54045
+ setRouteConfig((prev2) => ({
54046
+ ...prev2,
54047
+ allowMultiTx: !isMobile2
54048
+ }));
54049
+ }, [isMobile2, setRouteConfig]);
54334
54050
  };
54335
54051
  const name = "@skip-go/widget";
54336
54052
  const description = "Swap widget";
54337
- const version = "3.12.11";
54053
+ const version = "3.13.0";
54338
54054
  const repository = {
54339
54055
  url: "https://github.com/skip-mev/skip-go",
54340
54056
  directory: "packages/widget"
@@ -54396,7 +54112,7 @@ const devDependencies = {
54396
54112
  "@typescript-eslint/parser": "^7.15.0",
54397
54113
  "@vitejs/plugin-react": "^4.3.1",
54398
54114
  buffer: "^6.0.3",
54399
- "chain-registry": "^2.0.11",
54115
+ "chain-registry": "^2.0.18",
54400
54116
  download: "^8.0.0",
54401
54117
  eslint: "^9.9.0",
54402
54118
  "eslint-config-prettier": "^9.1.0",
@@ -54449,7 +54165,6 @@ const dependencies = {
54449
54165
  "@penumbra-zone/protobuf": "^7.2.0",
54450
54166
  "@penumbra-zone/transport-dom": "^7.5.0",
54451
54167
  "@r2wc/react-to-web-component": "^2.0.3",
54452
- "@sentry/react": "^8.46.0",
54453
54168
  "@skip-go/client": "workspace:^",
54454
54169
  "@solana/spl-token": "^0.4.8",
54455
54170
  "@solana/wallet-adapter-ledger": "^0.9.25",
@@ -54462,7 +54177,7 @@ const dependencies = {
54462
54177
  "@walletconnect/solana-adapter": "^0.0.8",
54463
54178
  add: "^2.0.6",
54464
54179
  bech32: "^2.0.0",
54465
- graz: "0.3.2",
54180
+ graz: "0.3.3",
54466
54181
  jotai: "^2.10.1",
54467
54182
  "jotai-effect": "^1.0.2",
54468
54183
  "jotai-tanstack-query": "^0.8.6",
@@ -54472,6 +54187,7 @@ const dependencies = {
54472
54187
  "react-error-boundary": "^4.0.13",
54473
54188
  "react-shadow-scope": "^1.0.5",
54474
54189
  "styled-components": "^6.1.13",
54190
+ uuid: "^11.1.0",
54475
54191
  yarn: "^1.22.22",
54476
54192
  zod: "^3.23.8"
54477
54193
  };
@@ -54493,18 +54209,8 @@ const packageJson = {
54493
54209
  dependencies,
54494
54210
  publishConfig
54495
54211
  };
54496
- const useMobileRouteConfig = () => {
54497
- const isMobile2 = useIsMobileScreenSize();
54498
- const setRouteConfig = useSetAtom(routeConfigAtom);
54499
- useEffect(() => {
54500
- setRouteConfig((prev2) => ({
54501
- ...prev2,
54502
- allowMultiTx: !isMobile2
54503
- }));
54504
- }, [isMobile2, setRouteConfig]);
54505
- };
54506
54212
  const initAmplitude = () => {
54507
- init$1("14616a575f32087cf0403ab8f3ea3ce0", {
54213
+ init("14616a575f32087cf0403ab8f3ea3ce0", {
54508
54214
  appVersion: version
54509
54215
  });
54510
54216
  const plugin = sessionReplayPlugin({
@@ -54514,13 +54220,9 @@ const initAmplitude = () => {
54514
54220
  };
54515
54221
  const useInitWidget = (props) => {
54516
54222
  var _a, _b;
54517
- if (props.enableSentrySessionReplays) {
54518
- initSentry();
54519
- }
54520
54223
  if (props.enableAmplitudeAnalytics) {
54521
54224
  initAmplitude();
54522
54225
  }
54523
- setTag("widget_version", version);
54524
54226
  useInitDefaultRoute(props.defaultRoute);
54525
54227
  useInitGetSigners(props);
54526
54228
  useMobileRouteConfig();
@@ -54706,6 +54408,86 @@ const useInitGetSigners = (props) => {
54706
54408
  }));
54707
54409
  }, [props.getCosmosSigner, props.getEvmSigner, props.getSvmSigner, setGetSigners]);
54708
54410
  };
54411
+ const updateHistoryFromCamelCaseToRouteDetails = () => {
54412
+ const { set } = jotaiStore;
54413
+ try {
54414
+ const transactionHistoryVersion = JSON.parse(
54415
+ localStorage.getItem(LOCAL_STORAGE_KEYS.transactionHistoryVersion) ?? "0"
54416
+ );
54417
+ const transactionHistory = JSON.parse(
54418
+ localStorage.getItem(LOCAL_STORAGE_KEYS.transactionHistory) ?? "[]"
54419
+ );
54420
+ if (!transactionHistory) {
54421
+ throw new Error("transactionHistory not found in localStorage");
54422
+ }
54423
+ if (transactionHistoryVersion === HISTORY_VERSION.camelCase) {
54424
+ const updatedTransactionHistory = transactionHistory.map(
54425
+ (txHistoryItem) => {
54426
+ var _a, _b, _c, _d;
54427
+ return {
54428
+ id: v4(),
54429
+ timestamp: txHistoryItem.timestamp,
54430
+ route: getSimpleRoute(txHistoryItem.route),
54431
+ status: txHistoryItem.status,
54432
+ txsRequired: (_a = txHistoryItem.route) == null ? void 0 : _a.txsRequired,
54433
+ txsSigned: txHistoryItem.signatures,
54434
+ transactionDetails: getTransactionDetailsWithSimpleTransactionDetailsStatus(
54435
+ txHistoryItem.transactionDetails
54436
+ ),
54437
+ transferEvents: txHistoryItem.transferEvents,
54438
+ transferAssetRelease: txHistoryItem.transferAssetRelease ?? ((_d = (_c = (_b = txHistoryItem.transactionDetails) == null ? void 0 : _b.at(-1)) == null ? void 0 : _c.status) == null ? void 0 : _d.transferAssetRelease)
54439
+ };
54440
+ }
54441
+ );
54442
+ localStorage.setItem(
54443
+ LOCAL_STORAGE_KEYS.transactionHistory,
54444
+ JSON.stringify(updatedTransactionHistory)
54445
+ );
54446
+ console.info(
54447
+ `updated from transactionHistoryVersion ${HISTORY_VERSION.camelCase} to ${HISTORY_VERSION.routeDetails}`
54448
+ );
54449
+ set(transactionHistoryVersionAtom, HISTORY_VERSION.routeDetails);
54450
+ }
54451
+ } catch {
54452
+ console.warn(
54453
+ `Failed to update transactionHistoryVersion from ${HISTORY_VERSION.camelCase} to ${HISTORY_VERSION.routeDetails}`
54454
+ );
54455
+ }
54456
+ };
54457
+ const getSimpleRoute = (route2) => {
54458
+ return {
54459
+ amountIn: route2 == null ? void 0 : route2.amountIn,
54460
+ amountOut: route2 == null ? void 0 : route2.amountOut,
54461
+ sourceAssetDenom: route2 == null ? void 0 : route2.sourceAssetDenom,
54462
+ sourceAssetChainId: route2 == null ? void 0 : route2.sourceAssetChainId,
54463
+ destAssetDenom: route2 == null ? void 0 : route2.destAssetDenom,
54464
+ destAssetChainId: route2 == null ? void 0 : route2.destAssetChainId,
54465
+ estimatedRouteDurationSeconds: route2 == null ? void 0 : route2.estimatedRouteDurationSeconds
54466
+ };
54467
+ };
54468
+ const getTransactionStatus = (state) => {
54469
+ switch (state) {
54470
+ case "STATE_SUBMITTED":
54471
+ case "STATE_PENDING":
54472
+ return "pending";
54473
+ case "STATE_COMPLETED_SUCCESS":
54474
+ return "success";
54475
+ case "STATE_COMPLETED_ERROR":
54476
+ case "STATE_PENDING_ERROR":
54477
+ return "failed";
54478
+ default:
54479
+ return "pending";
54480
+ }
54481
+ };
54482
+ const getTransactionDetailsWithSimpleTransactionDetailsStatus = (transactionDetails) => {
54483
+ return transactionDetails.map((txDetails) => {
54484
+ var _a;
54485
+ return {
54486
+ ...txDetails,
54487
+ status: getTransactionStatus((_a = txDetails.status) == null ? void 0 : _a.state)
54488
+ };
54489
+ });
54490
+ };
54709
54491
  const migrateOldLocalStorageValues = () => {
54710
54492
  if (typeof window === "undefined") return;
54711
54493
  const { set } = jotaiStore;
@@ -54745,6 +54527,7 @@ const migrateOldLocalStorageValues = () => {
54745
54527
  console.warn(`Failed to migrate localStorage key "${key}":`, err);
54746
54528
  }
54747
54529
  });
54530
+ updateHistoryFromCamelCaseToRouteDetails();
54748
54531
  };
54749
54532
  function toCamelCase(obj) {
54750
54533
  return convertKeys(obj, (key) => {