@skip-go/widget 3.12.11-alpha.0 → 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-BAMGhIE-.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,
@@ -48078,8 +47943,7 @@ const useGetAccount = () => {
48078
47943
  chainType,
48079
47944
  wallet: {
48080
47945
  name: "injected",
48081
- prettyName: "injected",
48082
- logo: chain == null ? void 0 : chain.logoUri
47946
+ prettyName: "injected"
48083
47947
  }
48084
47948
  };
48085
47949
  }
@@ -48385,6 +48249,7 @@ const ConnectEcoRow = ({
48385
48249
  return /* @__PURE__ */ jsx(
48386
48250
  ModalRowItem,
48387
48251
  {
48252
+ as: "div",
48388
48253
  style: { marginTop: ITEM_GAP$1, minHeight: `${ITEM_HEIGHT$2}px` },
48389
48254
  onClick: handleConnectClick,
48390
48255
  leftContent: account ? /* @__PURE__ */ jsxs(Row, { align: "center", gap: 10, children: [
@@ -48884,7 +48749,7 @@ const SwapSettingsDrawer = createModal(() => {
48884
48749
  }, [route2]);
48885
48750
  return /* @__PURE__ */ jsxs(StyledSwapPageSettings, { gap: 15, children: [
48886
48751
  /* @__PURE__ */ jsxs(Column, { gap: 10, children: [
48887
- /* @__PURE__ */ jsxs(Row, { justify: "space-between", align: "center", children: [
48752
+ route2 && /* @__PURE__ */ jsxs(Row, { justify: "space-between", align: "center", children: [
48888
48753
  /* @__PURE__ */ jsx(SwapDetailText, { children: "Route" }),
48889
48754
  /* @__PURE__ */ jsx(Row, { align: "center", gap: 5, children: chainsRoute == null ? void 0 : chainsRoute.map((chain, index) => {
48890
48755
  var _a;
@@ -50279,7 +50144,6 @@ const RoutePreferenceLabel = ({ preference }) => {
50279
50144
  };
50280
50145
  const SwapPageFooterItems = ({
50281
50146
  content,
50282
- showRouteInfo = false,
50283
50147
  showEstimatedTime = false,
50284
50148
  highlightSettings = false
50285
50149
  }) => {
@@ -50288,11 +50152,12 @@ const SwapPageFooterItems = ({
50288
50152
  const settingsChanged = useSettingsChanged();
50289
50153
  const isMobile2 = useIsMobileScreenSize();
50290
50154
  const isGoFast = useIsGoFast(route2);
50155
+ const currentTransaction = useAtomValue(currentTransactionAtom);
50291
50156
  const estimatedSeconds = route2 == null ? void 0 : route2.estimatedRouteDurationSeconds;
50292
- 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;
50293
50158
  const leftContent = () => {
50294
50159
  if (content) return content;
50295
- if (isLoading || !showRouteInfo || !route2) return null;
50160
+ if (isLoading) return null;
50296
50161
  return /* @__PURE__ */ jsxs(Row, { align: "flex-end", gap: 10, height: isMobile2 ? void 0 : 13, children: [
50297
50162
  showEstimatedTime && /* @__PURE__ */ jsxs(Fragment, { children: [
50298
50163
  /* @__PURE__ */ jsx(SettingsButton, { highlight: highlightSettings, changed: settingsChanged }),
@@ -50346,7 +50211,6 @@ const settingsDrawerAtom = atom$1(void 0);
50346
50211
  const useSettingsDrawer = () => {
50347
50212
  const [drawerOpen, setDrawerOpen] = useState(false);
50348
50213
  const settingsDrawer = useAtomValue(settingsDrawerAtom);
50349
- const { isError: isRouteError, data: route2 } = useAtomValue(skipRouteAtom);
50350
50214
  const isWaitingForNewRoute = useAtomValue(isWaitingForNewRouteAtom);
50351
50215
  const setShowGoFastErrorAtom = useSetAtom(goFastWarningAtom);
50352
50216
  const SettingsFooter = ({ content, ...props }) => {
@@ -50369,8 +50233,7 @@ const useSettingsDrawer = () => {
50369
50233
  return /* @__PURE__ */ jsx(
50370
50234
  SwapPageFooter,
50371
50235
  {
50372
- disabled: isRouteError || isWaitingForNewRoute || route2 === void 0,
50373
- showRouteInfo: true,
50236
+ disabled: isWaitingForNewRoute,
50374
50237
  showEstimatedTime: true,
50375
50238
  onClick: openSettingsDrawer,
50376
50239
  ...props
@@ -50386,7 +50249,6 @@ const WarningPageGoFast = ({ onClickBack, onClickContinue }) => {
50386
50249
  const theme = nt();
50387
50250
  useEffect(() => {
50388
50251
  setShowGoFastErrorAtom(false);
50389
- setTag("goFastWarning", true);
50390
50252
  }, [setShowGoFastErrorAtom]);
50391
50253
  const handleOnClickBack = () => {
50392
50254
  setErrorWarningAtom(void 0);
@@ -50545,9 +50407,6 @@ const ExpectedErrorPageInsufficientGasBalance = ({
50545
50407
  const theme = nt();
50546
50408
  const setErrorWarningAtom = useSetAtom(errorWarningAtom);
50547
50409
  const setCurrentPage = useSetAtom(currentPageAtom);
50548
- useEffect(() => {
50549
- setTag("errorMessage", error == null ? void 0 : error.message);
50550
- }, [error == null ? void 0 : error.message]);
50551
50410
  const onClickRetry = () => {
50552
50411
  setErrorWarningAtom(void 0);
50553
50412
  setCurrentPage(Routes.SwapPage);
@@ -50593,15 +50452,11 @@ const ExpectedErrorPageInsufficientGasBalance = ({
50593
50452
  ] });
50594
50453
  };
50595
50454
  const ExpectedErrorPageRelayFeeQuoteExpired = ({
50596
- error,
50597
50455
  onClickBack
50598
50456
  }) => {
50599
50457
  const theme = nt();
50600
50458
  const setErrorAtom = useSetAtom(errorWarningAtom);
50601
50459
  const setCurrentPage = useSetAtom(currentPageAtom);
50602
- useEffect(() => {
50603
- setTag("errorMessage", error == null ? void 0 : error.message);
50604
- }, [error == null ? void 0 : error.message]);
50605
50460
  const onClickRetry = () => {
50606
50461
  setErrorAtom(void 0);
50607
50462
  setCurrentPage(Routes.SwapPage);
@@ -50614,7 +50469,7 @@ const ExpectedErrorPageRelayFeeQuoteExpired = ({
50614
50469
  label: "Back",
50615
50470
  icon: ICONS.thinArrow,
50616
50471
  onClick: () => {
50617
- track("error page: relay fee quote expired - header back button clicked");
50472
+ track("expected error page: relay fee quote expired - header back button clicked");
50618
50473
  setErrorAtom(void 0);
50619
50474
  onClickBack == null ? void 0 : onClickBack();
50620
50475
  setCurrentPage(Routes.SwapPage);
@@ -50638,7 +50493,7 @@ const ExpectedErrorPageRelayFeeQuoteExpired = ({
50638
50493
  label: "Retry",
50639
50494
  icon: ICONS.rightArrow,
50640
50495
  onClick: () => {
50641
- track("error page: relay fee quote expired - retry button clicked");
50496
+ track("expected error page: relay fee quote expired - retry button clicked");
50642
50497
  onClickRetry();
50643
50498
  },
50644
50499
  backgroundColor: theme.error.text
@@ -51213,13 +51068,15 @@ const StyledGasStationTxText = dt(SmallText)`
51213
51068
  const useAutoSetAddress = () => {
51214
51069
  var _a, _b, _c;
51215
51070
  const [chainAddresses, setChainAddresses] = useAtom(chainAddressesAtom);
51216
- const { route: route2, overallStatus } = useAtomValue(swapExecutionStateAtom);
51071
+ const { route: route2 } = useAtomValue(swapExecutionStateAtom);
51072
+ const currentTransaction = useAtomValue(currentTransactionAtom);
51217
51073
  const requiredChainAddresses = route2 == null ? void 0 : route2.requiredChainAddresses;
51218
51074
  const { data: chains2 } = useAtomValue(skipChainsAtom);
51219
51075
  const sourceWallet = useAtomValue(walletsAtom);
51220
51076
  const [isLoading, setIsLoading] = useState(true);
51221
51077
  const [walletHasChanged, setWalletHasChanged] = useState(false);
51222
51078
  const [currentSourceWallets, setCurrentSourceWallets] = useState();
51079
+ const [currentConnectedAddress, setCurrentConnectedAddress] = useState();
51223
51080
  const { createCosmosWallets } = useCreateCosmosWallets();
51224
51081
  const { createEvmWallets } = useCreateEvmWallets();
51225
51082
  const { createSolanaWallets } = useCreateSolanaWallets();
@@ -51269,7 +51126,7 @@ const useAutoSetAddress = () => {
51269
51126
  walletPrettyName: "injected",
51270
51127
  walletChainType: chainType,
51271
51128
  walletInfo: {
51272
- logo: chain.logoUri
51129
+ logo: void 0
51273
51130
  }
51274
51131
  }
51275
51132
  }
@@ -51283,7 +51140,9 @@ const useAutoSetAddress = () => {
51283
51140
  const walletName = (_a2 = sourceWallet[chainType]) == null ? void 0 : _a2.walletName;
51284
51141
  const wallet = wallets.find((w2) => w2.walletName === walletName);
51285
51142
  const isSignRequired = signRequiredChains == null ? void 0 : signRequiredChains.includes(chainId);
51286
- const response = await ((_b2 = wallet == null ? void 0 : wallet.getAddress) == null ? void 0 : _b2.call(wallet, { signRequired: isSignRequired }));
51143
+ const response = await ((_b2 = wallet == null ? void 0 : wallet.getAddress) == null ? void 0 : _b2.call(wallet, {
51144
+ signRequired: isSignRequired
51145
+ }));
51287
51146
  const isInjectedWallet2 = connectedAddress == null ? void 0 : connectedAddress[chainId];
51288
51147
  const address = (connectedAddress == null ? void 0 : connectedAddress[chainId]) ?? (response == null ? void 0 : response.address);
51289
51148
  if (!address) {
@@ -51345,22 +51204,30 @@ const useAutoSetAddress = () => {
51345
51204
  );
51346
51205
  useEffect(() => {
51347
51206
  var _a2, _b2, _c2, _d, _e2, _f;
51348
- if (overallStatus !== "unconfirmed") {
51207
+ if (currentTransaction && (currentTransaction == null ? void 0 : currentTransaction.status) !== "unconfirmed") {
51349
51208
  setIsLoading(false);
51350
51209
  return;
51351
51210
  }
51352
51211
  const hasWalletChanged = ((_a2 = sourceWallet.cosmos) == null ? void 0 : _a2.id) !== ((_b2 = currentSourceWallets == null ? void 0 : currentSourceWallets.cosmos) == null ? void 0 : _b2.id) || ((_c2 = sourceWallet.evm) == null ? void 0 : _c2.id) !== ((_d = currentSourceWallets == null ? void 0 : currentSourceWallets.evm) == null ? void 0 : _d.id) || ((_e2 = sourceWallet.svm) == null ? void 0 : _e2.id) !== ((_f = currentSourceWallets == null ? void 0 : currentSourceWallets.svm) == null ? void 0 : _f.id);
51212
+ const hasConnectedAddressChanged = JSON.stringify(connectedAddress) !== JSON.stringify(currentConnectedAddress);
51213
+ if (hasConnectedAddressChanged) {
51214
+ setCurrentConnectedAddress(connectedAddress);
51215
+ setWalletHasChanged(true);
51216
+ }
51353
51217
  if (hasWalletChanged) {
51354
51218
  setCurrentSourceWallets(sourceWallet);
51355
51219
  setWalletHasChanged(true);
51356
51220
  }
51357
51221
  }, [
51358
51222
  connectRequiredChains,
51223
+ connectedAddress,
51224
+ currentConnectedAddress,
51359
51225
  (_a = currentSourceWallets == null ? void 0 : currentSourceWallets.cosmos) == null ? void 0 : _a.id,
51360
51226
  (_b = currentSourceWallets == null ? void 0 : currentSourceWallets.evm) == null ? void 0 : _b.id,
51361
51227
  (_c = currentSourceWallets == null ? void 0 : currentSourceWallets.svm) == null ? void 0 : _c.id,
51228
+ currentTransaction,
51229
+ currentTransaction == null ? void 0 : currentTransaction.status,
51362
51230
  isLoading,
51363
- overallStatus,
51364
51231
  requiredChainAddresses,
51365
51232
  sourceWallet
51366
51233
  ]);
@@ -51373,27 +51240,31 @@ const useAutoSetAddress = () => {
51373
51240
  return { connectRequiredChains, isLoading };
51374
51241
  };
51375
51242
  const useHandleTransactionTimeout = (swapExecutionState) => {
51376
- const { route: route2, transactionDetailsArray } = useAtomValue(swapExecutionStateAtom);
51243
+ const currentTransaction = useAtomValue(currentTransactionAtom);
51244
+ const setCurrentTransactionId = useSetAtom(setCurrentTransactionIdAtom);
51377
51245
  const setError = useSetAtom(errorWarningAtom);
51378
- const setOverallStatus = useSetAtom(setOverallStatusAtom);
51379
51246
  const [transactionTimeoutTimer, setTransactionTimeoutTimer] = useState();
51380
51247
  useEffect(() => {
51381
- if (!(route2 == null ? void 0 : route2.estimatedRouteDurationSeconds) || !(route2 == null ? void 0 : route2.txsRequired)) return;
51382
- if (swapExecutionState === SwapExecutionState.pending && transactionTimeoutTimer === void 0 && route2.txsRequired === transactionDetailsArray.length) {
51383
- 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)) {
51384
51252
  const timeoutTimer = setTimeout(
51385
51253
  () => {
51386
- 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
+ });
51387
51258
  setError({
51388
51259
  errorWarningType: ErrorWarningType.Timeout,
51389
51260
  onClickBack: () => {
51390
- setOverallStatus("unconfirmed");
51261
+ setCurrentTransactionId();
51391
51262
  },
51392
- explorerLink: createSkipExplorerLink(transactionDetailsArray),
51393
- 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) ?? ""
51394
51265
  });
51395
51266
  },
51396
- route2.estimatedRouteDurationSeconds * 1e3 * 3
51267
+ ((_c = currentTransaction == null ? void 0 : currentTransaction.route) == null ? void 0 : _c.estimatedRouteDurationSeconds) * 1e3 * 3
51397
51268
  );
51398
51269
  setTransactionTimeoutTimer(timeoutTimer);
51399
51270
  }
@@ -51401,98 +51272,28 @@ const useHandleTransactionTimeout = (swapExecutionState) => {
51401
51272
  clearTimeout(transactionTimeoutTimer);
51402
51273
  };
51403
51274
  }, [
51404
- route2,
51275
+ currentTransaction == null ? void 0 : currentTransaction.route,
51276
+ currentTransaction == null ? void 0 : currentTransaction.transactionDetails,
51277
+ currentTransaction == null ? void 0 : currentTransaction.txsRequired,
51278
+ setCurrentTransactionId,
51405
51279
  setError,
51406
- setOverallStatus,
51407
51280
  swapExecutionState,
51408
- transactionDetailsArray,
51409
51281
  transactionTimeoutTimer
51410
51282
  ]);
51411
51283
  };
51412
- const useSyncTxStatus = ({
51413
- statusData,
51414
- timestamp
51415
- }) => {
51416
- const transferEvents = statusData == null ? void 0 : statusData.transferEvents;
51417
- const setOverallStatus = useSetAtom(setOverallStatusAtom);
51418
- const {
51419
- route: route2,
51420
- transactionDetailsArray,
51421
- overallStatus,
51422
- transactionHistoryIndex: currentTransactionHistoryIndex
51423
- } = useAtomValue(swapExecutionStateAtom);
51424
- const setTransactionHistory = useSetAtom(setTransactionHistoryAtom);
51425
- const transactionHistoryItems = useAtomValue(transactionHistoryAtom);
51426
- const { isPending } = useAtomValue(skipSubmitSwapExecutionAtom);
51427
- const clientOperations = useMemo(() => {
51428
- if (!(route2 == null ? void 0 : route2.operations)) return [];
51429
- return getClientOperations(route2.operations);
51430
- }, [route2 == null ? void 0 : route2.operations]);
51431
- const computedSwapStatus = useMemo(() => {
51432
- if ((statusData == null ? void 0 : statusData.lastTxStatus) === "pending") {
51433
- if (isPending) {
51434
- setOverallStatus("pending");
51435
- }
51436
- return "pending";
51437
- }
51438
- if (!transferEvents) return;
51439
- if (statusData.isSuccess) {
51440
- return "completed";
51441
- }
51442
- if (!statusData.isSuccess && statusData.isSettled) {
51443
- return "failed";
51444
- }
51445
- if (transferEvents == null ? void 0 : transferEvents.find(({ status }) => status === "pending")) {
51446
- return "pending";
51447
- }
51448
- if (transferEvents == null ? void 0 : transferEvents.every(({ status }) => status === "unconfirmed")) {
51449
- return "unconfirmed";
51450
- }
51451
- }, [
51452
- statusData == null ? void 0 : statusData.lastTxStatus,
51453
- statusData == null ? void 0 : statusData.isSettled,
51454
- statusData == null ? void 0 : statusData.isSuccess,
51455
- transferEvents,
51456
- isPending,
51457
- setOverallStatus
51458
- ]);
51459
- useEffect(() => {
51460
- if (computedSwapStatus && timestamp !== void 0) {
51461
- const index = transactionHistoryItems.findIndex(
51462
- (txHistoryItem) => txHistoryItem.timestamp === timestamp
51463
- );
51464
- const oldTxHistoryItem = transactionHistoryItems[index];
51465
- const newTxHistoryItem = {
51466
- ...oldTxHistoryItem,
51467
- ...statusData,
51468
- status: computedSwapStatus
51469
- };
51470
- if (JSON.stringify(newTxHistoryItem) !== JSON.stringify(oldTxHistoryItem)) {
51471
- setTransactionHistory(newTxHistoryItem);
51472
- setOverallStatus(computedSwapStatus);
51473
- }
51474
- }
51475
- }, [
51476
- clientOperations,
51477
- overallStatus,
51478
- computedSwapStatus,
51479
- setOverallStatus,
51480
- transactionDetailsArray.length,
51481
- transactionHistoryItems,
51482
- statusData,
51483
- setTransactionHistory,
51484
- currentTransactionHistoryIndex,
51485
- timestamp
51486
- ]);
51487
- };
51488
51284
  function useSwapExecutionState({
51489
51285
  chainAddresses,
51490
51286
  route: route2,
51491
- overallStatus,
51492
- isValidatingGasBalance,
51493
- signaturesRemaining,
51494
51287
  isLoading
51495
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]);
51496
51297
  return useMemo(() => {
51497
51298
  var _a;
51498
51299
  if (isLoading) return SwapExecutionState.pendingGettingAddresses;
@@ -51506,22 +51307,22 @@ function useSwapExecutionState({
51506
51307
  }
51507
51308
  );
51508
51309
  const lastChainAddress = (_a = chainAddresses[requiredChainAddresses.length - 1]) == null ? void 0 : _a.address;
51509
- if (overallStatus === "completed") {
51310
+ if ((currentTransaction == null ? void 0 : currentTransaction.status) === "completed") {
51510
51311
  return SwapExecutionState.confirmed;
51511
51312
  }
51512
- if (overallStatus === "pending" || overallStatus === "failed") {
51513
- if (signaturesRemaining > 0) {
51514
- return SwapExecutionState.signaturesRemaining;
51515
- }
51313
+ if ((currentTransaction == null ? void 0 : currentTransaction.status) === "pending") {
51516
51314
  return SwapExecutionState.pending;
51517
51315
  }
51518
- if (overallStatus === "approving") {
51316
+ if ((currentTransaction == null ? void 0 : currentTransaction.status) === "allowance") {
51519
51317
  return SwapExecutionState.approving;
51520
51318
  }
51521
- if (isValidatingGasBalance && isValidatingGasBalance.status !== "completed") {
51319
+ if ((currentTransaction == null ? void 0 : currentTransaction.status) === "validating") {
51522
51320
  return SwapExecutionState.validatingGasBalance;
51523
51321
  }
51524
- if (overallStatus === "signing") {
51322
+ if ((currentTransaction == null ? void 0 : currentTransaction.status) === "signing") {
51323
+ if (showSignaturesRemaining) {
51324
+ return SwapExecutionState.signaturesRemaining;
51325
+ }
51525
51326
  return SwapExecutionState.waitingForSigning;
51526
51327
  }
51527
51328
  if (!lastChainAddress) {
@@ -51535,9 +51336,8 @@ function useSwapExecutionState({
51535
51336
  isLoading,
51536
51337
  chainAddresses,
51537
51338
  route2 == null ? void 0 : route2.requiredChainAddresses,
51538
- overallStatus,
51539
- isValidatingGasBalance,
51540
- signaturesRemaining
51339
+ currentTransaction == null ? void 0 : currentTransaction.status,
51340
+ showSignaturesRemaining
51541
51341
  ]);
51542
51342
  }
51543
51343
  const LightningIcon = ({
@@ -51772,11 +51572,12 @@ const useHandleTransactionFailed = (error, statusData) => {
51772
51572
  const setErrorWarning = useSetAtom(errorWarningAtom);
51773
51573
  const setCurrentPage = useSetAtom(currentPageAtom);
51774
51574
  const setSourceAsset = useSetAtom(sourceAssetAtom);
51575
+ const setCurrentTransactionId = useSetAtom(setCurrentTransactionIdAtom);
51775
51576
  const setDebouncedSourceAssetAmount = useSetAtom(debouncedSourceAssetAmountAtom);
51776
- const setOverallStatus = useSetAtom(setOverallStatusAtom);
51577
+ const currentTransaction = useAtomValue(currentTransactionAtom);
51777
51578
  const [{ data: assets2 }] = useAtom(skipAssetsAtom);
51778
- const { transactionDetailsArray, route: route2 } = useAtomValue(swapExecutionStateAtom);
51779
- const lastTransaction = transactionDetailsArray.at(-1);
51579
+ const { route: route2 } = useAtomValue(swapExecutionStateAtom);
51580
+ const lastTransaction = currentTransaction == null ? void 0 : currentTransaction.transactionDetails.at(-1);
51780
51581
  const lastTxHash = lastTransaction == null ? void 0 : lastTransaction.txHash;
51781
51582
  const getClientAsset = useCallback(
51782
51583
  (denom, chainId) => {
@@ -51787,7 +51588,7 @@ const useHandleTransactionFailed = (error, statusData) => {
51787
51588
  },
51788
51589
  [assets2]
51789
51590
  );
51790
- const explorerLink = createSkipExplorerLink(transactionDetailsArray);
51591
+ const explorerLink = createSkipExplorerLink(currentTransaction == null ? void 0 : currentTransaction.transactionDetails);
51791
51592
  const handleTransactionFailed = useCallback(() => {
51792
51593
  var _a, _b;
51793
51594
  track("unexpected error page: error occurred", { error, route: route2 });
@@ -51829,7 +51630,9 @@ const useHandleTransactionFailed = (error, statusData) => {
51829
51630
  setErrorWarning({
51830
51631
  errorWarningType: ErrorWarningType.Unexpected,
51831
51632
  error,
51832
- onClickBack: () => setOverallStatus("unconfirmed")
51633
+ onClickBack: () => {
51634
+ setCurrentTransactionId();
51635
+ }
51833
51636
  });
51834
51637
  }
51835
51638
  }, [
@@ -51840,28 +51643,24 @@ const useHandleTransactionFailed = (error, statusData) => {
51840
51643
  lastTxHash,
51841
51644
  route2,
51842
51645
  setCurrentPage,
51646
+ setCurrentTransactionId,
51843
51647
  setDebouncedSourceAssetAmount,
51844
51648
  setErrorWarning,
51845
- setOverallStatus,
51846
51649
  setSourceAsset,
51847
51650
  statusData == null ? void 0 : statusData.transferAssetRelease
51848
51651
  ]);
51849
51652
  useEffect(() => {
51850
- if ((statusData == null ? void 0 : statusData.isSuccess) || !(statusData == null ? void 0 : statusData.isSettled)) return;
51851
- const timeout = setTimeout(() => {
51852
- handleTransactionFailed();
51853
- }, DELAY_EXPECTING_TRANSFER_ASSET_RELEASE);
51854
- if (statusData.transferAssetRelease) {
51855
- clearTimeout(timeout);
51856
- 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);
51857
51662
  }
51858
- return () => clearTimeout(timeout);
51859
- }, [
51860
- statusData == null ? void 0 : statusData.isSettled,
51861
- statusData == null ? void 0 : statusData.isSuccess,
51862
- statusData == null ? void 0 : statusData.transferAssetRelease,
51863
- handleTransactionFailed
51864
- ]);
51663
+ }, [statusData == null ? void 0 : statusData.transferAssetRelease, handleTransactionFailed, statusData == null ? void 0 : statusData.status, statusData]);
51865
51664
  };
51866
51665
  function usePreventPageUnload(shouldWarn) {
51867
51666
  useEffect(() => {
@@ -51891,48 +51690,31 @@ var SwapExecutionState = /* @__PURE__ */ ((SwapExecutionState2) => {
51891
51690
  return SwapExecutionState2;
51892
51691
  })(SwapExecutionState || {});
51893
51692
  const SwapExecutionPage = () => {
51894
- var _a;
51895
51693
  const setCurrentPage = useSetAtom(currentPageAtom);
51896
- const {
51897
- route: route2,
51898
- clientOperations,
51899
- overallStatus,
51900
- transactionDetailsArray,
51901
- isValidatingGasBalance,
51902
- transactionsSigned
51903
- } = useAtomValue(swapExecutionStateAtom);
51904
- const lastTransactionInTime = useAtomValue(lastTransactionInTimeAtom);
51694
+ const { route: route2, clientOperations } = useAtomValue(swapExecutionStateAtom);
51695
+ const currentTransaction = useAtomValue(currentTransactionAtom);
51905
51696
  const chainAddresses = useAtomValue(chainAddressesAtom);
51906
51697
  const { connectRequiredChains, isLoading } = useAutoSetAddress();
51907
51698
  const [simpleRoute, setSimpleRoute] = useState(true);
51908
51699
  const { mutate: submitExecuteRouteMutation, error } = useAtomValue(skipSubmitSwapExecutionAtom);
51909
- const shouldDisplaySignaturesRemaining = (route2 == null ? void 0 : route2.txsRequired) && route2.txsRequired > 1;
51910
- const signaturesRemaining = shouldDisplaySignaturesRemaining ? route2.txsRequired - transactionsSigned : 0;
51911
- const { data: statusData } = useBroadcastedTxsStatus({
51912
- txsRequired: route2 == null ? void 0 : route2.txsRequired,
51913
- transactionDetails: transactionDetailsArray
51914
- });
51915
- 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);
51916
51705
  const lastTxHash = lastTransaction == null ? void 0 : lastTransaction.txHash;
51917
51706
  const lastTxChainId = lastTransaction == null ? void 0 : lastTransaction.chainId;
51918
- useSyncTxStatus({
51919
- statusData,
51920
- timestamp: (_a = lastTransactionInTime == null ? void 0 : lastTransactionInTime.transactionHistoryItem) == null ? void 0 : _a.timestamp
51921
- });
51922
51707
  const lastOperation = clientOperations[clientOperations.length - 1];
51923
51708
  const swapExecutionState = useSwapExecutionState({
51924
51709
  chainAddresses,
51925
51710
  route: route2,
51926
- overallStatus,
51927
- isValidatingGasBalance,
51928
- signaturesRemaining,
51929
51711
  isLoading
51930
51712
  });
51931
- 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);
51932
51714
  usePreventPageUnload(
51933
51715
  swapExecutionState === 5 || swapExecutionState === 4 || swapExecutionState === 8 || swapExecutionState === 7 || !isSafeToleave
51934
51716
  );
51935
- useHandleTransactionFailed(error, statusData);
51717
+ useHandleTransactionFailed(error, currentTransaction);
51936
51718
  useHandleTransactionTimeout(swapExecutionState);
51937
51719
  const firstOperationStatus = useMemo(() => {
51938
51720
  if (swapExecutionState === 6 || swapExecutionState === 3 || swapExecutionState === 5) {
@@ -51940,18 +51722,18 @@ const SwapExecutionPage = () => {
51940
51722
  }
51941
51723
  }, [swapExecutionState]);
51942
51724
  const secondOperationStatus = useMemo(() => {
51943
- var _a2;
51944
- const status = statusData == null ? void 0 : statusData.transferEvents;
51725
+ var _a;
51726
+ const status = currentTransaction == null ? void 0 : currentTransaction.transferEvents;
51945
51727
  if (swapExecutionState === 6) {
51946
51728
  return "completed";
51947
51729
  }
51948
- 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) {
51949
51731
  return status[0].status;
51950
51732
  }
51951
51733
  if (swapExecutionState === 3 || swapExecutionState === 5) {
51952
51734
  return "pending";
51953
51735
  }
51954
- }, [statusData, swapExecutionState]);
51736
+ }, [currentTransaction == null ? void 0 : currentTransaction.transferEvents, swapExecutionState]);
51955
51737
  const onClickEditDestinationWallet = useMemo(() => {
51956
51738
  track("swap execution page: edit destination address button - clicked");
51957
51739
  const loadingStates = [
@@ -51974,7 +51756,7 @@ const SwapExecutionPage = () => {
51974
51756
  };
51975
51757
  }, [swapExecutionState, lastOperation.signRequired, lastOperation.fromChain, route2]);
51976
51758
  const SwapExecutionPageRoute = simpleRoute ? SwapExecutionPageRouteSimple : SwapExecutionPageRouteDetailed;
51977
- 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);
51978
51760
  return /* @__PURE__ */ jsxs(Column, { gap: 5, children: [
51979
51761
  /* @__PURE__ */ jsx(
51980
51762
  PageHeader,
@@ -51990,7 +51772,10 @@ const SwapExecutionPage = () => {
51990
51772
  centerButton: shouldRenderTrackProgressButton ? {
51991
51773
  label: "Track progress",
51992
51774
  onClick: () => {
51993
- window.open(createSkipExplorerLink(transactionDetailsArray), "_blank");
51775
+ window.open(
51776
+ createSkipExplorerLink(currentTransaction == null ? void 0 : currentTransaction.transactionDetails),
51777
+ "_blank"
51778
+ );
51994
51779
  track("swap execution page: track progress button - clicked", {
51995
51780
  txHash: lastTxHash
51996
51781
  });
@@ -52013,7 +51798,7 @@ const SwapExecutionPage = () => {
52013
51798
  {
52014
51799
  onClickEditDestinationWallet,
52015
51800
  operations: clientOperations,
52016
- statusData,
51801
+ statusData: currentTransaction,
52017
51802
  swapExecutionState,
52018
51803
  firstOperationStatus,
52019
51804
  secondOperationStatus
@@ -52030,7 +51815,7 @@ const SwapExecutionPage = () => {
52030
51815
  submitExecuteRouteMutation
52031
51816
  }
52032
51817
  ),
52033
- /* @__PURE__ */ jsx(SwapPageFooter, { showRouteInfo: overallStatus === "unconfirmed" })
51818
+ /* @__PURE__ */ jsx(SwapPageFooter, {})
52034
51819
  ] });
52035
51820
  };
52036
51821
  const BridgeIcon = ({
@@ -52598,54 +52383,20 @@ const ConnectedWalletContent = () => {
52598
52383
  );
52599
52384
  };
52600
52385
  const useTxHistory = ({ txHistoryItem }) => {
52601
- var _a, _b;
52602
- const { data: chains2 } = useAtomValue(skipChainsAtom);
52603
- const transactionDetails = txHistoryItem == null ? void 0 : txHistoryItem.transactionDetails;
52604
- const chainIdFound = chains2 == null ? void 0 : chains2.some(
52605
- (chain) => transactionDetails == null ? void 0 : transactionDetails.map((tx) => tx.chainId).includes(chain.chainId ?? "")
52606
- );
52607
- const txsRequired = (_a = txHistoryItem == null ? void 0 : txHistoryItem.route) == null ? void 0 : _a.txsRequired;
52608
- let statusData = {
52609
- isSuccess: false,
52610
- isSettled: false,
52611
- transferEvents: [],
52612
- ...txHistoryItem,
52613
- transactionDetails: transactionDetails ?? []
52614
- };
52615
- const shouldFetchStatus = !(txHistoryItem == null ? void 0 : txHistoryItem.isSettled) && transactionDetails !== void 0 && chainIdFound;
52616
- const { data, isFetching, isPending } = useBroadcastedTxsStatus({
52617
- txsRequired,
52618
- transactionDetails,
52619
- enabled: shouldFetchStatus
52620
- });
52621
- if (data !== void 0) {
52622
- statusData = data;
52623
- }
52624
- useSyncTxStatus({
52625
- statusData,
52626
- timestamp: txHistoryItem == null ? void 0 : txHistoryItem.timestamp
52627
- });
52628
- const explorerLinks = /* @__PURE__ */ new Set();
52629
- (_b = statusData == null ? void 0 : statusData.transferEvents) == null ? void 0 : _b.forEach((transferEvent) => {
52630
- explorerLinks.add(transferEvent.fromExplorerLink);
52631
- explorerLinks.add(transferEvent.toExplorerLink);
52632
- });
52633
- const query = useQuery({
52634
- queryKey: ["tx-history-status", { transactionDetails, txsRequired, statusData }],
52635
- queryFn: () => {
52636
- if ((transactionDetails == null ? void 0 : transactionDetails.length) !== txsRequired) return "incomplete";
52637
- if (isFetching && isPending) return "unconfirmed";
52638
- if ((statusData == null ? void 0 : statusData.isSettled) && (statusData == null ? void 0 : statusData.isSuccess)) return "completed";
52639
- if ((statusData == null ? void 0 : statusData.isSettled) && !(statusData == null ? void 0 : statusData.isSuccess) || !chainIdFound) return "failed";
52640
- return "pending";
52641
- },
52642
- enabled: transactionDetails !== void 0 && txsRequired !== void 0 && statusData !== void 0
52643
- });
52644
- return {
52645
- status: query.data,
52646
- explorerLinks: Array.from(explorerLinks).filter((link) => link),
52647
- transferAssetRelease: (statusData == null ? void 0 : statusData.transferAssetRelease) ?? (txHistoryItem == null ? void 0 : txHistoryItem.transferAssetRelease)
52648
- };
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;
52649
52400
  };
52650
52401
  const SwapPageHeader = memo(() => {
52651
52402
  const setCurrentPage = useSetAtom(currentPageAtom);
@@ -52704,15 +52455,9 @@ const SwapPageHeader = memo(() => {
52704
52455
  });
52705
52456
  const TrackLatestTxHistoryItemStatus = memo(() => {
52706
52457
  const lastTxHistoryItemInTime = useAtomValue(lastTransactionInTimeAtom);
52707
- const setOverallStatus = useSetAtom(setOverallStatusAtom);
52708
- const { transactionsSigned, transactionDetailsArray } = useAtomValue(swapExecutionStateAtom);
52709
- const { isPending } = useAtomValue(skipSubmitSwapExecutionAtom);
52710
- const { transferAssetRelease } = useTxHistory({
52711
- txHistoryItem: lastTxHistoryItemInTime == null ? void 0 : lastTxHistoryItemInTime.transactionHistoryItem
52458
+ useTxHistory({
52459
+ txHistoryItem: lastTxHistoryItemInTime
52712
52460
  });
52713
- if (transferAssetRelease && transactionsSigned !== transactionDetailsArray.length && !isPending) {
52714
- setOverallStatus("failed");
52715
- }
52716
52461
  return null;
52717
52462
  });
52718
52463
  const noHistoryItemsAtom = atom$1((get) => {
@@ -52720,10 +52465,8 @@ const noHistoryItemsAtom = atom$1((get) => {
52720
52465
  return (txHistoryItems == null ? void 0 : txHistoryItems.length) === 0;
52721
52466
  });
52722
52467
  const isFetchingLastTransactionStatusAtom = atom$1((get) => {
52723
- var _a, _b, _c;
52724
- const { overallStatus, route: route2, transactionsSigned } = get(swapExecutionStateAtom);
52725
52468
  const lastTxHistoryItemInTime = get(lastTransactionInTimeAtom);
52726
- 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";
52727
52470
  });
52728
52471
  const useConnectToMissingCosmosChain = () => {
52729
52472
  const sourceAsset = useAtomValue(sourceAssetAtom);
@@ -52923,7 +52666,7 @@ const SwapPage = () => {
52923
52666
  }, [fees2]);
52924
52667
  const feeWarning = useMemo(() => {
52925
52668
  if (!(route2 == null ? void 0 : route2.usdAmountIn) || !(route2 == null ? void 0 : route2.usdAmountOut)) return false;
52926
- return parseFloat(route2.usdAmountOut) <= parseFloat(route2.usdAmountIn) * 0.9;
52669
+ return parseFloat(route2.usdAmountOut) < parseFloat(route2.usdAmountIn) * 0.9;
52927
52670
  }, [route2 == null ? void 0 : route2.usdAmountIn, route2 == null ? void 0 : route2.usdAmountOut]);
52928
52671
  const swapButton = useMemo(() => {
52929
52672
  var _a2;
@@ -52996,11 +52739,6 @@ const SwapPage = () => {
52996
52739
  setError(void 0);
52997
52740
  setChainAddresses({});
52998
52741
  setSwapExecutionState();
52999
- setUser({ username: sourceAccount == null ? void 0 : sourceAccount.address });
53000
- if (sourceAccount == null ? void 0 : sourceAccount.address) {
53001
- const replay = getReplay();
53002
- replay == null ? void 0 : replay.start();
53003
- }
53004
52742
  setCurrentPage(Routes.SwapExecutionPage);
53005
52743
  });
53006
52744
  };
@@ -53181,6 +52919,8 @@ const HistoryArrowIcon = ({
53181
52919
  );
53182
52920
  const statusMap = {
53183
52921
  unconfirmed: "Unconfirmed",
52922
+ allowance: "In Progress",
52923
+ validating: "In Progress",
53184
52924
  signing: "In Progress",
53185
52925
  broadcasted: "In Progress",
53186
52926
  pending: "In Progress",
@@ -53924,118 +53664,128 @@ const FilledWarningIcon = ({
53924
53664
  }
53925
53665
  )
53926
53666
  ] });
53927
- const TransactionHistoryPageHistoryItem = forwardRef(({ txHistoryItem, showDetails, onClickRow }, ref) => {
53928
- const theme = nt();
53929
- const isMobileScreenSize = useIsMobileScreenSize();
53930
- const { status: historyStatus, transferAssetRelease } = useTxHistory({
53931
- txHistoryItem
53932
- });
53933
- const removeTransactionHistoryItem = useSetAtom(removeTransactionHistoryItemAtom);
53934
- const {
53935
- route: {
53936
- amountIn,
53937
- amountOut,
53938
- sourceAssetDenom,
53939
- sourceAssetChainId,
53940
- destAssetDenom,
53941
- destAssetChainId
53942
- } = {},
53943
- timestamp,
53944
- transactionDetails
53945
- } = txHistoryItem;
53946
- const sourceAssetDetails = useGetAssetDetails({
53947
- assetDenom: sourceAssetDenom,
53948
- chainId: sourceAssetChainId,
53949
- tokenAmount: amountIn
53950
- });
53951
- const destinationAssetDetails = useGetAssetDetails({
53952
- assetDenom: destAssetDenom,
53953
- chainId: destAssetChainId,
53954
- tokenAmount: amountOut
53955
- });
53956
- const source = {
53957
- amount: sourceAssetDetails.amount,
53958
- asset: sourceAssetDetails.asset,
53959
- assetImage: sourceAssetDetails.assetImage ?? "",
53960
- chainName: sourceAssetDetails.chainName
53961
- };
53962
- const destination = {
53963
- amount: destinationAssetDetails.amount,
53964
- asset: destinationAssetDetails.asset,
53965
- assetImage: destinationAssetDetails.assetImage ?? "",
53966
- chainName: destinationAssetDetails.chainName
53967
- };
53968
- const renderStatus = useMemo(() => {
53969
- switch (historyStatus) {
53970
- case "unconfirmed":
53971
- case "pending":
53972
- return /* @__PURE__ */ jsx(
53973
- StyledAnimatedBorder,
53974
- {
53975
- width: 10,
53976
- height: 10,
53977
- backgroundColor: theme.primary.text.normal,
53978
- status: "pending"
53979
- }
53980
- );
53981
- case "completed":
53982
- return /* @__PURE__ */ jsx(StyledGreenDot, {});
53983
- case "incomplete":
53984
- case "failed": {
53985
- if (transferAssetRelease) {
53986
- return /* @__PURE__ */ jsx(FilledWarningIcon, { backgroundColor: theme.warning.text });
53987
- } else return /* @__PURE__ */ jsx(XIcon, { color: theme.error.text });
53988
- }
53989
- }
53990
- }, [
53991
- historyStatus,
53992
- theme.primary.text.normal,
53993
- theme.error.text,
53994
- theme.warning.text,
53995
- transferAssetRelease
53996
- ]);
53997
- const absoluteTimeString = useMemo(() => {
53998
- if (isMobileScreenSize) {
53999
- return getMobileDateFormat(new Date(timestamp));
54000
- }
54001
- return new Date(timestamp).toLocaleString();
54002
- }, [isMobileScreenSize, timestamp]);
54003
- const relativeTime = useMemo(() => {
54004
- if (historyStatus === "pending") {
54005
- return "In Progress";
54006
- }
54007
- if (!timestamp) return "";
54008
- return formatDistanceStrict(new Date(timestamp), /* @__PURE__ */ new Date(), {
54009
- addSuffix: true
54010
- }).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");
54011
- }, [timestamp, historyStatus]);
54012
- if (!txHistoryItem.route) return null;
54013
- return /* @__PURE__ */ jsxs(StyledHistoryContainer, { ref, showDetails, children: [
54014
- /* @__PURE__ */ jsxs(StyledHistoryItemRow, { align: "center", justify: "space-between", onClick: onClickRow, children: [
54015
- /* @__PURE__ */ jsxs(Row, { gap: 8, align: "center", children: [
54016
- /* @__PURE__ */ jsx(RenderAssetAmount, { ...source, sourceAsset: true }),
54017
- /* @__PURE__ */ jsx(ThinArrowIcon, { color: theme.primary.text.lowContrast, direction: "right" }),
54018
- /* @__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
+ ] })
54019
53770
  ] }),
54020
- /* @__PURE__ */ jsxs(Row, { align: "center", gap: 6, children: [
54021
- /* @__PURE__ */ jsx(SmallText, { children: relativeTime }),
54022
- /* @__PURE__ */ jsx(Row, { width: 20, align: "center", justify: "center", children: renderStatus })
54023
- ] })
54024
- ] }),
54025
- showDetails && /* @__PURE__ */ jsx(
54026
- TransactionHistoryPageHistoryItemDetails,
54027
- {
54028
- status: historyStatus,
54029
- transactionDetails,
54030
- sourceChainName: sourceAssetDetails.chainName ?? "--",
54031
- destinationChainName: destinationAssetDetails.chainName ?? "--",
54032
- absoluteTimeString,
54033
- onClickDelete: () => removeTransactionHistoryItem(txHistoryItem.timestamp),
54034
- transferAssetRelease
54035
- }
54036
- )
54037
- ] });
54038
- });
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
+ );
54039
53789
  TransactionHistoryPageHistoryItem.displayName = "TransactionHistoryPageHistoryItem";
54040
53790
  const RenderAssetAmount = ({
54041
53791
  amount,
@@ -54090,15 +53840,11 @@ const StyledGreenDot = dt.div`
54090
53840
  border-radius: 50%;
54091
53841
  `;
54092
53842
  const TransactionHistoryPage = () => {
54093
- var _a, _b, _c;
53843
+ var _a, _b;
54094
53844
  const theme = nt();
54095
53845
  const setCurrentPage = useSetAtom(currentPageAtom);
54096
53846
  const [itemIndexToShowDetail, setItemIndexToShowDetail] = useState(void 0);
54097
- const txHistory = useAtomValue(transactionHistoryAtom);
54098
- const historyList = useMemo(
54099
- () => txHistory.sort((a, b) => b.timestamp - a.timestamp),
54100
- [txHistory]
54101
- );
53847
+ const sortedHistoryItems = useAtomValue(sortedHistoryItemsAtom);
54102
53848
  return /* @__PURE__ */ jsxs(Column, { gap: 5, children: [
54103
53849
  /* @__PURE__ */ jsx(
54104
53850
  PageHeader,
@@ -54116,7 +53862,7 @@ const TransactionHistoryPage = () => {
54116
53862
  /* @__PURE__ */ jsx(StyledContainer, { gap: 5, children: /* @__PURE__ */ jsx(
54117
53863
  VirtualList,
54118
53864
  {
54119
- listItems: historyList,
53865
+ listItems: sortedHistoryItems,
54120
53866
  height: 262,
54121
53867
  empty: {
54122
53868
  details: "No transactions yet",
@@ -54135,18 +53881,15 @@ const TransactionHistoryPage = () => {
54135
53881
  item
54136
53882
  });
54137
53883
  setItemIndexToShowDetail((prev2) => prev2 === index ? void 0 : index);
54138
- }
53884
+ },
53885
+ onClickDelete: () => setItemIndexToShowDetail(void 0)
54139
53886
  }
54140
53887
  ),
54141
- itemKey: (item) => {
54142
- var _a2;
54143
- return (_a2 = item.timestamp) == null ? void 0 : _a2.toString();
54144
- },
54145
- 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
54146
53890
  },
54147
- txHistory.length
54148
- ) }),
54149
- /* @__PURE__ */ jsx(SwapPageFooter, {})
53891
+ sortedHistoryItems.length
53892
+ ) })
54150
53893
  ] });
54151
53894
  };
54152
53895
  const StyledContainer = dt(Column)`
@@ -54295,37 +54038,19 @@ const useInitDefaultRoute = (defaultRoute) => {
54295
54038
  setRouteToDefaultRoute(assets2);
54296
54039
  }, [assets2, defaultRoute, setDefaultRoute, setRouteToDefaultRoute]);
54297
54040
  };
54298
- let isSentryInitialized = false;
54299
- const initSentry = () => {
54300
- if (isSentryInitialized) return;
54301
- init({
54302
- dsn: "https://10ce608bdd1c68a13d3849d6b242333c@o4504768725909504.ingest.us.sentry.io/4508485201231872",
54303
- tunnel: "https://go.skip.build/api/sentry",
54304
- defaultIntegrations: false,
54305
- integrations: [
54306
- breadcrumbsIntegration(),
54307
- dedupeIntegration(),
54308
- functionToStringIntegration(),
54309
- httpContextIntegration(),
54310
- inboundFiltersIntegration(),
54311
- linkedErrorsIntegration(),
54312
- browserSessionIntegration(),
54313
- replayIntegration({
54314
- maskAllText: false,
54315
- maskAllInputs: false,
54316
- blockAllMedia: false,
54317
- networkDetailAllowUrls: [/^https:\/\/go\.skip\.build\//],
54318
- networkRequestHeaders: ["X-Custom-Header"],
54319
- networkResponseHeaders: ["X-Custom-Header"],
54320
- useCompression: false
54321
- })
54322
- ]
54323
- });
54324
- 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]);
54325
54050
  };
54326
54051
  const name = "@skip-go/widget";
54327
54052
  const description = "Swap widget";
54328
- const version = "3.12.11-alpha.0";
54053
+ const version = "3.13.0";
54329
54054
  const repository = {
54330
54055
  url: "https://github.com/skip-mev/skip-go",
54331
54056
  directory: "packages/widget"
@@ -54342,7 +54067,9 @@ const scripts = {
54342
54067
  "build:web-component": "NODE_OPTIONS=--max-old-space-size=32384 webpack --config webpack.config.js",
54343
54068
  "publish:web-component": "npm run build:web-component && cd web-component && npm publish && cd ..",
54344
54069
  prepack: "yarn run pre",
54070
+ postpack: "yarn run post",
54345
54071
  pre: "npm run build && node scripts/prepublish.cjs",
54072
+ post: "git checkout -- package.json",
54346
54073
  "generate-chains": "node scripts/generate-chains.cjs",
54347
54074
  "update-registries": "yarn up @initia/initia-registry chain-registry",
54348
54075
  test: "yarn playwright test",
@@ -54385,7 +54112,7 @@ const devDependencies = {
54385
54112
  "@typescript-eslint/parser": "^7.15.0",
54386
54113
  "@vitejs/plugin-react": "^4.3.1",
54387
54114
  buffer: "^6.0.3",
54388
- "chain-registry": "^2.0.11",
54115
+ "chain-registry": "^2.0.18",
54389
54116
  download: "^8.0.0",
54390
54117
  eslint: "^9.9.0",
54391
54118
  "eslint-config-prettier": "^9.1.0",
@@ -54438,7 +54165,6 @@ const dependencies = {
54438
54165
  "@penumbra-zone/protobuf": "^7.2.0",
54439
54166
  "@penumbra-zone/transport-dom": "^7.5.0",
54440
54167
  "@r2wc/react-to-web-component": "^2.0.3",
54441
- "@sentry/react": "^8.46.0",
54442
54168
  "@skip-go/client": "workspace:^",
54443
54169
  "@solana/spl-token": "^0.4.8",
54444
54170
  "@solana/wallet-adapter-ledger": "^0.9.25",
@@ -54451,7 +54177,7 @@ const dependencies = {
54451
54177
  "@walletconnect/solana-adapter": "^0.0.8",
54452
54178
  add: "^2.0.6",
54453
54179
  bech32: "^2.0.0",
54454
- graz: "0.3.2",
54180
+ graz: "0.3.3",
54455
54181
  jotai: "^2.10.1",
54456
54182
  "jotai-effect": "^1.0.2",
54457
54183
  "jotai-tanstack-query": "^0.8.6",
@@ -54461,6 +54187,7 @@ const dependencies = {
54461
54187
  "react-error-boundary": "^4.0.13",
54462
54188
  "react-shadow-scope": "^1.0.5",
54463
54189
  "styled-components": "^6.1.13",
54190
+ uuid: "^11.1.0",
54464
54191
  yarn: "^1.22.22",
54465
54192
  zod: "^3.23.8"
54466
54193
  };
@@ -54482,18 +54209,8 @@ const packageJson = {
54482
54209
  dependencies,
54483
54210
  publishConfig
54484
54211
  };
54485
- const useMobileRouteConfig = () => {
54486
- const isMobile2 = useIsMobileScreenSize();
54487
- const setRouteConfig = useSetAtom(routeConfigAtom);
54488
- useEffect(() => {
54489
- setRouteConfig((prev2) => ({
54490
- ...prev2,
54491
- allowMultiTx: !isMobile2
54492
- }));
54493
- }, [isMobile2, setRouteConfig]);
54494
- };
54495
54212
  const initAmplitude = () => {
54496
- init$1("14616a575f32087cf0403ab8f3ea3ce0", {
54213
+ init("14616a575f32087cf0403ab8f3ea3ce0", {
54497
54214
  appVersion: version
54498
54215
  });
54499
54216
  const plugin = sessionReplayPlugin({
@@ -54503,13 +54220,9 @@ const initAmplitude = () => {
54503
54220
  };
54504
54221
  const useInitWidget = (props) => {
54505
54222
  var _a, _b;
54506
- if (props.enableSentrySessionReplays) {
54507
- initSentry();
54508
- }
54509
54223
  if (props.enableAmplitudeAnalytics) {
54510
54224
  initAmplitude();
54511
54225
  }
54512
- setTag("widget_version", version);
54513
54226
  useInitDefaultRoute(props.defaultRoute);
54514
54227
  useInitGetSigners(props);
54515
54228
  useMobileRouteConfig();
@@ -54695,6 +54408,86 @@ const useInitGetSigners = (props) => {
54695
54408
  }));
54696
54409
  }, [props.getCosmosSigner, props.getEvmSigner, props.getSvmSigner, setGetSigners]);
54697
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
+ };
54698
54491
  const migrateOldLocalStorageValues = () => {
54699
54492
  if (typeof window === "undefined") return;
54700
54493
  const { set } = jotaiStore;
@@ -54734,6 +54527,7 @@ const migrateOldLocalStorageValues = () => {
54734
54527
  console.warn(`Failed to migrate localStorage key "${key}":`, err);
54735
54528
  }
54736
54529
  });
54530
+ updateHistoryFromCamelCaseToRouteDetails();
54737
54531
  };
54738
54532
  function toCamelCase(obj) {
54739
54533
  return convertKeys(obj, (key) => {