@skip-go/widget 3.12.11 → 3.14.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,
|
|
6
|
+
import { assets, chains, bridges, venues, ChainType, getSigningStargateClient, route, balances, executeMultipleRoutes, executeRoute, 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,
|
|
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, init, add, setUserId } 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) {
|
|
@@ -1765,8 +1765,8 @@ const flexProps = lt`
|
|
|
1765
1765
|
${({ flexDirection }) => flexDirection && `flex-direction: ${flexDirection}`};
|
|
1766
1766
|
`;
|
|
1767
1767
|
const Row = dt.div`
|
|
1768
|
-
${({ width }) => width && `width: ${width}px`};
|
|
1769
|
-
${({ height }) => height && `height: ${height}px`};
|
|
1768
|
+
${({ width }) => width !== void 0 && `width: ${typeof width === "number" ? `${width}px` : width}`};
|
|
1769
|
+
${({ height }) => height !== void 0 && `height: ${typeof height === "number" ? `${height}px` : height}`};
|
|
1770
1770
|
flex-direction: row;
|
|
1771
1771
|
${flexProps};
|
|
1772
1772
|
`;
|
|
@@ -1774,10 +1774,24 @@ const Column = dt(Row)`
|
|
|
1774
1774
|
flex-direction: column;
|
|
1775
1775
|
`;
|
|
1776
1776
|
const Spacer = dt.div`
|
|
1777
|
-
|
|
1778
|
-
${({ height }) => height && `height: ${height}px`};
|
|
1777
|
+
position: relative;
|
|
1779
1778
|
flex-shrink: 0;
|
|
1780
1779
|
flex-grow: 0;
|
|
1780
|
+
${({ width }) => width !== void 0 && `width: ${typeof width === "number" ? `${width}px` : width}`};
|
|
1781
|
+
${({ height }) => height !== void 0 && `height: ${typeof height === "number" ? `${height}px` : height}`};
|
|
1782
|
+
|
|
1783
|
+
${({ showLine, lineColor = "#ccc", lineThickness = 1 }) => showLine && `
|
|
1784
|
+
&::after {
|
|
1785
|
+
content: '';
|
|
1786
|
+
position: absolute;
|
|
1787
|
+
top: 50%;
|
|
1788
|
+
left: 0;
|
|
1789
|
+
width: 100%;
|
|
1790
|
+
height: ${lineThickness}px;
|
|
1791
|
+
background-color: ${lineColor};
|
|
1792
|
+
transform: translateY(-50%);
|
|
1793
|
+
}
|
|
1794
|
+
`}
|
|
1781
1795
|
`;
|
|
1782
1796
|
const withBoundProps = (WrappedComponent, boundProps) => {
|
|
1783
1797
|
return (props) => {
|
|
@@ -2193,7 +2207,7 @@ const Text = dt(SmallText)`
|
|
|
2193
2207
|
${({ useWindowsTextHack }) => useWindowsTextHack && isWindows() ? "margin-bottom: -4px" : ""};
|
|
2194
2208
|
${textProps}
|
|
2195
2209
|
`;
|
|
2196
|
-
|
|
2210
|
+
dt(Text).attrs({ as: "button" })`
|
|
2197
2211
|
${removeButtonStyles}
|
|
2198
2212
|
cursor: pointer;
|
|
2199
2213
|
`;
|
|
@@ -4143,11 +4157,7 @@ function shouldReduceFontSize(value) {
|
|
|
4143
4157
|
return valueWithoutCommas.length >= 14;
|
|
4144
4158
|
}
|
|
4145
4159
|
const formatDisplayAmount = (input, options = {}) => {
|
|
4146
|
-
const {
|
|
4147
|
-
showLessThanSign = true,
|
|
4148
|
-
decimals = DEFAULT_DECIMAL_PLACES,
|
|
4149
|
-
abbreviate = true
|
|
4150
|
-
} = options;
|
|
4160
|
+
const { showLessThanSign = true, decimals = DEFAULT_DECIMAL_PLACES, abbreviate = true } = options;
|
|
4151
4161
|
if (input === void 0) {
|
|
4152
4162
|
return "";
|
|
4153
4163
|
}
|
|
@@ -4616,9 +4626,6 @@ const UnexpectedErrorPageUnexpected = ({
|
|
|
4616
4626
|
const theme = nt();
|
|
4617
4627
|
const setErrorWarningAtom = useSetAtom(errorWarningAtom);
|
|
4618
4628
|
const setCurrentPage = useSetAtom(currentPageAtom);
|
|
4619
|
-
useEffect(() => {
|
|
4620
|
-
setTag("errorMessage", error == null ? void 0 : error.message);
|
|
4621
|
-
}, [error == null ? void 0 : error.message]);
|
|
4622
4629
|
const onClickRetry = () => {
|
|
4623
4630
|
setErrorWarningAtom(void 0);
|
|
4624
4631
|
setCurrentPage(Routes.SwapPage);
|
|
@@ -4663,336 +4670,6 @@ const UnexpectedErrorPageUnexpected = ({
|
|
|
4663
4670
|
)
|
|
4664
4671
|
] });
|
|
4665
4672
|
};
|
|
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
4673
|
function atomWithDebounce(delayMilliseconds = 250) {
|
|
4997
4674
|
const prevTimeoutAtom = atom$1(void 0);
|
|
4998
4675
|
const _currentValueAtom = atom$1();
|
|
@@ -6283,6 +5960,47 @@ const _mainnetChains = [
|
|
|
6283
5960
|
coinType: 118
|
|
6284
5961
|
}
|
|
6285
5962
|
},
|
|
5963
|
+
{
|
|
5964
|
+
chainId: "axone-1",
|
|
5965
|
+
currencies: [
|
|
5966
|
+
{
|
|
5967
|
+
coinDenom: "axone",
|
|
5968
|
+
coinMinimalDenom: "uaxone",
|
|
5969
|
+
coinDecimals: 6
|
|
5970
|
+
}
|
|
5971
|
+
],
|
|
5972
|
+
rest: "https://api.axone.cumulo.com.es",
|
|
5973
|
+
rpc: "https://rpc.axone.cumulo.com.es",
|
|
5974
|
+
bech32Config: {
|
|
5975
|
+
bech32PrefixAccAddr: "axone",
|
|
5976
|
+
bech32PrefixAccPub: "axonepub",
|
|
5977
|
+
bech32PrefixValAddr: "axonevaloper",
|
|
5978
|
+
bech32PrefixValPub: "axonevaloperpub",
|
|
5979
|
+
bech32PrefixConsAddr: "axonevalcons",
|
|
5980
|
+
bech32PrefixConsPub: "axonevalconspub"
|
|
5981
|
+
},
|
|
5982
|
+
chainName: "axone",
|
|
5983
|
+
feeCurrencies: [
|
|
5984
|
+
{
|
|
5985
|
+
coinDenom: "axone",
|
|
5986
|
+
coinMinimalDenom: "uaxone",
|
|
5987
|
+
coinDecimals: 6,
|
|
5988
|
+
gasPriceStep: {
|
|
5989
|
+
low: 1e-3,
|
|
5990
|
+
average: 5e-3,
|
|
5991
|
+
high: 0.01
|
|
5992
|
+
}
|
|
5993
|
+
}
|
|
5994
|
+
],
|
|
5995
|
+
stakeCurrency: {
|
|
5996
|
+
coinDenom: "axone",
|
|
5997
|
+
coinMinimalDenom: "uaxone",
|
|
5998
|
+
coinDecimals: 6
|
|
5999
|
+
},
|
|
6000
|
+
bip44: {
|
|
6001
|
+
coinType: 118
|
|
6002
|
+
}
|
|
6003
|
+
},
|
|
6286
6004
|
{
|
|
6287
6005
|
chainId: "bbn-1",
|
|
6288
6006
|
currencies: [
|
|
@@ -6633,11 +6351,6 @@ const _mainnetChains = [
|
|
|
6633
6351
|
coinDenom: "badge",
|
|
6634
6352
|
coinMinimalDenom: "ubadge",
|
|
6635
6353
|
coinDecimals: 9
|
|
6636
|
-
},
|
|
6637
|
-
{
|
|
6638
|
-
coinDenom: "stake",
|
|
6639
|
-
coinMinimalDenom: "ustake",
|
|
6640
|
-
coinDecimals: 9
|
|
6641
6354
|
}
|
|
6642
6355
|
],
|
|
6643
6356
|
rest: "http://134.122.12.165:1317",
|
|
@@ -7560,6 +7273,11 @@ const _mainnetChains = [
|
|
|
7560
7273
|
coinMinimalDenom: "factory/chihuahua1x4q2vkrz4dfgd9hcw0p5m2f2nuv2uqmt9xr8k2/achihuahuawifhat",
|
|
7561
7274
|
coinDecimals: 6
|
|
7562
7275
|
},
|
|
7276
|
+
{
|
|
7277
|
+
coinDenom: "BEER",
|
|
7278
|
+
coinMinimalDenom: "factory/chihuahua1sj9verkuk8aa9jrngnpwup6zjht4vwngjlpemnt9w38ccp0qnlcswvsuzc/beer",
|
|
7279
|
+
coinDecimals: 6
|
|
7280
|
+
},
|
|
7563
7281
|
{
|
|
7564
7282
|
coinDenom: "WOOF",
|
|
7565
7283
|
coinMinimalDenom: "factory/chihuahua13jawsn574rf3f0u5rhu7e8n6sayx5gkw3eddhp/uwoof",
|
|
@@ -7703,8 +7421,8 @@ const _mainnetChains = [
|
|
|
7703
7421
|
coinDecimals: 6
|
|
7704
7422
|
}
|
|
7705
7423
|
],
|
|
7706
|
-
rest: "https://
|
|
7707
|
-
rpc: "
|
|
7424
|
+
rest: "https://lcd.cifer.ai",
|
|
7425
|
+
rpc: "https://rpc.cifer.ai",
|
|
7708
7426
|
bech32Config: {
|
|
7709
7427
|
bech32PrefixAccAddr: "cife",
|
|
7710
7428
|
bech32PrefixAccPub: "cifepub",
|
|
@@ -8992,6 +8710,11 @@ const _mainnetChains = [
|
|
|
8992
8710
|
coinDenom: "saga",
|
|
8993
8711
|
coinMinimalDenom: "ibc/B88C39AD6C8550716DFD64C3AD28F355633554821249AC9F8BCC21341641CD18",
|
|
8994
8712
|
coinDecimals: 6
|
|
8713
|
+
},
|
|
8714
|
+
{
|
|
8715
|
+
coinDenom: "xrp",
|
|
8716
|
+
coinMinimalDenom: "ibc/8464A63954C0350A26C8588E20719F3A0AC8705E4CA0F7450B60C3F16B2D3421",
|
|
8717
|
+
coinDecimals: 18
|
|
8995
8718
|
}
|
|
8996
8719
|
],
|
|
8997
8720
|
rest: "https://api.elys.network",
|
|
@@ -9035,6 +8758,16 @@ const _mainnetChains = [
|
|
|
9035
8758
|
average: 0.025,
|
|
9036
8759
|
high: 0.03
|
|
9037
8760
|
}
|
|
8761
|
+
},
|
|
8762
|
+
{
|
|
8763
|
+
coinDenom: "xrp",
|
|
8764
|
+
coinMinimalDenom: "ibc/8464A63954C0350A26C8588E20719F3A0AC8705E4CA0F7450B60C3F16B2D3421",
|
|
8765
|
+
coinDecimals: 18,
|
|
8766
|
+
gasPriceStep: {
|
|
8767
|
+
low: 11395e6,
|
|
8768
|
+
average: 21395e6,
|
|
8769
|
+
high: 31395e6
|
|
8770
|
+
}
|
|
9038
8771
|
}
|
|
9039
8772
|
],
|
|
9040
8773
|
stakeCurrency: {
|
|
@@ -10561,6 +10294,11 @@ const _mainnetChains = [
|
|
|
10561
10294
|
coinDenom: "Hydro Wrapped hINJ",
|
|
10562
10295
|
coinMinimalDenom: "factory/inj14ejqjyq8um4p3xfqj74yld5waqljf88f9eneuk/inj18luqttqyckgpddndh8hvaq25d5nfwjc78m56lc",
|
|
10563
10296
|
coinDecimals: 18
|
|
10297
|
+
},
|
|
10298
|
+
{
|
|
10299
|
+
coinDenom: "wbtc",
|
|
10300
|
+
coinMinimalDenom: "ibc/0E293A7622DC9A6439DB60E6D234B5AF446962E27CA3AB44D0590603DFF6968E",
|
|
10301
|
+
coinDecimals: 8
|
|
10564
10302
|
}
|
|
10565
10303
|
],
|
|
10566
10304
|
rest: "https://6d0ff611-9009-4bd1-a7a7-acec7c70d454.injective-1.mesa-rest.newmetric.xyz",
|
|
@@ -11584,6 +11322,26 @@ const _mainnetChains = [
|
|
|
11584
11322
|
average: 0.025,
|
|
11585
11323
|
high: 0.03
|
|
11586
11324
|
}
|
|
11325
|
+
},
|
|
11326
|
+
{
|
|
11327
|
+
coinDenom: "kUSD",
|
|
11328
|
+
coinMinimalDenom: "ukusd",
|
|
11329
|
+
coinDecimals: 6,
|
|
11330
|
+
gasPriceStep: {
|
|
11331
|
+
low: 0.01,
|
|
11332
|
+
average: 0.025,
|
|
11333
|
+
high: 0.03
|
|
11334
|
+
}
|
|
11335
|
+
},
|
|
11336
|
+
{
|
|
11337
|
+
coinDenom: "USDC",
|
|
11338
|
+
coinMinimalDenom: "ibc/295548A78785A1007F232DE286149A6FF512F180AF5657780FC89C009E2C348F",
|
|
11339
|
+
coinDecimals: 6,
|
|
11340
|
+
gasPriceStep: {
|
|
11341
|
+
low: 0.01,
|
|
11342
|
+
average: 0.025,
|
|
11343
|
+
high: 0.03
|
|
11344
|
+
}
|
|
11587
11345
|
}
|
|
11588
11346
|
],
|
|
11589
11347
|
stakeCurrency: {
|
|
@@ -13243,12 +13001,12 @@ const _mainnetChains = [
|
|
|
13243
13001
|
currencies: [
|
|
13244
13002
|
{
|
|
13245
13003
|
coinDenom: "mtgbp",
|
|
13246
|
-
coinMinimalDenom: "
|
|
13247
|
-
coinDecimals:
|
|
13004
|
+
coinMinimalDenom: "umtgbp",
|
|
13005
|
+
coinDecimals: 6
|
|
13248
13006
|
}
|
|
13249
13007
|
],
|
|
13250
13008
|
rest: "https://lcd.mtgbp.com",
|
|
13251
|
-
rpc: "https://
|
|
13009
|
+
rpc: "https://rpc.mtgbp.com",
|
|
13252
13010
|
bech32Config: {
|
|
13253
13011
|
bech32PrefixAccAddr: "mtgbp",
|
|
13254
13012
|
bech32PrefixAccPub: "mtgbppub",
|
|
@@ -13261,22 +13019,22 @@ const _mainnetChains = [
|
|
|
13261
13019
|
feeCurrencies: [
|
|
13262
13020
|
{
|
|
13263
13021
|
coinDenom: "mtgbp",
|
|
13264
|
-
coinMinimalDenom: "
|
|
13265
|
-
coinDecimals:
|
|
13022
|
+
coinMinimalDenom: "umtgbp",
|
|
13023
|
+
coinDecimals: 6,
|
|
13266
13024
|
gasPriceStep: {
|
|
13267
|
-
low:
|
|
13268
|
-
average:
|
|
13269
|
-
high:
|
|
13025
|
+
low: 0.025,
|
|
13026
|
+
average: 0.03,
|
|
13027
|
+
high: 0.035
|
|
13270
13028
|
}
|
|
13271
13029
|
}
|
|
13272
13030
|
],
|
|
13273
13031
|
stakeCurrency: {
|
|
13274
13032
|
coinDenom: "mtgbp",
|
|
13275
|
-
coinMinimalDenom: "
|
|
13276
|
-
coinDecimals:
|
|
13033
|
+
coinMinimalDenom: "umtgbp",
|
|
13034
|
+
coinDecimals: 6
|
|
13277
13035
|
},
|
|
13278
13036
|
bip44: {
|
|
13279
|
-
coinType:
|
|
13037
|
+
coinType: 118
|
|
13280
13038
|
}
|
|
13281
13039
|
},
|
|
13282
13040
|
{
|
|
@@ -13649,6 +13407,11 @@ const _mainnetChains = [
|
|
|
13649
13407
|
coinDenom: "ltc",
|
|
13650
13408
|
coinMinimalDenom: "ibc/C4C791209A16419A4BB3C3177E5E8AE4477C9D7457842E7F531F91C513FA79A0",
|
|
13651
13409
|
coinDecimals: 8
|
|
13410
|
+
},
|
|
13411
|
+
{
|
|
13412
|
+
coinDenom: "TAB",
|
|
13413
|
+
coinMinimalDenom: "factory/neutron1r5qx58l3xx2y8gzjtkqjndjgx69mktmapl45vns0pa73z0zpn7fqgltnll/TAB",
|
|
13414
|
+
coinDecimals: 6
|
|
13652
13415
|
}
|
|
13653
13416
|
],
|
|
13654
13417
|
rest: "https://rest-lb.neutron.org",
|
|
@@ -17405,9 +17168,24 @@ const _mainnetChains = [
|
|
|
17405
17168
|
coinDecimals: 6
|
|
17406
17169
|
},
|
|
17407
17170
|
{
|
|
17408
|
-
coinDenom: "
|
|
17171
|
+
coinDenom: "XRP",
|
|
17409
17172
|
coinMinimalDenom: "ibc/46EB46DB30D3BBC6F404A9232C09785F36D40DA05C662A8E295712ECBAFF1609",
|
|
17410
17173
|
coinDecimals: 18
|
|
17174
|
+
},
|
|
17175
|
+
{
|
|
17176
|
+
coinDenom: "titan",
|
|
17177
|
+
coinMinimalDenom: "ibc/87B7A56E83C08DBFD567F0DE6463EC54181B8B819B3CAD7A584C47D59A2A05CF",
|
|
17178
|
+
coinDecimals: 6
|
|
17179
|
+
},
|
|
17180
|
+
{
|
|
17181
|
+
coinDenom: "ebaby",
|
|
17182
|
+
coinMinimalDenom: "factory/osmo12r3yc76u9lxe33yemstatnw8602culdjzrtr8lmnpycmd3z7d4jsxx60kc/FwNhFaW3zLxoLUgXCdWjqBzcvGNPaB7B2XZqm2xgrB93",
|
|
17183
|
+
coinDecimals: 6
|
|
17184
|
+
},
|
|
17185
|
+
{
|
|
17186
|
+
coinDenom: "FOST",
|
|
17187
|
+
coinMinimalDenom: "factory/osmo1q77cw0mmlluxu0wr29fcdd0tdnh78gzhkvhe4n6ulal9qvrtu43qtd0nh8/fost",
|
|
17188
|
+
coinDecimals: 6
|
|
17411
17189
|
}
|
|
17412
17190
|
],
|
|
17413
17191
|
rest: "https://lcd.osmosis.zone/",
|
|
@@ -18530,7 +18308,7 @@ const _mainnetChains = [
|
|
|
18530
18308
|
coinDecimals: 6
|
|
18531
18309
|
}
|
|
18532
18310
|
],
|
|
18533
|
-
rest: "https://shannon-grove-
|
|
18311
|
+
rest: "https://shannon-grove-api.mainnet.poktroll.com",
|
|
18534
18312
|
rpc: "https://shannon-grove-rpc.mainnet.poktroll.com",
|
|
18535
18313
|
bech32Config: {
|
|
18536
18314
|
bech32PrefixAccAddr: "pokt",
|
|
@@ -19687,6 +19465,16 @@ const _mainnetChains = [
|
|
|
19687
19465
|
coinMinimalDenom: "lp:33:upryzm",
|
|
19688
19466
|
coinDecimals: 6
|
|
19689
19467
|
},
|
|
19468
|
+
{
|
|
19469
|
+
coinDenom: "lp:34:pryzmypt-pryzm",
|
|
19470
|
+
coinMinimalDenom: "lp:34:upryzmypt-upryzm",
|
|
19471
|
+
coinDecimals: 6
|
|
19472
|
+
},
|
|
19473
|
+
{
|
|
19474
|
+
coinDenom: "lp:35:pryzm-usdc",
|
|
19475
|
+
coinMinimalDenom: "lp:35:upryzm-uusdc",
|
|
19476
|
+
coinDecimals: 6
|
|
19477
|
+
},
|
|
19690
19478
|
{
|
|
19691
19479
|
coinDenom: "lp:36:susds",
|
|
19692
19480
|
coinMinimalDenom: "lp:36:asusds",
|
|
@@ -19745,6 +19533,26 @@ const _mainnetChains = [
|
|
|
19745
19533
|
},
|
|
19746
19534
|
chainName: "pryzm",
|
|
19747
19535
|
feeCurrencies: [
|
|
19536
|
+
{
|
|
19537
|
+
coinDenom: "auuu",
|
|
19538
|
+
coinMinimalDenom: "factory/pryzm1jnhcsa5ddjsjq2t97v6a82z542rduxvtw6wd9h/uauuu",
|
|
19539
|
+
coinDecimals: 6,
|
|
19540
|
+
gasPriceStep: {
|
|
19541
|
+
low: 0.1,
|
|
19542
|
+
average: 0.15,
|
|
19543
|
+
high: 0.2
|
|
19544
|
+
}
|
|
19545
|
+
},
|
|
19546
|
+
{
|
|
19547
|
+
coinDenom: "pryzm",
|
|
19548
|
+
coinMinimalDenom: "upryzm",
|
|
19549
|
+
coinDecimals: 6,
|
|
19550
|
+
gasPriceStep: {
|
|
19551
|
+
low: 0.02,
|
|
19552
|
+
average: 0.03,
|
|
19553
|
+
high: 0.04
|
|
19554
|
+
}
|
|
19555
|
+
},
|
|
19748
19556
|
{
|
|
19749
19557
|
coinDenom: "atom",
|
|
19750
19558
|
coinMinimalDenom: "ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2",
|
|
@@ -19805,16 +19613,6 @@ const _mainnetChains = [
|
|
|
19805
19613
|
high: 0.04
|
|
19806
19614
|
}
|
|
19807
19615
|
},
|
|
19808
|
-
{
|
|
19809
|
-
coinDenom: "auuu",
|
|
19810
|
-
coinMinimalDenom: "factory/pryzm1jnhcsa5ddjsjq2t97v6a82z542rduxvtw6wd9h/uauuu",
|
|
19811
|
-
coinDecimals: 6,
|
|
19812
|
-
gasPriceStep: {
|
|
19813
|
-
low: 0.01,
|
|
19814
|
-
average: 0.015,
|
|
19815
|
-
high: 0.02
|
|
19816
|
-
}
|
|
19817
|
-
},
|
|
19818
19616
|
{
|
|
19819
19617
|
coinDenom: "dydx",
|
|
19820
19618
|
coinMinimalDenom: "ibc/F8CA5236869F819BC006EEF088E67889A26E4140339757878F0F4E229CDDA858",
|
|
@@ -19952,12 +19750,12 @@ const _mainnetChains = [
|
|
|
19952
19750
|
currencies: [
|
|
19953
19751
|
{
|
|
19954
19752
|
coinDenom: "qfs",
|
|
19955
|
-
coinMinimalDenom: "
|
|
19956
|
-
coinDecimals:
|
|
19753
|
+
coinMinimalDenom: "uqfs",
|
|
19754
|
+
coinDecimals: 6
|
|
19957
19755
|
}
|
|
19958
19756
|
],
|
|
19959
19757
|
rest: "https://lcd.qfsone.com",
|
|
19960
|
-
rpc: "https://
|
|
19758
|
+
rpc: "https://rpc.qfsone.com",
|
|
19961
19759
|
bech32Config: {
|
|
19962
19760
|
bech32PrefixAccAddr: "qfs",
|
|
19963
19761
|
bech32PrefixAccPub: "qfspub",
|
|
@@ -19970,22 +19768,22 @@ const _mainnetChains = [
|
|
|
19970
19768
|
feeCurrencies: [
|
|
19971
19769
|
{
|
|
19972
19770
|
coinDenom: "qfs",
|
|
19973
|
-
coinMinimalDenom: "
|
|
19974
|
-
coinDecimals:
|
|
19771
|
+
coinMinimalDenom: "uqfs",
|
|
19772
|
+
coinDecimals: 6,
|
|
19975
19773
|
gasPriceStep: {
|
|
19976
|
-
low:
|
|
19977
|
-
average:
|
|
19978
|
-
high:
|
|
19774
|
+
low: 0.025,
|
|
19775
|
+
average: 0.03,
|
|
19776
|
+
high: 0.035
|
|
19979
19777
|
}
|
|
19980
19778
|
}
|
|
19981
19779
|
],
|
|
19982
19780
|
stakeCurrency: {
|
|
19983
19781
|
coinDenom: "qfs",
|
|
19984
|
-
coinMinimalDenom: "
|
|
19985
|
-
coinDecimals:
|
|
19782
|
+
coinMinimalDenom: "uqfs",
|
|
19783
|
+
coinDecimals: 6
|
|
19986
19784
|
},
|
|
19987
19785
|
bip44: {
|
|
19988
|
-
coinType:
|
|
19786
|
+
coinType: 118
|
|
19989
19787
|
}
|
|
19990
19788
|
},
|
|
19991
19789
|
{
|
|
@@ -21853,6 +21651,62 @@ const _mainnetChains = [
|
|
|
21853
21651
|
coinType: 118
|
|
21854
21652
|
}
|
|
21855
21653
|
},
|
|
21654
|
+
{
|
|
21655
|
+
chainId: "symphony-1",
|
|
21656
|
+
currencies: [
|
|
21657
|
+
{
|
|
21658
|
+
coinDenom: "mld",
|
|
21659
|
+
coinMinimalDenom: "note",
|
|
21660
|
+
coinDecimals: 6
|
|
21661
|
+
},
|
|
21662
|
+
{
|
|
21663
|
+
coinDenom: "husd",
|
|
21664
|
+
coinMinimalDenom: "uusd",
|
|
21665
|
+
coinDecimals: 6
|
|
21666
|
+
},
|
|
21667
|
+
{
|
|
21668
|
+
coinDenom: "hkhd",
|
|
21669
|
+
coinMinimalDenom: "ukhd",
|
|
21670
|
+
coinDecimals: 6
|
|
21671
|
+
},
|
|
21672
|
+
{
|
|
21673
|
+
coinDenom: "hvnd",
|
|
21674
|
+
coinMinimalDenom: "uvnd",
|
|
21675
|
+
coinDecimals: 6
|
|
21676
|
+
}
|
|
21677
|
+
],
|
|
21678
|
+
rest: "https://symphony.api.nodeshub.online/",
|
|
21679
|
+
rpc: "https://symphony.rpc.nodeshub.online/",
|
|
21680
|
+
bech32Config: {
|
|
21681
|
+
bech32PrefixAccAddr: "symphony",
|
|
21682
|
+
bech32PrefixAccPub: "symphonypub",
|
|
21683
|
+
bech32PrefixValAddr: "symphonyvaloper",
|
|
21684
|
+
bech32PrefixValPub: "symphonyvaloperpub",
|
|
21685
|
+
bech32PrefixConsAddr: "symphonyvalcons",
|
|
21686
|
+
bech32PrefixConsPub: "symphonyvalconspub"
|
|
21687
|
+
},
|
|
21688
|
+
chainName: "symphony",
|
|
21689
|
+
feeCurrencies: [
|
|
21690
|
+
{
|
|
21691
|
+
coinDenom: "mld",
|
|
21692
|
+
coinMinimalDenom: "note",
|
|
21693
|
+
coinDecimals: 6,
|
|
21694
|
+
gasPriceStep: {
|
|
21695
|
+
low: 25e-5,
|
|
21696
|
+
average: 25e-4,
|
|
21697
|
+
high: 4e-3
|
|
21698
|
+
}
|
|
21699
|
+
}
|
|
21700
|
+
],
|
|
21701
|
+
stakeCurrency: {
|
|
21702
|
+
coinDenom: "mld",
|
|
21703
|
+
coinMinimalDenom: "note",
|
|
21704
|
+
coinDecimals: 6
|
|
21705
|
+
},
|
|
21706
|
+
bip44: {
|
|
21707
|
+
coinType: 118
|
|
21708
|
+
}
|
|
21709
|
+
},
|
|
21856
21710
|
{
|
|
21857
21711
|
chainId: "synternet-1",
|
|
21858
21712
|
currencies: [
|
|
@@ -21895,44 +21749,44 @@ const _mainnetChains = [
|
|
|
21895
21749
|
}
|
|
21896
21750
|
},
|
|
21897
21751
|
{
|
|
21898
|
-
chainId: "taketitan-
|
|
21752
|
+
chainId: "taketitan-1",
|
|
21899
21753
|
currencies: [
|
|
21900
21754
|
{
|
|
21901
|
-
coinDenom: "
|
|
21902
|
-
coinMinimalDenom: "
|
|
21903
|
-
coinDecimals:
|
|
21755
|
+
coinDenom: "titan",
|
|
21756
|
+
coinMinimalDenom: "utitan",
|
|
21757
|
+
coinDecimals: 6
|
|
21904
21758
|
}
|
|
21905
21759
|
],
|
|
21906
|
-
rest: "https://
|
|
21907
|
-
rpc: "https://
|
|
21760
|
+
rest: "https://lcd.taketitan.com",
|
|
21761
|
+
rpc: "https://rpc.taketitan.com",
|
|
21908
21762
|
bech32Config: {
|
|
21909
|
-
bech32PrefixAccAddr: "
|
|
21910
|
-
bech32PrefixAccPub: "
|
|
21911
|
-
bech32PrefixValAddr: "
|
|
21912
|
-
bech32PrefixValPub: "
|
|
21913
|
-
bech32PrefixConsAddr: "
|
|
21914
|
-
bech32PrefixConsPub: "
|
|
21763
|
+
bech32PrefixAccAddr: "titan",
|
|
21764
|
+
bech32PrefixAccPub: "titanpub",
|
|
21765
|
+
bech32PrefixValAddr: "titanvaloper",
|
|
21766
|
+
bech32PrefixValPub: "titanvaloperpub",
|
|
21767
|
+
bech32PrefixConsAddr: "titanvalcons",
|
|
21768
|
+
bech32PrefixConsPub: "titanvalconspub"
|
|
21915
21769
|
},
|
|
21916
21770
|
chainName: "taketitan",
|
|
21917
21771
|
feeCurrencies: [
|
|
21918
21772
|
{
|
|
21919
|
-
coinDenom: "
|
|
21920
|
-
coinMinimalDenom: "
|
|
21921
|
-
coinDecimals:
|
|
21773
|
+
coinDenom: "titan",
|
|
21774
|
+
coinMinimalDenom: "utitan",
|
|
21775
|
+
coinDecimals: 6,
|
|
21922
21776
|
gasPriceStep: {
|
|
21923
|
-
low:
|
|
21924
|
-
average:
|
|
21925
|
-
high:
|
|
21777
|
+
low: 0.025,
|
|
21778
|
+
average: 0.03,
|
|
21779
|
+
high: 0.035
|
|
21926
21780
|
}
|
|
21927
21781
|
}
|
|
21928
21782
|
],
|
|
21929
21783
|
stakeCurrency: {
|
|
21930
|
-
coinDenom: "
|
|
21931
|
-
coinMinimalDenom: "
|
|
21932
|
-
coinDecimals:
|
|
21784
|
+
coinDenom: "titan",
|
|
21785
|
+
coinMinimalDenom: "utitan",
|
|
21786
|
+
coinDecimals: 6
|
|
21933
21787
|
},
|
|
21934
21788
|
bip44: {
|
|
21935
|
-
coinType:
|
|
21789
|
+
coinType: 118
|
|
21936
21790
|
}
|
|
21937
21791
|
},
|
|
21938
21792
|
{
|
|
@@ -24052,6 +23906,42 @@ const _mainnetChains = [
|
|
|
24052
23906
|
coinType: 118
|
|
24053
23907
|
}
|
|
24054
23908
|
},
|
|
23909
|
+
{
|
|
23910
|
+
chainId: "xarchain",
|
|
23911
|
+
currencies: [
|
|
23912
|
+
{
|
|
23913
|
+
coinDenom: "stxar",
|
|
23914
|
+
coinMinimalDenom: "stxar",
|
|
23915
|
+
coinDecimals: 0
|
|
23916
|
+
}
|
|
23917
|
+
],
|
|
23918
|
+
rest: "https://cosmos01-testnet.arcana.network",
|
|
23919
|
+
rpc: "https://cosmos01-testnet.arcana.network:26650",
|
|
23920
|
+
bech32Config: {
|
|
23921
|
+
bech32PrefixAccAddr: "arcana",
|
|
23922
|
+
bech32PrefixAccPub: "arcanapub",
|
|
23923
|
+
bech32PrefixValAddr: "arcanavaloper",
|
|
23924
|
+
bech32PrefixValPub: "arcanavaloperpub",
|
|
23925
|
+
bech32PrefixConsAddr: "arcanavalcons",
|
|
23926
|
+
bech32PrefixConsPub: "arcanavalconspub"
|
|
23927
|
+
},
|
|
23928
|
+
chainName: "xarchain",
|
|
23929
|
+
feeCurrencies: [
|
|
23930
|
+
{
|
|
23931
|
+
coinDenom: "stxar",
|
|
23932
|
+
coinMinimalDenom: "stxar",
|
|
23933
|
+
coinDecimals: 0
|
|
23934
|
+
}
|
|
23935
|
+
],
|
|
23936
|
+
stakeCurrency: {
|
|
23937
|
+
coinDenom: "stxar",
|
|
23938
|
+
coinMinimalDenom: "stxar",
|
|
23939
|
+
coinDecimals: 0
|
|
23940
|
+
},
|
|
23941
|
+
bip44: {
|
|
23942
|
+
coinType: 118
|
|
23943
|
+
}
|
|
23944
|
+
},
|
|
24055
23945
|
{
|
|
24056
23946
|
chainId: "xion-mainnet-1",
|
|
24057
23947
|
currencies: [
|
|
@@ -26027,7 +25917,7 @@ const _testnetChains = [
|
|
|
26027
25917
|
coinDecimals: 6,
|
|
26028
25918
|
gasPriceStep: {
|
|
26029
25919
|
low: 0.01,
|
|
26030
|
-
average: 0.
|
|
25920
|
+
average: 0.02,
|
|
26031
25921
|
high: 0.03
|
|
26032
25922
|
}
|
|
26033
25923
|
}
|
|
@@ -27650,7 +27540,7 @@ const _testnetChains = [
|
|
|
27650
27540
|
}
|
|
27651
27541
|
},
|
|
27652
27542
|
{
|
|
27653
|
-
chainId: "lumera-testnet-
|
|
27543
|
+
chainId: "lumera-testnet-2",
|
|
27654
27544
|
currencies: [
|
|
27655
27545
|
{
|
|
27656
27546
|
coinDenom: "LUME",
|
|
@@ -29453,6 +29343,47 @@ const _testnetChains = [
|
|
|
29453
29343
|
coinType: 118
|
|
29454
29344
|
}
|
|
29455
29345
|
},
|
|
29346
|
+
{
|
|
29347
|
+
chainId: "safro-testnet-1",
|
|
29348
|
+
currencies: [
|
|
29349
|
+
{
|
|
29350
|
+
coinDenom: "saf",
|
|
29351
|
+
coinMinimalDenom: "usaf",
|
|
29352
|
+
coinDecimals: 6
|
|
29353
|
+
}
|
|
29354
|
+
],
|
|
29355
|
+
rest: "https://rest.testnet.safrochain.com",
|
|
29356
|
+
rpc: "https://rpc.testnet.safrochain.com",
|
|
29357
|
+
bech32Config: {
|
|
29358
|
+
bech32PrefixAccAddr: "addr_safro",
|
|
29359
|
+
bech32PrefixAccPub: "addr_safropub",
|
|
29360
|
+
bech32PrefixValAddr: "addr_safrovaloper",
|
|
29361
|
+
bech32PrefixValPub: "addr_safrovaloperpub",
|
|
29362
|
+
bech32PrefixConsAddr: "addr_safrovalcons",
|
|
29363
|
+
bech32PrefixConsPub: "addr_safrovalconspub"
|
|
29364
|
+
},
|
|
29365
|
+
chainName: "safrochaintestnet",
|
|
29366
|
+
feeCurrencies: [
|
|
29367
|
+
{
|
|
29368
|
+
coinDenom: "saf",
|
|
29369
|
+
coinMinimalDenom: "usaf",
|
|
29370
|
+
coinDecimals: 6,
|
|
29371
|
+
gasPriceStep: {
|
|
29372
|
+
low: 25e-4,
|
|
29373
|
+
average: 0.025,
|
|
29374
|
+
high: 0.04
|
|
29375
|
+
}
|
|
29376
|
+
}
|
|
29377
|
+
],
|
|
29378
|
+
stakeCurrency: {
|
|
29379
|
+
coinDenom: "saf",
|
|
29380
|
+
coinMinimalDenom: "usaf",
|
|
29381
|
+
coinDecimals: 6
|
|
29382
|
+
},
|
|
29383
|
+
bip44: {
|
|
29384
|
+
coinType: 118
|
|
29385
|
+
}
|
|
29386
|
+
},
|
|
29456
29387
|
{
|
|
29457
29388
|
chainId: "ssc-testnet-2",
|
|
29458
29389
|
currencies: [
|
|
@@ -30003,7 +29934,7 @@ const _testnetChains = [
|
|
|
30003
29934
|
}
|
|
30004
29935
|
},
|
|
30005
29936
|
{
|
|
30006
|
-
chainId: "sunrise-test-
|
|
29937
|
+
chainId: "sunrise-test-da-5",
|
|
30007
29938
|
currencies: [
|
|
30008
29939
|
{
|
|
30009
29940
|
coinDenom: "vrise",
|
|
@@ -30014,10 +29945,15 @@ const _testnetChains = [
|
|
|
30014
29945
|
coinDenom: "rise",
|
|
30015
29946
|
coinMinimalDenom: "urise",
|
|
30016
29947
|
coinDecimals: 6
|
|
29948
|
+
},
|
|
29949
|
+
{
|
|
29950
|
+
coinDenom: "usdrise",
|
|
29951
|
+
coinMinimalDenom: "uusdrise",
|
|
29952
|
+
coinDecimals: 6
|
|
30017
29953
|
}
|
|
30018
29954
|
],
|
|
30019
|
-
rest: "https://
|
|
30020
|
-
rpc: "https://
|
|
29955
|
+
rest: "https://sunrise-test-da-5.cauchye.net:1318",
|
|
29956
|
+
rpc: "https://sunrise-test-da-5.cauchye.net",
|
|
30021
29957
|
bech32Config: {
|
|
30022
29958
|
bech32PrefixAccAddr: "sunrise",
|
|
30023
29959
|
bech32PrefixAccPub: "sunrisepub",
|
|
@@ -30029,8 +29965,8 @@ const _testnetChains = [
|
|
|
30029
29965
|
chainName: "sunrisetestnet",
|
|
30030
29966
|
feeCurrencies: [
|
|
30031
29967
|
{
|
|
30032
|
-
coinDenom: "
|
|
30033
|
-
coinMinimalDenom: "
|
|
29968
|
+
coinDenom: "usdrise",
|
|
29969
|
+
coinMinimalDenom: "uusdrise",
|
|
30034
29970
|
coinDecimals: 6,
|
|
30035
29971
|
gasPriceStep: {
|
|
30036
29972
|
low: 25e-4,
|
|
@@ -30140,62 +30076,6 @@ const _testnetChains = [
|
|
|
30140
30076
|
coinType: 118
|
|
30141
30077
|
}
|
|
30142
30078
|
},
|
|
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
30079
|
{
|
|
30200
30080
|
chainId: "amber-2",
|
|
30201
30081
|
currencies: [
|
|
@@ -31706,6 +31586,12 @@ const _explorers = [
|
|
|
31706
31586
|
url: "https://explorer.whenmoonwhenlambo.money/arkeo",
|
|
31707
31587
|
txPage: "https://explorer.whenmoonwhenlambo.money/arkeo/tx/${txHash}",
|
|
31708
31588
|
accountPage: "https://explorer.whenmoonwhenlambo.money/arkeo/account/${accountAddress}"
|
|
31589
|
+
},
|
|
31590
|
+
{
|
|
31591
|
+
kind: "NodeStake",
|
|
31592
|
+
url: "https://explorer.nodestake.org/arkeo",
|
|
31593
|
+
txPage: "https://explorer.nodestake.org/arkeo/tx/${txHash}",
|
|
31594
|
+
accountPage: "https://explorer.nodestake.org/arkeo/account/${accountAddress}"
|
|
31709
31595
|
}
|
|
31710
31596
|
]
|
|
31711
31597
|
},
|
|
@@ -31973,6 +31859,23 @@ const _explorers = [
|
|
|
31973
31859
|
}
|
|
31974
31860
|
]
|
|
31975
31861
|
},
|
|
31862
|
+
{
|
|
31863
|
+
chainId: "axone-1",
|
|
31864
|
+
explorers: [
|
|
31865
|
+
{
|
|
31866
|
+
kind: "valopers",
|
|
31867
|
+
url: "https://axone.valopers.com/",
|
|
31868
|
+
txPage: "https://axone.valopers.com/transactions/${txHash}",
|
|
31869
|
+
accountPage: "https://axone.valopers.com/account/${accountAddress}"
|
|
31870
|
+
},
|
|
31871
|
+
{
|
|
31872
|
+
kind: "NodeStake",
|
|
31873
|
+
url: "https://explorer.nodestake.org/axone",
|
|
31874
|
+
txPage: "https://explorer.nodestake.org/axone/tx/${txHash}",
|
|
31875
|
+
accountPage: "https://explorer.nodestake.org/axone/account/${accountAddress}"
|
|
31876
|
+
}
|
|
31877
|
+
]
|
|
31878
|
+
},
|
|
31976
31879
|
{
|
|
31977
31880
|
chainId: "bbn-1",
|
|
31978
31881
|
explorers: [
|
|
@@ -32403,6 +32306,16 @@ const _explorers = [
|
|
|
32403
32306
|
}
|
|
32404
32307
|
]
|
|
32405
32308
|
},
|
|
32309
|
+
{
|
|
32310
|
+
chainId: "bcx_323-1",
|
|
32311
|
+
explorers: [
|
|
32312
|
+
{
|
|
32313
|
+
kind: "pingpub",
|
|
32314
|
+
url: "https://cosmos.buycex.net",
|
|
32315
|
+
txPage: "https://cosmos.buycex.net/tx/${txHash}"
|
|
32316
|
+
}
|
|
32317
|
+
]
|
|
32318
|
+
},
|
|
32406
32319
|
{
|
|
32407
32320
|
chainId: "canto_7700-1",
|
|
32408
32321
|
explorers: [
|
|
@@ -32783,9 +32696,8 @@ const _explorers = [
|
|
|
32783
32696
|
chainId: "cifer-2",
|
|
32784
32697
|
explorers: [
|
|
32785
32698
|
{
|
|
32786
|
-
|
|
32787
|
-
|
|
32788
|
-
txPage: "https://explorer.cifer.ai/transactions/${txHash}"
|
|
32699
|
+
url: "https://www.cifscan.com/",
|
|
32700
|
+
txPage: "https://www.cifscan.com/tx/${txHash}"
|
|
32789
32701
|
}
|
|
32790
32702
|
]
|
|
32791
32703
|
},
|
|
@@ -35580,7 +35492,7 @@ const _explorers = [
|
|
|
35580
35492
|
explorers: [
|
|
35581
35493
|
{
|
|
35582
35494
|
kind: "ping.pub",
|
|
35583
|
-
url: "https://blockexplorer.mtgbp.com
|
|
35495
|
+
url: "https://blockexplorer.mtgbp.com",
|
|
35584
35496
|
txPage: "https://blockexplorer.mtgbp.com/mtgbp/tx/${txHash}",
|
|
35585
35497
|
accountPage: "https://blockexplorer.mtgbp.com/mtgbp/accounts/${accountAddress}"
|
|
35586
35498
|
}
|
|
@@ -36479,6 +36391,12 @@ const _explorers = [
|
|
|
36479
36391
|
url: "https://shannon.pokt.network",
|
|
36480
36392
|
txPage: "https://shannon.pokt.network/tx/${txHash}",
|
|
36481
36393
|
accountPage: "https://shannon.pokt.network/poktroll/account/${accountAddress}"
|
|
36394
|
+
},
|
|
36395
|
+
{
|
|
36396
|
+
kind: "🗺 Ping Pub fork Explorer by Blockval",
|
|
36397
|
+
url: "https://explorer.blockval.io/pocket",
|
|
36398
|
+
txPage: "https://explorer.blockval.io/pocket/tx/${txHash}",
|
|
36399
|
+
accountPage: "https://explorer.blockval.io/pocket/account/${accountAddress}"
|
|
36482
36400
|
}
|
|
36483
36401
|
]
|
|
36484
36402
|
},
|
|
@@ -36648,7 +36566,7 @@ const _explorers = [
|
|
|
36648
36566
|
explorers: [
|
|
36649
36567
|
{
|
|
36650
36568
|
kind: "ping.pub",
|
|
36651
|
-
url: "https://blockexplorer.qfsone.com
|
|
36569
|
+
url: "https://blockexplorer.qfsone.com",
|
|
36652
36570
|
txPage: "https://blockexplorer.qfsone.com/qfs/tx/${txHash}",
|
|
36653
36571
|
accountPage: "https://blockexplorer.qfsone.com/qfs/accounts/${accountAddress}"
|
|
36654
36572
|
}
|
|
@@ -37964,6 +37882,17 @@ const _explorers = [
|
|
|
37964
37882
|
chainId: "sunrise-1",
|
|
37965
37883
|
explorers: []
|
|
37966
37884
|
},
|
|
37885
|
+
{
|
|
37886
|
+
chainId: "symphony-1",
|
|
37887
|
+
explorers: [
|
|
37888
|
+
{
|
|
37889
|
+
kind: "VinjanXplorer",
|
|
37890
|
+
url: "https://xplorer.vinjan.xyz/symphony",
|
|
37891
|
+
txPage: "https://xplorer.vinjan.xyz/symphony/tx/${txHash}",
|
|
37892
|
+
accountPage: "https://xplorer.vinjan.xyz/symphony/account/${accountAddress}"
|
|
37893
|
+
}
|
|
37894
|
+
]
|
|
37895
|
+
},
|
|
37967
37896
|
{
|
|
37968
37897
|
chainId: "synternet-1",
|
|
37969
37898
|
explorers: [
|
|
@@ -37987,13 +37916,13 @@ const _explorers = [
|
|
|
37987
37916
|
]
|
|
37988
37917
|
},
|
|
37989
37918
|
{
|
|
37990
|
-
chainId: "taketitan-
|
|
37919
|
+
chainId: "taketitan-1",
|
|
37991
37920
|
explorers: [
|
|
37992
37921
|
{
|
|
37993
37922
|
kind: "ping.pub",
|
|
37994
|
-
url: "https://
|
|
37995
|
-
txPage: "https://
|
|
37996
|
-
accountPage: "https://
|
|
37923
|
+
url: "https://blockexplorer.taketitan.com",
|
|
37924
|
+
txPage: "https://blockexplorer.taketitan.com/taketitan/tx/${txHash}",
|
|
37925
|
+
accountPage: "https://blockexplorer.taketitan.com/taketitan/accounts/${accountAddress}"
|
|
37997
37926
|
}
|
|
37998
37927
|
]
|
|
37999
37928
|
},
|
|
@@ -38251,12 +38180,6 @@ const _explorers = [
|
|
|
38251
38180
|
{
|
|
38252
38181
|
chainId: "umee-1",
|
|
38253
38182
|
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
38183
|
{
|
|
38261
38184
|
kind: "ping.pub",
|
|
38262
38185
|
url: "https://ping.pub/umee",
|
|
@@ -38442,6 +38365,15 @@ const _explorers = [
|
|
|
38442
38365
|
}
|
|
38443
38366
|
]
|
|
38444
38367
|
},
|
|
38368
|
+
{
|
|
38369
|
+
chainId: "xarchain",
|
|
38370
|
+
explorers: [
|
|
38371
|
+
{
|
|
38372
|
+
kind: "arcana ceries intent explorer",
|
|
38373
|
+
url: "https://explorer.arcana.network"
|
|
38374
|
+
}
|
|
38375
|
+
]
|
|
38376
|
+
},
|
|
38445
38377
|
{
|
|
38446
38378
|
chainId: "xion-mainnet-1",
|
|
38447
38379
|
explorers: [
|
|
@@ -39546,7 +39478,7 @@ const _explorers = [
|
|
|
39546
39478
|
]
|
|
39547
39479
|
},
|
|
39548
39480
|
{
|
|
39549
|
-
chainId: "lumera-testnet-
|
|
39481
|
+
chainId: "lumera-testnet-2",
|
|
39550
39482
|
explorers: [
|
|
39551
39483
|
{
|
|
39552
39484
|
kind: "ping.pub",
|
|
@@ -39947,6 +39879,16 @@ const _explorers = [
|
|
|
39947
39879
|
}
|
|
39948
39880
|
]
|
|
39949
39881
|
},
|
|
39882
|
+
{
|
|
39883
|
+
chainId: "safro-testnet-1",
|
|
39884
|
+
explorers: [
|
|
39885
|
+
{
|
|
39886
|
+
kind: "bigdipper",
|
|
39887
|
+
url: "https://explorer.testnet.safrochain.com",
|
|
39888
|
+
txPage: "https://explorer.testnet.safrochain.com/transactions/${txHash}"
|
|
39889
|
+
}
|
|
39890
|
+
]
|
|
39891
|
+
},
|
|
39950
39892
|
{
|
|
39951
39893
|
chainId: "ssc-testnet-2",
|
|
39952
39894
|
explorers: [
|
|
@@ -40142,7 +40084,7 @@ const _explorers = [
|
|
|
40142
40084
|
]
|
|
40143
40085
|
},
|
|
40144
40086
|
{
|
|
40145
|
-
chainId: "sunrise-test-
|
|
40087
|
+
chainId: "sunrise-test-da-5",
|
|
40146
40088
|
explorers: []
|
|
40147
40089
|
},
|
|
40148
40090
|
{
|
|
@@ -40156,10 +40098,15 @@ const _explorers = [
|
|
|
40156
40098
|
]
|
|
40157
40099
|
},
|
|
40158
40100
|
{
|
|
40159
|
-
chainId: "symphony-testnet-4"
|
|
40160
|
-
|
|
40161
|
-
|
|
40162
|
-
|
|
40101
|
+
chainId: "symphony-testnet-4",
|
|
40102
|
+
explorers: [
|
|
40103
|
+
{
|
|
40104
|
+
kind: "VinjanXplorer",
|
|
40105
|
+
url: "https://xplorer.vinjan.xyz/symphony-testnet",
|
|
40106
|
+
txPage: "https://xplorer.vinjan.xyz/symphony-testnet/tx/${txHash}",
|
|
40107
|
+
accountPage: "https://xplorer.vinjan.xyz/symphony-testnet/account/${accountAddress}"
|
|
40108
|
+
}
|
|
40109
|
+
]
|
|
40163
40110
|
},
|
|
40164
40111
|
{
|
|
40165
40112
|
chainId: "amber-2",
|
|
@@ -41372,6 +41319,10 @@ const routePreferenceAtom = atom$1(
|
|
|
41372
41319
|
}
|
|
41373
41320
|
);
|
|
41374
41321
|
const goFastWarningAtom = atomWithStorageNoCrossTabSync("showGoFastWarning", true);
|
|
41322
|
+
const ROUTE_ERROR_CODE_MAP = {
|
|
41323
|
+
5: "no route found",
|
|
41324
|
+
12: "no route found"
|
|
41325
|
+
};
|
|
41375
41326
|
const initializeDebounceValuesEffect = atomEffect(
|
|
41376
41327
|
(get, set) => {
|
|
41377
41328
|
const sourceAsset = get(sourceAssetAtom);
|
|
@@ -41467,10 +41418,15 @@ const _skipRouteAtom = atomWithQuery((get) => {
|
|
|
41467
41418
|
};
|
|
41468
41419
|
});
|
|
41469
41420
|
const skipRouteAtom = atom$1((get) => {
|
|
41421
|
+
var _a;
|
|
41470
41422
|
const { data, isError, error, isFetching, isPending } = get(_skipRouteAtom);
|
|
41471
41423
|
const caughtError = data;
|
|
41472
41424
|
const routeResponse = data;
|
|
41473
41425
|
if (caughtError == null ? void 0 : caughtError.isError) {
|
|
41426
|
+
const error2 = caughtError.error;
|
|
41427
|
+
if (((_a = caughtError == null ? void 0 : caughtError.error) == null ? void 0 : _a.code) && ROUTE_ERROR_CODE_MAP[caughtError.error.code]) {
|
|
41428
|
+
error2.message = ROUTE_ERROR_CODE_MAP[caughtError.error.code];
|
|
41429
|
+
}
|
|
41474
41430
|
return {
|
|
41475
41431
|
data: void 0,
|
|
41476
41432
|
isError: true,
|
|
@@ -41519,6 +41475,8 @@ const setRouteToDefaultRouteAtom = atom$1(null, (get, set, assets2) => {
|
|
|
41519
41475
|
});
|
|
41520
41476
|
var HISTORY_VERSION = /* @__PURE__ */ ((HISTORY_VERSION2) => {
|
|
41521
41477
|
HISTORY_VERSION2[HISTORY_VERSION2["camelCase"] = 0] = "camelCase";
|
|
41478
|
+
HISTORY_VERSION2[HISTORY_VERSION2["routeDetails"] = 1] = "routeDetails";
|
|
41479
|
+
HISTORY_VERSION2[HISTORY_VERSION2["userAddresses"] = 2] = "userAddresses";
|
|
41522
41480
|
return HISTORY_VERSION2;
|
|
41523
41481
|
})(HISTORY_VERSION || {});
|
|
41524
41482
|
const transactionHistoryVersionAtom = atomWithStorage(
|
|
@@ -41529,31 +41487,49 @@ const transactionHistoryAtom = atomWithStorage(
|
|
|
41529
41487
|
LOCAL_STORAGE_KEYS.transactionHistory,
|
|
41530
41488
|
[]
|
|
41531
41489
|
);
|
|
41490
|
+
const sortedHistoryItemsAtom = atom$1((get) => {
|
|
41491
|
+
const history = get(transactionHistoryAtom);
|
|
41492
|
+
const sortedAndFiltered = history.filter(
|
|
41493
|
+
(historyItem) => historyItem.txsSigned > 0 && historyItem.mainRouteId === void 0 && historyItem.transactionDetails.some((tx) => tx.txHash)
|
|
41494
|
+
).map((historyItem) => {
|
|
41495
|
+
const relatedRoutes = [...historyItem.relatedRoutes ?? []];
|
|
41496
|
+
return {
|
|
41497
|
+
...historyItem,
|
|
41498
|
+
relatedRoutes
|
|
41499
|
+
};
|
|
41500
|
+
}).sort((a, b) => b.timestamp - a.timestamp);
|
|
41501
|
+
return sortedAndFiltered;
|
|
41502
|
+
});
|
|
41532
41503
|
const setTransactionHistoryAtom = atom$1(
|
|
41533
41504
|
null,
|
|
41534
41505
|
(get, set, historyItem) => {
|
|
41535
41506
|
const history = get(transactionHistoryAtom);
|
|
41536
|
-
const index = history.findIndex((item) => item.
|
|
41507
|
+
const index = history.findIndex((item) => item.id === historyItem.id);
|
|
41537
41508
|
const newHistory = [...history];
|
|
41538
41509
|
if (index !== -1) {
|
|
41539
41510
|
const oldItem = newHistory[index];
|
|
41540
41511
|
newHistory[index] = { ...oldItem, ...historyItem };
|
|
41541
41512
|
} else {
|
|
41542
|
-
|
|
41513
|
+
if (historyItem.id) {
|
|
41514
|
+
if (historyItem.mainRouteId === void 0) {
|
|
41515
|
+
set(setCurrentTransactionIdAtom, historyItem.id);
|
|
41516
|
+
}
|
|
41517
|
+
newHistory.push(historyItem);
|
|
41518
|
+
}
|
|
41543
41519
|
}
|
|
41544
41520
|
set(transactionHistoryAtom, newHistory);
|
|
41545
41521
|
}
|
|
41546
41522
|
);
|
|
41547
|
-
const
|
|
41523
|
+
const currentTransactionAtom = atom$1((get) => {
|
|
41524
|
+
const { currentTransactionId } = get(swapExecutionStateAtom);
|
|
41548
41525
|
const history = get(transactionHistoryAtom);
|
|
41526
|
+
return history.find((historyItem) => historyItem.id === currentTransactionId);
|
|
41527
|
+
});
|
|
41528
|
+
const lastTransactionInTimeAtom = atom$1((get) => {
|
|
41529
|
+
const history = get(sortedHistoryItemsAtom);
|
|
41549
41530
|
if (history.length === 0) return;
|
|
41550
41531
|
const sorted = [...history].sort((a, b) => b.timestamp - a.timestamp);
|
|
41551
|
-
|
|
41552
|
-
const originalIndex = history.findIndex((tx) => tx.timestamp === lastTx.timestamp);
|
|
41553
|
-
return {
|
|
41554
|
-
transactionHistoryItem: lastTx,
|
|
41555
|
-
index: originalIndex
|
|
41556
|
-
};
|
|
41532
|
+
return sorted.at(0);
|
|
41557
41533
|
});
|
|
41558
41534
|
const removeTransactionHistoryItemAtom = atom$1(null, (get, set, timestamp) => {
|
|
41559
41535
|
const history = get(transactionHistoryAtom);
|
|
@@ -41561,6 +41537,118 @@ const removeTransactionHistoryItemAtom = atom$1(null, (get, set, timestamp) => {
|
|
|
41561
41537
|
const newHistory = history.filter((item) => item.timestamp !== timestamp);
|
|
41562
41538
|
set(transactionHistoryAtom, newHistory);
|
|
41563
41539
|
});
|
|
41540
|
+
var OperationType = /* @__PURE__ */ ((OperationType2) => {
|
|
41541
|
+
OperationType2["swap"] = "swap";
|
|
41542
|
+
OperationType2["evmSwap"] = "evmSwap";
|
|
41543
|
+
OperationType2["transfer"] = "transfer";
|
|
41544
|
+
OperationType2["axelarTransfer"] = "axelarTransfer";
|
|
41545
|
+
OperationType2["cctpTransfer"] = "cctpTransfer";
|
|
41546
|
+
OperationType2["hyperlaneTransfer"] = "hyperlaneTransfer";
|
|
41547
|
+
OperationType2["opInitTransfer"] = "opInitTransfer";
|
|
41548
|
+
OperationType2["bankSend"] = "bankSend";
|
|
41549
|
+
OperationType2["goFastTransfer"] = "goFastTransfer";
|
|
41550
|
+
OperationType2["stargateTransfer"] = "stargateTransfer";
|
|
41551
|
+
OperationType2["eurekaTransfer"] = "eurekaTransfer";
|
|
41552
|
+
OperationType2["layerZeroTransfer"] = "layerZeroTransfer";
|
|
41553
|
+
return OperationType2;
|
|
41554
|
+
})(OperationType || {});
|
|
41555
|
+
function getOperationDetailsAndType(operation) {
|
|
41556
|
+
const combinedOperation = operation;
|
|
41557
|
+
let returnValue = {
|
|
41558
|
+
details: {},
|
|
41559
|
+
type: void 0
|
|
41560
|
+
};
|
|
41561
|
+
Object.values(OperationType).find((type2) => {
|
|
41562
|
+
var _a;
|
|
41563
|
+
const originalDetails = combinedOperation == null ? void 0 : combinedOperation[type2];
|
|
41564
|
+
if (originalDetails) {
|
|
41565
|
+
const operationDetails = { ...originalDetails };
|
|
41566
|
+
switch (type2) {
|
|
41567
|
+
case "swap":
|
|
41568
|
+
case "evmSwap":
|
|
41569
|
+
operationDetails.toChainId = originalDetails.fromChainId;
|
|
41570
|
+
break;
|
|
41571
|
+
case "axelarTransfer":
|
|
41572
|
+
operationDetails.denomIn = ((_a = originalDetails.ibcTransferToAxelar) == null ? void 0 : _a.denomIn) ?? originalDetails.denomIn;
|
|
41573
|
+
break;
|
|
41574
|
+
case "bankSend": {
|
|
41575
|
+
const bankSend = originalDetails;
|
|
41576
|
+
operationDetails.denomIn = bankSend.denom;
|
|
41577
|
+
operationDetails.denomOut = bankSend.denom;
|
|
41578
|
+
operationDetails.fromChainId = bankSend.chainId;
|
|
41579
|
+
operationDetails.toChainId = bankSend.chainId;
|
|
41580
|
+
break;
|
|
41581
|
+
}
|
|
41582
|
+
}
|
|
41583
|
+
returnValue = {
|
|
41584
|
+
details: operationDetails,
|
|
41585
|
+
type: type2
|
|
41586
|
+
};
|
|
41587
|
+
}
|
|
41588
|
+
});
|
|
41589
|
+
return returnValue;
|
|
41590
|
+
}
|
|
41591
|
+
function getClientOperation(operation) {
|
|
41592
|
+
const { details, type: type2 } = getOperationDetailsAndType(operation);
|
|
41593
|
+
return {
|
|
41594
|
+
type: type2,
|
|
41595
|
+
...details,
|
|
41596
|
+
txIndex: operation.txIndex,
|
|
41597
|
+
amountIn: operation.amountIn,
|
|
41598
|
+
amountOut: operation.amountOut,
|
|
41599
|
+
swapVenues: [
|
|
41600
|
+
...details.swapVenues ?? [],
|
|
41601
|
+
...(details == null ? void 0 : details.swapIn) ? [details == null ? void 0 : details.swapIn.swapVenue] : [],
|
|
41602
|
+
...(details == null ? void 0 : details.swapOut) ? [details == null ? void 0 : details.swapOut.swapVenue] : []
|
|
41603
|
+
]
|
|
41604
|
+
};
|
|
41605
|
+
}
|
|
41606
|
+
function getClientOperations(operations) {
|
|
41607
|
+
if (!operations) return [];
|
|
41608
|
+
let transferIndex = 0;
|
|
41609
|
+
const filteredOperations = filterNeutronSwapFee(operations);
|
|
41610
|
+
return filteredOperations.map((operation, index, arr) => {
|
|
41611
|
+
const prevOperation = arr[index - 1];
|
|
41612
|
+
const signRequired = (() => {
|
|
41613
|
+
if (index === 0) {
|
|
41614
|
+
return false;
|
|
41615
|
+
} else {
|
|
41616
|
+
if (operation.txIndex > prevOperation.txIndex) {
|
|
41617
|
+
return true;
|
|
41618
|
+
}
|
|
41619
|
+
return false;
|
|
41620
|
+
}
|
|
41621
|
+
})();
|
|
41622
|
+
const clientOperation = getClientOperation(operation);
|
|
41623
|
+
const isSwap = clientOperation.type === "swap" || clientOperation.type === "evmSwap";
|
|
41624
|
+
const result = {
|
|
41625
|
+
...clientOperation,
|
|
41626
|
+
transferIndex,
|
|
41627
|
+
signRequired,
|
|
41628
|
+
isSwap
|
|
41629
|
+
};
|
|
41630
|
+
if (!isSwap) {
|
|
41631
|
+
transferIndex++;
|
|
41632
|
+
}
|
|
41633
|
+
return result;
|
|
41634
|
+
});
|
|
41635
|
+
}
|
|
41636
|
+
function filterNeutronSwapFee(operations) {
|
|
41637
|
+
return operations.filter((op, i) => {
|
|
41638
|
+
var _a, _b, _c, _d, _e2, _f, _g, _h;
|
|
41639
|
+
const clientOperation = getClientOperation(op);
|
|
41640
|
+
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") {
|
|
41641
|
+
const nextOperation = operations[i + 1];
|
|
41642
|
+
if (nextOperation) {
|
|
41643
|
+
const nextClientOperation = getClientOperation(nextOperation);
|
|
41644
|
+
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") {
|
|
41645
|
+
return false;
|
|
41646
|
+
}
|
|
41647
|
+
}
|
|
41648
|
+
}
|
|
41649
|
+
return true;
|
|
41650
|
+
});
|
|
41651
|
+
}
|
|
41564
41652
|
function isUserRejectedRequestError(input) {
|
|
41565
41653
|
if (input instanceof Error) {
|
|
41566
41654
|
if (
|
|
@@ -45486,7 +45574,7 @@ function walletConnect(parameters) {
|
|
|
45486
45574
|
const optionalChains = config2.chains.map((x2) => x2.id);
|
|
45487
45575
|
if (!optionalChains.length)
|
|
45488
45576
|
return;
|
|
45489
|
-
const { EthereumProvider } = await import("./index.es-
|
|
45577
|
+
const { EthereumProvider } = await import("./index.es-DlJZjBcA.js");
|
|
45490
45578
|
return await EthereumProvider.init({
|
|
45491
45579
|
...parameters,
|
|
45492
45580
|
disableProviderPing: true,
|
|
@@ -45815,43 +45903,343 @@ const createExplorerLink = ({
|
|
|
45815
45903
|
};
|
|
45816
45904
|
const createSkipExplorerLink = (transactionDetails) => {
|
|
45817
45905
|
var _a, _b;
|
|
45906
|
+
if (!transactionDetails) return "";
|
|
45818
45907
|
const { get } = jotaiStore;
|
|
45819
45908
|
const txHashCommaSeperatedList = (_a = transactionDetails == null ? void 0 : transactionDetails.map((txDetails) => txDetails.txHash)) == null ? void 0 : _a.join(",");
|
|
45820
45909
|
const isTestnet = get(onlyTestnetsAtom);
|
|
45821
45910
|
const initialTxChainId = (_b = transactionDetails == null ? void 0 : transactionDetails[0]) == null ? void 0 : _b.chainId;
|
|
45822
45911
|
return `https://explorer.skip.build/?tx_hash=${txHashCommaSeperatedList}&chain_id=${initialTxChainId}${isTestnet ? "&is_testnet=true" : ""}`;
|
|
45823
45912
|
};
|
|
45913
|
+
const skipAllBalancesRequestAtom = atom$1(void 0);
|
|
45914
|
+
const skipAllBalancesAtom = atomWithQuery((get) => {
|
|
45915
|
+
const params = get(skipAllBalancesRequestAtom);
|
|
45916
|
+
const isInvertingSwap = get(isInvertingSwapAtom);
|
|
45917
|
+
const enabled = params && !isInvertingSwap;
|
|
45918
|
+
return {
|
|
45919
|
+
queryKey: ["skipBalances", params],
|
|
45920
|
+
queryFn: async () => {
|
|
45921
|
+
if (!params) {
|
|
45922
|
+
return { chains: {} };
|
|
45923
|
+
}
|
|
45924
|
+
if (Object.keys((params == null ? void 0 : params.chains) ?? {}).length === 0) {
|
|
45925
|
+
return { chains: {} };
|
|
45926
|
+
}
|
|
45927
|
+
const res = await balances({ ...params, abortDuplicateRequests: true });
|
|
45928
|
+
if (res === void 0) {
|
|
45929
|
+
return { chains: {} };
|
|
45930
|
+
}
|
|
45931
|
+
if (res.chains === void 0) {
|
|
45932
|
+
return { chains: {} };
|
|
45933
|
+
}
|
|
45934
|
+
return res;
|
|
45935
|
+
},
|
|
45936
|
+
enabled,
|
|
45937
|
+
refetchInterval: 1e3 * 60,
|
|
45938
|
+
retry: 1,
|
|
45939
|
+
gcTime: 0,
|
|
45940
|
+
placeholderData: (prevData) => prevData
|
|
45941
|
+
};
|
|
45942
|
+
});
|
|
45943
|
+
const GAS_ON_RECEIVE_AMOUNT_USD = {
|
|
45944
|
+
[ChainType.Cosmos]: 0.1,
|
|
45945
|
+
evm_l2: 2
|
|
45946
|
+
};
|
|
45947
|
+
const gasOnReceiveAtom = atom$1(void 0);
|
|
45948
|
+
const gasOnReceiveAmountAtom = atom$1(void 0);
|
|
45949
|
+
const gasOnReceiveRouteRequestAtom = atom$1((get) => {
|
|
45950
|
+
var _a, _b, _c, _d, _e2, _f;
|
|
45951
|
+
const balances2 = get(skipAllBalancesAtom);
|
|
45952
|
+
const chains2 = get(skipChainsAtom);
|
|
45953
|
+
const sourceAsset = get(sourceAssetAtom);
|
|
45954
|
+
const destinationAsset = get(destinationAssetAtom);
|
|
45955
|
+
const _amount = get(gasOnReceiveAmountAtom);
|
|
45956
|
+
if (!sourceAsset || !destinationAsset) return;
|
|
45957
|
+
const destinationChain = (_a = chains2.data) == null ? void 0 : _a.find((c) => c.chainId === (destinationAsset == null ? void 0 : destinationAsset.chainId));
|
|
45958
|
+
const amountUsd = (() => {
|
|
45959
|
+
if (_amount !== void 0) {
|
|
45960
|
+
const parsedAmount = Number(_amount);
|
|
45961
|
+
if (!isNaN(parsedAmount)) return parsedAmount;
|
|
45962
|
+
}
|
|
45963
|
+
if ((destinationChain == null ? void 0 : destinationChain.chainType) === ChainType.Evm) {
|
|
45964
|
+
return GAS_ON_RECEIVE_AMOUNT_USD.evm_l2;
|
|
45965
|
+
}
|
|
45966
|
+
return GAS_ON_RECEIVE_AMOUNT_USD[ChainType.Cosmos];
|
|
45967
|
+
})();
|
|
45968
|
+
const destinationFeeAssets = (() => {
|
|
45969
|
+
var _a2;
|
|
45970
|
+
if ((destinationChain == null ? void 0 : destinationChain.chainType) === ChainType.Evm) {
|
|
45971
|
+
const assets2 = get(skipAssetsAtom);
|
|
45972
|
+
const evmFeeAsset = (_a2 = assets2.data) == null ? void 0 : _a2.find(
|
|
45973
|
+
(asset) => asset.chain_key === (destinationChain == null ? void 0 : destinationChain.chainId) && asset.denom.includes("-native")
|
|
45974
|
+
);
|
|
45975
|
+
if (evmFeeAsset) {
|
|
45976
|
+
return [{ amountOut: void 0, denom: evmFeeAsset.denom }];
|
|
45977
|
+
}
|
|
45978
|
+
}
|
|
45979
|
+
return destinationChain == null ? void 0 : destinationChain.feeAssets.map((asset) => {
|
|
45980
|
+
var _a3, _b2, _c2;
|
|
45981
|
+
const gasPrice = ((_a3 = asset.gasPrice) == null ? void 0 : _a3.average) ?? ((_b2 = asset.gasPrice) == null ? void 0 : _b2.high) ?? ((_c2 = asset.gasPrice) == null ? void 0 : _c2.low);
|
|
45982
|
+
return {
|
|
45983
|
+
amountOut: gasPrice && convertHumanReadableAmountToCryptoAmount(
|
|
45984
|
+
BigNumber(gasPrice).multipliedBy(3).toNumber(),
|
|
45985
|
+
destinationAsset == null ? void 0 : destinationAsset.decimals
|
|
45986
|
+
),
|
|
45987
|
+
denom: asset.denom
|
|
45988
|
+
};
|
|
45989
|
+
});
|
|
45990
|
+
})();
|
|
45991
|
+
if (!(sourceAsset == null ? void 0 : sourceAsset.chainId) || !sourceAsset.denom || !destinationFeeAssets) return;
|
|
45992
|
+
const sourceAssetUsdPrice = (_f = (_e2 = (_d = (_c = (_b = balances2 == null ? void 0 : balances2.data) == null ? void 0 : _b.chains) == null ? void 0 : _c[sourceAsset == null ? void 0 : sourceAsset.chainId]) == null ? void 0 : _d.denoms) == null ? void 0 : _e2[sourceAsset == null ? void 0 : sourceAsset.denom]) == null ? void 0 : _f.price;
|
|
45993
|
+
if (!sourceAssetUsdPrice) return;
|
|
45994
|
+
const amount = BigNumber(sourceAssetUsdPrice).multipliedBy(amountUsd).toString();
|
|
45995
|
+
return {
|
|
45996
|
+
amountIn: convertHumanReadableAmountToCryptoAmount(amount, destinationAsset == null ? void 0 : destinationAsset.decimals),
|
|
45997
|
+
sourceAssetChainId: sourceAsset.chainId,
|
|
45998
|
+
sourceAssetDenom: sourceAsset.denom,
|
|
45999
|
+
destAssetChainId: destinationAsset == null ? void 0 : destinationAsset.chainId,
|
|
46000
|
+
destAssetDenoms: destinationFeeAssets
|
|
46001
|
+
};
|
|
46002
|
+
});
|
|
46003
|
+
const isSomeDestinationFeeBalanceAvailableAtom = atomWithQuery((get) => {
|
|
46004
|
+
const chainAddresses = get(chainAddressesAtom);
|
|
46005
|
+
const chainAddressesArray = Object.values(chainAddresses);
|
|
46006
|
+
const destination = chainAddressesArray == null ? void 0 : chainAddressesArray[chainAddressesArray.length - 1];
|
|
46007
|
+
const destinationAddress = destination == null ? void 0 : destination.address;
|
|
46008
|
+
const gasOnReceiveRouteParams = get(gasOnReceiveRouteRequestAtom);
|
|
46009
|
+
const queryEnabled = !!destinationAddress && !!gasOnReceiveRouteParams;
|
|
46010
|
+
return {
|
|
46011
|
+
enabled: queryEnabled,
|
|
46012
|
+
retry: false,
|
|
46013
|
+
refetchOnReconnect: false,
|
|
46014
|
+
refetchOnWindowFocus: false,
|
|
46015
|
+
refetchInterval: false,
|
|
46016
|
+
queryKey: ["destinationBalances", { destination, gasOnReceiveRouteParams }],
|
|
46017
|
+
queryFn: async () => {
|
|
46018
|
+
if (!gasOnReceiveRouteParams) return false;
|
|
46019
|
+
const balanceResponse = await balances({
|
|
46020
|
+
chains: {
|
|
46021
|
+
[destination.chainId]: {
|
|
46022
|
+
address: destinationAddress
|
|
46023
|
+
}
|
|
46024
|
+
}
|
|
46025
|
+
});
|
|
46026
|
+
const isSomeBalanceAvailable = gasOnReceiveRouteParams == null ? void 0 : gasOnReceiveRouteParams.destAssetDenoms.some(
|
|
46027
|
+
({ denom, amountOut }) => {
|
|
46028
|
+
var _a, _b, _c, _d;
|
|
46029
|
+
const balanceAmount = (_d = (_c = (_b = (_a = balanceResponse == null ? void 0 : balanceResponse.chains) == null ? void 0 : _a[destination.chainId]) == null ? void 0 : _b.denoms) == null ? void 0 : _c[denom]) == null ? void 0 : _d.amount;
|
|
46030
|
+
const isMoreThanAmountOut = !!balanceAmount && !!amountOut && BigNumber(balanceAmount).isGreaterThanOrEqualTo(amountOut);
|
|
46031
|
+
return amountOut ? isMoreThanAmountOut : balanceAmount && balanceAmount !== "0";
|
|
46032
|
+
}
|
|
46033
|
+
);
|
|
46034
|
+
if (!isSomeBalanceAvailable) {
|
|
46035
|
+
track("gas on receive: no destination balance");
|
|
46036
|
+
}
|
|
46037
|
+
return isSomeBalanceAvailable;
|
|
46038
|
+
}
|
|
46039
|
+
};
|
|
46040
|
+
});
|
|
46041
|
+
const gasOnReceiveAtomEffect = atomEffect((get, set) => {
|
|
46042
|
+
var _a;
|
|
46043
|
+
const gorRoute = get(gasOnReceiveRouteAtom);
|
|
46044
|
+
const isSomeDestinationFeeBalanceAvailable = get(isSomeDestinationFeeBalanceAvailableAtom);
|
|
46045
|
+
const currentTransactionItem = get(currentTransactionAtom);
|
|
46046
|
+
if (gorRoute.isLoading || isSomeDestinationFeeBalanceAvailable.isLoading) return;
|
|
46047
|
+
if (currentTransactionItem) return;
|
|
46048
|
+
if (!((_a = gorRoute.data) == null ? void 0 : _a.gasOnReceiveAsset)) return;
|
|
46049
|
+
if (isSomeDestinationFeeBalanceAvailable.data) {
|
|
46050
|
+
set(gasOnReceiveAtom, (prev2) => prev2 ?? false);
|
|
46051
|
+
} else {
|
|
46052
|
+
set(gasOnReceiveAtom, (prev2) => prev2 ?? true);
|
|
46053
|
+
}
|
|
46054
|
+
});
|
|
46055
|
+
const gasOnReceiveRouteAtom = atomWithQuery((get) => {
|
|
46056
|
+
const { data: chains2 } = get(skipChainsAtom);
|
|
46057
|
+
const { data: originalRoute } = get(skipRouteAtom);
|
|
46058
|
+
const params = get(skipRouteRequestAtom);
|
|
46059
|
+
const currentPage = get(currentPageAtom);
|
|
46060
|
+
const destinationAsset = get(destinationAssetAtom);
|
|
46061
|
+
const routeConfig = get(routeConfigAtom);
|
|
46062
|
+
const swapSettings = get(swapSettingsAtom);
|
|
46063
|
+
const gasOnReceiveRouteParams = get(gasOnReceiveRouteRequestAtom);
|
|
46064
|
+
const currentTransactionItem = get(currentTransactionAtom);
|
|
46065
|
+
const destinationAssetIsAFeeAsset = gasOnReceiveRouteParams == null ? void 0 : gasOnReceiveRouteParams.destAssetDenoms.map((i) => i.denom).includes((destinationAsset == null ? void 0 : destinationAsset.denom) ?? "");
|
|
46066
|
+
const chainAddresses = get(chainAddressesAtom);
|
|
46067
|
+
const chainAddressesArray = Object.values(chainAddresses);
|
|
46068
|
+
const destination = chainAddressesArray == null ? void 0 : chainAddressesArray[chainAddressesArray.length - 1];
|
|
46069
|
+
const destinationAddress = destination == null ? void 0 : destination.address;
|
|
46070
|
+
const enabledDestinationChainType = [ChainType.Cosmos, ChainType.Evm];
|
|
46071
|
+
const disabledChainIds = ["1", "solana"];
|
|
46072
|
+
const chain = chains2 == null ? void 0 : chains2.find((i) => i.chainId === (destination == null ? void 0 : destination.chainId));
|
|
46073
|
+
const isRouteEnabled = (() => {
|
|
46074
|
+
if (!chain) return false;
|
|
46075
|
+
if (!enabledDestinationChainType.includes(chain.chainType)) return false;
|
|
46076
|
+
if (disabledChainIds.includes(chain.chainId)) return false;
|
|
46077
|
+
return true;
|
|
46078
|
+
})();
|
|
46079
|
+
const queryEnabled = originalRoute && currentPage === Routes.SwapExecutionPage && !destinationAssetIsAFeeAsset && !!destinationAddress && isRouteEnabled && !currentTransactionItem;
|
|
46080
|
+
return {
|
|
46081
|
+
enabled: queryEnabled,
|
|
46082
|
+
queryKey: [
|
|
46083
|
+
"gasOnReceiveRoute",
|
|
46084
|
+
{
|
|
46085
|
+
originalRoute: {
|
|
46086
|
+
usdAmountOut: originalRoute == null ? void 0 : originalRoute.usdAmountOut
|
|
46087
|
+
},
|
|
46088
|
+
params,
|
|
46089
|
+
destinationAddress,
|
|
46090
|
+
sourceAssetChainId: gasOnReceiveRouteParams == null ? void 0 : gasOnReceiveRouteParams.sourceAssetChainId,
|
|
46091
|
+
sourceAssetDenom: gasOnReceiveRouteParams == null ? void 0 : gasOnReceiveRouteParams.sourceAssetDenom,
|
|
46092
|
+
destAssetChainId: gasOnReceiveRouteParams == null ? void 0 : gasOnReceiveRouteParams.destAssetChainId,
|
|
46093
|
+
destAssetDenoms: gasOnReceiveRouteParams == null ? void 0 : gasOnReceiveRouteParams.destAssetDenoms
|
|
46094
|
+
}
|
|
46095
|
+
],
|
|
46096
|
+
retry: false,
|
|
46097
|
+
refetchInterval: false,
|
|
46098
|
+
queryFn: async () => {
|
|
46099
|
+
if (!params) throw new Error("No route request provided");
|
|
46100
|
+
let feeRoute;
|
|
46101
|
+
if (destinationAssetIsAFeeAsset || !(gasOnReceiveRouteParams == null ? void 0 : gasOnReceiveRouteParams.destAssetDenoms) || gasOnReceiveRouteParams.destAssetDenoms.length === 0) {
|
|
46102
|
+
return null;
|
|
46103
|
+
}
|
|
46104
|
+
const {
|
|
46105
|
+
destAssetDenoms,
|
|
46106
|
+
amountIn: amountInFallback,
|
|
46107
|
+
...restParams
|
|
46108
|
+
} = gasOnReceiveRouteParams;
|
|
46109
|
+
const splitDenoms = chunkArray(destAssetDenoms);
|
|
46110
|
+
for (const chunk of splitDenoms) {
|
|
46111
|
+
const feeAssetRoutes = chunk.map(async ({ amountOut, denom }) => {
|
|
46112
|
+
try {
|
|
46113
|
+
const res = await route({
|
|
46114
|
+
destAssetDenom: denom,
|
|
46115
|
+
amountIn: amountOut ? void 0 : amountInFallback,
|
|
46116
|
+
amountOut: amountOut ?? void 0,
|
|
46117
|
+
...restParams,
|
|
46118
|
+
smartRelay: true,
|
|
46119
|
+
...routeConfig,
|
|
46120
|
+
goFast: swapSettings.routePreference === RoutePreference.FASTEST,
|
|
46121
|
+
allowMultiTx: false,
|
|
46122
|
+
abortDuplicateRequests: true
|
|
46123
|
+
});
|
|
46124
|
+
return res;
|
|
46125
|
+
} catch (_e2) {
|
|
46126
|
+
return null;
|
|
46127
|
+
}
|
|
46128
|
+
});
|
|
46129
|
+
const result = await Promise.all(feeAssetRoutes);
|
|
46130
|
+
const _feeRoute = result.find((result2) => result2 == null ? void 0 : result2.usdAmountOut);
|
|
46131
|
+
if (_feeRoute == null ? void 0 : _feeRoute.usdAmountOut) {
|
|
46132
|
+
feeRoute = _feeRoute;
|
|
46133
|
+
break;
|
|
46134
|
+
}
|
|
46135
|
+
}
|
|
46136
|
+
if (!(feeRoute == null ? void 0 : feeRoute.amountOut) || !originalRoute) return null;
|
|
46137
|
+
params.amountIn = BigNumber(originalRoute.amountIn ?? 0).minus(BigNumber((feeRoute == null ? void 0 : feeRoute.amountIn) ?? 0)).toString();
|
|
46138
|
+
params.amountOut = void 0;
|
|
46139
|
+
const mainRoute = await route({
|
|
46140
|
+
...params,
|
|
46141
|
+
smartRelay: true,
|
|
46142
|
+
...routeConfig,
|
|
46143
|
+
goFast: swapSettings.routePreference === RoutePreference.FASTEST,
|
|
46144
|
+
abortDuplicateRequests: true
|
|
46145
|
+
});
|
|
46146
|
+
if (!mainRoute) return null;
|
|
46147
|
+
return {
|
|
46148
|
+
mainRoute,
|
|
46149
|
+
feeRoute,
|
|
46150
|
+
gasOnReceiveAsset: {
|
|
46151
|
+
amountOut: feeRoute.amountOut,
|
|
46152
|
+
amountUsd: feeRoute.usdAmountOut,
|
|
46153
|
+
denom: feeRoute.destAssetDenom,
|
|
46154
|
+
chainId: feeRoute.destAssetChainId
|
|
46155
|
+
}
|
|
46156
|
+
};
|
|
46157
|
+
}
|
|
46158
|
+
};
|
|
46159
|
+
});
|
|
46160
|
+
const chunkArray = (arr, size2 = 3) => {
|
|
46161
|
+
const result = [];
|
|
46162
|
+
for (let i = 0; i < arr.length; i += size2) {
|
|
46163
|
+
result.push(arr.slice(i, i + size2));
|
|
46164
|
+
}
|
|
46165
|
+
return result;
|
|
46166
|
+
};
|
|
45824
46167
|
const chainAddressesAtom = atom$1({});
|
|
46168
|
+
const feeRouteChainAddressesAtom = atom$1({});
|
|
46169
|
+
const feeRouteAddressesAtomEffect = atomEffect((get, set) => {
|
|
46170
|
+
var _a;
|
|
46171
|
+
const isEnabled = get(gasOnReceiveAtom);
|
|
46172
|
+
const gasRoute = get(gasOnReceiveRouteAtom);
|
|
46173
|
+
const _chainAddresses = get(chainAddressesAtom);
|
|
46174
|
+
const chainAddresses = Object.values(_chainAddresses);
|
|
46175
|
+
const { data: chains2 } = get(skipChainsAtom);
|
|
46176
|
+
if (isEnabled && ((_a = gasRoute.data) == null ? void 0 : _a.feeRoute)) {
|
|
46177
|
+
gasRoute.data.feeRoute.requiredChainAddresses.forEach((chainId, i) => {
|
|
46178
|
+
const chain = chains2 == null ? void 0 : chains2.find((c) => c.chainId === chainId);
|
|
46179
|
+
const findAddress = chainAddresses.find((address) => address.chainId === chainId);
|
|
46180
|
+
if (findAddress) {
|
|
46181
|
+
set(feeRouteChainAddressesAtom, (prev2) => ({
|
|
46182
|
+
...prev2,
|
|
46183
|
+
[i]: findAddress
|
|
46184
|
+
}));
|
|
46185
|
+
} else {
|
|
46186
|
+
set(feeRouteChainAddressesAtom, (prev2) => ({
|
|
46187
|
+
...prev2,
|
|
46188
|
+
[i]: {
|
|
46189
|
+
chainId,
|
|
46190
|
+
address: void 0,
|
|
46191
|
+
chainType: chain == null ? void 0 : chain.chainType
|
|
46192
|
+
}
|
|
46193
|
+
}));
|
|
46194
|
+
}
|
|
46195
|
+
});
|
|
46196
|
+
}
|
|
46197
|
+
});
|
|
45825
46198
|
const swapExecutionStateAtom = atomWithStorageNoCrossTabSync(
|
|
45826
46199
|
LOCAL_STORAGE_KEYS.swapExecutionState,
|
|
45827
46200
|
{
|
|
45828
46201
|
route: void 0,
|
|
45829
46202
|
clientOperations: [],
|
|
45830
46203
|
userAddresses: [],
|
|
45831
|
-
|
|
45832
|
-
transactionHistoryIndex: 0,
|
|
45833
|
-
overallStatus: "unconfirmed",
|
|
45834
|
-
isValidatingGasBalance: void 0,
|
|
45835
|
-
transactionsSigned: 0,
|
|
45836
|
-
timestamp: -1
|
|
46204
|
+
currentTransactionId: void 0
|
|
45837
46205
|
}
|
|
45838
46206
|
);
|
|
45839
|
-
const
|
|
45840
|
-
set(swapExecutionStateAtom, (
|
|
45841
|
-
|
|
45842
|
-
|
|
45843
|
-
set(swapExecutionStateAtom, (state) => ({
|
|
45844
|
-
...state,
|
|
45845
|
-
isValidatingGasBalance: void 0
|
|
46207
|
+
const setCurrentTransactionIdAtom = atom$1(null, (_get, set, transactionId) => {
|
|
46208
|
+
set(swapExecutionStateAtom, (prev2) => ({
|
|
46209
|
+
...prev2,
|
|
46210
|
+
currentTransactionId: transactionId
|
|
45846
46211
|
}));
|
|
45847
46212
|
});
|
|
46213
|
+
const gasRouteEffect = atomEffect((get, set) => {
|
|
46214
|
+
const { data: originalRoute } = get(skipRouteAtom);
|
|
46215
|
+
const { data: gorRoute } = get(gasOnReceiveRouteAtom);
|
|
46216
|
+
const isGorEnabled = get(gasOnReceiveAtom);
|
|
46217
|
+
const currentTransaction = get(currentTransactionAtom);
|
|
46218
|
+
if (currentTransaction) return;
|
|
46219
|
+
set(swapExecutionStateAtom, (prev2) => {
|
|
46220
|
+
var _a;
|
|
46221
|
+
return {
|
|
46222
|
+
...prev2,
|
|
46223
|
+
mainRoute: gorRoute == null ? void 0 : gorRoute.mainRoute,
|
|
46224
|
+
feeRoute: gorRoute == null ? void 0 : gorRoute.feeRoute,
|
|
46225
|
+
isFeeRouteEnabled: isGorEnabled,
|
|
46226
|
+
...isGorEnabled && (gorRoute == null ? void 0 : gorRoute.mainRoute) ? {
|
|
46227
|
+
route: gorRoute.mainRoute,
|
|
46228
|
+
clientOperations: getClientOperations(gorRoute.mainRoute.operations)
|
|
46229
|
+
} : {
|
|
46230
|
+
route: originalRoute ?? prev2.originalRoute,
|
|
46231
|
+
clientOperations: getClientOperations(
|
|
46232
|
+
(originalRoute == null ? void 0 : originalRoute.operations) ?? ((_a = prev2.originalRoute) == null ? void 0 : _a.operations)
|
|
46233
|
+
)
|
|
46234
|
+
}
|
|
46235
|
+
};
|
|
46236
|
+
});
|
|
46237
|
+
});
|
|
45848
46238
|
const setSwapExecutionStateAtom = atom$1(null, (get, set) => {
|
|
45849
46239
|
var _a;
|
|
45850
46240
|
const { data: route2 } = get(skipRouteAtom);
|
|
45851
46241
|
const { data: chains2 } = get(skipChainsAtom);
|
|
45852
|
-
const transactionHistory = get(transactionHistoryAtom);
|
|
45853
46242
|
const callbacks = get(callbacksAtom);
|
|
45854
|
-
const transactionHistoryIndex = Array.isArray(transactionHistory) ? transactionHistory.length : 0;
|
|
45855
46243
|
if (!route2) return;
|
|
45856
46244
|
const {
|
|
45857
46245
|
requiredChainAddresses,
|
|
@@ -45869,52 +46257,59 @@ const setSwapExecutionStateAtom = atom$1(null, (get, set) => {
|
|
|
45869
46257
|
address: ""
|
|
45870
46258
|
};
|
|
45871
46259
|
});
|
|
46260
|
+
set(gasOnReceiveAtom, void 0);
|
|
45872
46261
|
set(chainAddressesAtom, initialChainAddresses);
|
|
45873
46262
|
set(swapExecutionStateAtom, {
|
|
45874
46263
|
userAddresses: [],
|
|
45875
|
-
transactionDetailsArray: [],
|
|
45876
46264
|
route: route2,
|
|
46265
|
+
originalRoute: route2,
|
|
46266
|
+
feeRoute: void 0,
|
|
46267
|
+
mainRoute: void 0,
|
|
45877
46268
|
clientOperations: getClientOperations(route2.operations),
|
|
45878
|
-
|
|
45879
|
-
overallStatus: "unconfirmed",
|
|
45880
|
-
isValidatingGasBalance: void 0,
|
|
45881
|
-
transactionsSigned: 0,
|
|
45882
|
-
timestamp: Date.now()
|
|
46269
|
+
currentTransactionId: void 0
|
|
45883
46270
|
});
|
|
45884
46271
|
set(submitSwapExecutionCallbacksAtom, {
|
|
45885
|
-
|
|
46272
|
+
onRouteStatusUpdated: async (routeStatus) => {
|
|
45886
46273
|
var _a2;
|
|
45887
|
-
|
|
45888
|
-
|
|
46274
|
+
const failedFeeRoute = (_a2 = routeStatus == null ? void 0 : routeStatus.relatedRoutes) == null ? void 0 : _a2.find(
|
|
46275
|
+
(relatedRoute) => relatedRoute.status === "failed"
|
|
46276
|
+
);
|
|
46277
|
+
if (failedFeeRoute) {
|
|
46278
|
+
track("gas on receive: fee route failed", { feeRoute: failedFeeRoute });
|
|
46279
|
+
}
|
|
46280
|
+
set(setTransactionHistoryAtom, routeStatus);
|
|
45889
46281
|
},
|
|
45890
46282
|
onTransactionUpdated: (txInfo) => {
|
|
45891
|
-
var _a2;
|
|
45892
46283
|
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
46284
|
},
|
|
45899
46285
|
onApproveAllowance: async ({ status, allowance }) => {
|
|
45900
46286
|
track("execute route: approve allowance", { status, allowance });
|
|
45901
|
-
|
|
45902
|
-
|
|
45903
|
-
|
|
46287
|
+
},
|
|
46288
|
+
onTransactionSigned: async (txInfo) => {
|
|
46289
|
+
track("execute route: transaction signed");
|
|
46290
|
+
set(swapExecutionStateAtom, (prev2) => {
|
|
46291
|
+
const clientOperations = prev2.clientOperations;
|
|
46292
|
+
const signRequiredIndex = clientOperations.findIndex((operation) => {
|
|
46293
|
+
return operation.signRequired && (operation.chainId === txInfo.chainId || operation.fromChainId === txInfo.chainId);
|
|
46294
|
+
});
|
|
46295
|
+
if (signRequiredIndex >= 0) {
|
|
46296
|
+
clientOperations[signRequiredIndex].signRequired = false;
|
|
46297
|
+
}
|
|
46298
|
+
return {
|
|
46299
|
+
...prev2,
|
|
46300
|
+
clientOperations
|
|
46301
|
+
};
|
|
46302
|
+
});
|
|
45904
46303
|
},
|
|
45905
46304
|
onTransactionBroadcast: async (txInfo) => {
|
|
45906
46305
|
var _a2;
|
|
45907
46306
|
track("execute route: transaction broadcasted", { txInfo });
|
|
45908
|
-
setUser({ id: txInfo == null ? void 0 : txInfo.txHash });
|
|
45909
46307
|
const chain = chains2 == null ? void 0 : chains2.find((chain2) => chain2.chainId === txInfo.chainId);
|
|
45910
46308
|
const explorerLink = createExplorerLink({
|
|
45911
46309
|
chainId: txInfo.chainId,
|
|
45912
46310
|
chainType: chain == null ? void 0 : chain.chainType,
|
|
45913
46311
|
txHash: txInfo.txHash
|
|
45914
46312
|
});
|
|
45915
|
-
set(setTransactionDetailsAtom, {
|
|
45916
|
-
transactionDetails: { ...txInfo, explorerLink, status: void 0 }
|
|
45917
|
-
});
|
|
45918
46313
|
(_a2 = callbacks == null ? void 0 : callbacks.onTransactionBroadcasted) == null ? void 0 : _a2.call(callbacks, {
|
|
45919
46314
|
chainId: txInfo.chainId,
|
|
45920
46315
|
txHash: txInfo.txHash,
|
|
@@ -45929,8 +46324,11 @@ const setSwapExecutionStateAtom = atom$1(null, (get, set) => {
|
|
|
45929
46324
|
},
|
|
45930
46325
|
onTransactionCompleted: async ({ chainId, txHash, status }) => {
|
|
45931
46326
|
var _a2;
|
|
45932
|
-
track("execute route: transaction completed", {
|
|
45933
|
-
|
|
46327
|
+
track("execute route: transaction completed", {
|
|
46328
|
+
chainId,
|
|
46329
|
+
txHash,
|
|
46330
|
+
status
|
|
46331
|
+
});
|
|
45934
46332
|
const chain = chains2 == null ? void 0 : chains2.find((chain2) => chain2.chainId === chainId);
|
|
45935
46333
|
const explorerLink = createExplorerLink({
|
|
45936
46334
|
chainId,
|
|
@@ -45949,34 +46347,10 @@ const setSwapExecutionStateAtom = atom$1(null, (get, set) => {
|
|
|
45949
46347
|
destAssetChainId
|
|
45950
46348
|
});
|
|
45951
46349
|
},
|
|
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
46350
|
onError: (error) => {
|
|
45978
46351
|
var _a2, _b, _c;
|
|
45979
46352
|
const currentPage = get(currentPageAtom);
|
|
46353
|
+
set(setCurrentTransactionIdAtom);
|
|
45980
46354
|
track("execute route: error", { error, route: route2 });
|
|
45981
46355
|
(_a2 = callbacks == null ? void 0 : callbacks.onTransactionFailed) == null ? void 0 : _a2.call(callbacks, {
|
|
45982
46356
|
error: error == null ? void 0 : error.message
|
|
@@ -45985,83 +46359,37 @@ const setSwapExecutionStateAtom = atom$1(null, (get, set) => {
|
|
|
45985
46359
|
track("expected error page: user rejected request");
|
|
45986
46360
|
if (currentPage === Routes.SwapExecutionPage) {
|
|
45987
46361
|
set(errorWarningAtom, {
|
|
45988
|
-
errorWarningType: ErrorWarningType.AuthFailed
|
|
45989
|
-
onClickBack: () => {
|
|
45990
|
-
set(setOverallStatusAtom, "unconfirmed");
|
|
45991
|
-
set(clearIsValidatingGasBalanceAtom);
|
|
45992
|
-
}
|
|
46362
|
+
errorWarningType: ErrorWarningType.AuthFailed
|
|
45993
46363
|
});
|
|
45994
46364
|
}
|
|
45995
46365
|
} 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");
|
|
46366
|
+
track("expected error page: relay fee quote has expired");
|
|
45997
46367
|
set(errorWarningAtom, {
|
|
45998
|
-
errorWarningType: ErrorWarningType.ExpiredRelayFeeQuote
|
|
45999
|
-
error,
|
|
46000
|
-
onClickBack: () => {
|
|
46001
|
-
set(setOverallStatusAtom, "unconfirmed");
|
|
46002
|
-
}
|
|
46368
|
+
errorWarningType: ErrorWarningType.ExpiredRelayFeeQuote
|
|
46003
46369
|
});
|
|
46004
46370
|
} else if ((_c = error == null ? void 0 : error.message) == null ? void 0 : _c.toLowerCase().includes("insufficient balance for gas")) {
|
|
46005
46371
|
track("expected error page: insufficient gas balance");
|
|
46006
46372
|
set(errorWarningAtom, {
|
|
46007
46373
|
errorWarningType: ErrorWarningType.InsufficientBalanceForGas,
|
|
46008
|
-
error
|
|
46009
|
-
onClickBack: () => {
|
|
46010
|
-
set(setOverallStatusAtom, "unconfirmed");
|
|
46011
|
-
}
|
|
46374
|
+
error
|
|
46012
46375
|
});
|
|
46013
46376
|
}
|
|
46014
46377
|
},
|
|
46015
46378
|
onValidateGasBalance: async (props) => {
|
|
46016
46379
|
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
46380
|
}
|
|
46024
46381
|
});
|
|
46025
46382
|
});
|
|
46026
|
-
|
|
46383
|
+
atom$1(
|
|
46027
46384
|
null,
|
|
46028
46385
|
(_get, set, isValidatingGasBalance) => {
|
|
46029
|
-
set(swapExecutionStateAtom, (state) => ({
|
|
46030
|
-
|
|
46031
|
-
|
|
46032
|
-
|
|
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
|
-
});
|
|
46386
|
+
set(swapExecutionStateAtom, (state) => ({
|
|
46387
|
+
...state,
|
|
46388
|
+
isValidatingGasBalance
|
|
46389
|
+
}));
|
|
46062
46390
|
}
|
|
46063
46391
|
);
|
|
46064
|
-
const
|
|
46392
|
+
const userAddressesEffectAtom = atomEffect((get, set) => {
|
|
46065
46393
|
const chainAddresses = get(chainAddressesAtom);
|
|
46066
46394
|
const addressesMatch = Object.values(chainAddresses).every(
|
|
46067
46395
|
(chainAddress) => !!chainAddress.address
|
|
@@ -46078,18 +46406,36 @@ const chainAddressEffectAtom = atomEffect((get, set) => {
|
|
|
46078
46406
|
userAddresses
|
|
46079
46407
|
}));
|
|
46080
46408
|
});
|
|
46409
|
+
const feeRouteUserAddressesEffectAtom = atomEffect((get, set) => {
|
|
46410
|
+
const chainAddresses = get(feeRouteChainAddressesAtom);
|
|
46411
|
+
const addressesMatch = Object.values(chainAddresses).every(
|
|
46412
|
+
(chainAddress) => !!chainAddress.address
|
|
46413
|
+
);
|
|
46414
|
+
if (!addressesMatch) return;
|
|
46415
|
+
const userAddresses = Object.values(chainAddresses).map((chainAddress) => {
|
|
46416
|
+
return {
|
|
46417
|
+
chainId: chainAddress.chainId,
|
|
46418
|
+
address: chainAddress.address
|
|
46419
|
+
};
|
|
46420
|
+
});
|
|
46421
|
+
set(swapExecutionStateAtom, (prev2) => ({
|
|
46422
|
+
...prev2,
|
|
46423
|
+
feeRouteUserAddresses: userAddresses
|
|
46424
|
+
}));
|
|
46425
|
+
});
|
|
46081
46426
|
const submitSwapExecutionCallbacksAtom = atom$1();
|
|
46082
46427
|
const simulateTxAtom = atom$1();
|
|
46083
46428
|
const batchSignTxsAtom = atom$1(true);
|
|
46084
46429
|
const skipSubmitSwapExecutionAtom = atomWithMutation((get) => {
|
|
46085
46430
|
var _a;
|
|
46086
|
-
const { route: route2,
|
|
46431
|
+
const { userAddresses, route: route2, mainRoute, feeRoute, isFeeRouteEnabled, feeRouteUserAddresses } = get(swapExecutionStateAtom);
|
|
46087
46432
|
const submitSwapExecutionCallbacks = get(submitSwapExecutionCallbacksAtom);
|
|
46088
46433
|
const simulateTx = get(simulateTxAtom);
|
|
46089
46434
|
const batchSignTxs = get(batchSignTxsAtom);
|
|
46090
46435
|
const swapSettings = get(swapSettingsAtom);
|
|
46091
46436
|
const getSigners = get(getConnectedSignersAtom);
|
|
46092
46437
|
const wallets = get(walletsAtom);
|
|
46438
|
+
const isDestinationFeeBalanceAvailable = get(isSomeDestinationFeeBalanceAvailableAtom);
|
|
46093
46439
|
const { timeoutSeconds } = get(routeConfigAtom);
|
|
46094
46440
|
const { data: chains2 } = get(skipChainsAtom);
|
|
46095
46441
|
const sourceAsset = get(sourceAssetAtom);
|
|
@@ -46109,16 +46455,11 @@ const skipSubmitSwapExecutionAtom = atomWithMutation((get) => {
|
|
|
46109
46455
|
gcTime: Infinity,
|
|
46110
46456
|
mutationFn: async ({ getSvmSigner }) => {
|
|
46111
46457
|
var _a2;
|
|
46112
|
-
|
|
46113
|
-
|
|
46114
|
-
try {
|
|
46115
|
-
await executeRoute({
|
|
46116
|
-
route: route2,
|
|
46117
|
-
userAddresses,
|
|
46458
|
+
const createParams = (sourceChainId) => {
|
|
46459
|
+
return {
|
|
46118
46460
|
timeoutSeconds,
|
|
46119
|
-
slippageTolerancePercent: swapSettings.slippage.toString(),
|
|
46120
46461
|
useUnlimitedApproval: swapSettings.useUnlimitedApproval,
|
|
46121
|
-
simulate: simulateTx !== void 0 ? simulateTx :
|
|
46462
|
+
simulate: simulateTx !== void 0 ? simulateTx : sourceChainId !== "984122",
|
|
46122
46463
|
batchSignTxs: batchSignTxs !== void 0 ? batchSignTxs : true,
|
|
46123
46464
|
...submitSwapExecutionCallbacks,
|
|
46124
46465
|
getCosmosSigner: async (chainId) => {
|
|
@@ -46156,17 +46497,59 @@ const skipSubmitSwapExecutionAtom = atomWithMutation((get) => {
|
|
|
46156
46497
|
}
|
|
46157
46498
|
return adapter;
|
|
46158
46499
|
}
|
|
46159
|
-
}
|
|
46500
|
+
};
|
|
46501
|
+
};
|
|
46502
|
+
try {
|
|
46503
|
+
if (isFeeRouteEnabled && mainRoute && feeRoute) {
|
|
46504
|
+
if (!(feeRouteUserAddresses == null ? void 0 : feeRouteUserAddresses.length)) return;
|
|
46505
|
+
track("execute route", {
|
|
46506
|
+
gasOnReceive: true,
|
|
46507
|
+
isDestinationFeeBalanceAvailable: isDestinationFeeBalanceAvailable.data,
|
|
46508
|
+
mainRoute,
|
|
46509
|
+
feeRoute
|
|
46510
|
+
});
|
|
46511
|
+
await executeMultipleRoutes({
|
|
46512
|
+
route: {
|
|
46513
|
+
mainRoute,
|
|
46514
|
+
...isFeeRouteEnabled ? { feeRoute } : {}
|
|
46515
|
+
},
|
|
46516
|
+
userAddresses: {
|
|
46517
|
+
mainRoute: userAddresses,
|
|
46518
|
+
...isFeeRouteEnabled ? { feeRoute: feeRouteUserAddresses } : {}
|
|
46519
|
+
},
|
|
46520
|
+
slippageTolerancePercent: {
|
|
46521
|
+
mainRoute: swapSettings.slippage.toString(),
|
|
46522
|
+
...isFeeRouteEnabled ? { feeRoute: "10" } : {}
|
|
46523
|
+
},
|
|
46524
|
+
...createParams(mainRoute.sourceAssetChainId)
|
|
46525
|
+
});
|
|
46526
|
+
} else {
|
|
46527
|
+
if (!route2) return;
|
|
46528
|
+
if (!userAddresses.length) return;
|
|
46529
|
+
track("execute route", {
|
|
46530
|
+
gasOnReceive: false,
|
|
46531
|
+
isDestinationFeeBalanceAvailable: isDestinationFeeBalanceAvailable.data,
|
|
46532
|
+
mainRoute: route2
|
|
46533
|
+
});
|
|
46534
|
+
await executeRoute({
|
|
46535
|
+
route: route2,
|
|
46536
|
+
userAddresses,
|
|
46537
|
+
slippageTolerancePercent: swapSettings.slippage.toString(),
|
|
46538
|
+
...createParams(route2.sourceAssetChainId)
|
|
46539
|
+
});
|
|
46540
|
+
}
|
|
46160
46541
|
} catch (error) {
|
|
46161
46542
|
console.error(error);
|
|
46162
|
-
|
|
46543
|
+
const currentTransaction = get(currentTransactionAtom);
|
|
46544
|
+
(_a2 = submitSwapExecutionCallbacks == null ? void 0 : submitSwapExecutionCallbacks.onError) == null ? void 0 : _a2.call(submitSwapExecutionCallbacks, error, currentTransaction == null ? void 0 : currentTransaction.transactionDetails);
|
|
46163
46545
|
}
|
|
46164
46546
|
return null;
|
|
46165
46547
|
},
|
|
46166
46548
|
onError: (error) => {
|
|
46167
46549
|
var _a2;
|
|
46168
46550
|
console.error(error);
|
|
46169
|
-
|
|
46551
|
+
const currentTransaction = get(currentTransactionAtom);
|
|
46552
|
+
(_a2 = submitSwapExecutionCallbacks == null ? void 0 : submitSwapExecutionCallbacks.onError) == null ? void 0 : _a2.call(submitSwapExecutionCallbacks, error, currentTransaction == null ? void 0 : currentTransaction.transactionDetails);
|
|
46170
46553
|
}
|
|
46171
46554
|
};
|
|
46172
46555
|
});
|
|
@@ -46191,18 +46574,15 @@ const UnexpectedErrorPageTimeout = ({
|
|
|
46191
46574
|
const theme = nt();
|
|
46192
46575
|
const [errorWarning, setErrorWarning] = useAtom(errorWarningAtom);
|
|
46193
46576
|
const setCurrentPage = useSetAtom(currentPageAtom);
|
|
46194
|
-
const { route: route2
|
|
46577
|
+
const { route: route2 } = useAtomValue(swapExecutionStateAtom);
|
|
46195
46578
|
const isGoFast = useIsGoFast(route2);
|
|
46196
|
-
const
|
|
46197
|
-
txsRequired: route2 == null ? void 0 : route2.txsRequired,
|
|
46198
|
-
transactionDetails: transactionDetailsArray
|
|
46199
|
-
});
|
|
46579
|
+
const lastTransactionInTime = useAtomValue(lastTransactionInTimeAtom);
|
|
46200
46580
|
useEffect(() => {
|
|
46201
|
-
if (errorWarning && (
|
|
46581
|
+
if (errorWarning && (lastTransactionInTime == null ? void 0 : lastTransactionInTime.status) !== "pending") {
|
|
46202
46582
|
track("unexpected error page: transaction timeover - transaction settled");
|
|
46203
46583
|
setErrorWarning(void 0);
|
|
46204
46584
|
}
|
|
46205
|
-
}, [
|
|
46585
|
+
}, [errorWarning, lastTransactionInTime == null ? void 0 : lastTransactionInTime.status, setErrorWarning]);
|
|
46206
46586
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
46207
46587
|
/* @__PURE__ */ jsx(
|
|
46208
46588
|
PageHeader,
|
|
@@ -46710,12 +47090,12 @@ const ModalRowItem = ({
|
|
|
46710
47090
|
const StyledModalRowItemContainer = dt(Row)`
|
|
46711
47091
|
${removeButtonStyles};
|
|
46712
47092
|
position: relative;
|
|
46713
|
-
width: 100%;
|
|
46714
47093
|
height: 60px;
|
|
46715
47094
|
border-radius: ${({ theme }) => {
|
|
46716
47095
|
var _a;
|
|
46717
47096
|
return convertToPxValue((_a = theme.borderRadius) == null ? void 0 : _a.rowItem);
|
|
46718
47097
|
}};
|
|
47098
|
+
width: 100%;
|
|
46719
47099
|
padding: 12px 15px;
|
|
46720
47100
|
margin-top: 5px;
|
|
46721
47101
|
|
|
@@ -46812,6 +47192,7 @@ const VirtualList = ({
|
|
|
46812
47192
|
}) => {
|
|
46813
47193
|
const theme = nt();
|
|
46814
47194
|
const [currentlyFocusedElement, setCurrentlyFocusedElement] = useState();
|
|
47195
|
+
const [currentlyFocusedItemKey, setCurrentlyFocusedItemKey] = useState();
|
|
46815
47196
|
const listHeight = useListHeight(itemHeight);
|
|
46816
47197
|
const listRef = useRef(null);
|
|
46817
47198
|
const itemRefs = useRef({});
|
|
@@ -46856,10 +47237,11 @@ const VirtualList = ({
|
|
|
46856
47237
|
useEffect(() => {
|
|
46857
47238
|
if (!listRef.current || expandedItemKey == null) return;
|
|
46858
47239
|
const index = listItems.findIndex((item) => itemKey(item) === expandedItemKey);
|
|
46859
|
-
if (index !== -1) {
|
|
47240
|
+
if (index !== -1 && currentlyFocusedItemKey !== expandedItemKey) {
|
|
46860
47241
|
listRef.current.scrollTo({ index, align: "top" });
|
|
47242
|
+
setCurrentlyFocusedItemKey(expandedItemKey);
|
|
46861
47243
|
}
|
|
46862
|
-
}, [expandedItemKey, listItems, itemKey]);
|
|
47244
|
+
}, [expandedItemKey, listItems, itemKey, currentlyFocusedElement, currentlyFocusedItemKey]);
|
|
46863
47245
|
if (listItems.length === 0) {
|
|
46864
47246
|
return /* @__PURE__ */ jsxs(StyledNoResultsContainer, { gap: 10, height: height ?? listHeight, children: [
|
|
46865
47247
|
empty == null ? void 0 : empty.icon,
|
|
@@ -46946,29 +47328,6 @@ const useCopyAddress = () => {
|
|
|
46946
47328
|
isShowingCopyAddressFeedback
|
|
46947
47329
|
};
|
|
46948
47330
|
};
|
|
46949
|
-
const skipAllBalancesRequestAtom = atom$1(void 0);
|
|
46950
|
-
const skipAllBalancesAtom = atomWithQuery((get) => {
|
|
46951
|
-
const params = get(skipAllBalancesRequestAtom);
|
|
46952
|
-
const isInvertingSwap = get(isInvertingSwapAtom);
|
|
46953
|
-
const enabled = params && !isInvertingSwap;
|
|
46954
|
-
return {
|
|
46955
|
-
queryKey: ["skipBalances", params],
|
|
46956
|
-
queryFn: async () => {
|
|
46957
|
-
if (!params) {
|
|
46958
|
-
return { chains: {} };
|
|
46959
|
-
}
|
|
46960
|
-
if (Object.keys((params == null ? void 0 : params.chains) ?? {}).length === 0) {
|
|
46961
|
-
return { chains: {} };
|
|
46962
|
-
}
|
|
46963
|
-
return balances({ ...params, abortDuplicateRequests: true });
|
|
46964
|
-
},
|
|
46965
|
-
enabled,
|
|
46966
|
-
refetchInterval: 1e3 * 60,
|
|
46967
|
-
retry: 1,
|
|
46968
|
-
gcTime: 0,
|
|
46969
|
-
placeholderData: (prevData) => prevData
|
|
46970
|
-
};
|
|
46971
|
-
});
|
|
46972
47331
|
const useGetBalance = () => {
|
|
46973
47332
|
const { data: skipBalances } = useAtomValue(skipAllBalancesAtom);
|
|
46974
47333
|
const getBalance = useCallback(
|
|
@@ -47196,10 +47555,17 @@ const SwapExecutionPageRouteDetailedRow = ({
|
|
|
47196
47555
|
const selectedChainAddress = context === "destination" ? lastChainAddress : firstChainAddressFoundForChainId;
|
|
47197
47556
|
return {
|
|
47198
47557
|
address: selectedChainAddress == null ? void 0 : selectedChainAddress.address,
|
|
47199
|
-
image: (selectedChainAddress == null ? void 0 : selectedChainAddress.source) === "wallet" && ((_a2 = selectedChainAddress == null ? void 0 : selectedChainAddress.wallet) == null ? void 0 : _a2.walletInfo.logo) || void 0
|
|
47558
|
+
image: (selectedChainAddress == null ? void 0 : selectedChainAddress.source) === "wallet" && ((_a2 = selectedChainAddress == null ? void 0 : selectedChainAddress.wallet) == null ? void 0 : _a2.walletInfo.logo) || void 0,
|
|
47559
|
+
source: selectedChainAddress == null ? void 0 : selectedChainAddress.source
|
|
47200
47560
|
};
|
|
47201
47561
|
}, [chainAddresses, chainId, context]);
|
|
47202
47562
|
const walletImage = useCroppedImage(chainAddressWallet.image);
|
|
47563
|
+
const renderWalletImage = useMemo(() => {
|
|
47564
|
+
if ((chainAddressWallet == null ? void 0 : chainAddressWallet.source) === "injected" || (chainAddressWallet == null ? void 0 : chainAddressWallet.source) === "input") return;
|
|
47565
|
+
if (!chainAddressWallet.address) return;
|
|
47566
|
+
if (walletImage) return /* @__PURE__ */ jsx("img", { height: "100%", src: walletImage });
|
|
47567
|
+
return /* @__PURE__ */ jsx(SkeletonElement, { height: 18, width: 18 });
|
|
47568
|
+
}, [chainAddressWallet.address, chainAddressWallet == null ? void 0 : chainAddressWallet.source, walletImage]);
|
|
47203
47569
|
const renderAddress = useMemo(() => {
|
|
47204
47570
|
const Container2 = shouldRenderEditDestinationWallet ? ({ children }) => /* @__PURE__ */ jsx(Row, { gap: 5, children }) : o.Fragment;
|
|
47205
47571
|
if (!chainAddressWallet.address) return;
|
|
@@ -47215,15 +47581,7 @@ const SwapExecutionPageRouteDetailedRow = ({
|
|
|
47215
47581
|
};
|
|
47216
47582
|
return /* @__PURE__ */ jsxs(Container2, { children: [
|
|
47217
47583
|
/* @__PURE__ */ jsxs(AddressPillButton, { onClick: () => copyAddress(chainAddressWallet == null ? void 0 : chainAddressWallet.address), children: [
|
|
47218
|
-
|
|
47219
|
-
"img",
|
|
47220
|
-
{
|
|
47221
|
-
src: walletImage,
|
|
47222
|
-
style: {
|
|
47223
|
-
height: "100%"
|
|
47224
|
-
}
|
|
47225
|
-
}
|
|
47226
|
-
) : /* @__PURE__ */ jsx(SkeletonElement, { height: 18, width: 18 }),
|
|
47584
|
+
renderWalletImage,
|
|
47227
47585
|
renderContent()
|
|
47228
47586
|
] }),
|
|
47229
47587
|
shouldRenderEditDestinationWallet && /* @__PURE__ */ jsx(
|
|
@@ -47239,7 +47597,7 @@ const SwapExecutionPageRouteDetailedRow = ({
|
|
|
47239
47597
|
}, [
|
|
47240
47598
|
shouldRenderEditDestinationWallet,
|
|
47241
47599
|
chainAddressWallet.address,
|
|
47242
|
-
|
|
47600
|
+
renderWalletImage,
|
|
47243
47601
|
isMobileScreenSize,
|
|
47244
47602
|
onClickEditDestinationWallet,
|
|
47245
47603
|
theme.primary.text.lowContrast,
|
|
@@ -47283,7 +47641,7 @@ const SwapExecutionPageRouteDetailedRow = ({
|
|
|
47283
47641
|
},
|
|
47284
47642
|
justify: "space-between",
|
|
47285
47643
|
children: /* @__PURE__ */ jsxs(Row, { align: "center", children: [
|
|
47286
|
-
/* @__PURE__ */ jsxs(LeftContent, { children: [
|
|
47644
|
+
/* @__PURE__ */ jsxs(LeftContent, { gap: 5, children: [
|
|
47287
47645
|
/* @__PURE__ */ jsxs(Row, { gap: 5, align: "center", children: [
|
|
47288
47646
|
/* @__PURE__ */ jsx(StyledAssetAmount, { normalTextColor: true, title: assetDetails == null ? void 0 : assetDetails.amount, children: formatDisplayAmount(assetDetails == null ? void 0 : assetDetails.amount) }),
|
|
47289
47647
|
/* @__PURE__ */ jsx(StyledSymbol, { normalTextColor: true, children: assetDetails == null ? void 0 : assetDetails.symbol }),
|
|
@@ -48420,7 +48778,7 @@ const ConnectEcoRow = ({
|
|
|
48420
48778
|
),
|
|
48421
48779
|
/* @__PURE__ */ jsx(ChainIndicator, { chainId: accountchainId })
|
|
48422
48780
|
] })
|
|
48423
|
-
] }) : /* @__PURE__ */ jsxs(
|
|
48781
|
+
] }) : /* @__PURE__ */ jsxs(Text, { children: [
|
|
48424
48782
|
"Connect to",
|
|
48425
48783
|
" ",
|
|
48426
48784
|
chainType === ChainType.Cosmos ? "Cosmos" : chainType === ChainType.Evm ? "Ethereum" : "Solana"
|
|
@@ -48662,6 +49020,16 @@ const QuestionMarkIcon = ({
|
|
|
48662
49020
|
)
|
|
48663
49021
|
}
|
|
48664
49022
|
);
|
|
49023
|
+
const QuestionMarkTooltip = ({ content }) => {
|
|
49024
|
+
return /* @__PURE__ */ jsx(Tooltip, { content, children: /* @__PURE__ */ jsx(StyledQuestionMarkIcon, {}) });
|
|
49025
|
+
};
|
|
49026
|
+
const StyledQuestionMarkIcon = dt(QuestionMarkIcon)`
|
|
49027
|
+
color: ${({ theme }) => theme.primary.text.ultraLowContrast};
|
|
49028
|
+
&:hover {
|
|
49029
|
+
color: ${({ theme }) => theme.primary.text.normal};
|
|
49030
|
+
}
|
|
49031
|
+
transition: color 0.2s ease;
|
|
49032
|
+
`;
|
|
48665
49033
|
const SlippageSelector = () => {
|
|
48666
49034
|
const [isInputFocused, setIsInputFocused] = useState(false);
|
|
48667
49035
|
const [customSlippageInput, setCustomSlippageInput] = useState("");
|
|
@@ -48677,10 +49045,9 @@ const SlippageSelector = () => {
|
|
|
48677
49045
|
"Max Slippage",
|
|
48678
49046
|
/* @__PURE__ */ jsx(Spacer, { width: 5 }),
|
|
48679
49047
|
/* @__PURE__ */ jsx(
|
|
48680
|
-
|
|
49048
|
+
QuestionMarkTooltip,
|
|
48681
49049
|
{
|
|
48682
|
-
content: /* @__PURE__ */ jsx(SmallText, { normalTextColor: true, style: { width: 250 }, children: "If price changes unfavorably during the transaction by more than this amount, the transaction will revert." })
|
|
48683
|
-
children: /* @__PURE__ */ jsx(QuestionMarkIcon, {})
|
|
49050
|
+
content: /* @__PURE__ */ jsx(SmallText, { normalTextColor: true, style: { width: 250 }, children: "If price changes unfavorably during the transaction by more than this amount, the transaction will revert." })
|
|
48684
49051
|
}
|
|
48685
49052
|
)
|
|
48686
49053
|
] }),
|
|
@@ -48833,10 +49200,9 @@ const RoutePreferenceSelector = () => {
|
|
|
48833
49200
|
"Route Preference",
|
|
48834
49201
|
/* @__PURE__ */ jsx(Spacer, { width: 5 }),
|
|
48835
49202
|
/* @__PURE__ */ jsx(
|
|
48836
|
-
|
|
49203
|
+
QuestionMarkTooltip,
|
|
48837
49204
|
{
|
|
48838
|
-
content: /* @__PURE__ */ jsx(SmallText, { normalTextColor: true, style: { width: 250 }, children: "Choose if faster or cheaper routes should be prioritized. Fast routes require a $50 minimum from Ethereum and may not be available if there is insufficient liquidity for an asset." })
|
|
48839
|
-
children: /* @__PURE__ */ jsx(QuestionMarkIcon, {})
|
|
49205
|
+
content: /* @__PURE__ */ jsx(SmallText, { normalTextColor: true, style: { width: 250 }, children: "Choose if faster or cheaper routes should be prioritized. Fast routes require a $50 minimum from Ethereum and may not be available if there is insufficient liquidity for an asset." })
|
|
48840
49206
|
}
|
|
48841
49207
|
)
|
|
48842
49208
|
] }),
|
|
@@ -48883,7 +49249,7 @@ const SwapSettingsDrawer = createModal(() => {
|
|
|
48883
49249
|
}, [route2]);
|
|
48884
49250
|
return /* @__PURE__ */ jsxs(StyledSwapPageSettings, { gap: 15, children: [
|
|
48885
49251
|
/* @__PURE__ */ jsxs(Column, { gap: 10, children: [
|
|
48886
|
-
/* @__PURE__ */ jsxs(Row, { justify: "space-between", align: "center", children: [
|
|
49252
|
+
route2 && /* @__PURE__ */ jsxs(Row, { justify: "space-between", align: "center", children: [
|
|
48887
49253
|
/* @__PURE__ */ jsx(SwapDetailText, { children: "Route" }),
|
|
48888
49254
|
/* @__PURE__ */ jsx(Row, { align: "center", gap: 5, children: chainsRoute == null ? void 0 : chainsRoute.map((chain, index) => {
|
|
48889
49255
|
var _a;
|
|
@@ -49562,7 +49928,7 @@ const SwapPageAssetChainInput = ({
|
|
|
49562
49928
|
"%"
|
|
49563
49929
|
] })
|
|
49564
49930
|
] }) : /* @__PURE__ */ jsx(SmallText, { children: usdValue && formatUSD(usdValue) }),
|
|
49565
|
-
usdValue && feeLabel && /* @__PURE__ */ jsx(Row, { align: "center", gap: 4, children: /* @__PURE__ */ jsx(SmallText, {
|
|
49931
|
+
usdValue && feeLabel && /* @__PURE__ */ jsx(Row, { style: { color: feeColor }, align: "center", gap: 4, children: typeof feeLabel === "string" ? /* @__PURE__ */ jsx(SmallText, { children: feeLabel }) : feeLabel })
|
|
49566
49932
|
] }),
|
|
49567
49933
|
(assetDetails == null ? void 0 : assetDetails.chainName) ? /* @__PURE__ */ jsx(
|
|
49568
49934
|
StyledOnChainGhostButton,
|
|
@@ -50006,9 +50372,9 @@ var WalletSource = /* @__PURE__ */ ((WalletSource2) => {
|
|
|
50006
50372
|
const SetAddressModal = createModal((modalProps) => {
|
|
50007
50373
|
var _a, _b, _c;
|
|
50008
50374
|
const isMobileScreenSize = useIsMobileScreenSize();
|
|
50009
|
-
const { chainId, chainAddressIndex } = modalProps;
|
|
50010
|
-
const { route: route2 } = useAtomValue(swapExecutionStateAtom);
|
|
50011
|
-
const requiredChainAddresses = route2 == null ? void 0 : route2.requiredChainAddresses;
|
|
50375
|
+
const { chainId, chainAddressIndex, isFeeRoute } = modalProps;
|
|
50376
|
+
const { route: route2, feeRoute } = useAtomValue(swapExecutionStateAtom);
|
|
50377
|
+
const requiredChainAddresses = isFeeRoute ? feeRoute == null ? void 0 : feeRoute.requiredChainAddresses : route2 == null ? void 0 : route2.requiredChainAddresses;
|
|
50012
50378
|
if (modalProps.chainAddressIndex === void 0) {
|
|
50013
50379
|
throw new Error("chain address index cannot be undefined");
|
|
50014
50380
|
}
|
|
@@ -50020,7 +50386,10 @@ const SetAddressModal = createModal((modalProps) => {
|
|
|
50020
50386
|
const [showManualAddressInput, setShowManualAddressInput] = useState(false);
|
|
50021
50387
|
const [manualWalletAddress, setManualWalletAddress] = useState("");
|
|
50022
50388
|
const _walletList = useWalletList({ chainId, destinationWalletList: true });
|
|
50023
|
-
const [
|
|
50389
|
+
const [_chainAddresses, _setChainAddresses] = useAtom(chainAddressesAtom);
|
|
50390
|
+
const [feeRouteChainAddresses, setFeeRouteChainAddresses] = useAtom(feeRouteChainAddressesAtom);
|
|
50391
|
+
const chainAddresses = isFeeRoute ? feeRouteChainAddresses : _chainAddresses;
|
|
50392
|
+
const setChainAddresses = isFeeRoute ? setFeeRouteChainAddresses : _setChainAddresses;
|
|
50024
50393
|
const showWithdrawalWarning = new Set(Object.values(chainAddresses).map(({ chainId: chainId2 }) => chainId2)).size > 1;
|
|
50025
50394
|
const mobile = isMobile();
|
|
50026
50395
|
const manualWalletEntry = {
|
|
@@ -50278,7 +50647,6 @@ const RoutePreferenceLabel = ({ preference }) => {
|
|
|
50278
50647
|
};
|
|
50279
50648
|
const SwapPageFooterItems = ({
|
|
50280
50649
|
content,
|
|
50281
|
-
showRouteInfo = false,
|
|
50282
50650
|
showEstimatedTime = false,
|
|
50283
50651
|
highlightSettings = false
|
|
50284
50652
|
}) => {
|
|
@@ -50287,11 +50655,12 @@ const SwapPageFooterItems = ({
|
|
|
50287
50655
|
const settingsChanged = useSettingsChanged();
|
|
50288
50656
|
const isMobile2 = useIsMobileScreenSize();
|
|
50289
50657
|
const isGoFast = useIsGoFast(route2);
|
|
50658
|
+
const currentTransaction = useAtomValue(currentTransactionAtom);
|
|
50290
50659
|
const estimatedSeconds = route2 == null ? void 0 : route2.estimatedRouteDurationSeconds;
|
|
50291
|
-
const signaturesRequired = (route2 == null ? void 0 : route2.txsRequired) ??
|
|
50660
|
+
const signaturesRequired = route2 ? (route2 == null ? void 0 : route2.txsRequired) - ((currentTransaction == null ? void 0 : currentTransaction.txsSigned) ?? 0) : 0;
|
|
50292
50661
|
const leftContent = () => {
|
|
50293
50662
|
if (content) return content;
|
|
50294
|
-
if (isLoading
|
|
50663
|
+
if (isLoading) return null;
|
|
50295
50664
|
return /* @__PURE__ */ jsxs(Row, { align: "flex-end", gap: 10, height: isMobile2 ? void 0 : 13, children: [
|
|
50296
50665
|
showEstimatedTime && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
50297
50666
|
/* @__PURE__ */ jsx(SettingsButton, { highlight: highlightSettings, changed: settingsChanged }),
|
|
@@ -50345,7 +50714,6 @@ const settingsDrawerAtom = atom$1(void 0);
|
|
|
50345
50714
|
const useSettingsDrawer = () => {
|
|
50346
50715
|
const [drawerOpen, setDrawerOpen] = useState(false);
|
|
50347
50716
|
const settingsDrawer = useAtomValue(settingsDrawerAtom);
|
|
50348
|
-
const { isError: isRouteError, data: route2 } = useAtomValue(skipRouteAtom);
|
|
50349
50717
|
const isWaitingForNewRoute = useAtomValue(isWaitingForNewRouteAtom);
|
|
50350
50718
|
const setShowGoFastErrorAtom = useSetAtom(goFastWarningAtom);
|
|
50351
50719
|
const SettingsFooter = ({ content, ...props }) => {
|
|
@@ -50368,8 +50736,7 @@ const useSettingsDrawer = () => {
|
|
|
50368
50736
|
return /* @__PURE__ */ jsx(
|
|
50369
50737
|
SwapPageFooter,
|
|
50370
50738
|
{
|
|
50371
|
-
disabled:
|
|
50372
|
-
showRouteInfo: true,
|
|
50739
|
+
disabled: isWaitingForNewRoute,
|
|
50373
50740
|
showEstimatedTime: true,
|
|
50374
50741
|
onClick: openSettingsDrawer,
|
|
50375
50742
|
...props
|
|
@@ -50385,7 +50752,6 @@ const WarningPageGoFast = ({ onClickBack, onClickContinue }) => {
|
|
|
50385
50752
|
const theme = nt();
|
|
50386
50753
|
useEffect(() => {
|
|
50387
50754
|
setShowGoFastErrorAtom(false);
|
|
50388
|
-
setTag("goFastWarning", true);
|
|
50389
50755
|
}, [setShowGoFastErrorAtom]);
|
|
50390
50756
|
const handleOnClickBack = () => {
|
|
50391
50757
|
setErrorWarningAtom(void 0);
|
|
@@ -50544,9 +50910,6 @@ const ExpectedErrorPageInsufficientGasBalance = ({
|
|
|
50544
50910
|
const theme = nt();
|
|
50545
50911
|
const setErrorWarningAtom = useSetAtom(errorWarningAtom);
|
|
50546
50912
|
const setCurrentPage = useSetAtom(currentPageAtom);
|
|
50547
|
-
useEffect(() => {
|
|
50548
|
-
setTag("errorMessage", error == null ? void 0 : error.message);
|
|
50549
|
-
}, [error == null ? void 0 : error.message]);
|
|
50550
50913
|
const onClickRetry = () => {
|
|
50551
50914
|
setErrorWarningAtom(void 0);
|
|
50552
50915
|
setCurrentPage(Routes.SwapPage);
|
|
@@ -50592,15 +50955,11 @@ const ExpectedErrorPageInsufficientGasBalance = ({
|
|
|
50592
50955
|
] });
|
|
50593
50956
|
};
|
|
50594
50957
|
const ExpectedErrorPageRelayFeeQuoteExpired = ({
|
|
50595
|
-
error,
|
|
50596
50958
|
onClickBack
|
|
50597
50959
|
}) => {
|
|
50598
50960
|
const theme = nt();
|
|
50599
50961
|
const setErrorAtom = useSetAtom(errorWarningAtom);
|
|
50600
50962
|
const setCurrentPage = useSetAtom(currentPageAtom);
|
|
50601
|
-
useEffect(() => {
|
|
50602
|
-
setTag("errorMessage", error == null ? void 0 : error.message);
|
|
50603
|
-
}, [error == null ? void 0 : error.message]);
|
|
50604
50963
|
const onClickRetry = () => {
|
|
50605
50964
|
setErrorAtom(void 0);
|
|
50606
50965
|
setCurrentPage(Routes.SwapPage);
|
|
@@ -50613,7 +50972,7 @@ const ExpectedErrorPageRelayFeeQuoteExpired = ({
|
|
|
50613
50972
|
label: "Back",
|
|
50614
50973
|
icon: ICONS.thinArrow,
|
|
50615
50974
|
onClick: () => {
|
|
50616
|
-
track("error page: relay fee quote expired - header back button clicked");
|
|
50975
|
+
track("expected error page: relay fee quote expired - header back button clicked");
|
|
50617
50976
|
setErrorAtom(void 0);
|
|
50618
50977
|
onClickBack == null ? void 0 : onClickBack();
|
|
50619
50978
|
setCurrentPage(Routes.SwapPage);
|
|
@@ -50637,7 +50996,7 @@ const ExpectedErrorPageRelayFeeQuoteExpired = ({
|
|
|
50637
50996
|
label: "Retry",
|
|
50638
50997
|
icon: ICONS.rightArrow,
|
|
50639
50998
|
onClick: () => {
|
|
50640
|
-
track("error page: relay fee quote expired - retry button clicked");
|
|
50999
|
+
track("expected error page: relay fee quote expired - retry button clicked");
|
|
50641
51000
|
onClickRetry();
|
|
50642
51001
|
},
|
|
50643
51002
|
backgroundColor: theme.error.text
|
|
@@ -50700,6 +51059,20 @@ const SwapExecutionPageRouteSimpleRow = ({
|
|
|
50700
51059
|
});
|
|
50701
51060
|
const groupedAssets = useGroupedAssetByRecommendedSymbol();
|
|
50702
51061
|
const groupedAsset = groupedAssets == null ? void 0 : groupedAssets.find((i) => i.id === (assetDetails == null ? void 0 : assetDetails.symbol));
|
|
51062
|
+
const { feeRoute } = useAtomValue(swapExecutionStateAtom);
|
|
51063
|
+
const isGorEnabled = useAtomValue(gasOnReceiveAtom);
|
|
51064
|
+
const { data: assets2 } = useAtomValue(skipAssetsAtom);
|
|
51065
|
+
const gasOnReceiveAsset = useMemo(() => {
|
|
51066
|
+
const gasAsset = {
|
|
51067
|
+
chainId: feeRoute == null ? void 0 : feeRoute.destAssetChainId,
|
|
51068
|
+
denom: feeRoute == null ? void 0 : feeRoute.destAssetDenom
|
|
51069
|
+
};
|
|
51070
|
+
if (!gasAsset) return;
|
|
51071
|
+
const asset = assets2 == null ? void 0 : assets2.find(
|
|
51072
|
+
(a) => a.chainId === (gasAsset == null ? void 0 : gasAsset.chainId) && a.denom === (gasAsset == null ? void 0 : gasAsset.denom)
|
|
51073
|
+
);
|
|
51074
|
+
return asset;
|
|
51075
|
+
}, [assets2, feeRoute == null ? void 0 : feeRoute.destAssetChainId, feeRoute == null ? void 0 : feeRoute.destAssetDenom]);
|
|
50703
51076
|
const chainAddresses = useAtomValue(chainAddressesAtom);
|
|
50704
51077
|
const source = useMemo(() => {
|
|
50705
51078
|
var _a, _b;
|
|
@@ -50725,11 +51098,21 @@ const SwapExecutionPageRouteSimpleRow = ({
|
|
|
50725
51098
|
}, [chainAddresses, context]);
|
|
50726
51099
|
const walletImage = useCroppedImage(source.image);
|
|
50727
51100
|
const renderWalletImage = useMemo(() => {
|
|
50728
|
-
if (source.source === "injected") return;
|
|
51101
|
+
if (source.source === "injected" || source.source === "input") return;
|
|
50729
51102
|
if (!source.address) return;
|
|
50730
51103
|
if (walletImage) return /* @__PURE__ */ jsx("img", { height: 12, width: 12, src: walletImage });
|
|
50731
51104
|
return /* @__PURE__ */ jsx(SkeletonElement, { height: 12, width: 12 });
|
|
50732
51105
|
}, [source.address, source.source, walletImage]);
|
|
51106
|
+
const renderGasRouteAmount = useMemo(() => {
|
|
51107
|
+
var _a;
|
|
51108
|
+
if (!isGorEnabled) return;
|
|
51109
|
+
if (context === "source") return;
|
|
51110
|
+
if (!gasOnReceiveAsset) return;
|
|
51111
|
+
const amountUsd = feeRoute == null ? void 0 : feeRoute.usdAmountOut;
|
|
51112
|
+
if (!amountUsd) return;
|
|
51113
|
+
const assetSymbol = ((_a = gasOnReceiveAsset == null ? void 0 : gasOnReceiveAsset.recommendedSymbol) == null ? void 0 : _a.toUpperCase()) ?? "";
|
|
51114
|
+
return `+ ${formatUSD(amountUsd)} in ${assetSymbol}`;
|
|
51115
|
+
}, [context, feeRoute == null ? void 0 : feeRoute.usdAmountOut, gasOnReceiveAsset, isGorEnabled]);
|
|
50733
51116
|
const renderExplorerLink = useMemo(() => {
|
|
50734
51117
|
if (!explorerLink) return;
|
|
50735
51118
|
if (isMobileScreenSize) {
|
|
@@ -50762,7 +51145,11 @@ const SwapExecutionPageRouteSimpleRow = ({
|
|
|
50762
51145
|
" ",
|
|
50763
51146
|
assetDetails == null ? void 0 : assetDetails.symbol
|
|
50764
51147
|
] }),
|
|
50765
|
-
usdValue && /* @__PURE__ */
|
|
51148
|
+
usdValue && /* @__PURE__ */ jsxs(SmallText, { children: [
|
|
51149
|
+
formatUSD(usdValue),
|
|
51150
|
+
" ",
|
|
51151
|
+
renderGasRouteAmount
|
|
51152
|
+
] }),
|
|
50766
51153
|
/* @__PURE__ */ jsxs(Row, { align: "center", height: 18, gap: 5, children: [
|
|
50767
51154
|
/* @__PURE__ */ jsxs(StyledChainName, { normalTextColor: true, textWrap: "nowrap", children: [
|
|
50768
51155
|
"on ",
|
|
@@ -50842,11 +51229,12 @@ const SwapExecutionPageRouteSimple = ({
|
|
|
50842
51229
|
statusData,
|
|
50843
51230
|
onClickEditDestinationWallet,
|
|
50844
51231
|
swapExecutionState,
|
|
50845
|
-
firstOperationStatus
|
|
51232
|
+
firstOperationStatus,
|
|
51233
|
+
bottomContent
|
|
50846
51234
|
}) => {
|
|
50847
51235
|
var _a, _b;
|
|
50848
51236
|
const theme = nt();
|
|
50849
|
-
const { route: route2 } = useAtomValue(swapExecutionStateAtom);
|
|
51237
|
+
const { route: route2, originalRoute } = useAtomValue(swapExecutionStateAtom);
|
|
50850
51238
|
const firstOperation = operations[0];
|
|
50851
51239
|
const lastOperation = operations[operations.length - 1];
|
|
50852
51240
|
const status = statusData == null ? void 0 : statusData.transferEvents;
|
|
@@ -50862,10 +51250,10 @@ const SwapExecutionPageRouteSimple = ({
|
|
|
50862
51250
|
}
|
|
50863
51251
|
}, [firstOperationStatus, lastOperation.transferIndex, status, swapExecutionState]);
|
|
50864
51252
|
const source = {
|
|
50865
|
-
denom:
|
|
50866
|
-
tokenAmount:
|
|
50867
|
-
chainId:
|
|
50868
|
-
usdValue:
|
|
51253
|
+
denom: originalRoute == null ? void 0 : originalRoute.sourceAssetDenom,
|
|
51254
|
+
tokenAmount: (originalRoute == null ? void 0 : originalRoute.amountIn) ?? "",
|
|
51255
|
+
chainId: originalRoute == null ? void 0 : originalRoute.sourceAssetChainId,
|
|
51256
|
+
usdValue: originalRoute == null ? void 0 : originalRoute.usdAmountIn
|
|
50869
51257
|
};
|
|
50870
51258
|
const destination = {
|
|
50871
51259
|
denom: lastOperation.denomOut,
|
|
@@ -50896,7 +51284,8 @@ const SwapExecutionPageRouteSimple = ({
|
|
|
50896
51284
|
explorerLink: destinationExplorerLink,
|
|
50897
51285
|
context: "destination"
|
|
50898
51286
|
}
|
|
50899
|
-
)
|
|
51287
|
+
),
|
|
51288
|
+
bottomContent
|
|
50900
51289
|
] });
|
|
50901
51290
|
};
|
|
50902
51291
|
const StyledBridgeArrowIcon = dt(BridgeArrowIcon)`
|
|
@@ -50905,11 +51294,6 @@ const StyledBridgeArrowIcon = dt(BridgeArrowIcon)`
|
|
|
50905
51294
|
`;
|
|
50906
51295
|
const StyledSwapExecutionPageRoute$1 = dt(Column)`
|
|
50907
51296
|
padding: 30px;
|
|
50908
|
-
background: ${({ theme }) => theme.primary.background.normal};
|
|
50909
|
-
border-radius: ${({ theme }) => {
|
|
50910
|
-
var _a;
|
|
50911
|
-
return convertToPxValue((_a = theme.borderRadius) == null ? void 0 : _a.main);
|
|
50912
|
-
}};
|
|
50913
51297
|
min-height: 225px;
|
|
50914
51298
|
`;
|
|
50915
51299
|
const SwapExecutionBridgeIcon = ({
|
|
@@ -51036,13 +51420,14 @@ const SwapExecutionPageRouteDetailed = ({
|
|
|
51036
51420
|
onClickEditDestinationWallet,
|
|
51037
51421
|
swapExecutionState,
|
|
51038
51422
|
firstOperationStatus,
|
|
51039
|
-
secondOperationStatus
|
|
51423
|
+
secondOperationStatus,
|
|
51424
|
+
bottomContent
|
|
51040
51425
|
}) => {
|
|
51041
51426
|
var _a;
|
|
51042
51427
|
const { data: swapVenues } = useAtomValue(skipSwapVenuesAtom);
|
|
51043
51428
|
const { data: bridges2 } = useAtomValue(skipBridgesAtom);
|
|
51429
|
+
const { originalRoute } = useAtomValue(swapExecutionStateAtom);
|
|
51044
51430
|
const isGasStationTx = useIsGasStationTx();
|
|
51045
|
-
const firstOperation = operations[0];
|
|
51046
51431
|
const status = statusData == null ? void 0 : statusData.transferEvents;
|
|
51047
51432
|
const getBridgeSwapVenue = useCallback(
|
|
51048
51433
|
(operation) => {
|
|
@@ -51148,22 +51533,25 @@ const SwapExecutionPageRouteDetailed = ({
|
|
|
51148
51533
|
status,
|
|
51149
51534
|
statusData
|
|
51150
51535
|
]);
|
|
51151
|
-
return /* @__PURE__ */
|
|
51152
|
-
/* @__PURE__ */
|
|
51153
|
-
|
|
51154
|
-
|
|
51155
|
-
|
|
51156
|
-
|
|
51157
|
-
|
|
51158
|
-
|
|
51159
|
-
|
|
51160
|
-
|
|
51161
|
-
|
|
51162
|
-
|
|
51163
|
-
|
|
51164
|
-
|
|
51165
|
-
|
|
51166
|
-
|
|
51536
|
+
return /* @__PURE__ */ jsxs(StyledSwapExecutionPageRoute, { children: [
|
|
51537
|
+
/* @__PURE__ */ jsxs(Column, { children: [
|
|
51538
|
+
/* @__PURE__ */ jsx(
|
|
51539
|
+
SwapExecutionPageRouteDetailedRow,
|
|
51540
|
+
{
|
|
51541
|
+
tokenAmount: (originalRoute == null ? void 0 : originalRoute.amountIn) ?? "",
|
|
51542
|
+
denom: originalRoute == null ? void 0 : originalRoute.sourceAssetDenom,
|
|
51543
|
+
chainId: originalRoute == null ? void 0 : originalRoute.sourceAssetChainId,
|
|
51544
|
+
explorerLink: (_a = status == null ? void 0 : status[0]) == null ? void 0 : _a.fromExplorerLink,
|
|
51545
|
+
status: firstOperationStatus,
|
|
51546
|
+
context: "source",
|
|
51547
|
+
index: 0
|
|
51548
|
+
}
|
|
51549
|
+
),
|
|
51550
|
+
renderOperations,
|
|
51551
|
+
isGasStationTx && /* @__PURE__ */ jsx(StyledGasStationTxText, { children: "Transactions from EVM to Babylon have gas provided automatically if no gas tokens are found." })
|
|
51552
|
+
] }),
|
|
51553
|
+
bottomContent
|
|
51554
|
+
] });
|
|
51167
51555
|
};
|
|
51168
51556
|
const OperationTypeIconContainer = dt(Column).attrs({
|
|
51169
51557
|
as: Column
|
|
@@ -51175,12 +51563,7 @@ const OperationTypeIconContainer = dt(Column).attrs({
|
|
|
51175
51563
|
`;
|
|
51176
51564
|
const StyledSwapExecutionPageRoute = dt(Column)`
|
|
51177
51565
|
padding: 25px;
|
|
51178
|
-
gap:
|
|
51179
|
-
background: ${({ theme }) => theme.primary.background.normal};
|
|
51180
|
-
border-radius: ${({ theme }) => {
|
|
51181
|
-
var _a;
|
|
51182
|
-
return convertToPxValue((_a = theme.borderRadius) == null ? void 0 : _a.main);
|
|
51183
|
-
}};
|
|
51566
|
+
gap: 5px;
|
|
51184
51567
|
min-height: 225px;
|
|
51185
51568
|
`;
|
|
51186
51569
|
const StyledSwapVenueOrBridgeImage = dt.img`
|
|
@@ -51209,10 +51592,55 @@ const StyledGasStationTxText = dt(SmallText)`
|
|
|
51209
51592
|
padding: 12px;
|
|
51210
51593
|
border-radius: 6px;
|
|
51211
51594
|
`;
|
|
51595
|
+
const SwapExecutionPageRouteContainer = ({
|
|
51596
|
+
showDetailed,
|
|
51597
|
+
...routeProps
|
|
51598
|
+
}) => {
|
|
51599
|
+
const simpleRef = useRef(null);
|
|
51600
|
+
const detailedRef = useRef(null);
|
|
51601
|
+
const [containerHeight, setContainerHeight] = useState(0);
|
|
51602
|
+
useEffect(() => {
|
|
51603
|
+
const updateHeight = () => {
|
|
51604
|
+
const activeRef = showDetailed ? detailedRef : simpleRef;
|
|
51605
|
+
if (activeRef.current) {
|
|
51606
|
+
const height = activeRef.current.scrollHeight;
|
|
51607
|
+
setContainerHeight(height);
|
|
51608
|
+
}
|
|
51609
|
+
};
|
|
51610
|
+
updateHeight();
|
|
51611
|
+
const timeoutId = setTimeout(updateHeight, 10);
|
|
51612
|
+
return () => clearTimeout(timeoutId);
|
|
51613
|
+
}, [showDetailed, routeProps.operations, routeProps.statusData, routeProps.bottomContent]);
|
|
51614
|
+
return /* @__PURE__ */ jsxs(StyledContainer$1, { style: { height: containerHeight }, children: [
|
|
51615
|
+
/* @__PURE__ */ jsx(StyledRouteWrapper, { ref: simpleRef, isVisible: !showDetailed, isActive: !showDetailed, children: /* @__PURE__ */ jsx(SwapExecutionPageRouteSimple, { ...routeProps }) }),
|
|
51616
|
+
/* @__PURE__ */ jsx(StyledRouteWrapper, { ref: detailedRef, isVisible: showDetailed, isActive: showDetailed, children: /* @__PURE__ */ jsx(SwapExecutionPageRouteDetailed, { ...routeProps }) })
|
|
51617
|
+
] });
|
|
51618
|
+
};
|
|
51619
|
+
const StyledContainer$1 = dt.div`
|
|
51620
|
+
position: relative;
|
|
51621
|
+
overflow: hidden;
|
|
51622
|
+
transition: height 0.25s cubic-bezier(0.4, 0, 0.2, 1);
|
|
51623
|
+
min-height: 225px;
|
|
51624
|
+
background: ${({ theme }) => theme.primary.background.normal};
|
|
51625
|
+
border-radius: ${({ theme }) => {
|
|
51626
|
+
var _a;
|
|
51627
|
+
return convertToPxValue((_a = theme.borderRadius) == null ? void 0 : _a.main);
|
|
51628
|
+
}};
|
|
51629
|
+
`;
|
|
51630
|
+
const StyledRouteWrapper = dt.div`
|
|
51631
|
+
position: ${({ isActive: $isActive }) => $isActive ? "relative" : "absolute"};
|
|
51632
|
+
top: 0;
|
|
51633
|
+
left: 0;
|
|
51634
|
+
right: 0;
|
|
51635
|
+
opacity: ${({ isVisible: $isVisible }) => $isVisible ? 1 : 0};
|
|
51636
|
+
transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1);
|
|
51637
|
+
pointer-events: ${({ isVisible: $isVisible }) => $isVisible ? "auto" : "none"};
|
|
51638
|
+
`;
|
|
51212
51639
|
const useAutoSetAddress = () => {
|
|
51213
51640
|
var _a, _b, _c;
|
|
51214
51641
|
const [chainAddresses, setChainAddresses] = useAtom(chainAddressesAtom);
|
|
51215
|
-
const { route: route2
|
|
51642
|
+
const { route: route2 } = useAtomValue(swapExecutionStateAtom);
|
|
51643
|
+
const currentTransaction = useAtomValue(currentTransactionAtom);
|
|
51216
51644
|
const requiredChainAddresses = route2 == null ? void 0 : route2.requiredChainAddresses;
|
|
51217
51645
|
const { data: chains2 } = useAtomValue(skipChainsAtom);
|
|
51218
51646
|
const sourceWallet = useAtomValue(walletsAtom);
|
|
@@ -51223,7 +51651,7 @@ const useAutoSetAddress = () => {
|
|
|
51223
51651
|
const { createCosmosWallets } = useCreateCosmosWallets();
|
|
51224
51652
|
const { createEvmWallets } = useCreateEvmWallets();
|
|
51225
51653
|
const { createSolanaWallets } = useCreateSolanaWallets();
|
|
51226
|
-
useAtom(
|
|
51654
|
+
useAtom(userAddressesEffectAtom);
|
|
51227
51655
|
const connectedAddress = useAtomValue(connectedAddressesAtom);
|
|
51228
51656
|
const signRequiredChains = useMemo(() => {
|
|
51229
51657
|
if (!(route2 == null ? void 0 : route2.operations)) return;
|
|
@@ -51347,7 +51775,7 @@ const useAutoSetAddress = () => {
|
|
|
51347
51775
|
);
|
|
51348
51776
|
useEffect(() => {
|
|
51349
51777
|
var _a2, _b2, _c2, _d, _e2, _f;
|
|
51350
|
-
if (
|
|
51778
|
+
if (currentTransaction && (currentTransaction == null ? void 0 : currentTransaction.status) !== "unconfirmed") {
|
|
51351
51779
|
setIsLoading(false);
|
|
51352
51780
|
return;
|
|
51353
51781
|
}
|
|
@@ -51368,8 +51796,9 @@ const useAutoSetAddress = () => {
|
|
|
51368
51796
|
(_a = currentSourceWallets == null ? void 0 : currentSourceWallets.cosmos) == null ? void 0 : _a.id,
|
|
51369
51797
|
(_b = currentSourceWallets == null ? void 0 : currentSourceWallets.evm) == null ? void 0 : _b.id,
|
|
51370
51798
|
(_c = currentSourceWallets == null ? void 0 : currentSourceWallets.svm) == null ? void 0 : _c.id,
|
|
51799
|
+
currentTransaction,
|
|
51800
|
+
currentTransaction == null ? void 0 : currentTransaction.status,
|
|
51371
51801
|
isLoading,
|
|
51372
|
-
overallStatus,
|
|
51373
51802
|
requiredChainAddresses,
|
|
51374
51803
|
sourceWallet
|
|
51375
51804
|
]);
|
|
@@ -51382,27 +51811,31 @@ const useAutoSetAddress = () => {
|
|
|
51382
51811
|
return { connectRequiredChains, isLoading };
|
|
51383
51812
|
};
|
|
51384
51813
|
const useHandleTransactionTimeout = (swapExecutionState) => {
|
|
51385
|
-
const
|
|
51814
|
+
const currentTransaction = useAtomValue(currentTransactionAtom);
|
|
51815
|
+
const setCurrentTransactionId = useSetAtom(setCurrentTransactionIdAtom);
|
|
51386
51816
|
const setError = useSetAtom(errorWarningAtom);
|
|
51387
|
-
const setOverallStatus = useSetAtom(setOverallStatusAtom);
|
|
51388
51817
|
const [transactionTimeoutTimer, setTransactionTimeoutTimer] = useState();
|
|
51389
51818
|
useEffect(() => {
|
|
51390
|
-
|
|
51391
|
-
if (
|
|
51392
|
-
|
|
51819
|
+
var _a, _b, _c;
|
|
51820
|
+
if (!((_a = currentTransaction == null ? void 0 : currentTransaction.route) == null ? void 0 : _a.estimatedRouteDurationSeconds) || !(currentTransaction == null ? void 0 : currentTransaction.txsRequired))
|
|
51821
|
+
return;
|
|
51822
|
+
if (swapExecutionState === SwapExecutionState.pending && transactionTimeoutTimer === void 0 && (currentTransaction == null ? void 0 : currentTransaction.txsRequired) === ((_b = currentTransaction == null ? void 0 : currentTransaction.transactionDetails) == null ? void 0 : _b.length)) {
|
|
51393
51823
|
const timeoutTimer = setTimeout(
|
|
51394
51824
|
() => {
|
|
51395
|
-
|
|
51825
|
+
var _a2, _b2;
|
|
51826
|
+
track("unexpected error page: transaction timeover", {
|
|
51827
|
+
route: currentTransaction == null ? void 0 : currentTransaction.route
|
|
51828
|
+
});
|
|
51396
51829
|
setError({
|
|
51397
51830
|
errorWarningType: ErrorWarningType.Timeout,
|
|
51398
51831
|
onClickBack: () => {
|
|
51399
|
-
|
|
51832
|
+
setCurrentTransactionId();
|
|
51400
51833
|
},
|
|
51401
|
-
explorerLink: createSkipExplorerLink(
|
|
51402
|
-
txHash:
|
|
51834
|
+
explorerLink: (currentTransaction == null ? void 0 : currentTransaction.transactionDetails) ? createSkipExplorerLink(currentTransaction.transactionDetails) : "",
|
|
51835
|
+
txHash: ((_b2 = (_a2 = currentTransaction == null ? void 0 : currentTransaction.transactionDetails) == null ? void 0 : _a2.at(-1)) == null ? void 0 : _b2.txHash) ?? ""
|
|
51403
51836
|
});
|
|
51404
51837
|
},
|
|
51405
|
-
|
|
51838
|
+
((_c = currentTransaction == null ? void 0 : currentTransaction.route) == null ? void 0 : _c.estimatedRouteDurationSeconds) * 1e3 * 3
|
|
51406
51839
|
);
|
|
51407
51840
|
setTransactionTimeoutTimer(timeoutTimer);
|
|
51408
51841
|
}
|
|
@@ -51410,103 +51843,40 @@ const useHandleTransactionTimeout = (swapExecutionState) => {
|
|
|
51410
51843
|
clearTimeout(transactionTimeoutTimer);
|
|
51411
51844
|
};
|
|
51412
51845
|
}, [
|
|
51413
|
-
|
|
51846
|
+
currentTransaction == null ? void 0 : currentTransaction.route,
|
|
51847
|
+
currentTransaction == null ? void 0 : currentTransaction.transactionDetails,
|
|
51848
|
+
currentTransaction == null ? void 0 : currentTransaction.txsRequired,
|
|
51849
|
+
setCurrentTransactionId,
|
|
51414
51850
|
setError,
|
|
51415
|
-
setOverallStatus,
|
|
51416
51851
|
swapExecutionState,
|
|
51417
|
-
transactionDetailsArray,
|
|
51418
51852
|
transactionTimeoutTimer
|
|
51419
51853
|
]);
|
|
51420
51854
|
};
|
|
51421
|
-
const useSyncTxStatus = ({
|
|
51422
|
-
statusData,
|
|
51423
|
-
timestamp
|
|
51424
|
-
}) => {
|
|
51425
|
-
const transferEvents = statusData == null ? void 0 : statusData.transferEvents;
|
|
51426
|
-
const setOverallStatus = useSetAtom(setOverallStatusAtom);
|
|
51427
|
-
const {
|
|
51428
|
-
route: route2,
|
|
51429
|
-
transactionDetailsArray,
|
|
51430
|
-
overallStatus,
|
|
51431
|
-
transactionHistoryIndex: currentTransactionHistoryIndex
|
|
51432
|
-
} = useAtomValue(swapExecutionStateAtom);
|
|
51433
|
-
const setTransactionHistory = useSetAtom(setTransactionHistoryAtom);
|
|
51434
|
-
const transactionHistoryItems = useAtomValue(transactionHistoryAtom);
|
|
51435
|
-
const { isPending } = useAtomValue(skipSubmitSwapExecutionAtom);
|
|
51436
|
-
const clientOperations = useMemo(() => {
|
|
51437
|
-
if (!(route2 == null ? void 0 : route2.operations)) return [];
|
|
51438
|
-
return getClientOperations(route2.operations);
|
|
51439
|
-
}, [route2 == null ? void 0 : route2.operations]);
|
|
51440
|
-
const computedSwapStatus = useMemo(() => {
|
|
51441
|
-
if ((statusData == null ? void 0 : statusData.lastTxStatus) === "pending") {
|
|
51442
|
-
if (isPending) {
|
|
51443
|
-
setOverallStatus("pending");
|
|
51444
|
-
}
|
|
51445
|
-
return "pending";
|
|
51446
|
-
}
|
|
51447
|
-
if (!transferEvents) return;
|
|
51448
|
-
if (statusData.isSuccess) {
|
|
51449
|
-
return "completed";
|
|
51450
|
-
}
|
|
51451
|
-
if (!statusData.isSuccess && statusData.isSettled) {
|
|
51452
|
-
return "failed";
|
|
51453
|
-
}
|
|
51454
|
-
if (transferEvents == null ? void 0 : transferEvents.find(({ status }) => status === "pending")) {
|
|
51455
|
-
return "pending";
|
|
51456
|
-
}
|
|
51457
|
-
if (transferEvents == null ? void 0 : transferEvents.every(({ status }) => status === "unconfirmed")) {
|
|
51458
|
-
return "unconfirmed";
|
|
51459
|
-
}
|
|
51460
|
-
}, [
|
|
51461
|
-
statusData == null ? void 0 : statusData.lastTxStatus,
|
|
51462
|
-
statusData == null ? void 0 : statusData.isSettled,
|
|
51463
|
-
statusData == null ? void 0 : statusData.isSuccess,
|
|
51464
|
-
transferEvents,
|
|
51465
|
-
isPending,
|
|
51466
|
-
setOverallStatus
|
|
51467
|
-
]);
|
|
51468
|
-
useEffect(() => {
|
|
51469
|
-
if (computedSwapStatus && timestamp !== void 0) {
|
|
51470
|
-
const index = transactionHistoryItems.findIndex(
|
|
51471
|
-
(txHistoryItem) => txHistoryItem.timestamp === timestamp
|
|
51472
|
-
);
|
|
51473
|
-
const oldTxHistoryItem = transactionHistoryItems[index];
|
|
51474
|
-
const newTxHistoryItem = {
|
|
51475
|
-
...oldTxHistoryItem,
|
|
51476
|
-
...statusData,
|
|
51477
|
-
status: computedSwapStatus
|
|
51478
|
-
};
|
|
51479
|
-
if (JSON.stringify(newTxHistoryItem) !== JSON.stringify(oldTxHistoryItem)) {
|
|
51480
|
-
setTransactionHistory(newTxHistoryItem);
|
|
51481
|
-
setOverallStatus(computedSwapStatus);
|
|
51482
|
-
}
|
|
51483
|
-
}
|
|
51484
|
-
}, [
|
|
51485
|
-
clientOperations,
|
|
51486
|
-
overallStatus,
|
|
51487
|
-
computedSwapStatus,
|
|
51488
|
-
setOverallStatus,
|
|
51489
|
-
transactionDetailsArray.length,
|
|
51490
|
-
transactionHistoryItems,
|
|
51491
|
-
statusData,
|
|
51492
|
-
setTransactionHistory,
|
|
51493
|
-
currentTransactionHistoryIndex,
|
|
51494
|
-
timestamp
|
|
51495
|
-
]);
|
|
51496
|
-
};
|
|
51497
51855
|
function useSwapExecutionState({
|
|
51498
51856
|
chainAddresses,
|
|
51499
|
-
|
|
51500
|
-
|
|
51501
|
-
|
|
51502
|
-
|
|
51503
|
-
|
|
51857
|
+
requiredChainAddresses,
|
|
51858
|
+
isGettingAddressesLoading,
|
|
51859
|
+
isFetchingDestinationBalance,
|
|
51860
|
+
feeRouteChainAddresses,
|
|
51861
|
+
feeRouteRequiredChainAddresses,
|
|
51862
|
+
isGettingFeeRouteAddressesLoading
|
|
51504
51863
|
}) {
|
|
51864
|
+
const currentTransaction = useAtomValue(currentTransactionAtom);
|
|
51865
|
+
const isFeeRouteEnabled = useAtomValue(gasOnReceiveAtom);
|
|
51866
|
+
const showSignaturesRemaining = useMemo(() => {
|
|
51867
|
+
if (!currentTransaction) return false;
|
|
51868
|
+
if ((currentTransaction == null ? void 0 : currentTransaction.txsRequired) >= 2 && (currentTransaction == null ? void 0 : currentTransaction.txsSigned) !== (currentTransaction == null ? void 0 : currentTransaction.txsRequired)) {
|
|
51869
|
+
return true;
|
|
51870
|
+
}
|
|
51871
|
+
return false;
|
|
51872
|
+
}, [currentTransaction]);
|
|
51505
51873
|
return useMemo(() => {
|
|
51506
51874
|
var _a;
|
|
51507
|
-
if (
|
|
51875
|
+
if (isFetchingDestinationBalance) return SwapExecutionState.pendingGettingDestinationBalance;
|
|
51876
|
+
if (isGettingAddressesLoading) return SwapExecutionState.pendingGettingAddresses;
|
|
51877
|
+
if (isFeeRouteEnabled && isGettingFeeRouteAddressesLoading)
|
|
51878
|
+
return SwapExecutionState.pendingGettingFeeRouteAddresses;
|
|
51508
51879
|
if (!chainAddresses) return SwapExecutionState.destinationAddressUnset;
|
|
51509
|
-
const requiredChainAddresses = route2 == null ? void 0 : route2.requiredChainAddresses;
|
|
51510
51880
|
if (!requiredChainAddresses) return SwapExecutionState.destinationAddressUnset;
|
|
51511
51881
|
const allAddressesSet = requiredChainAddresses.every(
|
|
51512
51882
|
(_chainId, index) => {
|
|
@@ -51514,23 +51884,32 @@ function useSwapExecutionState({
|
|
|
51514
51884
|
return (_a2 = chainAddresses[index]) == null ? void 0 : _a2.address;
|
|
51515
51885
|
}
|
|
51516
51886
|
);
|
|
51887
|
+
const feeRouteAllAddressesSet = feeRouteRequiredChainAddresses == null ? void 0 : feeRouteRequiredChainAddresses.every(
|
|
51888
|
+
(_chainId, index) => {
|
|
51889
|
+
var _a2;
|
|
51890
|
+
return (_a2 = feeRouteChainAddresses == null ? void 0 : feeRouteChainAddresses[index]) == null ? void 0 : _a2.address;
|
|
51891
|
+
}
|
|
51892
|
+
);
|
|
51517
51893
|
const lastChainAddress = (_a = chainAddresses[requiredChainAddresses.length - 1]) == null ? void 0 : _a.address;
|
|
51518
|
-
if (
|
|
51894
|
+
if ((currentTransaction == null ? void 0 : currentTransaction.status) === "failed") {
|
|
51895
|
+
return SwapExecutionState.pendingError;
|
|
51896
|
+
}
|
|
51897
|
+
if ((currentTransaction == null ? void 0 : currentTransaction.status) === "completed") {
|
|
51519
51898
|
return SwapExecutionState.confirmed;
|
|
51520
51899
|
}
|
|
51521
|
-
if (
|
|
51522
|
-
if (signaturesRemaining > 0) {
|
|
51523
|
-
return SwapExecutionState.signaturesRemaining;
|
|
51524
|
-
}
|
|
51900
|
+
if ((currentTransaction == null ? void 0 : currentTransaction.status) === "pending") {
|
|
51525
51901
|
return SwapExecutionState.pending;
|
|
51526
51902
|
}
|
|
51527
|
-
if (
|
|
51903
|
+
if ((currentTransaction == null ? void 0 : currentTransaction.status) === "allowance") {
|
|
51528
51904
|
return SwapExecutionState.approving;
|
|
51529
51905
|
}
|
|
51530
|
-
if (
|
|
51906
|
+
if ((currentTransaction == null ? void 0 : currentTransaction.status) === "validating") {
|
|
51531
51907
|
return SwapExecutionState.validatingGasBalance;
|
|
51532
51908
|
}
|
|
51533
|
-
if (
|
|
51909
|
+
if ((currentTransaction == null ? void 0 : currentTransaction.status) === "signing") {
|
|
51910
|
+
if (showSignaturesRemaining) {
|
|
51911
|
+
return SwapExecutionState.signaturesRemaining;
|
|
51912
|
+
}
|
|
51534
51913
|
return SwapExecutionState.waitingForSigning;
|
|
51535
51914
|
}
|
|
51536
51915
|
if (!lastChainAddress) {
|
|
@@ -51539,14 +51918,21 @@ function useSwapExecutionState({
|
|
|
51539
51918
|
if (!allAddressesSet) {
|
|
51540
51919
|
return SwapExecutionState.recoveryAddressUnset;
|
|
51541
51920
|
}
|
|
51921
|
+
if (isFeeRouteEnabled && feeRouteRequiredChainAddresses && !feeRouteAllAddressesSet) {
|
|
51922
|
+
return SwapExecutionState.feeRouteRecoveryAddressUnset;
|
|
51923
|
+
}
|
|
51542
51924
|
return SwapExecutionState.ready;
|
|
51543
51925
|
}, [
|
|
51544
|
-
|
|
51926
|
+
isFetchingDestinationBalance,
|
|
51927
|
+
isGettingAddressesLoading,
|
|
51928
|
+
isFeeRouteEnabled,
|
|
51929
|
+
isGettingFeeRouteAddressesLoading,
|
|
51545
51930
|
chainAddresses,
|
|
51546
|
-
|
|
51547
|
-
|
|
51548
|
-
|
|
51549
|
-
|
|
51931
|
+
requiredChainAddresses,
|
|
51932
|
+
feeRouteRequiredChainAddresses,
|
|
51933
|
+
currentTransaction == null ? void 0 : currentTransaction.status,
|
|
51934
|
+
feeRouteChainAddresses,
|
|
51935
|
+
showSignaturesRemaining
|
|
51550
51936
|
]);
|
|
51551
51937
|
}
|
|
51552
51938
|
const LightningIcon = ({
|
|
@@ -51631,18 +52017,29 @@ const useCountdown = ({
|
|
|
51631
52017
|
}, [estimatedRouteDurationSeconds, enabled, timer]);
|
|
51632
52018
|
return countdown;
|
|
51633
52019
|
};
|
|
52020
|
+
function useDebouncedValue(value, delay) {
|
|
52021
|
+
const [debouncedValue, setDebouncedValue] = useState(value);
|
|
52022
|
+
useEffect(() => {
|
|
52023
|
+
const timeout = setTimeout(() => setDebouncedValue(value), delay);
|
|
52024
|
+
return () => clearTimeout(timeout);
|
|
52025
|
+
}, [value, delay]);
|
|
52026
|
+
return debouncedValue;
|
|
52027
|
+
}
|
|
51634
52028
|
const SwapExecutionButton = ({
|
|
51635
52029
|
swapExecutionState,
|
|
51636
52030
|
route: route2,
|
|
51637
52031
|
signaturesRemaining,
|
|
51638
52032
|
lastOperation,
|
|
51639
52033
|
connectRequiredChains,
|
|
52034
|
+
connectFeeRouteRequiredChains,
|
|
51640
52035
|
submitExecuteRouteMutation
|
|
51641
52036
|
}) => {
|
|
52037
|
+
var _a, _b, _c;
|
|
51642
52038
|
const countdown = useCountdown({
|
|
51643
52039
|
estimatedRouteDurationSeconds: route2 == null ? void 0 : route2.estimatedRouteDurationSeconds,
|
|
51644
52040
|
enabled: swapExecutionState === SwapExecutionState.pending
|
|
51645
52041
|
});
|
|
52042
|
+
const chainAddresses = useAtomValue(chainAddressesAtom);
|
|
51646
52043
|
const { wallets: solanaWallets2 } = useWallet();
|
|
51647
52044
|
const svmWallet = useAtomValue(svmWalletAtom);
|
|
51648
52045
|
const theme = nt();
|
|
@@ -51662,7 +52059,8 @@ const SwapExecutionButton = ({
|
|
|
51662
52059
|
route2 == null ? void 0 : route2.destAssetChainId,
|
|
51663
52060
|
route2 == null ? void 0 : route2.txsRequired
|
|
51664
52061
|
]);
|
|
51665
|
-
|
|
52062
|
+
const debouncedSwapExecutionState = useDebouncedValue(swapExecutionState, 150);
|
|
52063
|
+
switch (debouncedSwapExecutionState) {
|
|
51666
52064
|
case SwapExecutionState.recoveryAddressUnset:
|
|
51667
52065
|
return /* @__PURE__ */ jsx(
|
|
51668
52066
|
MainButton,
|
|
@@ -51675,6 +52073,18 @@ const SwapExecutionButton = ({
|
|
|
51675
52073
|
}
|
|
51676
52074
|
}
|
|
51677
52075
|
);
|
|
52076
|
+
case SwapExecutionState.feeRouteRecoveryAddressUnset:
|
|
52077
|
+
return /* @__PURE__ */ jsx(
|
|
52078
|
+
MainButton,
|
|
52079
|
+
{
|
|
52080
|
+
label: "Set intermediary address",
|
|
52081
|
+
icon: ICONS.rightArrow,
|
|
52082
|
+
onClick: () => {
|
|
52083
|
+
track("swap execution page: set recovery address button - clicked");
|
|
52084
|
+
connectFeeRouteRequiredChains == null ? void 0 : connectFeeRouteRequiredChains(true);
|
|
52085
|
+
}
|
|
52086
|
+
}
|
|
52087
|
+
);
|
|
51678
52088
|
case SwapExecutionState.destinationAddressUnset:
|
|
51679
52089
|
return /* @__PURE__ */ jsx(
|
|
51680
52090
|
MainButton,
|
|
@@ -51694,7 +52104,8 @@ const SwapExecutionButton = ({
|
|
|
51694
52104
|
}
|
|
51695
52105
|
);
|
|
51696
52106
|
case SwapExecutionState.ready: {
|
|
51697
|
-
|
|
52107
|
+
const destinationWalletSource = ((_a = route2 == null ? void 0 : route2.requiredChainAddresses) == null ? void 0 : _a.length) && ((_c = chainAddresses[((_b = route2 == null ? void 0 : route2.requiredChainAddresses) == null ? void 0 : _b.length) - 1]) == null ? void 0 : _c.source);
|
|
52108
|
+
track("swap execution page: confirm button - clicked", { route: route2, destinationWalletSource });
|
|
51698
52109
|
const onClickConfirmSwap = () => {
|
|
51699
52110
|
if ((route2 == null ? void 0 : route2.txsRequired) && route2.txsRequired > 1) {
|
|
51700
52111
|
track("warning page: additional signing required", { route: route2 });
|
|
@@ -51772,6 +52183,10 @@ const SwapExecutionButton = ({
|
|
|
51772
52183
|
);
|
|
51773
52184
|
case SwapExecutionState.pendingGettingAddresses:
|
|
51774
52185
|
return /* @__PURE__ */ jsx(MainButton, { label: "Getting addresses", loading: true });
|
|
52186
|
+
case SwapExecutionState.pendingGettingDestinationBalance:
|
|
52187
|
+
return /* @__PURE__ */ jsx(MainButton, { label: "Getting destination balance", loading: true });
|
|
52188
|
+
case SwapExecutionState.pendingError:
|
|
52189
|
+
return /* @__PURE__ */ jsx(MainButton, { label: "Awaiting result", loading: true });
|
|
51775
52190
|
default:
|
|
51776
52191
|
return null;
|
|
51777
52192
|
}
|
|
@@ -51781,11 +52196,12 @@ const useHandleTransactionFailed = (error, statusData) => {
|
|
|
51781
52196
|
const setErrorWarning = useSetAtom(errorWarningAtom);
|
|
51782
52197
|
const setCurrentPage = useSetAtom(currentPageAtom);
|
|
51783
52198
|
const setSourceAsset = useSetAtom(sourceAssetAtom);
|
|
52199
|
+
const setCurrentTransactionId = useSetAtom(setCurrentTransactionIdAtom);
|
|
51784
52200
|
const setDebouncedSourceAssetAmount = useSetAtom(debouncedSourceAssetAmountAtom);
|
|
51785
|
-
const
|
|
52201
|
+
const currentTransaction = useAtomValue(currentTransactionAtom);
|
|
51786
52202
|
const [{ data: assets2 }] = useAtom(skipAssetsAtom);
|
|
51787
|
-
const {
|
|
51788
|
-
const lastTransaction =
|
|
52203
|
+
const { route: route2 } = useAtomValue(swapExecutionStateAtom);
|
|
52204
|
+
const lastTransaction = currentTransaction == null ? void 0 : currentTransaction.transactionDetails.at(-1);
|
|
51789
52205
|
const lastTxHash = lastTransaction == null ? void 0 : lastTransaction.txHash;
|
|
51790
52206
|
const getClientAsset = useCallback(
|
|
51791
52207
|
(denom, chainId) => {
|
|
@@ -51796,7 +52212,7 @@ const useHandleTransactionFailed = (error, statusData) => {
|
|
|
51796
52212
|
},
|
|
51797
52213
|
[assets2]
|
|
51798
52214
|
);
|
|
51799
|
-
const explorerLink = createSkipExplorerLink(
|
|
52215
|
+
const explorerLink = createSkipExplorerLink(currentTransaction == null ? void 0 : currentTransaction.transactionDetails);
|
|
51800
52216
|
const handleTransactionFailed = useCallback(() => {
|
|
51801
52217
|
var _a, _b;
|
|
51802
52218
|
track("unexpected error page: error occurred", { error, route: route2 });
|
|
@@ -51838,7 +52254,9 @@ const useHandleTransactionFailed = (error, statusData) => {
|
|
|
51838
52254
|
setErrorWarning({
|
|
51839
52255
|
errorWarningType: ErrorWarningType.Unexpected,
|
|
51840
52256
|
error,
|
|
51841
|
-
onClickBack: () =>
|
|
52257
|
+
onClickBack: () => {
|
|
52258
|
+
setCurrentTransactionId();
|
|
52259
|
+
}
|
|
51842
52260
|
});
|
|
51843
52261
|
}
|
|
51844
52262
|
}, [
|
|
@@ -51849,28 +52267,24 @@ const useHandleTransactionFailed = (error, statusData) => {
|
|
|
51849
52267
|
lastTxHash,
|
|
51850
52268
|
route2,
|
|
51851
52269
|
setCurrentPage,
|
|
52270
|
+
setCurrentTransactionId,
|
|
51852
52271
|
setDebouncedSourceAssetAmount,
|
|
51853
52272
|
setErrorWarning,
|
|
51854
|
-
setOverallStatus,
|
|
51855
52273
|
setSourceAsset,
|
|
51856
52274
|
statusData == null ? void 0 : statusData.transferAssetRelease
|
|
51857
52275
|
]);
|
|
51858
52276
|
useEffect(() => {
|
|
51859
|
-
if ((statusData == null ? void 0 : statusData.
|
|
51860
|
-
|
|
51861
|
-
|
|
51862
|
-
|
|
51863
|
-
|
|
51864
|
-
|
|
51865
|
-
|
|
52277
|
+
if ((statusData == null ? void 0 : statusData.status) === "failed" || (statusData == null ? void 0 : statusData.status) === "incomplete") {
|
|
52278
|
+
const timeout = setTimeout(() => {
|
|
52279
|
+
handleTransactionFailed();
|
|
52280
|
+
}, DELAY_EXPECTING_TRANSFER_ASSET_RELEASE);
|
|
52281
|
+
if (statusData == null ? void 0 : statusData.transferAssetRelease) {
|
|
52282
|
+
clearTimeout(timeout);
|
|
52283
|
+
handleTransactionFailed();
|
|
52284
|
+
}
|
|
52285
|
+
return () => clearTimeout(timeout);
|
|
51866
52286
|
}
|
|
51867
|
-
|
|
51868
|
-
}, [
|
|
51869
|
-
statusData == null ? void 0 : statusData.isSettled,
|
|
51870
|
-
statusData == null ? void 0 : statusData.isSuccess,
|
|
51871
|
-
statusData == null ? void 0 : statusData.transferAssetRelease,
|
|
51872
|
-
handleTransactionFailed
|
|
51873
|
-
]);
|
|
52287
|
+
}, [statusData == null ? void 0 : statusData.transferAssetRelease, handleTransactionFailed, statusData == null ? void 0 : statusData.status, statusData]);
|
|
51874
52288
|
};
|
|
51875
52289
|
function usePreventPageUnload(shouldWarn) {
|
|
51876
52290
|
useEffect(() => {
|
|
@@ -51886,6 +52300,348 @@ function usePreventPageUnload(shouldWarn) {
|
|
|
51886
52300
|
return () => window.removeEventListener("beforeunload", handleBeforeUnload);
|
|
51887
52301
|
}, [shouldWarn]);
|
|
51888
52302
|
}
|
|
52303
|
+
const GasIcon = ({ color = "currentColor" }) => /* @__PURE__ */ jsx("svg", { width: "16", height: "15", viewBox: "0 0 16 15", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx(
|
|
52304
|
+
"path",
|
|
52305
|
+
{
|
|
52306
|
+
d: "M1.22261 1.84952C1.24188 1.32934 1.4249 0.895862 1.77169 0.549076C2.11847 0.202289 2.55195 0.0192658 3.07213 0H7.69592C8.2161 0.0192658 8.64958 0.202289 8.99636 0.549076C9.34315 0.895862 9.52617 1.32934 9.54544 1.84952V7.39807H9.77663C10.4895 7.41734 11.0867 7.66779 11.5684 8.14944C12.05 8.63109 12.3005 9.22832 12.3197 9.94116V10.8659C12.3582 11.2898 12.5894 11.521 13.0133 11.5595C13.4371 11.521 13.6683 11.2898 13.7069 10.8659V6.38662C13.3023 6.29029 12.9748 6.07836 12.7243 5.75084C12.4546 5.44259 12.3197 5.06691 12.3197 4.62379V2.77428L11.395 1.84952C11.1445 1.54126 11.1445 1.23301 11.395 0.924759C11.7032 0.674302 12.0115 0.674302 12.3197 0.924759L14.5449 3.14996C14.911 3.51601 15.094 3.95912 15.094 4.4793V10.8659C15.0747 11.4632 14.8724 11.9544 14.4871 12.3398C14.1018 12.7251 13.6105 12.9274 13.0133 12.9466C12.416 12.9274 11.9248 12.7251 11.5395 12.3398C11.1541 11.9544 10.9518 11.4632 10.9326 10.8659V9.94116C10.9326 9.61364 10.817 9.33429 10.5858 9.1031C10.3739 8.89117 10.1042 8.77558 9.77663 8.75631H9.54544V12.9466C9.81516 12.9466 10.0367 13.0333 10.2101 13.2067C10.3835 13.3801 10.4702 13.6017 10.4702 13.8714C10.4702 14.1411 10.3835 14.3627 10.2101 14.5361C10.0367 14.7094 9.81516 14.7961 9.54544 14.7961H1.22261C0.952888 14.7961 0.731333 14.7094 0.55794 14.5361C0.384547 14.3627 0.297852 14.1411 0.297852 13.8714C0.297852 13.6017 0.384547 13.3801 0.55794 13.2067C0.731333 13.0333 0.952888 12.9466 1.22261 12.9466V1.84952ZM3.07213 5.08617C3.09139 5.37516 3.24552 5.52929 3.53451 5.54855H7.23354C7.52253 5.52929 7.67666 5.37516 7.69592 5.08617V2.3119C7.67666 2.02291 7.52253 1.86878 7.23354 1.84952H3.53451C3.24552 1.86878 3.09139 2.02291 3.07213 2.3119V5.08617Z",
|
|
52307
|
+
fill: color
|
|
52308
|
+
}
|
|
52309
|
+
) });
|
|
52310
|
+
const SwitchWrapper = dt.div`
|
|
52311
|
+
width: 42px;
|
|
52312
|
+
height: 24px;
|
|
52313
|
+
border-radius: ${({ theme }) => {
|
|
52314
|
+
var _a;
|
|
52315
|
+
return convertToPxValue((_a = theme.borderRadius) == null ? void 0 : _a.selectionButton);
|
|
52316
|
+
}};
|
|
52317
|
+
background-color: ${({ checked, theme }) => checked ? theme.brandColor : theme.secondary.background.transparent};
|
|
52318
|
+
display: flex;
|
|
52319
|
+
align-items: center;
|
|
52320
|
+
padding: 6px;
|
|
52321
|
+
cursor: pointer;
|
|
52322
|
+
transition: background-color 0.2s ease;
|
|
52323
|
+
user-select: none;
|
|
52324
|
+
`;
|
|
52325
|
+
const SwitchThumb = dt.div`
|
|
52326
|
+
width: 16px;
|
|
52327
|
+
height: 16px;
|
|
52328
|
+
border-radius: ${({ theme }) => {
|
|
52329
|
+
var _a;
|
|
52330
|
+
return convertToPxValue((_a = theme.borderRadius) == null ? void 0 : _a.selectionButton);
|
|
52331
|
+
}};
|
|
52332
|
+
background-color: ${({ checked, theme }) => checked ? theme.secondary.background.normal : theme.primary.text.ultraLowContrast};
|
|
52333
|
+
transition: transform 0.2s ease;
|
|
52334
|
+
transform: translateX(${({ checked }) => checked ? "16px" : "0"});
|
|
52335
|
+
`;
|
|
52336
|
+
const Switch = ({ checked = false, onChange }) => {
|
|
52337
|
+
const [isChecked, setIsChecked] = useState(checked);
|
|
52338
|
+
const toggle = () => {
|
|
52339
|
+
const newVal = !isChecked;
|
|
52340
|
+
setIsChecked(newVal);
|
|
52341
|
+
onChange == null ? void 0 : onChange(newVal);
|
|
52342
|
+
};
|
|
52343
|
+
return /* @__PURE__ */ jsx(SwitchWrapper, { checked: isChecked, onClick: toggle, children: /* @__PURE__ */ jsx(SwitchThumb, { checked: isChecked }) });
|
|
52344
|
+
};
|
|
52345
|
+
const SpinnerIcon = (props) => {
|
|
52346
|
+
return /* @__PURE__ */ jsxs("svg", { fill: "none", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
|
|
52347
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", opacity: ".25", r: "10", stroke: "currentColor", strokeWidth: "4" }),
|
|
52348
|
+
/* @__PURE__ */ jsx(
|
|
52349
|
+
"path",
|
|
52350
|
+
{
|
|
52351
|
+
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z",
|
|
52352
|
+
fill: "currentColor",
|
|
52353
|
+
opacity: ".75"
|
|
52354
|
+
}
|
|
52355
|
+
)
|
|
52356
|
+
] });
|
|
52357
|
+
};
|
|
52358
|
+
const GasOnReceive = ({ routeDetails, hideContainer } = {}) => {
|
|
52359
|
+
var _a, _b, _c, _d, _e2;
|
|
52360
|
+
const theme = nt();
|
|
52361
|
+
const [gasOnReceive, setGasOnReceive] = useAtom(gasOnReceiveAtom);
|
|
52362
|
+
const { isLoading: fetchingGasRoute } = useAtomValue(gasOnReceiveRouteAtom);
|
|
52363
|
+
const { feeRoute } = useAtomValue(swapExecutionStateAtom);
|
|
52364
|
+
const { data: assets2 } = useAtomValue(skipAssetsAtom);
|
|
52365
|
+
const isSomeDestinationFeeBalanceAvailable = useAtomValue(
|
|
52366
|
+
isSomeDestinationFeeBalanceAvailableAtom
|
|
52367
|
+
);
|
|
52368
|
+
const currentTransaction = useAtomValue(currentTransactionAtom);
|
|
52369
|
+
const isFetchingBalance = isSomeDestinationFeeBalanceAvailable.isLoading;
|
|
52370
|
+
const gasOnReceiveAsset = useMemo(() => {
|
|
52371
|
+
var _a2, _b2;
|
|
52372
|
+
const gasAsset = {
|
|
52373
|
+
chainId: ((_a2 = routeDetails == null ? void 0 : routeDetails.route) == null ? void 0 : _a2.destAssetChainId) ?? (feeRoute == null ? void 0 : feeRoute.destAssetChainId),
|
|
52374
|
+
denom: ((_b2 = routeDetails == null ? void 0 : routeDetails.route) == null ? void 0 : _b2.destAssetDenom) ?? (feeRoute == null ? void 0 : feeRoute.destAssetDenom)
|
|
52375
|
+
};
|
|
52376
|
+
if (!gasAsset) return;
|
|
52377
|
+
const asset = assets2 == null ? void 0 : assets2.find(
|
|
52378
|
+
(a) => a.chainId === (gasAsset == null ? void 0 : gasAsset.chainId) && a.denom === (gasAsset == null ? void 0 : gasAsset.denom)
|
|
52379
|
+
);
|
|
52380
|
+
return asset;
|
|
52381
|
+
}, [
|
|
52382
|
+
assets2,
|
|
52383
|
+
feeRoute == null ? void 0 : feeRoute.destAssetChainId,
|
|
52384
|
+
feeRoute == null ? void 0 : feeRoute.destAssetDenom,
|
|
52385
|
+
(_a = routeDetails == null ? void 0 : routeDetails.route) == null ? void 0 : _a.destAssetChainId,
|
|
52386
|
+
(_b = routeDetails == null ? void 0 : routeDetails.route) == null ? void 0 : _b.destAssetDenom
|
|
52387
|
+
]);
|
|
52388
|
+
const amountUsd = ((_c = routeDetails == null ? void 0 : routeDetails.route) == null ? void 0 : _c.usdAmountOut) ?? (feeRoute == null ? void 0 : feeRoute.usdAmountOut);
|
|
52389
|
+
const amountOut = ((_d = routeDetails == null ? void 0 : routeDetails.route) == null ? void 0 : _d.amountOut) ?? (feeRoute == null ? void 0 : feeRoute.amountOut) ?? "";
|
|
52390
|
+
const assetSymbol = ((_e2 = gasOnReceiveAsset == null ? void 0 : gasOnReceiveAsset.recommendedSymbol) == null ? void 0 : _e2.toUpperCase()) ?? "";
|
|
52391
|
+
const gasOnReceiveText = useMemo(() => {
|
|
52392
|
+
var _a2;
|
|
52393
|
+
const formattedAmountText = amountUsd && Number(amountUsd) > 0 ? `${formatUSD(amountUsd)} in ${assetSymbol}` : `${convertTokenAmountToHumanReadableAmount(amountOut, gasOnReceiveAsset == null ? void 0 : gasOnReceiveAsset.decimals)} ${assetSymbol}`;
|
|
52394
|
+
const transferAssetRelease = routeDetails == null ? void 0 : routeDetails.transferAssetRelease;
|
|
52395
|
+
const transferAssetReleaseDetails = assets2 == null ? void 0 : assets2.find(
|
|
52396
|
+
(a) => a.chainId === (transferAssetRelease == null ? void 0 : transferAssetRelease.chainId) && a.denom === (transferAssetRelease == null ? void 0 : transferAssetRelease.denom)
|
|
52397
|
+
);
|
|
52398
|
+
switch (routeDetails == null ? void 0 : routeDetails.status) {
|
|
52399
|
+
case "pending":
|
|
52400
|
+
return `Receiving ${formattedAmountText}`;
|
|
52401
|
+
case "completed":
|
|
52402
|
+
return `Received ${formattedAmountText} as gas top-up`;
|
|
52403
|
+
case "failed":
|
|
52404
|
+
if (transferAssetReleaseDetails) {
|
|
52405
|
+
return `Gas top-up failed. Assets released as ${(transferAssetRelease == null ? void 0 : transferAssetRelease.amount) ? convertTokenAmountToHumanReadableAmount(transferAssetRelease == null ? void 0 : transferAssetRelease.amount, transferAssetReleaseDetails == null ? void 0 : transferAssetReleaseDetails.decimals) : void 0} ${(_a2 = transferAssetReleaseDetails == null ? void 0 : transferAssetReleaseDetails.recommendedSymbol) == null ? void 0 : _a2.toUpperCase()}`;
|
|
52406
|
+
}
|
|
52407
|
+
return `Failed to receive ${formattedAmountText} as gas top-up`;
|
|
52408
|
+
default:
|
|
52409
|
+
return /* @__PURE__ */ jsxs(Row, { align: "center", gap: 8, children: [
|
|
52410
|
+
"Enable gas top up",
|
|
52411
|
+
/* @__PURE__ */ jsx(
|
|
52412
|
+
QuestionMarkTooltip,
|
|
52413
|
+
{
|
|
52414
|
+
content: /* @__PURE__ */ jsxs(SmallText, { normalTextColor: true, style: { whiteSpace: "nowrap" }, children: [
|
|
52415
|
+
"You'll get ",
|
|
52416
|
+
formattedAmountText
|
|
52417
|
+
] })
|
|
52418
|
+
}
|
|
52419
|
+
)
|
|
52420
|
+
] });
|
|
52421
|
+
}
|
|
52422
|
+
}, [amountOut, amountUsd, assetSymbol, assets2, gasOnReceiveAsset == null ? void 0 : gasOnReceiveAsset.decimals, routeDetails]);
|
|
52423
|
+
const renderIcon = useMemo(() => {
|
|
52424
|
+
if ((routeDetails == null ? void 0 : routeDetails.status) === "pending") {
|
|
52425
|
+
return /* @__PURE__ */ jsx(
|
|
52426
|
+
SmallText,
|
|
52427
|
+
{
|
|
52428
|
+
style: {
|
|
52429
|
+
marginLeft: "8px",
|
|
52430
|
+
marginRight: "8px",
|
|
52431
|
+
position: "relative"
|
|
52432
|
+
},
|
|
52433
|
+
children: /* @__PURE__ */ jsx(
|
|
52434
|
+
SpinnerIcon,
|
|
52435
|
+
{
|
|
52436
|
+
style: {
|
|
52437
|
+
animation: "spin 1s linear infinite",
|
|
52438
|
+
position: "absolute",
|
|
52439
|
+
height: 14,
|
|
52440
|
+
width: 14
|
|
52441
|
+
}
|
|
52442
|
+
}
|
|
52443
|
+
)
|
|
52444
|
+
}
|
|
52445
|
+
);
|
|
52446
|
+
}
|
|
52447
|
+
return /* @__PURE__ */ jsx(
|
|
52448
|
+
GasIcon,
|
|
52449
|
+
{
|
|
52450
|
+
color: (routeDetails == null ? void 0 : routeDetails.status) === "failed" ? theme.warning.text : theme.primary.text.lowContrast
|
|
52451
|
+
}
|
|
52452
|
+
);
|
|
52453
|
+
}, [routeDetails == null ? void 0 : routeDetails.status, theme.primary.text.lowContrast, theme.warning.text]);
|
|
52454
|
+
if (!routeDetails && (!feeRoute || !gasOnReceiveAsset)) {
|
|
52455
|
+
return null;
|
|
52456
|
+
}
|
|
52457
|
+
return /* @__PURE__ */ jsxs(GasOnReceiveContainer, { hideContainer, align: "center", justify: "space-between", children: [
|
|
52458
|
+
/* @__PURE__ */ jsxs(Row, { gap: 8, align: "center", children: [
|
|
52459
|
+
renderIcon,
|
|
52460
|
+
(isFetchingBalance || fetchingGasRoute) && !routeDetails ? /* @__PURE__ */ jsx(SkeletonElement, { height: 20, width: 300 }) : /* @__PURE__ */ jsx(
|
|
52461
|
+
SmallText,
|
|
52462
|
+
{
|
|
52463
|
+
color: (routeDetails == null ? void 0 : routeDetails.status) === "failed" ? theme.warning.text : theme.primary.text.lowContrast,
|
|
52464
|
+
children: gasOnReceiveText
|
|
52465
|
+
}
|
|
52466
|
+
)
|
|
52467
|
+
] }),
|
|
52468
|
+
routeDetails ? null : !isFetchingBalance && !currentTransaction && /* @__PURE__ */ jsx(
|
|
52469
|
+
Switch,
|
|
52470
|
+
{
|
|
52471
|
+
checked: gasOnReceive,
|
|
52472
|
+
onChange: (value) => {
|
|
52473
|
+
track("gas on receive: toggle button - clicked", {
|
|
52474
|
+
gasOnReceive: value
|
|
52475
|
+
});
|
|
52476
|
+
setGasOnReceive(value);
|
|
52477
|
+
}
|
|
52478
|
+
}
|
|
52479
|
+
)
|
|
52480
|
+
] });
|
|
52481
|
+
};
|
|
52482
|
+
const GasOnReceiveContainer = dt(Row)`
|
|
52483
|
+
${({ hideContainer, theme }) => !hideContainer && lt`
|
|
52484
|
+
background-color: ${theme.secondary.background.transparent};
|
|
52485
|
+
padding: 15px 20px;
|
|
52486
|
+
height: 40px;
|
|
52487
|
+
`}
|
|
52488
|
+
border-radius: ${({ theme }) => {
|
|
52489
|
+
var _a;
|
|
52490
|
+
return convertToPxValue((_a = theme.borderRadius) == null ? void 0 : _a.selectionButton);
|
|
52491
|
+
}};
|
|
52492
|
+
`;
|
|
52493
|
+
const useFeeRouteAutoSetAddress = () => {
|
|
52494
|
+
var _a, _b, _c;
|
|
52495
|
+
const [feeRouteChainAddresses, setFeeRouteChainAddresses] = useAtom(feeRouteChainAddressesAtom);
|
|
52496
|
+
const { feeRoute, isFeeRouteEnabled } = useAtomValue(swapExecutionStateAtom);
|
|
52497
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
52498
|
+
const connectedAddress = useAtomValue(connectedAddressesAtom);
|
|
52499
|
+
const sourceWallet = useAtomValue(walletsAtom);
|
|
52500
|
+
const currentTransaction = useAtomValue(currentTransactionAtom);
|
|
52501
|
+
const [walletHasChanged, setWalletHasChanged] = useState(false);
|
|
52502
|
+
const [currentSourceWallets, setCurrentSourceWallets] = useState();
|
|
52503
|
+
const [currentConnectedAddress, setCurrentConnectedAddress] = useState();
|
|
52504
|
+
const { createCosmosWallets } = useCreateCosmosWallets();
|
|
52505
|
+
const { createEvmWallets } = useCreateEvmWallets();
|
|
52506
|
+
const { createSolanaWallets } = useCreateSolanaWallets();
|
|
52507
|
+
useAtom(feeRouteUserAddressesEffectAtom);
|
|
52508
|
+
const connectRequiredChains = useCallback(
|
|
52509
|
+
async (openModal) => {
|
|
52510
|
+
setIsLoading(true);
|
|
52511
|
+
const createWallets = {
|
|
52512
|
+
[ChainType.Cosmos]: createCosmosWallets,
|
|
52513
|
+
[ChainType.Evm]: createEvmWallets,
|
|
52514
|
+
[ChainType.Svm]: createSolanaWallets
|
|
52515
|
+
};
|
|
52516
|
+
try {
|
|
52517
|
+
if (!feeRoute || !isFeeRouteEnabled) return;
|
|
52518
|
+
const requiredChainAddresses = feeRoute.requiredChainAddresses;
|
|
52519
|
+
if (!requiredChainAddresses) return;
|
|
52520
|
+
Object.entries(feeRouteChainAddresses).forEach(async ([_index, chainAddress], index) => {
|
|
52521
|
+
var _a2, _b2;
|
|
52522
|
+
if (!chainAddress.address || chainAddress.address === "") {
|
|
52523
|
+
const injectedAddress = connectedAddress == null ? void 0 : connectedAddress[chainAddress.chainId];
|
|
52524
|
+
if (injectedAddress) {
|
|
52525
|
+
setFeeRouteChainAddresses((prev2) => ({
|
|
52526
|
+
...prev2,
|
|
52527
|
+
[index]: {
|
|
52528
|
+
...chainAddress,
|
|
52529
|
+
address: injectedAddress,
|
|
52530
|
+
source: WalletSource.Injected
|
|
52531
|
+
}
|
|
52532
|
+
}));
|
|
52533
|
+
} else {
|
|
52534
|
+
if (!chainAddress.chainType) return;
|
|
52535
|
+
const wallets = createWallets[chainAddress.chainType](chainAddress.chainId);
|
|
52536
|
+
const walletName = (_a2 = sourceWallet[chainAddress.chainType]) == null ? void 0 : _a2.walletName;
|
|
52537
|
+
const wallet = wallets.find((w2) => w2.walletName === walletName);
|
|
52538
|
+
const response = await ((_b2 = wallet == null ? void 0 : wallet.getAddress) == null ? void 0 : _b2.call(wallet, {}));
|
|
52539
|
+
const getLogo = () => {
|
|
52540
|
+
var _a3;
|
|
52541
|
+
if ((wallet == null ? void 0 : wallet.walletChainType) === "evm" && (wallet == null ? void 0 : wallet.walletName) === "app.keplr") {
|
|
52542
|
+
return getCosmosWalletInfo(WalletType.KEPLR).imgSrc;
|
|
52543
|
+
}
|
|
52544
|
+
return (response == null ? void 0 : response.logo) ?? ((_a3 = wallet == null ? void 0 : wallet.walletInfo) == null ? void 0 : _a3.logo);
|
|
52545
|
+
};
|
|
52546
|
+
if (response == null ? void 0 : response.address) {
|
|
52547
|
+
setFeeRouteChainAddresses((prev2) => ({
|
|
52548
|
+
...prev2,
|
|
52549
|
+
[index]: {
|
|
52550
|
+
...chainAddress,
|
|
52551
|
+
address: response.address,
|
|
52552
|
+
logo: response.logo,
|
|
52553
|
+
source: WalletSource.Wallet,
|
|
52554
|
+
wallet: wallet ? {
|
|
52555
|
+
walletName: wallet == null ? void 0 : wallet.walletName,
|
|
52556
|
+
walletPrettyName: wallet == null ? void 0 : wallet.walletPrettyName,
|
|
52557
|
+
walletChainType: chainAddress.chainType,
|
|
52558
|
+
walletInfo: {
|
|
52559
|
+
logo: getLogo()
|
|
52560
|
+
}
|
|
52561
|
+
} : void 0
|
|
52562
|
+
}
|
|
52563
|
+
}));
|
|
52564
|
+
} else if (openModal) {
|
|
52565
|
+
NiceModal.show(Modals.SetAddressModal, {
|
|
52566
|
+
chainId: chainAddress.chainId,
|
|
52567
|
+
chainAddressIndex: index,
|
|
52568
|
+
isFeeRoute: true
|
|
52569
|
+
});
|
|
52570
|
+
}
|
|
52571
|
+
}
|
|
52572
|
+
}
|
|
52573
|
+
});
|
|
52574
|
+
} catch (error) {
|
|
52575
|
+
console.error("Error connecting required chains:", error);
|
|
52576
|
+
} finally {
|
|
52577
|
+
setIsLoading(false);
|
|
52578
|
+
}
|
|
52579
|
+
},
|
|
52580
|
+
[
|
|
52581
|
+
connectedAddress,
|
|
52582
|
+
createCosmosWallets,
|
|
52583
|
+
createEvmWallets,
|
|
52584
|
+
createSolanaWallets,
|
|
52585
|
+
feeRoute,
|
|
52586
|
+
feeRouteChainAddresses,
|
|
52587
|
+
isFeeRouteEnabled,
|
|
52588
|
+
setFeeRouteChainAddresses,
|
|
52589
|
+
sourceWallet
|
|
52590
|
+
]
|
|
52591
|
+
);
|
|
52592
|
+
useEffect(() => {
|
|
52593
|
+
var _a2, _b2, _c2, _d, _e2, _f;
|
|
52594
|
+
if (currentTransaction && (currentTransaction == null ? void 0 : currentTransaction.status) !== "unconfirmed") {
|
|
52595
|
+
setIsLoading(false);
|
|
52596
|
+
return;
|
|
52597
|
+
}
|
|
52598
|
+
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);
|
|
52599
|
+
const hasConnectedAddressChanged = JSON.stringify(connectedAddress) !== JSON.stringify(currentConnectedAddress);
|
|
52600
|
+
if (hasConnectedAddressChanged) {
|
|
52601
|
+
setCurrentConnectedAddress(connectedAddress);
|
|
52602
|
+
setWalletHasChanged(true);
|
|
52603
|
+
}
|
|
52604
|
+
if (hasWalletChanged) {
|
|
52605
|
+
setCurrentSourceWallets(sourceWallet);
|
|
52606
|
+
setWalletHasChanged(true);
|
|
52607
|
+
}
|
|
52608
|
+
}, [
|
|
52609
|
+
connectRequiredChains,
|
|
52610
|
+
connectedAddress,
|
|
52611
|
+
currentConnectedAddress,
|
|
52612
|
+
(_a = currentSourceWallets == null ? void 0 : currentSourceWallets.cosmos) == null ? void 0 : _a.id,
|
|
52613
|
+
(_b = currentSourceWallets == null ? void 0 : currentSourceWallets.evm) == null ? void 0 : _b.id,
|
|
52614
|
+
(_c = currentSourceWallets == null ? void 0 : currentSourceWallets.svm) == null ? void 0 : _c.id,
|
|
52615
|
+
currentTransaction,
|
|
52616
|
+
currentTransaction == null ? void 0 : currentTransaction.status,
|
|
52617
|
+
isLoading,
|
|
52618
|
+
feeRoute == null ? void 0 : feeRoute.requiredChainAddresses,
|
|
52619
|
+
sourceWallet
|
|
52620
|
+
]);
|
|
52621
|
+
useEffect(() => {
|
|
52622
|
+
if (!isFeeRouteEnabled) {
|
|
52623
|
+
setIsLoading(false);
|
|
52624
|
+
return;
|
|
52625
|
+
} else {
|
|
52626
|
+
setWalletHasChanged(true);
|
|
52627
|
+
}
|
|
52628
|
+
}, [isFeeRouteEnabled]);
|
|
52629
|
+
useEffect(() => {
|
|
52630
|
+
if (walletHasChanged && isFeeRouteEnabled) {
|
|
52631
|
+
connectRequiredChains();
|
|
52632
|
+
setWalletHasChanged(false);
|
|
52633
|
+
}
|
|
52634
|
+
}, [
|
|
52635
|
+
connectRequiredChains,
|
|
52636
|
+
isFeeRouteEnabled,
|
|
52637
|
+
feeRoute == null ? void 0 : feeRoute.requiredChainAddresses,
|
|
52638
|
+
walletHasChanged
|
|
52639
|
+
]);
|
|
52640
|
+
return {
|
|
52641
|
+
connectRequiredChains,
|
|
52642
|
+
isLoading
|
|
52643
|
+
};
|
|
52644
|
+
};
|
|
51889
52645
|
var SwapExecutionState = /* @__PURE__ */ ((SwapExecutionState2) => {
|
|
51890
52646
|
SwapExecutionState2[SwapExecutionState2["recoveryAddressUnset"] = 0] = "recoveryAddressUnset";
|
|
51891
52647
|
SwapExecutionState2[SwapExecutionState2["destinationAddressUnset"] = 1] = "destinationAddressUnset";
|
|
@@ -51897,51 +52653,57 @@ var SwapExecutionState = /* @__PURE__ */ ((SwapExecutionState2) => {
|
|
|
51897
52653
|
SwapExecutionState2[SwapExecutionState2["validatingGasBalance"] = 7] = "validatingGasBalance";
|
|
51898
52654
|
SwapExecutionState2[SwapExecutionState2["approving"] = 8] = "approving";
|
|
51899
52655
|
SwapExecutionState2[SwapExecutionState2["pendingGettingAddresses"] = 9] = "pendingGettingAddresses";
|
|
52656
|
+
SwapExecutionState2[SwapExecutionState2["pendingGettingDestinationBalance"] = 10] = "pendingGettingDestinationBalance";
|
|
52657
|
+
SwapExecutionState2[SwapExecutionState2["pendingGettingFeeRouteAddresses"] = 11] = "pendingGettingFeeRouteAddresses";
|
|
52658
|
+
SwapExecutionState2[SwapExecutionState2["feeRouteRecoveryAddressUnset"] = 12] = "feeRouteRecoveryAddressUnset";
|
|
52659
|
+
SwapExecutionState2[SwapExecutionState2["pendingError"] = 13] = "pendingError";
|
|
51900
52660
|
return SwapExecutionState2;
|
|
51901
52661
|
})(SwapExecutionState || {});
|
|
51902
52662
|
const SwapExecutionPage = () => {
|
|
51903
|
-
|
|
52663
|
+
const theme = nt();
|
|
51904
52664
|
const setCurrentPage = useSetAtom(currentPageAtom);
|
|
51905
|
-
const {
|
|
51906
|
-
|
|
51907
|
-
clientOperations,
|
|
51908
|
-
overallStatus,
|
|
51909
|
-
transactionDetailsArray,
|
|
51910
|
-
isValidatingGasBalance,
|
|
51911
|
-
transactionsSigned
|
|
51912
|
-
} = useAtomValue(swapExecutionStateAtom);
|
|
51913
|
-
const lastTransactionInTime = useAtomValue(lastTransactionInTimeAtom);
|
|
52665
|
+
const { route: route2, clientOperations, feeRoute } = useAtomValue(swapExecutionStateAtom);
|
|
52666
|
+
const currentTransaction = useAtomValue(currentTransactionAtom);
|
|
51914
52667
|
const chainAddresses = useAtomValue(chainAddressesAtom);
|
|
51915
|
-
const
|
|
52668
|
+
const feeRouteChainAddresses = useAtomValue(feeRouteChainAddressesAtom);
|
|
52669
|
+
const { connectRequiredChains, isLoading: isGettingAddressesLoading } = useAutoSetAddress();
|
|
52670
|
+
const {
|
|
52671
|
+
connectRequiredChains: connectFeeRouteRequiredChains,
|
|
52672
|
+
isLoading: isGettingFeeRouteAddressesLoading
|
|
52673
|
+
} = useFeeRouteAutoSetAddress();
|
|
51916
52674
|
const [simpleRoute, setSimpleRoute] = useState(true);
|
|
52675
|
+
const isSomeDestinationFeeBalanceAvailable = useAtomValue(
|
|
52676
|
+
isSomeDestinationFeeBalanceAvailableAtom
|
|
52677
|
+
);
|
|
52678
|
+
const { data: gasRoute, isLoading: isGasRouteLoading } = useAtomValue(gasOnReceiveRouteAtom);
|
|
52679
|
+
const gasRouteEnabled = useAtomValue(gasOnReceiveAtom);
|
|
52680
|
+
const isFetchingDestinationBalance = isSomeDestinationFeeBalanceAvailable.isLoading || isGasRouteLoading;
|
|
52681
|
+
useAtom(gasRouteEffect);
|
|
52682
|
+
useAtom(feeRouteAddressesAtomEffect);
|
|
52683
|
+
useAtom(gasOnReceiveAtomEffect);
|
|
51917
52684
|
const { mutate: submitExecuteRouteMutation, error } = useAtomValue(skipSubmitSwapExecutionAtom);
|
|
51918
|
-
const
|
|
51919
|
-
|
|
51920
|
-
|
|
51921
|
-
|
|
51922
|
-
|
|
51923
|
-
});
|
|
51924
|
-
const lastTransaction = transactionDetailsArray.at(-1);
|
|
52685
|
+
const signaturesRemaining = useMemo(() => {
|
|
52686
|
+
if (!currentTransaction) return 0;
|
|
52687
|
+
return currentTransaction.txsRequired - currentTransaction.txsSigned;
|
|
52688
|
+
}, [currentTransaction]);
|
|
52689
|
+
const lastTransaction = currentTransaction == null ? void 0 : currentTransaction.transactionDetails.at(-1);
|
|
51925
52690
|
const lastTxHash = lastTransaction == null ? void 0 : lastTransaction.txHash;
|
|
51926
52691
|
const lastTxChainId = lastTransaction == null ? void 0 : lastTransaction.chainId;
|
|
51927
|
-
useSyncTxStatus({
|
|
51928
|
-
statusData,
|
|
51929
|
-
timestamp: (_a = lastTransactionInTime == null ? void 0 : lastTransactionInTime.transactionHistoryItem) == null ? void 0 : _a.timestamp
|
|
51930
|
-
});
|
|
51931
52692
|
const lastOperation = clientOperations[clientOperations.length - 1];
|
|
51932
52693
|
const swapExecutionState = useSwapExecutionState({
|
|
51933
52694
|
chainAddresses,
|
|
51934
|
-
|
|
51935
|
-
|
|
51936
|
-
|
|
51937
|
-
|
|
51938
|
-
|
|
52695
|
+
requiredChainAddresses: route2 == null ? void 0 : route2.requiredChainAddresses,
|
|
52696
|
+
feeRouteChainAddresses,
|
|
52697
|
+
feeRouteRequiredChainAddresses: feeRoute == null ? void 0 : feeRoute.requiredChainAddresses,
|
|
52698
|
+
isGettingAddressesLoading,
|
|
52699
|
+
isGettingFeeRouteAddressesLoading,
|
|
52700
|
+
isFetchingDestinationBalance
|
|
51939
52701
|
});
|
|
51940
|
-
const isSafeToleave = (route2 == null ? void 0 : route2.txsRequired) ===
|
|
52702
|
+
const isSafeToleave = (route2 == null ? void 0 : route2.txsRequired) === (currentTransaction == null ? void 0 : currentTransaction.transactionDetails.length);
|
|
51941
52703
|
usePreventPageUnload(
|
|
51942
52704
|
swapExecutionState === 5 || swapExecutionState === 4 || swapExecutionState === 8 || swapExecutionState === 7 || !isSafeToleave
|
|
51943
52705
|
);
|
|
51944
|
-
useHandleTransactionFailed(error,
|
|
52706
|
+
useHandleTransactionFailed(error, currentTransaction);
|
|
51945
52707
|
useHandleTransactionTimeout(swapExecutionState);
|
|
51946
52708
|
const firstOperationStatus = useMemo(() => {
|
|
51947
52709
|
if (swapExecutionState === 6 || swapExecutionState === 3 || swapExecutionState === 5) {
|
|
@@ -51949,18 +52711,18 @@ const SwapExecutionPage = () => {
|
|
|
51949
52711
|
}
|
|
51950
52712
|
}, [swapExecutionState]);
|
|
51951
52713
|
const secondOperationStatus = useMemo(() => {
|
|
51952
|
-
var
|
|
51953
|
-
const status =
|
|
52714
|
+
var _a;
|
|
52715
|
+
const status = currentTransaction == null ? void 0 : currentTransaction.transferEvents;
|
|
51954
52716
|
if (swapExecutionState === 6) {
|
|
51955
52717
|
return "completed";
|
|
51956
52718
|
}
|
|
51957
|
-
if ((
|
|
52719
|
+
if ((_a = status == null ? void 0 : status[0]) == null ? void 0 : _a.status) {
|
|
51958
52720
|
return status[0].status;
|
|
51959
52721
|
}
|
|
51960
52722
|
if (swapExecutionState === 3 || swapExecutionState === 5) {
|
|
51961
52723
|
return "pending";
|
|
51962
52724
|
}
|
|
51963
|
-
}, [
|
|
52725
|
+
}, [currentTransaction == null ? void 0 : currentTransaction.transferEvents, swapExecutionState]);
|
|
51964
52726
|
const onClickEditDestinationWallet = useMemo(() => {
|
|
51965
52727
|
track("swap execution page: edit destination address button - clicked");
|
|
51966
52728
|
const loadingStates = [
|
|
@@ -51982,8 +52744,22 @@ const SwapExecutionPage = () => {
|
|
|
51982
52744
|
});
|
|
51983
52745
|
};
|
|
51984
52746
|
}, [swapExecutionState, lastOperation.signRequired, lastOperation.fromChain, route2]);
|
|
51985
|
-
const
|
|
51986
|
-
const
|
|
52747
|
+
const shouldRenderTrackProgressButton = lastTxHash && lastTxChainId && (route2 == null ? void 0 : route2.txsRequired) === (currentTransaction == null ? void 0 : currentTransaction.transactionDetails.length);
|
|
52748
|
+
const gasOnReceiveComponent = useMemo(() => {
|
|
52749
|
+
var _a;
|
|
52750
|
+
return (gasRoute || feeRoute) && !isGasRouteLoading && !currentTransaction && !isFetchingDestinationBalance || currentTransaction && gasRouteEnabled ? /* @__PURE__ */ jsxs(Column, { children: [
|
|
52751
|
+
/* @__PURE__ */ jsx(Spacer, { height: 30, showLine: true, lineColor: theme.secondary.background.transparent }),
|
|
52752
|
+
/* @__PURE__ */ jsx(GasOnReceive, { routeDetails: (_a = currentTransaction == null ? void 0 : currentTransaction.relatedRoutes) == null ? void 0 : _a[0] })
|
|
52753
|
+
] }) : null;
|
|
52754
|
+
}, [
|
|
52755
|
+
currentTransaction,
|
|
52756
|
+
feeRoute,
|
|
52757
|
+
gasRoute,
|
|
52758
|
+
gasRouteEnabled,
|
|
52759
|
+
isFetchingDestinationBalance,
|
|
52760
|
+
isGasRouteLoading,
|
|
52761
|
+
theme.secondary.background.transparent
|
|
52762
|
+
]);
|
|
51987
52763
|
return /* @__PURE__ */ jsxs(Column, { gap: 5, children: [
|
|
51988
52764
|
/* @__PURE__ */ jsx(
|
|
51989
52765
|
PageHeader,
|
|
@@ -51999,7 +52775,10 @@ const SwapExecutionPage = () => {
|
|
|
51999
52775
|
centerButton: shouldRenderTrackProgressButton ? {
|
|
52000
52776
|
label: "Track progress",
|
|
52001
52777
|
onClick: () => {
|
|
52002
|
-
window.open(
|
|
52778
|
+
window.open(
|
|
52779
|
+
createSkipExplorerLink(currentTransaction == null ? void 0 : currentTransaction.transactionDetails),
|
|
52780
|
+
"_blank"
|
|
52781
|
+
);
|
|
52003
52782
|
track("swap execution page: track progress button - clicked", {
|
|
52004
52783
|
txHash: lastTxHash
|
|
52005
52784
|
});
|
|
@@ -52018,14 +52797,16 @@ const SwapExecutionPage = () => {
|
|
|
52018
52797
|
}
|
|
52019
52798
|
),
|
|
52020
52799
|
/* @__PURE__ */ jsx(
|
|
52021
|
-
|
|
52800
|
+
SwapExecutionPageRouteContainer,
|
|
52022
52801
|
{
|
|
52802
|
+
showDetailed: !simpleRoute,
|
|
52023
52803
|
onClickEditDestinationWallet,
|
|
52024
52804
|
operations: clientOperations,
|
|
52025
|
-
statusData,
|
|
52805
|
+
statusData: currentTransaction,
|
|
52026
52806
|
swapExecutionState,
|
|
52027
52807
|
firstOperationStatus,
|
|
52028
|
-
secondOperationStatus
|
|
52808
|
+
secondOperationStatus,
|
|
52809
|
+
bottomContent: gasOnReceiveComponent
|
|
52029
52810
|
}
|
|
52030
52811
|
),
|
|
52031
52812
|
/* @__PURE__ */ jsx(
|
|
@@ -52036,10 +52817,11 @@ const SwapExecutionPage = () => {
|
|
|
52036
52817
|
signaturesRemaining,
|
|
52037
52818
|
lastOperation,
|
|
52038
52819
|
connectRequiredChains,
|
|
52820
|
+
connectFeeRouteRequiredChains,
|
|
52039
52821
|
submitExecuteRouteMutation
|
|
52040
52822
|
}
|
|
52041
52823
|
),
|
|
52042
|
-
/* @__PURE__ */ jsx(SwapPageFooter, {
|
|
52824
|
+
/* @__PURE__ */ jsx(SwapPageFooter, {})
|
|
52043
52825
|
] });
|
|
52044
52826
|
};
|
|
52045
52827
|
const BridgeIcon = ({
|
|
@@ -52466,8 +53248,8 @@ const useCleanupDebouncedAtoms = () => {
|
|
|
52466
53248
|
}, [cleanupDebouncedDestinationAssetAmount, cleanupDebouncedSourceAssetAmount]);
|
|
52467
53249
|
};
|
|
52468
53250
|
const useUpdateAmountWhenRouteChanges = () => {
|
|
52469
|
-
const
|
|
52470
|
-
const
|
|
53251
|
+
const route2 = useAtomValue(skipRouteAtom);
|
|
53252
|
+
const direction = useAtomValue(swapDirectionAtom);
|
|
52471
53253
|
const [sourceAsset, setSourceAsset] = useAtom(sourceAssetAtom);
|
|
52472
53254
|
const [destinationAsset, setDestinationAsset] = useAtom(destinationAssetAtom);
|
|
52473
53255
|
const prevRoute = useRef(route2.data);
|
|
@@ -52488,12 +53270,16 @@ const useUpdateAmountWhenRouteChanges = () => {
|
|
|
52488
53270
|
if (direction === "swap-in") {
|
|
52489
53271
|
setDestinationAsset((old) => ({
|
|
52490
53272
|
...old,
|
|
52491
|
-
amount: removeTrailingZeros(
|
|
53273
|
+
amount: removeTrailingZeros(
|
|
53274
|
+
formatDisplayAmount(swapInAmount, { decimals: 5, abbreviate: false })
|
|
53275
|
+
)
|
|
52492
53276
|
}));
|
|
52493
53277
|
} else if (direction === "swap-out") {
|
|
52494
53278
|
setSourceAsset((old) => ({
|
|
52495
53279
|
...old,
|
|
52496
|
-
amount: removeTrailingZeros(
|
|
53280
|
+
amount: removeTrailingZeros(
|
|
53281
|
+
formatDisplayAmount(swapOutAmount, { decimals: 5, abbreviate: false })
|
|
53282
|
+
)
|
|
52497
53283
|
}));
|
|
52498
53284
|
}
|
|
52499
53285
|
}, [route2.data, direction, sourceAsset, destinationAsset, setSourceAsset, setDestinationAsset]);
|
|
@@ -52513,19 +53299,6 @@ const useShowCosmosLedgerWarning = () => {
|
|
|
52513
53299
|
return !!(account == null ? void 0 : account.wallet.isLedger);
|
|
52514
53300
|
}, [sourceAsset == null ? void 0 : sourceAsset.chainId, chainType, getAccount]);
|
|
52515
53301
|
};
|
|
52516
|
-
const SpinnerIcon = (props) => {
|
|
52517
|
-
return /* @__PURE__ */ jsxs("svg", { fill: "none", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
|
|
52518
|
-
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", opacity: ".25", r: "10", stroke: "currentColor", strokeWidth: "4" }),
|
|
52519
|
-
/* @__PURE__ */ jsx(
|
|
52520
|
-
"path",
|
|
52521
|
-
{
|
|
52522
|
-
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z",
|
|
52523
|
-
fill: "currentColor",
|
|
52524
|
-
opacity: ".75"
|
|
52525
|
-
}
|
|
52526
|
-
)
|
|
52527
|
-
] });
|
|
52528
|
-
};
|
|
52529
53302
|
const ConnectedWalletContent = () => {
|
|
52530
53303
|
const sourceAsset = useAtomValue(sourceAssetAtom);
|
|
52531
53304
|
const getAccount = useGetAccount();
|
|
@@ -52607,54 +53380,46 @@ const ConnectedWalletContent = () => {
|
|
|
52607
53380
|
);
|
|
52608
53381
|
};
|
|
52609
53382
|
const useTxHistory = ({ txHistoryItem }) => {
|
|
52610
|
-
|
|
52611
|
-
const
|
|
52612
|
-
const
|
|
52613
|
-
|
|
52614
|
-
|
|
52615
|
-
|
|
52616
|
-
|
|
52617
|
-
|
|
52618
|
-
|
|
52619
|
-
|
|
52620
|
-
|
|
52621
|
-
|
|
52622
|
-
|
|
52623
|
-
|
|
52624
|
-
|
|
52625
|
-
|
|
52626
|
-
|
|
52627
|
-
|
|
52628
|
-
|
|
52629
|
-
|
|
52630
|
-
|
|
52631
|
-
|
|
52632
|
-
|
|
52633
|
-
|
|
52634
|
-
|
|
52635
|
-
|
|
52636
|
-
|
|
52637
|
-
|
|
52638
|
-
|
|
52639
|
-
|
|
52640
|
-
|
|
52641
|
-
|
|
52642
|
-
|
|
52643
|
-
|
|
52644
|
-
|
|
52645
|
-
|
|
52646
|
-
|
|
52647
|
-
|
|
52648
|
-
|
|
52649
|
-
|
|
52650
|
-
},
|
|
52651
|
-
enabled: transactionDetails !== void 0 && txsRequired !== void 0 && statusData !== void 0
|
|
52652
|
-
});
|
|
52653
|
-
return {
|
|
52654
|
-
status: query.data,
|
|
52655
|
-
explorerLinks: Array.from(explorerLinks).filter((link) => link),
|
|
52656
|
-
transferAssetRelease: (statusData == null ? void 0 : statusData.transferAssetRelease) ?? (txHistoryItem == null ? void 0 : txHistoryItem.transferAssetRelease)
|
|
52657
|
-
};
|
|
53383
|
+
const setTransactionHistory = useSetAtom(setTransactionHistoryAtom);
|
|
53384
|
+
const unsubscribersRef = useRef(null);
|
|
53385
|
+
const subscribedIdsRef = useRef(/* @__PURE__ */ new Set());
|
|
53386
|
+
useEffect(() => {
|
|
53387
|
+
var _a;
|
|
53388
|
+
if (!txHistoryItem) return;
|
|
53389
|
+
const unsubscribers = [];
|
|
53390
|
+
const subscribedRouteIds = /* @__PURE__ */ new Set();
|
|
53391
|
+
const subscribe = (route2) => {
|
|
53392
|
+
if (!route2.id || subscribedRouteIds.has(route2.id)) return;
|
|
53393
|
+
subscribedRouteIds.add(route2.id);
|
|
53394
|
+
unsubscribers.push(
|
|
53395
|
+
subscribeToRouteStatus({
|
|
53396
|
+
routeDetails: route2,
|
|
53397
|
+
onRouteStatusUpdated: (routeStatus) => {
|
|
53398
|
+
var _a2;
|
|
53399
|
+
const failedFeeRoute = (_a2 = routeStatus == null ? void 0 : routeStatus.relatedRoutes) == null ? void 0 : _a2.find(
|
|
53400
|
+
(relatedRoute) => relatedRoute.status === "failed"
|
|
53401
|
+
);
|
|
53402
|
+
if (failedFeeRoute) {
|
|
53403
|
+
track("gas on receive: fee route failed", { feeRoute: failedFeeRoute });
|
|
53404
|
+
}
|
|
53405
|
+
setTransactionHistory(routeStatus);
|
|
53406
|
+
}
|
|
53407
|
+
})
|
|
53408
|
+
);
|
|
53409
|
+
};
|
|
53410
|
+
subscribe(txHistoryItem);
|
|
53411
|
+
(_a = txHistoryItem.relatedRoutes) == null ? void 0 : _a.forEach((relatedRoute) => {
|
|
53412
|
+
if (relatedRoute && relatedRoute.id) {
|
|
53413
|
+
subscribe(relatedRoute);
|
|
53414
|
+
}
|
|
53415
|
+
});
|
|
53416
|
+
unsubscribersRef.current = unsubscribers;
|
|
53417
|
+
subscribedIdsRef.current = subscribedRouteIds;
|
|
53418
|
+
return () => {
|
|
53419
|
+
unsubscribers.forEach((unsub) => unsub());
|
|
53420
|
+
};
|
|
53421
|
+
}, [txHistoryItem, setTransactionHistory]);
|
|
53422
|
+
return txHistoryItem;
|
|
52658
53423
|
};
|
|
52659
53424
|
const SwapPageHeader = memo(() => {
|
|
52660
53425
|
const setCurrentPage = useSetAtom(currentPageAtom);
|
|
@@ -52713,15 +53478,9 @@ const SwapPageHeader = memo(() => {
|
|
|
52713
53478
|
});
|
|
52714
53479
|
const TrackLatestTxHistoryItemStatus = memo(() => {
|
|
52715
53480
|
const lastTxHistoryItemInTime = useAtomValue(lastTransactionInTimeAtom);
|
|
52716
|
-
|
|
52717
|
-
|
|
52718
|
-
const { isPending } = useAtomValue(skipSubmitSwapExecutionAtom);
|
|
52719
|
-
const { transferAssetRelease } = useTxHistory({
|
|
52720
|
-
txHistoryItem: lastTxHistoryItemInTime == null ? void 0 : lastTxHistoryItemInTime.transactionHistoryItem
|
|
53481
|
+
useTxHistory({
|
|
53482
|
+
txHistoryItem: lastTxHistoryItemInTime
|
|
52721
53483
|
});
|
|
52722
|
-
if (transferAssetRelease && transactionsSigned !== transactionDetailsArray.length && !isPending) {
|
|
52723
|
-
setOverallStatus("failed");
|
|
52724
|
-
}
|
|
52725
53484
|
return null;
|
|
52726
53485
|
});
|
|
52727
53486
|
const noHistoryItemsAtom = atom$1((get) => {
|
|
@@ -52729,10 +53488,8 @@ const noHistoryItemsAtom = atom$1((get) => {
|
|
|
52729
53488
|
return (txHistoryItems == null ? void 0 : txHistoryItems.length) === 0;
|
|
52730
53489
|
});
|
|
52731
53490
|
const isFetchingLastTransactionStatusAtom = atom$1((get) => {
|
|
52732
|
-
var _a, _b, _c;
|
|
52733
|
-
const { overallStatus, route: route2, transactionsSigned } = get(swapExecutionStateAtom);
|
|
52734
53491
|
const lastTxHistoryItemInTime = get(lastTransactionInTimeAtom);
|
|
52735
|
-
return
|
|
53492
|
+
return (lastTxHistoryItemInTime == null ? void 0 : lastTxHistoryItemInTime.status) === "pending";
|
|
52736
53493
|
});
|
|
52737
53494
|
const useConnectToMissingCosmosChain = () => {
|
|
52738
53495
|
const sourceAsset = useAtomValue(sourceAssetAtom);
|
|
@@ -52774,6 +53531,183 @@ const useConnectToMissingCosmosChain = () => {
|
|
|
52774
53531
|
}, [sourceAsset, wallets, extraChainIdsToConnect, addExtraChainIdsToConnectForWalletType]);
|
|
52775
53532
|
return { isAskingToApproveConnection };
|
|
52776
53533
|
};
|
|
53534
|
+
const name = "@skip-go/widget";
|
|
53535
|
+
const description = "Swap widget";
|
|
53536
|
+
const version = "3.14.0";
|
|
53537
|
+
const repository = {
|
|
53538
|
+
url: "https://github.com/skip-mev/skip-go",
|
|
53539
|
+
directory: "packages/widget"
|
|
53540
|
+
};
|
|
53541
|
+
const type = "module";
|
|
53542
|
+
const scripts = {
|
|
53543
|
+
dev: "vite --force --host",
|
|
53544
|
+
"dev:visual-test": "VISUAL_TEST=true yarn dev",
|
|
53545
|
+
"dev:storybook": "storybook dev -p 6006",
|
|
53546
|
+
build: "npm run generate-chains && NODE_OPTIONS=--max-old-space-size=16384 vite build",
|
|
53547
|
+
"watch:build": "vite build --watch",
|
|
53548
|
+
lint: "NODE_OPTIONS=--max-old-space-size=32384 eslint . --fix",
|
|
53549
|
+
preview: "vite preview",
|
|
53550
|
+
"build:web-component": "NODE_OPTIONS=--max-old-space-size=32384 webpack --config webpack.config.js",
|
|
53551
|
+
"publish:web-component": "npm run build:web-component && cd web-component && npm publish && cd ..",
|
|
53552
|
+
prepack: "yarn run pre",
|
|
53553
|
+
postpack: "yarn run post",
|
|
53554
|
+
pre: "npm run build && node scripts/prepublish.cjs",
|
|
53555
|
+
post: "git checkout -- package.json",
|
|
53556
|
+
"generate-chains": "node scripts/generate-chains.cjs",
|
|
53557
|
+
"update-registries": "yarn up @initia/initia-registry chain-registry",
|
|
53558
|
+
test: "yarn playwright test",
|
|
53559
|
+
"update-screenshots": "UPDATE_SCREENSHOTS=true yarn playwright test Keplr.test.tsx",
|
|
53560
|
+
"combine-images": "node scripts/combine-images.mjs"
|
|
53561
|
+
};
|
|
53562
|
+
const exports = {
|
|
53563
|
+
".": {
|
|
53564
|
+
types: "./build/index.d.ts",
|
|
53565
|
+
"import": "./build/index.js"
|
|
53566
|
+
}
|
|
53567
|
+
};
|
|
53568
|
+
const types = "./build/index.d.ts";
|
|
53569
|
+
const files = [
|
|
53570
|
+
"build",
|
|
53571
|
+
"README.md"
|
|
53572
|
+
];
|
|
53573
|
+
const devDependencies = {
|
|
53574
|
+
"@chromatic-com/storybook": "^1.6.1",
|
|
53575
|
+
"@eslint/js": "^9.9.0",
|
|
53576
|
+
"@initia/initia-registry": "^1.0.6",
|
|
53577
|
+
"@keplr-wallet/types": "^0.12.125",
|
|
53578
|
+
"@playwright/test": "^1.51.1",
|
|
53579
|
+
"@storybook/addon-essentials": "^8.2.6",
|
|
53580
|
+
"@storybook/addon-interactions": "^8.2.6",
|
|
53581
|
+
"@storybook/addon-links": "^8.2.6",
|
|
53582
|
+
"@storybook/addon-onboarding": "^8.2.6",
|
|
53583
|
+
"@storybook/blocks": "^8.2.6",
|
|
53584
|
+
"@storybook/react": "^8.2.6",
|
|
53585
|
+
"@storybook/react-vite": "^8.2.6",
|
|
53586
|
+
"@storybook/test": "^8.2.6",
|
|
53587
|
+
"@testing-library/dom": "^10.4.0",
|
|
53588
|
+
"@testing-library/react": "^16.2.0",
|
|
53589
|
+
"@types/eslint__js": "^8.42.3",
|
|
53590
|
+
"@types/pluralize": "^0.0.33",
|
|
53591
|
+
"@types/pngjs": "^6.0.5",
|
|
53592
|
+
"@types/react": "^19.0.10",
|
|
53593
|
+
"@types/react-dom": "^19.0.4",
|
|
53594
|
+
"@typescript-eslint/eslint-plugin": "^7.15.0",
|
|
53595
|
+
"@typescript-eslint/parser": "^7.15.0",
|
|
53596
|
+
"@vitejs/plugin-react": "^4.3.1",
|
|
53597
|
+
buffer: "^6.0.3",
|
|
53598
|
+
"chain-registry": "^2.0.34",
|
|
53599
|
+
download: "^8.0.0",
|
|
53600
|
+
eslint: "^9.9.0",
|
|
53601
|
+
"eslint-config-prettier": "^9.1.0",
|
|
53602
|
+
"eslint-plugin-prettier": "^5.2.1",
|
|
53603
|
+
"eslint-plugin-react-hooks": "^4.6.2",
|
|
53604
|
+
"fs-extra": "^11.3.0",
|
|
53605
|
+
"node-polyfill-webpack-plugin": "^4.0.0",
|
|
53606
|
+
"pino-pretty": "^13.0.0",
|
|
53607
|
+
pixelmatch: "^7.1.0",
|
|
53608
|
+
pngjs: "^7.0.0",
|
|
53609
|
+
"postcss-loader": "^8.1.1",
|
|
53610
|
+
prettier: "^3.4.2",
|
|
53611
|
+
process: "^0.11.10",
|
|
53612
|
+
pureimage: "^0.4.18",
|
|
53613
|
+
"raw-loader": "^4.0.2",
|
|
53614
|
+
react: ">=17.0.0",
|
|
53615
|
+
"react-dom": ">=17.0.0",
|
|
53616
|
+
starknet: "6.11.0",
|
|
53617
|
+
storybook: "^8.2.6",
|
|
53618
|
+
"ts-loader": "^9.5.1",
|
|
53619
|
+
typescript: "^5.5.4",
|
|
53620
|
+
"typescript-eslint": "^8.2.0",
|
|
53621
|
+
"url-loader": "^4.1.1",
|
|
53622
|
+
vite: "^5.3.4",
|
|
53623
|
+
"vite-plugin-dts": "^4.0.0-beta.1",
|
|
53624
|
+
"vite-plugin-node-polyfills": "^0.22.0",
|
|
53625
|
+
webpack: "^5.94.0",
|
|
53626
|
+
"webpack-cli": "^5.1.4"
|
|
53627
|
+
};
|
|
53628
|
+
const peerDependencies = {
|
|
53629
|
+
"@tanstack/react-query": "^5.51.21",
|
|
53630
|
+
react: ">=17.0.0",
|
|
53631
|
+
"react-dom": ">=17.0.0",
|
|
53632
|
+
viem: "^2.21.55",
|
|
53633
|
+
wagmi: "^2.14.1"
|
|
53634
|
+
};
|
|
53635
|
+
const dependencies = {
|
|
53636
|
+
"@amplitude/analytics-browser": "^2.11.12",
|
|
53637
|
+
"@amplitude/plugin-session-replay-browser": "^1.16.5",
|
|
53638
|
+
"@cosmjs/amino": "0.33.1",
|
|
53639
|
+
"@cosmjs/cosmwasm-stargate": "0.33.1",
|
|
53640
|
+
"@cosmjs/encoding": "0.33.1",
|
|
53641
|
+
"@cosmjs/math": "0.33.1",
|
|
53642
|
+
"@cosmjs/proto-signing": "0.33.1",
|
|
53643
|
+
"@cosmjs/stargate": "0.33.1",
|
|
53644
|
+
"@ebay/nice-modal-react": "^1.2.13",
|
|
53645
|
+
"@eslint/compat": "^1.1.1",
|
|
53646
|
+
"@penumbra-zone/bech32m": "^13.0.0",
|
|
53647
|
+
"@penumbra-zone/client": "^24.0.0",
|
|
53648
|
+
"@penumbra-zone/protobuf": "^7.2.0",
|
|
53649
|
+
"@penumbra-zone/transport-dom": "^7.5.0",
|
|
53650
|
+
"@r2wc/react-to-web-component": "^2.0.3",
|
|
53651
|
+
"@skip-go/client": "workspace:^",
|
|
53652
|
+
"@solana/spl-token": "^0.4.8",
|
|
53653
|
+
"@solana/wallet-adapter-ledger": "^0.9.25",
|
|
53654
|
+
"@solana/wallet-adapter-react": "^0.15.39",
|
|
53655
|
+
"@solana/wallet-adapter-wallets": "^0.19.37",
|
|
53656
|
+
"@solana/web3.js": "^1.95.8",
|
|
53657
|
+
"@tanstack/query-core": "^5.51.21",
|
|
53658
|
+
"@walletconnect/modal": "^2.7.0",
|
|
53659
|
+
"@walletconnect/sign-client": "^2.20.3",
|
|
53660
|
+
"@walletconnect/solana-adapter": "^0.0.8",
|
|
53661
|
+
add: "^2.0.6",
|
|
53662
|
+
bech32: "^2.0.0",
|
|
53663
|
+
graz: "0.3.3",
|
|
53664
|
+
jotai: "^2.10.1",
|
|
53665
|
+
"jotai-effect": "^1.0.2",
|
|
53666
|
+
"jotai-tanstack-query": "^0.8.6",
|
|
53667
|
+
"lodash.debounce": "^4.0.8",
|
|
53668
|
+
pluralize: "^8.0.0",
|
|
53669
|
+
"rc-virtual-list": "^3.14.5",
|
|
53670
|
+
"react-error-boundary": "^4.0.13",
|
|
53671
|
+
"react-shadow-scope": "^1.0.5",
|
|
53672
|
+
"styled-components": "^6.1.13",
|
|
53673
|
+
uuid: "^11.1.0",
|
|
53674
|
+
yarn: "^1.22.22",
|
|
53675
|
+
zod: "^3.23.8"
|
|
53676
|
+
};
|
|
53677
|
+
const publishConfig = {
|
|
53678
|
+
access: "public"
|
|
53679
|
+
};
|
|
53680
|
+
const packageJson = {
|
|
53681
|
+
name,
|
|
53682
|
+
description,
|
|
53683
|
+
version,
|
|
53684
|
+
repository,
|
|
53685
|
+
type,
|
|
53686
|
+
scripts,
|
|
53687
|
+
exports,
|
|
53688
|
+
types,
|
|
53689
|
+
files,
|
|
53690
|
+
devDependencies,
|
|
53691
|
+
peerDependencies,
|
|
53692
|
+
dependencies,
|
|
53693
|
+
publishConfig
|
|
53694
|
+
};
|
|
53695
|
+
let isAmplitudeInitialized = false;
|
|
53696
|
+
const initAmplitude = () => {
|
|
53697
|
+
if (isAmplitudeInitialized) return;
|
|
53698
|
+
init("14616a575f32087cf0403ab8f3ea3ce0", {
|
|
53699
|
+
appVersion: version
|
|
53700
|
+
});
|
|
53701
|
+
isAmplitudeInitialized = true;
|
|
53702
|
+
};
|
|
53703
|
+
const startAmplitudeSessionReplay = () => {
|
|
53704
|
+
if (isAmplitudeInitialized) {
|
|
53705
|
+
const plugin = sessionReplayPlugin({
|
|
53706
|
+
sampleRate: 1
|
|
53707
|
+
});
|
|
53708
|
+
add(plugin);
|
|
53709
|
+
}
|
|
53710
|
+
};
|
|
52777
53711
|
const SwapPage = () => {
|
|
52778
53712
|
var _a;
|
|
52779
53713
|
const { SettingsFooter, drawerOpen } = useSettingsDrawer();
|
|
@@ -52804,6 +53738,7 @@ const SwapPage = () => {
|
|
|
52804
53738
|
const getBalance = useGetBalance();
|
|
52805
53739
|
const callbacks = useAtomValue(callbacksAtom);
|
|
52806
53740
|
const setChainAddresses = useSetAtom(chainAddressesAtom);
|
|
53741
|
+
const setFeeRouteChainAddresses = useSetAtom(feeRouteChainAddressesAtom);
|
|
52807
53742
|
useFetchAllBalances();
|
|
52808
53743
|
useCleanupDebouncedAtoms();
|
|
52809
53744
|
useUpdateAmountWhenRouteChanges();
|
|
@@ -52926,13 +53861,16 @@ const SwapPage = () => {
|
|
|
52926
53861
|
var _a2;
|
|
52927
53862
|
const formattedUsdAmount = (_a2 = getTotalFees(fees2)) == null ? void 0 : _a2.formattedUsdAmount;
|
|
52928
53863
|
if (formattedUsdAmount) {
|
|
52929
|
-
return
|
|
53864
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(SmallText, { color: "inherit", children: [
|
|
53865
|
+
formattedUsdAmount,
|
|
53866
|
+
" in fees"
|
|
53867
|
+
] }) });
|
|
52930
53868
|
}
|
|
52931
|
-
return "no fees";
|
|
53869
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(SmallText, { color: "inherit", children: "no fees" }) });
|
|
52932
53870
|
}, [fees2]);
|
|
52933
53871
|
const feeWarning = useMemo(() => {
|
|
52934
53872
|
if (!(route2 == null ? void 0 : route2.usdAmountIn) || !(route2 == null ? void 0 : route2.usdAmountOut)) return false;
|
|
52935
|
-
return parseFloat(route2.usdAmountOut)
|
|
53873
|
+
return parseFloat(route2.usdAmountOut) < parseFloat(route2.usdAmountIn) * 0.9;
|
|
52936
53874
|
}, [route2 == null ? void 0 : route2.usdAmountIn, route2 == null ? void 0 : route2.usdAmountOut]);
|
|
52937
53875
|
const swapButton = useMemo(() => {
|
|
52938
53876
|
var _a2;
|
|
@@ -52994,6 +53932,7 @@ const SwapPage = () => {
|
|
|
52994
53932
|
}
|
|
52995
53933
|
const onClick = () => {
|
|
52996
53934
|
var _a3, _b;
|
|
53935
|
+
startAmplitudeSessionReplay();
|
|
52997
53936
|
track("swap page: continue button - clicked", {
|
|
52998
53937
|
route: route2,
|
|
52999
53938
|
type: isSwapOperation ? "swap" : "send",
|
|
@@ -53004,12 +53943,8 @@ const SwapPage = () => {
|
|
|
53004
53943
|
startTransition(() => {
|
|
53005
53944
|
setError(void 0);
|
|
53006
53945
|
setChainAddresses({});
|
|
53946
|
+
setFeeRouteChainAddresses({});
|
|
53007
53947
|
setSwapExecutionState();
|
|
53008
|
-
setUser({ username: sourceAccount == null ? void 0 : sourceAccount.address });
|
|
53009
|
-
if (sourceAccount == null ? void 0 : sourceAccount.address) {
|
|
53010
|
-
const replay = getReplay();
|
|
53011
|
-
replay == null ? void 0 : replay.start();
|
|
53012
|
-
}
|
|
53013
53948
|
setCurrentPage(Routes.SwapExecutionPage);
|
|
53014
53949
|
});
|
|
53015
53950
|
};
|
|
@@ -53101,6 +54036,7 @@ const SwapPage = () => {
|
|
|
53101
54036
|
showGoFastWarning,
|
|
53102
54037
|
isGoFast,
|
|
53103
54038
|
setChainAddresses,
|
|
54039
|
+
setFeeRouteChainAddresses,
|
|
53104
54040
|
setCurrentPage,
|
|
53105
54041
|
setSwapExecutionState,
|
|
53106
54042
|
setError
|
|
@@ -53190,6 +54126,8 @@ const HistoryArrowIcon = ({
|
|
|
53190
54126
|
);
|
|
53191
54127
|
const statusMap = {
|
|
53192
54128
|
unconfirmed: "Unconfirmed",
|
|
54129
|
+
allowance: "In Progress",
|
|
54130
|
+
validating: "In Progress",
|
|
53193
54131
|
signing: "In Progress",
|
|
53194
54132
|
broadcasted: "In Progress",
|
|
53195
54133
|
pending: "In Progress",
|
|
@@ -53205,7 +54143,10 @@ const TransactionHistoryPageHistoryItemDetails = ({
|
|
|
53205
54143
|
absoluteTimeString,
|
|
53206
54144
|
onClickDelete,
|
|
53207
54145
|
transferAssetRelease,
|
|
53208
|
-
transactionDetails
|
|
54146
|
+
transactionDetails,
|
|
54147
|
+
feeAssetRouteDetails,
|
|
54148
|
+
senderAddress,
|
|
54149
|
+
receiverAddress
|
|
53209
54150
|
}) => {
|
|
53210
54151
|
var _a;
|
|
53211
54152
|
const theme = nt();
|
|
@@ -53275,6 +54216,18 @@ const TransactionHistoryPageHistoryItemDetails = ({
|
|
|
53275
54216
|
}
|
|
53276
54217
|
)
|
|
53277
54218
|
] }),
|
|
54219
|
+
senderAddress && /* @__PURE__ */ jsxs(StyledHistoryItemDetailRow, { align: "center", children: [
|
|
54220
|
+
/* @__PURE__ */ jsx(StyledDetailsLabel, { children: "Sender" }),
|
|
54221
|
+
/* @__PURE__ */ jsx(SmallText, { normalTextColor: true, children: senderAddress })
|
|
54222
|
+
] }),
|
|
54223
|
+
receiverAddress && /* @__PURE__ */ jsxs(StyledHistoryItemDetailRow, { align: "center", children: [
|
|
54224
|
+
/* @__PURE__ */ jsx(StyledDetailsLabel, { children: "Receiver" }),
|
|
54225
|
+
/* @__PURE__ */ jsx(SmallText, { normalTextColor: true, children: receiverAddress })
|
|
54226
|
+
] }),
|
|
54227
|
+
feeAssetRouteDetails && /* @__PURE__ */ jsx(StyledHistoryItemDetailRow, { align: "center", children: /* @__PURE__ */ jsxs(Column, { width: "100%", children: [
|
|
54228
|
+
/* @__PURE__ */ jsx(Spacer, { height: 20, showLine: true, lineColor: theme.secondary.background.transparent }),
|
|
54229
|
+
/* @__PURE__ */ jsx(GasOnReceive, { hideContainer: true, routeDetails: feeAssetRouteDetails })
|
|
54230
|
+
] }) }),
|
|
53278
54231
|
/* @__PURE__ */ jsx(Row, { align: "center", style: { marginTop: 10, padding: "0px 10px" }, children: /* @__PURE__ */ jsxs(Button, { onClick: onClickDelete, gap: 5, align: "center", children: [
|
|
53279
54232
|
/* @__PURE__ */ jsx(SmallText, { color: theme.error.text, children: "Delete" }),
|
|
53280
54233
|
/* @__PURE__ */ jsx(TrashIcon, { color: theme.error.text })
|
|
@@ -53933,118 +54886,177 @@ const FilledWarningIcon = ({
|
|
|
53933
54886
|
}
|
|
53934
54887
|
)
|
|
53935
54888
|
] });
|
|
53936
|
-
const TransactionHistoryPageHistoryItem = forwardRef(
|
|
53937
|
-
|
|
53938
|
-
|
|
53939
|
-
|
|
53940
|
-
|
|
53941
|
-
|
|
53942
|
-
|
|
53943
|
-
|
|
53944
|
-
|
|
53945
|
-
|
|
53946
|
-
|
|
53947
|
-
|
|
53948
|
-
|
|
53949
|
-
|
|
53950
|
-
|
|
53951
|
-
|
|
53952
|
-
|
|
53953
|
-
|
|
53954
|
-
|
|
53955
|
-
|
|
53956
|
-
|
|
53957
|
-
|
|
53958
|
-
|
|
53959
|
-
|
|
53960
|
-
|
|
53961
|
-
|
|
53962
|
-
|
|
53963
|
-
|
|
53964
|
-
|
|
53965
|
-
|
|
53966
|
-
|
|
53967
|
-
|
|
53968
|
-
|
|
53969
|
-
|
|
53970
|
-
|
|
53971
|
-
|
|
53972
|
-
|
|
53973
|
-
|
|
53974
|
-
|
|
53975
|
-
|
|
53976
|
-
|
|
53977
|
-
|
|
53978
|
-
|
|
53979
|
-
|
|
53980
|
-
|
|
53981
|
-
|
|
53982
|
-
|
|
53983
|
-
|
|
53984
|
-
|
|
53985
|
-
|
|
53986
|
-
|
|
53987
|
-
|
|
54889
|
+
const TransactionHistoryPageHistoryItem = forwardRef(
|
|
54890
|
+
({
|
|
54891
|
+
txHistoryItem,
|
|
54892
|
+
showDetails,
|
|
54893
|
+
onClickRow,
|
|
54894
|
+
onClickDelete
|
|
54895
|
+
}, ref) => {
|
|
54896
|
+
var _a, _b;
|
|
54897
|
+
const theme = nt();
|
|
54898
|
+
const isMobileScreenSize = useIsMobileScreenSize();
|
|
54899
|
+
const historyItem = useTxHistory({
|
|
54900
|
+
txHistoryItem
|
|
54901
|
+
});
|
|
54902
|
+
const removeTransactionHistoryItem = useSetAtom(removeTransactionHistoryItemAtom);
|
|
54903
|
+
const {
|
|
54904
|
+
route: {
|
|
54905
|
+
amountIn,
|
|
54906
|
+
amountOut,
|
|
54907
|
+
sourceAssetDenom,
|
|
54908
|
+
sourceAssetChainId,
|
|
54909
|
+
destAssetDenom,
|
|
54910
|
+
destAssetChainId
|
|
54911
|
+
},
|
|
54912
|
+
timestamp,
|
|
54913
|
+
transactionDetails
|
|
54914
|
+
} = txHistoryItem;
|
|
54915
|
+
const totalSourceTokenAmount = useMemo(() => {
|
|
54916
|
+
var _a2;
|
|
54917
|
+
const totalRelatedRouteSourceAmount = ((_a2 = txHistoryItem == null ? void 0 : txHistoryItem.relatedRoutes) == null ? void 0 : _a2.reduce(
|
|
54918
|
+
(acc, routeDetail) => {
|
|
54919
|
+
var _a3;
|
|
54920
|
+
return BigNumber(acc).plus(BigNumber(((_a3 = routeDetail.route) == null ? void 0 : _a3.amountIn) || 0)).toNumber();
|
|
54921
|
+
},
|
|
54922
|
+
0
|
|
54923
|
+
)) ?? 0;
|
|
54924
|
+
return BigNumber(amountIn ?? 0).plus(BigNumber(totalRelatedRouteSourceAmount)).toString();
|
|
54925
|
+
}, [amountIn, txHistoryItem]);
|
|
54926
|
+
const sourceAssetDetails = useGetAssetDetails({
|
|
54927
|
+
assetDenom: sourceAssetDenom,
|
|
54928
|
+
chainId: sourceAssetChainId,
|
|
54929
|
+
tokenAmount: totalSourceTokenAmount
|
|
54930
|
+
});
|
|
54931
|
+
const destinationAssetDetails = useGetAssetDetails({
|
|
54932
|
+
assetDenom: destAssetDenom,
|
|
54933
|
+
chainId: destAssetChainId,
|
|
54934
|
+
tokenAmount: amountOut
|
|
54935
|
+
});
|
|
54936
|
+
const source = {
|
|
54937
|
+
amount: sourceAssetDetails.amount,
|
|
54938
|
+
asset: sourceAssetDetails.asset,
|
|
54939
|
+
assetImage: sourceAssetDetails.assetImage ?? "",
|
|
54940
|
+
chainName: sourceAssetDetails.chainName
|
|
54941
|
+
};
|
|
54942
|
+
const destination = {
|
|
54943
|
+
amount: destinationAssetDetails.amount,
|
|
54944
|
+
asset: destinationAssetDetails.asset,
|
|
54945
|
+
assetImage: destinationAssetDetails.assetImage ?? "",
|
|
54946
|
+
chainName: destinationAssetDetails.chainName
|
|
54947
|
+
};
|
|
54948
|
+
const feeAssetRouteDetails = useMemo(() => {
|
|
54949
|
+
var _a2, _b2;
|
|
54950
|
+
return ((_a2 = historyItem == null ? void 0 : historyItem.relatedRoutes) == null ? void 0 : _a2[0]) || ((_b2 = txHistoryItem == null ? void 0 : txHistoryItem.relatedRoutes) == null ? void 0 : _b2[0]);
|
|
54951
|
+
}, [historyItem, txHistoryItem]);
|
|
54952
|
+
const renderStatus = useMemo(() => {
|
|
54953
|
+
switch (historyItem == null ? void 0 : historyItem.status) {
|
|
54954
|
+
case "unconfirmed":
|
|
54955
|
+
case "pending":
|
|
54956
|
+
return /* @__PURE__ */ jsx(
|
|
54957
|
+
StyledAnimatedBorder,
|
|
54958
|
+
{
|
|
54959
|
+
width: 10,
|
|
54960
|
+
height: 10,
|
|
54961
|
+
backgroundColor: theme.primary.text.normal,
|
|
54962
|
+
status: "pending"
|
|
54963
|
+
}
|
|
54964
|
+
);
|
|
54965
|
+
case "completed":
|
|
54966
|
+
return /* @__PURE__ */ jsx(StyledGreenDot, {});
|
|
54967
|
+
case "incomplete":
|
|
54968
|
+
case "failed": {
|
|
54969
|
+
if (historyItem == null ? void 0 : historyItem.transferAssetRelease) {
|
|
54970
|
+
return /* @__PURE__ */ jsx(FilledWarningIcon, { backgroundColor: theme.warning.text });
|
|
54971
|
+
} else return /* @__PURE__ */ jsx(XIcon, { color: theme.error.text });
|
|
54972
|
+
}
|
|
54973
|
+
}
|
|
54974
|
+
}, [
|
|
54975
|
+
historyItem == null ? void 0 : historyItem.status,
|
|
54976
|
+
historyItem == null ? void 0 : historyItem.transferAssetRelease,
|
|
54977
|
+
theme.primary.text.normal,
|
|
54978
|
+
theme.error.text,
|
|
54979
|
+
theme.warning.text
|
|
54980
|
+
]);
|
|
54981
|
+
const absoluteTimeString = useMemo(() => {
|
|
54982
|
+
if (isMobileScreenSize) {
|
|
54983
|
+
return getMobileDateFormat(new Date(timestamp));
|
|
54984
|
+
}
|
|
54985
|
+
return new Date(timestamp).toLocaleString();
|
|
54986
|
+
}, [isMobileScreenSize, timestamp]);
|
|
54987
|
+
const relativeTime = useMemo(() => {
|
|
54988
|
+
if ((historyItem == null ? void 0 : historyItem.status) === "pending") {
|
|
54989
|
+
return "In Progress";
|
|
54990
|
+
}
|
|
54991
|
+
if (!timestamp) return "";
|
|
54992
|
+
return formatDistanceStrict(new Date(timestamp), /* @__PURE__ */ new Date(), {
|
|
54993
|
+
addSuffix: true
|
|
54994
|
+
}).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");
|
|
54995
|
+
}, [historyItem == null ? void 0 : historyItem.status, timestamp]);
|
|
54996
|
+
const senderAddress = useMemo(() => {
|
|
54997
|
+
var _a2, _b2;
|
|
54998
|
+
return (_b2 = (_a2 = historyItem == null ? void 0 : historyItem.userAddresses) == null ? void 0 : _a2.find(
|
|
54999
|
+
(address) => {
|
|
55000
|
+
var _a3;
|
|
55001
|
+
return address.chainId === ((_a3 = historyItem == null ? void 0 : historyItem.route) == null ? void 0 : _a3.sourceAssetChainId);
|
|
55002
|
+
}
|
|
55003
|
+
)) == null ? void 0 : _b2.address;
|
|
55004
|
+
}, [(_a = historyItem == null ? void 0 : historyItem.route) == null ? void 0 : _a.sourceAssetChainId, historyItem == null ? void 0 : historyItem.userAddresses]);
|
|
55005
|
+
const receiverAddress = useMemo(() => {
|
|
55006
|
+
var _a2, _b2, _c, _d;
|
|
55007
|
+
if ((historyItem == null ? void 0 : historyItem.transferAssetRelease) !== void 0) {
|
|
55008
|
+
return (_b2 = (_a2 = historyItem == null ? void 0 : historyItem.userAddresses) == null ? void 0 : _a2.find(
|
|
55009
|
+
(address) => {
|
|
55010
|
+
var _a3;
|
|
55011
|
+
return address.chainId === ((_a3 = historyItem == null ? void 0 : historyItem.transferAssetRelease) == null ? void 0 : _a3.chainId);
|
|
53988
55012
|
}
|
|
53989
|
-
);
|
|
53990
|
-
|
|
53991
|
-
|
|
53992
|
-
|
|
53993
|
-
|
|
53994
|
-
|
|
53995
|
-
|
|
53996
|
-
|
|
53997
|
-
|
|
53998
|
-
|
|
53999
|
-
|
|
54000
|
-
|
|
54001
|
-
|
|
54002
|
-
|
|
54003
|
-
|
|
54004
|
-
|
|
54005
|
-
|
|
54006
|
-
|
|
54007
|
-
|
|
54008
|
-
|
|
54009
|
-
|
|
54010
|
-
|
|
54011
|
-
|
|
54012
|
-
|
|
54013
|
-
|
|
54014
|
-
return "In Progress";
|
|
54015
|
-
}
|
|
54016
|
-
if (!timestamp) return "";
|
|
54017
|
-
return formatDistanceStrict(new Date(timestamp), /* @__PURE__ */ new Date(), {
|
|
54018
|
-
addSuffix: true
|
|
54019
|
-
}).replace("minutes", "mins").replace("minute", "min").replace("hours", "hrs").replace("hour", "hr").replace("seconds", "secs").replace("second", "sec").replace("months", "mos").replace("month", "mo").replace("years", "yrs").replace("year", "yr");
|
|
54020
|
-
}, [timestamp, historyStatus]);
|
|
54021
|
-
if (!txHistoryItem.route) return null;
|
|
54022
|
-
return /* @__PURE__ */ jsxs(StyledHistoryContainer, { ref, showDetails, children: [
|
|
54023
|
-
/* @__PURE__ */ jsxs(StyledHistoryItemRow, { align: "center", justify: "space-between", onClick: onClickRow, children: [
|
|
54024
|
-
/* @__PURE__ */ jsxs(Row, { gap: 8, align: "center", children: [
|
|
54025
|
-
/* @__PURE__ */ jsx(RenderAssetAmount, { ...source, sourceAsset: true }),
|
|
54026
|
-
/* @__PURE__ */ jsx(ThinArrowIcon, { color: theme.primary.text.lowContrast, direction: "right" }),
|
|
54027
|
-
/* @__PURE__ */ jsx(RenderAssetAmount, { ...destination })
|
|
55013
|
+
)) == null ? void 0 : _b2.address;
|
|
55014
|
+
}
|
|
55015
|
+
return (_d = (_c = historyItem == null ? void 0 : historyItem.userAddresses) == null ? void 0 : _c.find(
|
|
55016
|
+
(address) => {
|
|
55017
|
+
var _a3;
|
|
55018
|
+
return address.chainId === ((_a3 = historyItem == null ? void 0 : historyItem.route) == null ? void 0 : _a3.destAssetChainId);
|
|
55019
|
+
}
|
|
55020
|
+
)) == null ? void 0 : _d.address;
|
|
55021
|
+
}, [
|
|
55022
|
+
(_b = historyItem == null ? void 0 : historyItem.route) == null ? void 0 : _b.destAssetChainId,
|
|
55023
|
+
historyItem == null ? void 0 : historyItem.transferAssetRelease,
|
|
55024
|
+
historyItem == null ? void 0 : historyItem.userAddresses
|
|
55025
|
+
]);
|
|
55026
|
+
if (!txHistoryItem.route) return null;
|
|
55027
|
+
return /* @__PURE__ */ jsxs(StyledHistoryContainer, { ref, showDetails, children: [
|
|
55028
|
+
/* @__PURE__ */ jsxs(StyledHistoryItemRow, { align: "center", justify: "space-between", onClick: onClickRow, children: [
|
|
55029
|
+
/* @__PURE__ */ jsxs(Row, { gap: 8, align: "center", children: [
|
|
55030
|
+
/* @__PURE__ */ jsx(RenderAssetAmount, { ...source, sourceAsset: true }),
|
|
55031
|
+
/* @__PURE__ */ jsx(ThinArrowIcon, { color: theme.primary.text.lowContrast, direction: "right" }),
|
|
55032
|
+
/* @__PURE__ */ jsx(RenderAssetAmount, { ...destination })
|
|
55033
|
+
] }),
|
|
55034
|
+
/* @__PURE__ */ jsxs(Row, { align: "center", gap: 6, children: [
|
|
55035
|
+
/* @__PURE__ */ jsx(SmallText, { children: relativeTime }),
|
|
55036
|
+
/* @__PURE__ */ jsx(Row, { width: 20, align: "center", justify: "center", children: renderStatus })
|
|
55037
|
+
] })
|
|
54028
55038
|
] }),
|
|
54029
|
-
/* @__PURE__ */
|
|
54030
|
-
|
|
54031
|
-
|
|
54032
|
-
|
|
54033
|
-
|
|
54034
|
-
|
|
54035
|
-
|
|
54036
|
-
|
|
54037
|
-
|
|
54038
|
-
|
|
54039
|
-
|
|
54040
|
-
|
|
54041
|
-
|
|
54042
|
-
|
|
54043
|
-
|
|
54044
|
-
|
|
54045
|
-
|
|
54046
|
-
|
|
54047
|
-
});
|
|
55039
|
+
showDetails && /* @__PURE__ */ jsx(
|
|
55040
|
+
TransactionHistoryPageHistoryItemDetails,
|
|
55041
|
+
{
|
|
55042
|
+
status: historyItem == null ? void 0 : historyItem.status,
|
|
55043
|
+
transactionDetails,
|
|
55044
|
+
sourceChainName: sourceAssetDetails.chainName ?? "--",
|
|
55045
|
+
destinationChainName: destinationAssetDetails.chainName ?? "--",
|
|
55046
|
+
absoluteTimeString,
|
|
55047
|
+
onClickDelete: () => {
|
|
55048
|
+
removeTransactionHistoryItem(txHistoryItem.timestamp);
|
|
55049
|
+
onClickDelete == null ? void 0 : onClickDelete();
|
|
55050
|
+
},
|
|
55051
|
+
transferAssetRelease: historyItem == null ? void 0 : historyItem.transferAssetRelease,
|
|
55052
|
+
feeAssetRouteDetails,
|
|
55053
|
+
senderAddress,
|
|
55054
|
+
receiverAddress
|
|
55055
|
+
}
|
|
55056
|
+
)
|
|
55057
|
+
] });
|
|
55058
|
+
}
|
|
55059
|
+
);
|
|
54048
55060
|
TransactionHistoryPageHistoryItem.displayName = "TransactionHistoryPageHistoryItem";
|
|
54049
55061
|
const RenderAssetAmount = ({
|
|
54050
55062
|
amount,
|
|
@@ -54099,15 +55111,11 @@ const StyledGreenDot = dt.div`
|
|
|
54099
55111
|
border-radius: 50%;
|
|
54100
55112
|
`;
|
|
54101
55113
|
const TransactionHistoryPage = () => {
|
|
54102
|
-
var _a, _b
|
|
55114
|
+
var _a, _b;
|
|
54103
55115
|
const theme = nt();
|
|
54104
55116
|
const setCurrentPage = useSetAtom(currentPageAtom);
|
|
54105
55117
|
const [itemIndexToShowDetail, setItemIndexToShowDetail] = useState(void 0);
|
|
54106
|
-
const
|
|
54107
|
-
const historyList = useMemo(
|
|
54108
|
-
() => txHistory.sort((a, b) => b.timestamp - a.timestamp),
|
|
54109
|
-
[txHistory]
|
|
54110
|
-
);
|
|
55118
|
+
const sortedHistoryItems = useAtomValue(sortedHistoryItemsAtom);
|
|
54111
55119
|
return /* @__PURE__ */ jsxs(Column, { gap: 5, children: [
|
|
54112
55120
|
/* @__PURE__ */ jsx(
|
|
54113
55121
|
PageHeader,
|
|
@@ -54125,7 +55133,7 @@ const TransactionHistoryPage = () => {
|
|
|
54125
55133
|
/* @__PURE__ */ jsx(StyledContainer, { gap: 5, children: /* @__PURE__ */ jsx(
|
|
54126
55134
|
VirtualList,
|
|
54127
55135
|
{
|
|
54128
|
-
listItems:
|
|
55136
|
+
listItems: sortedHistoryItems,
|
|
54129
55137
|
height: 262,
|
|
54130
55138
|
empty: {
|
|
54131
55139
|
details: "No transactions yet",
|
|
@@ -54144,18 +55152,15 @@ const TransactionHistoryPage = () => {
|
|
|
54144
55152
|
item
|
|
54145
55153
|
});
|
|
54146
55154
|
setItemIndexToShowDetail((prev2) => prev2 === index ? void 0 : index);
|
|
54147
|
-
}
|
|
55155
|
+
},
|
|
55156
|
+
onClickDelete: () => setItemIndexToShowDetail(void 0)
|
|
54148
55157
|
}
|
|
54149
55158
|
),
|
|
54150
|
-
itemKey: (item) =>
|
|
54151
|
-
|
|
54152
|
-
return (_a2 = item.timestamp) == null ? void 0 : _a2.toString();
|
|
54153
|
-
},
|
|
54154
|
-
expandedItemKey: itemIndexToShowDetail ? (_c = (_b = historyList[itemIndexToShowDetail]) == null ? void 0 : _b.timestamp) == null ? void 0 : _c.toString() : void 0
|
|
55159
|
+
itemKey: (item) => item.id,
|
|
55160
|
+
expandedItemKey: itemIndexToShowDetail ? (_b = sortedHistoryItems[itemIndexToShowDetail]) == null ? void 0 : _b.id : void 0
|
|
54155
55161
|
},
|
|
54156
|
-
|
|
54157
|
-
) })
|
|
54158
|
-
/* @__PURE__ */ jsx(SwapPageFooter, {})
|
|
55162
|
+
sortedHistoryItems.length
|
|
55163
|
+
) })
|
|
54159
55164
|
] });
|
|
54160
55165
|
};
|
|
54161
55166
|
const StyledContainer = dt(Column)`
|
|
@@ -54304,195 +55309,6 @@ const useInitDefaultRoute = (defaultRoute) => {
|
|
|
54304
55309
|
setRouteToDefaultRoute(assets2);
|
|
54305
55310
|
}, [assets2, defaultRoute, setDefaultRoute, setRouteToDefaultRoute]);
|
|
54306
55311
|
};
|
|
54307
|
-
let isSentryInitialized = false;
|
|
54308
|
-
const initSentry = () => {
|
|
54309
|
-
if (isSentryInitialized) return;
|
|
54310
|
-
init({
|
|
54311
|
-
dsn: "https://10ce608bdd1c68a13d3849d6b242333c@o4504768725909504.ingest.us.sentry.io/4508485201231872",
|
|
54312
|
-
tunnel: "https://go.skip.build/api/sentry",
|
|
54313
|
-
defaultIntegrations: false,
|
|
54314
|
-
integrations: [
|
|
54315
|
-
breadcrumbsIntegration(),
|
|
54316
|
-
dedupeIntegration(),
|
|
54317
|
-
functionToStringIntegration(),
|
|
54318
|
-
httpContextIntegration(),
|
|
54319
|
-
inboundFiltersIntegration(),
|
|
54320
|
-
linkedErrorsIntegration(),
|
|
54321
|
-
browserSessionIntegration(),
|
|
54322
|
-
replayIntegration({
|
|
54323
|
-
maskAllText: false,
|
|
54324
|
-
maskAllInputs: false,
|
|
54325
|
-
blockAllMedia: false,
|
|
54326
|
-
networkDetailAllowUrls: [/^https:\/\/go\.skip\.build\//],
|
|
54327
|
-
networkRequestHeaders: ["X-Custom-Header"],
|
|
54328
|
-
networkResponseHeaders: ["X-Custom-Header"],
|
|
54329
|
-
useCompression: false
|
|
54330
|
-
})
|
|
54331
|
-
]
|
|
54332
|
-
});
|
|
54333
|
-
isSentryInitialized = true;
|
|
54334
|
-
};
|
|
54335
|
-
const name = "@skip-go/widget";
|
|
54336
|
-
const description = "Swap widget";
|
|
54337
|
-
const version = "3.12.11";
|
|
54338
|
-
const repository = {
|
|
54339
|
-
url: "https://github.com/skip-mev/skip-go",
|
|
54340
|
-
directory: "packages/widget"
|
|
54341
|
-
};
|
|
54342
|
-
const type = "module";
|
|
54343
|
-
const scripts = {
|
|
54344
|
-
dev: "vite --force --host",
|
|
54345
|
-
"dev:visual-test": "VISUAL_TEST=true yarn dev",
|
|
54346
|
-
"dev:storybook": "storybook dev -p 6006",
|
|
54347
|
-
build: "npm run generate-chains && NODE_OPTIONS=--max-old-space-size=16384 vite build",
|
|
54348
|
-
"watch:build": "vite build --watch",
|
|
54349
|
-
lint: "NODE_OPTIONS=--max-old-space-size=32384 eslint . --fix",
|
|
54350
|
-
preview: "vite preview",
|
|
54351
|
-
"build:web-component": "NODE_OPTIONS=--max-old-space-size=32384 webpack --config webpack.config.js",
|
|
54352
|
-
"publish:web-component": "npm run build:web-component && cd web-component && npm publish && cd ..",
|
|
54353
|
-
prepack: "yarn run pre",
|
|
54354
|
-
postpack: "yarn run post",
|
|
54355
|
-
pre: "npm run build && node scripts/prepublish.cjs",
|
|
54356
|
-
post: "git checkout -- package.json",
|
|
54357
|
-
"generate-chains": "node scripts/generate-chains.cjs",
|
|
54358
|
-
"update-registries": "yarn up @initia/initia-registry chain-registry",
|
|
54359
|
-
test: "yarn playwright test",
|
|
54360
|
-
"update-screenshots": "UPDATE_SCREENSHOTS=true yarn playwright test Keplr.test.tsx",
|
|
54361
|
-
"combine-images": "node scripts/combine-images.mjs"
|
|
54362
|
-
};
|
|
54363
|
-
const exports = {
|
|
54364
|
-
".": {
|
|
54365
|
-
types: "./build/index.d.ts",
|
|
54366
|
-
"import": "./build/index.js"
|
|
54367
|
-
}
|
|
54368
|
-
};
|
|
54369
|
-
const types = "./build/index.d.ts";
|
|
54370
|
-
const files = [
|
|
54371
|
-
"build",
|
|
54372
|
-
"README.md"
|
|
54373
|
-
];
|
|
54374
|
-
const devDependencies = {
|
|
54375
|
-
"@chromatic-com/storybook": "^1.6.1",
|
|
54376
|
-
"@eslint/js": "^9.9.0",
|
|
54377
|
-
"@initia/initia-registry": "^1.0.6",
|
|
54378
|
-
"@keplr-wallet/types": "^0.12.125",
|
|
54379
|
-
"@playwright/test": "^1.51.1",
|
|
54380
|
-
"@storybook/addon-essentials": "^8.2.6",
|
|
54381
|
-
"@storybook/addon-interactions": "^8.2.6",
|
|
54382
|
-
"@storybook/addon-links": "^8.2.6",
|
|
54383
|
-
"@storybook/addon-onboarding": "^8.2.6",
|
|
54384
|
-
"@storybook/blocks": "^8.2.6",
|
|
54385
|
-
"@storybook/react": "^8.2.6",
|
|
54386
|
-
"@storybook/react-vite": "^8.2.6",
|
|
54387
|
-
"@storybook/test": "^8.2.6",
|
|
54388
|
-
"@testing-library/dom": "^10.4.0",
|
|
54389
|
-
"@testing-library/react": "^16.2.0",
|
|
54390
|
-
"@types/eslint__js": "^8.42.3",
|
|
54391
|
-
"@types/pluralize": "^0.0.33",
|
|
54392
|
-
"@types/pngjs": "^6.0.5",
|
|
54393
|
-
"@types/react": "^19.0.10",
|
|
54394
|
-
"@types/react-dom": "^19.0.4",
|
|
54395
|
-
"@typescript-eslint/eslint-plugin": "^7.15.0",
|
|
54396
|
-
"@typescript-eslint/parser": "^7.15.0",
|
|
54397
|
-
"@vitejs/plugin-react": "^4.3.1",
|
|
54398
|
-
buffer: "^6.0.3",
|
|
54399
|
-
"chain-registry": "^2.0.11",
|
|
54400
|
-
download: "^8.0.0",
|
|
54401
|
-
eslint: "^9.9.0",
|
|
54402
|
-
"eslint-config-prettier": "^9.1.0",
|
|
54403
|
-
"eslint-plugin-prettier": "^5.2.1",
|
|
54404
|
-
"eslint-plugin-react-hooks": "^4.6.2",
|
|
54405
|
-
"fs-extra": "^11.3.0",
|
|
54406
|
-
"node-polyfill-webpack-plugin": "^4.0.0",
|
|
54407
|
-
"pino-pretty": "^13.0.0",
|
|
54408
|
-
pixelmatch: "^7.1.0",
|
|
54409
|
-
pngjs: "^7.0.0",
|
|
54410
|
-
"postcss-loader": "^8.1.1",
|
|
54411
|
-
prettier: "^3.4.2",
|
|
54412
|
-
process: "^0.11.10",
|
|
54413
|
-
pureimage: "^0.4.18",
|
|
54414
|
-
"raw-loader": "^4.0.2",
|
|
54415
|
-
react: ">=17.0.0",
|
|
54416
|
-
"react-dom": ">=17.0.0",
|
|
54417
|
-
starknet: "6.11.0",
|
|
54418
|
-
storybook: "^8.2.6",
|
|
54419
|
-
"ts-loader": "^9.5.1",
|
|
54420
|
-
typescript: "^5.5.4",
|
|
54421
|
-
"typescript-eslint": "^8.2.0",
|
|
54422
|
-
"url-loader": "^4.1.1",
|
|
54423
|
-
vite: "^5.3.4",
|
|
54424
|
-
"vite-plugin-dts": "^4.0.0-beta.1",
|
|
54425
|
-
"vite-plugin-node-polyfills": "^0.22.0",
|
|
54426
|
-
webpack: "^5.94.0",
|
|
54427
|
-
"webpack-cli": "^5.1.4"
|
|
54428
|
-
};
|
|
54429
|
-
const peerDependencies = {
|
|
54430
|
-
"@tanstack/react-query": "^5.51.21",
|
|
54431
|
-
react: ">=17.0.0",
|
|
54432
|
-
"react-dom": ">=17.0.0",
|
|
54433
|
-
viem: "^2.21.55",
|
|
54434
|
-
wagmi: "^2.14.1"
|
|
54435
|
-
};
|
|
54436
|
-
const dependencies = {
|
|
54437
|
-
"@amplitude/analytics-browser": "^2.11.12",
|
|
54438
|
-
"@amplitude/plugin-session-replay-browser": "^1.16.5",
|
|
54439
|
-
"@cosmjs/amino": "0.33.1",
|
|
54440
|
-
"@cosmjs/cosmwasm-stargate": "0.33.1",
|
|
54441
|
-
"@cosmjs/encoding": "0.33.1",
|
|
54442
|
-
"@cosmjs/math": "0.33.1",
|
|
54443
|
-
"@cosmjs/proto-signing": "0.33.1",
|
|
54444
|
-
"@cosmjs/stargate": "0.33.1",
|
|
54445
|
-
"@ebay/nice-modal-react": "^1.2.13",
|
|
54446
|
-
"@eslint/compat": "^1.1.1",
|
|
54447
|
-
"@penumbra-zone/bech32m": "^13.0.0",
|
|
54448
|
-
"@penumbra-zone/client": "^24.0.0",
|
|
54449
|
-
"@penumbra-zone/protobuf": "^7.2.0",
|
|
54450
|
-
"@penumbra-zone/transport-dom": "^7.5.0",
|
|
54451
|
-
"@r2wc/react-to-web-component": "^2.0.3",
|
|
54452
|
-
"@sentry/react": "^8.46.0",
|
|
54453
|
-
"@skip-go/client": "workspace:^",
|
|
54454
|
-
"@solana/spl-token": "^0.4.8",
|
|
54455
|
-
"@solana/wallet-adapter-ledger": "^0.9.25",
|
|
54456
|
-
"@solana/wallet-adapter-react": "^0.15.39",
|
|
54457
|
-
"@solana/wallet-adapter-wallets": "^0.19.37",
|
|
54458
|
-
"@solana/web3.js": "^1.95.8",
|
|
54459
|
-
"@tanstack/query-core": "^5.51.21",
|
|
54460
|
-
"@walletconnect/modal": "^2.7.0",
|
|
54461
|
-
"@walletconnect/sign-client": "^2.20.3",
|
|
54462
|
-
"@walletconnect/solana-adapter": "^0.0.8",
|
|
54463
|
-
add: "^2.0.6",
|
|
54464
|
-
bech32: "^2.0.0",
|
|
54465
|
-
graz: "0.3.2",
|
|
54466
|
-
jotai: "^2.10.1",
|
|
54467
|
-
"jotai-effect": "^1.0.2",
|
|
54468
|
-
"jotai-tanstack-query": "^0.8.6",
|
|
54469
|
-
"lodash.debounce": "^4.0.8",
|
|
54470
|
-
pluralize: "^8.0.0",
|
|
54471
|
-
"rc-virtual-list": "^3.14.5",
|
|
54472
|
-
"react-error-boundary": "^4.0.13",
|
|
54473
|
-
"react-shadow-scope": "^1.0.5",
|
|
54474
|
-
"styled-components": "^6.1.13",
|
|
54475
|
-
yarn: "^1.22.22",
|
|
54476
|
-
zod: "^3.23.8"
|
|
54477
|
-
};
|
|
54478
|
-
const publishConfig = {
|
|
54479
|
-
access: "public"
|
|
54480
|
-
};
|
|
54481
|
-
const packageJson = {
|
|
54482
|
-
name,
|
|
54483
|
-
description,
|
|
54484
|
-
version,
|
|
54485
|
-
repository,
|
|
54486
|
-
type,
|
|
54487
|
-
scripts,
|
|
54488
|
-
exports,
|
|
54489
|
-
types,
|
|
54490
|
-
files,
|
|
54491
|
-
devDependencies,
|
|
54492
|
-
peerDependencies,
|
|
54493
|
-
dependencies,
|
|
54494
|
-
publishConfig
|
|
54495
|
-
};
|
|
54496
55312
|
const useMobileRouteConfig = () => {
|
|
54497
55313
|
const isMobile2 = useIsMobileScreenSize();
|
|
54498
55314
|
const setRouteConfig = useSetAtom(routeConfigAtom);
|
|
@@ -54503,24 +55319,11 @@ const useMobileRouteConfig = () => {
|
|
|
54503
55319
|
}));
|
|
54504
55320
|
}, [isMobile2, setRouteConfig]);
|
|
54505
55321
|
};
|
|
54506
|
-
const initAmplitude = () => {
|
|
54507
|
-
init$1("14616a575f32087cf0403ab8f3ea3ce0", {
|
|
54508
|
-
appVersion: version
|
|
54509
|
-
});
|
|
54510
|
-
const plugin = sessionReplayPlugin({
|
|
54511
|
-
sampleRate: 1
|
|
54512
|
-
});
|
|
54513
|
-
add(plugin);
|
|
54514
|
-
};
|
|
54515
55322
|
const useInitWidget = (props) => {
|
|
54516
55323
|
var _a, _b;
|
|
54517
|
-
if (props.enableSentrySessionReplays) {
|
|
54518
|
-
initSentry();
|
|
54519
|
-
}
|
|
54520
55324
|
if (props.enableAmplitudeAnalytics) {
|
|
54521
55325
|
initAmplitude();
|
|
54522
55326
|
}
|
|
54523
|
-
setTag("widget_version", version);
|
|
54524
55327
|
useInitDefaultRoute(props.defaultRoute);
|
|
54525
55328
|
useInitGetSigners(props);
|
|
54526
55329
|
useMobileRouteConfig();
|
|
@@ -54545,16 +55348,18 @@ const useInitWidget = (props) => {
|
|
|
54545
55348
|
const getSigners = useAtomValue(getConnectedSignersAtom);
|
|
54546
55349
|
const wallets = useAtomValue(walletsAtom);
|
|
54547
55350
|
const mergedSkipClientConfig = useMemo(() => {
|
|
54548
|
-
const { apiUrl, chainIdsToAffiliates, endpointOptions: endpointOptions2 } = props;
|
|
55351
|
+
const { apiUrl, chainIdsToAffiliates, endpointOptions: endpointOptions2, apiKey } = props;
|
|
54549
55352
|
const fromWidgetProps = {
|
|
54550
55353
|
apiUrl,
|
|
54551
55354
|
chainIdsToAffiliates,
|
|
54552
|
-
endpointOptions: endpointOptions2
|
|
55355
|
+
endpointOptions: endpointOptions2,
|
|
55356
|
+
apiKey
|
|
54553
55357
|
};
|
|
54554
55358
|
return {
|
|
54555
55359
|
apiUrl: fromWidgetProps.apiUrl ?? defaultSkipClientConfig.apiUrl,
|
|
54556
55360
|
endpointOptions: fromWidgetProps.endpointOptions ?? defaultSkipClientConfig.endpointOptions,
|
|
54557
|
-
chainIdsToAffiliates: fromWidgetProps.chainIdsToAffiliates ?? {}
|
|
55361
|
+
chainIdsToAffiliates: fromWidgetProps.chainIdsToAffiliates ?? {},
|
|
55362
|
+
apiKey: fromWidgetProps.apiKey
|
|
54558
55363
|
};
|
|
54559
55364
|
}, [props]);
|
|
54560
55365
|
const mergedTheme = useMemo(() => {
|
|
@@ -54706,6 +55511,130 @@ const useInitGetSigners = (props) => {
|
|
|
54706
55511
|
}));
|
|
54707
55512
|
}, [props.getCosmosSigner, props.getEvmSigner, props.getSvmSigner, setGetSigners]);
|
|
54708
55513
|
};
|
|
55514
|
+
const updateHistoryFromCamelCaseToRouteDetails = () => {
|
|
55515
|
+
const { set } = jotaiStore;
|
|
55516
|
+
try {
|
|
55517
|
+
const transactionHistoryVersion = JSON.parse(
|
|
55518
|
+
localStorage.getItem(LOCAL_STORAGE_KEYS.transactionHistoryVersion) ?? "0"
|
|
55519
|
+
);
|
|
55520
|
+
const transactionHistory = JSON.parse(
|
|
55521
|
+
localStorage.getItem(LOCAL_STORAGE_KEYS.transactionHistory) ?? "[]"
|
|
55522
|
+
);
|
|
55523
|
+
if (!transactionHistory) {
|
|
55524
|
+
throw new Error("transactionHistory not found in localStorage");
|
|
55525
|
+
}
|
|
55526
|
+
if (transactionHistoryVersion === HISTORY_VERSION.camelCase) {
|
|
55527
|
+
const updatedTransactionHistory = transactionHistory.map(
|
|
55528
|
+
(txHistoryItem) => {
|
|
55529
|
+
var _a, _b, _c, _d;
|
|
55530
|
+
return {
|
|
55531
|
+
id: v4(),
|
|
55532
|
+
timestamp: txHistoryItem.timestamp,
|
|
55533
|
+
route: getSimpleRoute(txHistoryItem.route),
|
|
55534
|
+
status: txHistoryItem.status,
|
|
55535
|
+
txsRequired: (_a = txHistoryItem.route) == null ? void 0 : _a.txsRequired,
|
|
55536
|
+
txsSigned: txHistoryItem.signatures,
|
|
55537
|
+
transactionDetails: getTransactionDetailsWithSimpleTransactionDetailsStatus(
|
|
55538
|
+
txHistoryItem.transactionDetails
|
|
55539
|
+
),
|
|
55540
|
+
transferEvents: txHistoryItem.transferEvents,
|
|
55541
|
+
transferAssetRelease: txHistoryItem.transferAssetRelease ?? ((_d = (_c = (_b = txHistoryItem.transactionDetails) == null ? void 0 : _b.at(-1)) == null ? void 0 : _c.status) == null ? void 0 : _d.transferAssetRelease)
|
|
55542
|
+
};
|
|
55543
|
+
}
|
|
55544
|
+
);
|
|
55545
|
+
localStorage.setItem(
|
|
55546
|
+
LOCAL_STORAGE_KEYS.transactionHistory,
|
|
55547
|
+
JSON.stringify(updatedTransactionHistory)
|
|
55548
|
+
);
|
|
55549
|
+
console.info(
|
|
55550
|
+
`updated from transactionHistoryVersion ${HISTORY_VERSION.camelCase} to ${HISTORY_VERSION.routeDetails}`
|
|
55551
|
+
);
|
|
55552
|
+
set(transactionHistoryVersionAtom, HISTORY_VERSION.routeDetails);
|
|
55553
|
+
}
|
|
55554
|
+
} catch {
|
|
55555
|
+
console.warn(
|
|
55556
|
+
`Failed to update transactionHistoryVersion from ${HISTORY_VERSION.camelCase} to ${HISTORY_VERSION.routeDetails}`
|
|
55557
|
+
);
|
|
55558
|
+
}
|
|
55559
|
+
};
|
|
55560
|
+
const getSimpleRoute = (route2) => {
|
|
55561
|
+
return {
|
|
55562
|
+
amountIn: route2 == null ? void 0 : route2.amountIn,
|
|
55563
|
+
amountOut: route2 == null ? void 0 : route2.amountOut,
|
|
55564
|
+
sourceAssetDenom: route2 == null ? void 0 : route2.sourceAssetDenom,
|
|
55565
|
+
sourceAssetChainId: route2 == null ? void 0 : route2.sourceAssetChainId,
|
|
55566
|
+
destAssetDenom: route2 == null ? void 0 : route2.destAssetDenom,
|
|
55567
|
+
destAssetChainId: route2 == null ? void 0 : route2.destAssetChainId,
|
|
55568
|
+
estimatedRouteDurationSeconds: route2 == null ? void 0 : route2.estimatedRouteDurationSeconds
|
|
55569
|
+
};
|
|
55570
|
+
};
|
|
55571
|
+
const getTransactionStatus = (state) => {
|
|
55572
|
+
switch (state) {
|
|
55573
|
+
case "STATE_SUBMITTED":
|
|
55574
|
+
case "STATE_PENDING":
|
|
55575
|
+
return "pending";
|
|
55576
|
+
case "STATE_COMPLETED_SUCCESS":
|
|
55577
|
+
return "success";
|
|
55578
|
+
case "STATE_COMPLETED_ERROR":
|
|
55579
|
+
case "STATE_PENDING_ERROR":
|
|
55580
|
+
return "failed";
|
|
55581
|
+
default:
|
|
55582
|
+
return "pending";
|
|
55583
|
+
}
|
|
55584
|
+
};
|
|
55585
|
+
const getTransactionDetailsWithSimpleTransactionDetailsStatus = (transactionDetails) => {
|
|
55586
|
+
return transactionDetails.map((txDetails) => {
|
|
55587
|
+
var _a;
|
|
55588
|
+
return {
|
|
55589
|
+
...txDetails,
|
|
55590
|
+
status: getTransactionStatus((_a = txDetails.status) == null ? void 0 : _a.state)
|
|
55591
|
+
};
|
|
55592
|
+
});
|
|
55593
|
+
};
|
|
55594
|
+
const updateHistoryFromRouteDetailsToUserAddresses = () => {
|
|
55595
|
+
const { set } = jotaiStore;
|
|
55596
|
+
try {
|
|
55597
|
+
const transactionHistoryVersion = JSON.parse(
|
|
55598
|
+
localStorage.getItem(LOCAL_STORAGE_KEYS.transactionHistoryVersion) ?? "0"
|
|
55599
|
+
);
|
|
55600
|
+
const transactionHistory = JSON.parse(
|
|
55601
|
+
localStorage.getItem(LOCAL_STORAGE_KEYS.transactionHistory) ?? "[]"
|
|
55602
|
+
);
|
|
55603
|
+
if (!transactionHistory) {
|
|
55604
|
+
throw new Error("transactionHistory not found in localStorage");
|
|
55605
|
+
}
|
|
55606
|
+
if (transactionHistoryVersion === HISTORY_VERSION.routeDetails) {
|
|
55607
|
+
const updatedTransactionHistory = transactionHistory.map((txHistoryItem) => {
|
|
55608
|
+
const { senderAddress, receiverAddress, ...rest } = txHistoryItem;
|
|
55609
|
+
return {
|
|
55610
|
+
...rest,
|
|
55611
|
+
userAddresses: [
|
|
55612
|
+
{
|
|
55613
|
+
chainId: txHistoryItem.route.sourceAssetChainId,
|
|
55614
|
+
address: senderAddress
|
|
55615
|
+
},
|
|
55616
|
+
{
|
|
55617
|
+
chainId: txHistoryItem.route.destAssetChainId,
|
|
55618
|
+
address: receiverAddress
|
|
55619
|
+
}
|
|
55620
|
+
]
|
|
55621
|
+
};
|
|
55622
|
+
});
|
|
55623
|
+
localStorage.setItem(
|
|
55624
|
+
LOCAL_STORAGE_KEYS.transactionHistory,
|
|
55625
|
+
JSON.stringify(updatedTransactionHistory)
|
|
55626
|
+
);
|
|
55627
|
+
console.info(
|
|
55628
|
+
`updated from transactionHistoryVersion ${HISTORY_VERSION.routeDetails} to ${HISTORY_VERSION.userAddresses}`
|
|
55629
|
+
);
|
|
55630
|
+
set(transactionHistoryVersionAtom, HISTORY_VERSION.userAddresses);
|
|
55631
|
+
}
|
|
55632
|
+
} catch {
|
|
55633
|
+
console.warn(
|
|
55634
|
+
`Failed to update transactionHistoryVersion from ${HISTORY_VERSION.routeDetails} to ${HISTORY_VERSION.userAddresses}`
|
|
55635
|
+
);
|
|
55636
|
+
}
|
|
55637
|
+
};
|
|
54709
55638
|
const migrateOldLocalStorageValues = () => {
|
|
54710
55639
|
if (typeof window === "undefined") return;
|
|
54711
55640
|
const { set } = jotaiStore;
|
|
@@ -54745,6 +55674,8 @@ const migrateOldLocalStorageValues = () => {
|
|
|
54745
55674
|
console.warn(`Failed to migrate localStorage key "${key}":`, err);
|
|
54746
55675
|
}
|
|
54747
55676
|
});
|
|
55677
|
+
updateHistoryFromCamelCaseToRouteDetails();
|
|
55678
|
+
updateHistoryFromRouteDetailsToUserAddresses();
|
|
54748
55679
|
};
|
|
54749
55680
|
function toCamelCase(obj) {
|
|
54750
55681
|
return convertKeys(obj, (key) => {
|