@skip-go/widget 3.10.7 → 3.10.8
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import o, { useContext, useState, useMemo, useEffect, useRef, useDebugValue, createElement, useCallback, Fragment as Fragment$1, forwardRef } from "react";
|
|
2
|
+
import o, { useContext, useState, useMemo, useEffect, useRef, useDebugValue, createElement, useCallback, Fragment as Fragment$1, memo, forwardRef } from "react";
|
|
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";
|
|
@@ -2131,6 +2131,20 @@ const iconMap = {
|
|
|
2131
2131
|
/* goFast */
|
|
2132
2132
|
]: GoFastIcon
|
|
2133
2133
|
};
|
|
2134
|
+
const isBrowser = typeof window !== "undefined" && typeof window.navigator !== "undefined";
|
|
2135
|
+
function isMobile() {
|
|
2136
|
+
if (!isBrowser) {
|
|
2137
|
+
return false;
|
|
2138
|
+
}
|
|
2139
|
+
return window.matchMedia("(pointer:coarse)").matches || !!window.navigator.userAgent.match(/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u);
|
|
2140
|
+
}
|
|
2141
|
+
function isWindows() {
|
|
2142
|
+
var _a;
|
|
2143
|
+
return (
|
|
2144
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2145
|
+
((_a = window.navigator.userAgentData) == null ? void 0 : _a.platform.startsWith("Win")) ?? navigator.platform.startsWith("Win")
|
|
2146
|
+
);
|
|
2147
|
+
}
|
|
2134
2148
|
const removeButtonStyles = lt`
|
|
2135
2149
|
background: none;
|
|
2136
2150
|
border: none;
|
|
@@ -2194,6 +2208,7 @@ const Text = dt(SmallText)`
|
|
|
2194
2208
|
font-size: 20px;
|
|
2195
2209
|
font-weight: 400;
|
|
2196
2210
|
letter-spacing: 0;
|
|
2211
|
+
${({ useWindowsTextHack }) => useWindowsTextHack && isWindows() ? "margin-bottom: -4px" : ""};
|
|
2197
2212
|
${textProps}
|
|
2198
2213
|
`;
|
|
2199
2214
|
const TextButton = dt(Text).attrs({ as: "button" })`
|
|
@@ -4155,14 +4170,33 @@ const PillButtonLink = dt(PillButton).attrs({
|
|
|
4155
4170
|
color: ${({ theme }) => theme.primary.text.lowContrast};
|
|
4156
4171
|
text-decoration: none;
|
|
4157
4172
|
`;
|
|
4158
|
-
const
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4173
|
+
const PageHeader = ({
|
|
4174
|
+
leftButton,
|
|
4175
|
+
centerButton,
|
|
4176
|
+
rightButton,
|
|
4177
|
+
rightContent
|
|
4178
|
+
}) => {
|
|
4179
|
+
const renderIcon = (icon) => {
|
|
4180
|
+
if (o.isValidElement(icon)) {
|
|
4181
|
+
return () => icon;
|
|
4182
|
+
}
|
|
4183
|
+
if (icon && icon in iconMap) {
|
|
4184
|
+
return iconMap[icon];
|
|
4185
|
+
}
|
|
4186
|
+
return () => null;
|
|
4187
|
+
};
|
|
4188
|
+
const LeftIcon = renderIcon(leftButton == null ? void 0 : leftButton.icon);
|
|
4189
|
+
const CenterIcon = renderIcon(centerButton == null ? void 0 : centerButton.icon);
|
|
4190
|
+
const RightIcon = renderIcon(rightButton == null ? void 0 : rightButton.icon);
|
|
4191
|
+
return /* @__PURE__ */ jsxs(StyledPageHeaderContainer, { align: "center", justify: "space-between", children: [
|
|
4162
4192
|
/* @__PURE__ */ jsx(Row, { align: "center", gap: 10, children: leftButton && /* @__PURE__ */ jsxs(GhostButton, { gap: 5, align: "center", onClick: leftButton.onClick, children: [
|
|
4163
4193
|
/* @__PURE__ */ jsx(LeftIcon, {}),
|
|
4164
4194
|
leftButton.label
|
|
4165
4195
|
] }) }),
|
|
4196
|
+
/* @__PURE__ */ jsx(CenterContainer, { children: centerButton && /* @__PURE__ */ jsxs(GhostButton, { gap: 5, align: "center", onClick: centerButton.onClick, children: [
|
|
4197
|
+
/* @__PURE__ */ jsx(CenterIcon, {}),
|
|
4198
|
+
centerButton.label
|
|
4199
|
+
] }) }),
|
|
4166
4200
|
/* @__PURE__ */ jsxs(Row, { align: "center", gap: 10, children: [
|
|
4167
4201
|
rightContent,
|
|
4168
4202
|
rightButton && /* @__PURE__ */ jsxs(GhostButton, { gap: 5, align: "center", onClick: rightButton.onClick, children: [
|
|
@@ -4172,8 +4206,14 @@ const SwapPageHeader = ({ leftButton, rightButton, rightContent }) => {
|
|
|
4172
4206
|
] })
|
|
4173
4207
|
] });
|
|
4174
4208
|
};
|
|
4175
|
-
const
|
|
4209
|
+
const StyledPageHeaderContainer = dt(Row)`
|
|
4176
4210
|
height: 30px;
|
|
4211
|
+
position: relative;
|
|
4212
|
+
`;
|
|
4213
|
+
const CenterContainer = dt.div`
|
|
4214
|
+
position: absolute;
|
|
4215
|
+
left: 50%;
|
|
4216
|
+
transform: translateX(-50%);
|
|
4177
4217
|
`;
|
|
4178
4218
|
const WarningPageBadPrice = ({
|
|
4179
4219
|
onClickContinue,
|
|
@@ -4267,7 +4307,7 @@ const WarningPageBadPrice = ({
|
|
|
4267
4307
|
const { title, descriptionContent } = errorPageContent;
|
|
4268
4308
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4269
4309
|
/* @__PURE__ */ jsx(
|
|
4270
|
-
|
|
4310
|
+
PageHeader,
|
|
4271
4311
|
{
|
|
4272
4312
|
leftButton: {
|
|
4273
4313
|
label: "Back",
|
|
@@ -4326,7 +4366,7 @@ const ExpectedErrorPageAuthFailed = ({ onClickBack }) => {
|
|
|
4326
4366
|
};
|
|
4327
4367
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4328
4368
|
/* @__PURE__ */ jsx(
|
|
4329
|
-
|
|
4369
|
+
PageHeader,
|
|
4330
4370
|
{
|
|
4331
4371
|
leftButton: {
|
|
4332
4372
|
label: "Back",
|
|
@@ -4398,7 +4438,7 @@ const UnexpectedErrorPageTransactionFailed = ({
|
|
|
4398
4438
|
const setCurrentPage = useSetAtom(currentPageAtom);
|
|
4399
4439
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4400
4440
|
/* @__PURE__ */ jsx(
|
|
4401
|
-
|
|
4441
|
+
PageHeader,
|
|
4402
4442
|
{
|
|
4403
4443
|
leftButton: {
|
|
4404
4444
|
label: "Back",
|
|
@@ -4473,7 +4513,7 @@ const UnexpectedErrorPageUnexpected = ({
|
|
|
4473
4513
|
};
|
|
4474
4514
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4475
4515
|
/* @__PURE__ */ jsx(
|
|
4476
|
-
|
|
4516
|
+
PageHeader,
|
|
4477
4517
|
{
|
|
4478
4518
|
leftButton: {
|
|
4479
4519
|
label: "Back",
|
|
@@ -4794,7 +4834,7 @@ const useBroadcastedTxsStatus = ({
|
|
|
4794
4834
|
setPrevData(resData);
|
|
4795
4835
|
return resData;
|
|
4796
4836
|
},
|
|
4797
|
-
enabled: !isSettled && (!!txs && txs.length > 0 && enabled !== void 0 ? enabled : true),
|
|
4837
|
+
enabled: txsRequired !== void 0 && txs !== void 0 && !isSettled && (!!txs && txs.length > 0 && enabled !== void 0 ? enabled : true),
|
|
4798
4838
|
refetchInterval: 500,
|
|
4799
4839
|
// to make the data persist when query key changed
|
|
4800
4840
|
initialData: prevData
|
|
@@ -5260,8 +5300,8 @@ const setTransactionHistoryAtom = atom$1(
|
|
|
5260
5300
|
null,
|
|
5261
5301
|
(get, set, index, historyItem) => {
|
|
5262
5302
|
const history = get(transactionHistoryAtom);
|
|
5263
|
-
const
|
|
5264
|
-
const
|
|
5303
|
+
const newHistory = [...history];
|
|
5304
|
+
const oldHistoryItem = newHistory[index] ?? {};
|
|
5265
5305
|
newHistory[index] = { ...oldHistoryItem, ...historyItem };
|
|
5266
5306
|
set(transactionHistoryAtom, newHistory);
|
|
5267
5307
|
}
|
|
@@ -5284,8 +5324,9 @@ atomWithQuery((get) => {
|
|
|
5284
5324
|
queryFn: async () => {
|
|
5285
5325
|
const nestedTransactionHistoryPromises = transactionHistory.map(
|
|
5286
5326
|
async (transactionHistoryItem) => {
|
|
5327
|
+
var _a;
|
|
5287
5328
|
const transactionDetailsPromises = await Promise.all(
|
|
5288
|
-
transactionHistoryItem.transactionDetails.map(async (transactionDetail) => {
|
|
5329
|
+
(_a = transactionHistoryItem.transactionDetails) == null ? void 0 : _a.map(async (transactionDetail) => {
|
|
5289
5330
|
if (transactionHistoryItem.status !== "completed" && transactionHistoryItem.status !== "failed") {
|
|
5290
5331
|
return await transactionStatus(transactionDetail);
|
|
5291
5332
|
}
|
|
@@ -43478,7 +43519,7 @@ function walletConnect(parameters) {
|
|
|
43478
43519
|
const optionalChains = config2.chains.map((x2) => x2.id);
|
|
43479
43520
|
if (!optionalChains.length)
|
|
43480
43521
|
return;
|
|
43481
|
-
const { EthereumProvider } = await import("./index.es-
|
|
43522
|
+
const { EthereumProvider } = await import("./index.es-BHI6rKwj.js");
|
|
43482
43523
|
return await EthereumProvider.init({
|
|
43483
43524
|
...parameters,
|
|
43484
43525
|
disableProviderPing: true,
|
|
@@ -43678,13 +43719,6 @@ function walletConnect(parameters) {
|
|
|
43678
43719
|
}
|
|
43679
43720
|
}));
|
|
43680
43721
|
}
|
|
43681
|
-
const isBrowser = typeof window !== "undefined" && typeof window.navigator !== "undefined";
|
|
43682
|
-
function isMobile() {
|
|
43683
|
-
if (!isBrowser) {
|
|
43684
|
-
return false;
|
|
43685
|
-
}
|
|
43686
|
-
return window.matchMedia("(pointer:coarse)").matches || !!window.navigator.userAgent.match(/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u);
|
|
43687
|
-
}
|
|
43688
43722
|
const formaTestnet = defineChain$1({
|
|
43689
43723
|
id: 984123,
|
|
43690
43724
|
name: "Forma Testnet",
|
|
@@ -43812,6 +43846,14 @@ const createExplorerLink = ({
|
|
|
43812
43846
|
return void 0;
|
|
43813
43847
|
}
|
|
43814
43848
|
};
|
|
43849
|
+
const createSkipExplorerLink = (transactionDetails) => {
|
|
43850
|
+
var _a, _b;
|
|
43851
|
+
const { get } = jotaiStore;
|
|
43852
|
+
const txHashCommaSeperatedList = (_a = transactionDetails == null ? void 0 : transactionDetails.map((txDetails) => txDetails.txHash)) == null ? void 0 : _a.join(",");
|
|
43853
|
+
const isTestnet = get(onlyTestnetsAtom);
|
|
43854
|
+
const initialTxChainId = (_b = transactionDetails == null ? void 0 : transactionDetails[0]) == null ? void 0 : _b.chainId;
|
|
43855
|
+
return `https://explorer.skip.build/?tx_hash=${txHashCommaSeperatedList}&chain_id=${initialTxChainId}${isTestnet ? "&is_testnet=true" : ""}`;
|
|
43856
|
+
};
|
|
43815
43857
|
var WalletAdapterNetwork;
|
|
43816
43858
|
(function(WalletAdapterNetwork2) {
|
|
43817
43859
|
WalletAdapterNetwork2["Mainnet"] = "mainnet-beta";
|
|
@@ -43895,7 +43937,10 @@ const setSwapExecutionStateAtom = atom$1(null, (get, set) => {
|
|
|
43895
43937
|
var _a2;
|
|
43896
43938
|
track("execute route: transaction updated", { txInfo });
|
|
43897
43939
|
if (((_a2 = txInfo.status) == null ? void 0 : _a2.status) !== "STATE_COMPLETED") {
|
|
43898
|
-
set(setTransactionDetailsAtom,
|
|
43940
|
+
set(setTransactionDetailsAtom, {
|
|
43941
|
+
transactionDetails: txInfo,
|
|
43942
|
+
transactionHistoryIndex
|
|
43943
|
+
});
|
|
43899
43944
|
}
|
|
43900
43945
|
},
|
|
43901
43946
|
onApproveAllowance: async ({ status, allowance }) => {
|
|
@@ -43907,6 +43952,7 @@ const setSwapExecutionStateAtom = atom$1(null, (get, set) => {
|
|
|
43907
43952
|
onTransactionBroadcast: async (txInfo) => {
|
|
43908
43953
|
var _a2;
|
|
43909
43954
|
track("execute route: transaction broadcasted", { txInfo });
|
|
43955
|
+
set(setValidatingGasBalanceAtom, { status: "completed" });
|
|
43910
43956
|
setUser({ id: txInfo == null ? void 0 : txInfo.txHash });
|
|
43911
43957
|
const chain = chains2 == null ? void 0 : chains2.find((chain2) => chain2.chainId === txInfo.chainId);
|
|
43912
43958
|
const explorerLink = createExplorerLink({
|
|
@@ -43914,11 +43960,10 @@ const setSwapExecutionStateAtom = atom$1(null, (get, set) => {
|
|
|
43914
43960
|
chainType: chain == null ? void 0 : chain.chainType,
|
|
43915
43961
|
txHash: txInfo.txHash
|
|
43916
43962
|
});
|
|
43917
|
-
set(
|
|
43918
|
-
|
|
43919
|
-
{ ...txInfo, explorerLink, status: void 0 },
|
|
43963
|
+
set(setTransactionDetailsAtom, {
|
|
43964
|
+
transactionDetails: { ...txInfo, explorerLink, status: void 0 },
|
|
43920
43965
|
transactionHistoryIndex
|
|
43921
|
-
);
|
|
43966
|
+
});
|
|
43922
43967
|
(_a2 = callbacks == null ? void 0 : callbacks.onTransactionBroadcasted) == null ? void 0 : _a2.call(callbacks, {
|
|
43923
43968
|
chainId: txInfo.chainId,
|
|
43924
43969
|
txHash: txInfo.txHash,
|
|
@@ -43955,7 +44000,9 @@ const setSwapExecutionStateAtom = atom$1(null, (get, set) => {
|
|
|
43955
44000
|
},
|
|
43956
44001
|
onTransactionSigned: async (txInfo) => {
|
|
43957
44002
|
track("execute route: transaction signed");
|
|
44003
|
+
let transactionsSigned = 0;
|
|
43958
44004
|
set(swapExecutionStateAtom, (prev2) => {
|
|
44005
|
+
transactionsSigned = (prev2.transactionsSigned ?? 0) + 1;
|
|
43959
44006
|
const clientOperations = prev2.clientOperations;
|
|
43960
44007
|
const signRequiredIndex = clientOperations.findIndex((operation) => {
|
|
43961
44008
|
return operation.signRequired && (operation.chainId === txInfo.chainId || operation.fromChainId === txInfo.chainId);
|
|
@@ -43966,19 +44013,23 @@ const setSwapExecutionStateAtom = atom$1(null, (get, set) => {
|
|
|
43966
44013
|
return {
|
|
43967
44014
|
...prev2,
|
|
43968
44015
|
clientOperations,
|
|
43969
|
-
transactionsSigned
|
|
44016
|
+
transactionsSigned
|
|
43970
44017
|
};
|
|
43971
44018
|
});
|
|
44019
|
+
const transactionHistoryItem = get(transactionHistoryAtom)[transactionHistoryIndex];
|
|
44020
|
+
set(setTransactionHistoryAtom, transactionHistoryIndex, {
|
|
44021
|
+
...transactionHistoryItem,
|
|
44022
|
+
signatures: transactionsSigned
|
|
44023
|
+
});
|
|
43972
44024
|
set(setOverallStatusAtom, "pending");
|
|
43973
44025
|
},
|
|
43974
|
-
onError: (error
|
|
44026
|
+
onError: (error) => {
|
|
43975
44027
|
var _a2, _b, _c;
|
|
43976
44028
|
const currentPage = get(currentPageAtom);
|
|
43977
44029
|
track("execute route: error", { error, route: route2 });
|
|
43978
44030
|
(_a2 = callbacks == null ? void 0 : callbacks.onTransactionFailed) == null ? void 0 : _a2.call(callbacks, {
|
|
43979
44031
|
error: error == null ? void 0 : error.message
|
|
43980
44032
|
});
|
|
43981
|
-
const lastTransaction = transactionDetailsArray == null ? void 0 : transactionDetailsArray[(transactionDetailsArray == null ? void 0 : transactionDetailsArray.length) - 1];
|
|
43982
44033
|
if (isUserRejectedRequestError(error)) {
|
|
43983
44034
|
track("expected error page: user rejected request");
|
|
43984
44035
|
if (currentPage === Routes.SwapExecutionPage) {
|
|
@@ -44008,28 +44059,6 @@ const setSwapExecutionStateAtom = atom$1(null, (get, set) => {
|
|
|
44008
44059
|
set(setOverallStatusAtom, "unconfirmed");
|
|
44009
44060
|
}
|
|
44010
44061
|
});
|
|
44011
|
-
} else if (lastTransaction == null ? void 0 : lastTransaction.explorerLink) {
|
|
44012
|
-
track("unexpected error page: transaction failed", { lastTransaction });
|
|
44013
|
-
set(errorWarningAtom, {
|
|
44014
|
-
errorWarningType: ErrorWarningType.TransactionFailed,
|
|
44015
|
-
onClickBack: () => {
|
|
44016
|
-
set(setOverallStatusAtom, "unconfirmed");
|
|
44017
|
-
},
|
|
44018
|
-
explorerLink: (lastTransaction == null ? void 0 : lastTransaction.explorerLink) ?? "",
|
|
44019
|
-
txHash: (lastTransaction == null ? void 0 : lastTransaction.txHash) ?? "",
|
|
44020
|
-
onClickContactSupport: () => {
|
|
44021
|
-
window.open("https://skip.build/discord", "_blank");
|
|
44022
|
-
}
|
|
44023
|
-
});
|
|
44024
|
-
} else {
|
|
44025
|
-
track("unexpected error page: unexpected error", { error, route: route2 });
|
|
44026
|
-
set(errorWarningAtom, {
|
|
44027
|
-
errorWarningType: ErrorWarningType.Unexpected,
|
|
44028
|
-
error,
|
|
44029
|
-
onClickBack: () => {
|
|
44030
|
-
set(setOverallStatusAtom, "unconfirmed");
|
|
44031
|
-
}
|
|
44032
|
-
});
|
|
44033
44062
|
}
|
|
44034
44063
|
},
|
|
44035
44064
|
onValidateGasBalance: async (props) => {
|
|
@@ -44046,10 +44075,10 @@ const setValidatingGasBalanceAtom = atom$1(
|
|
|
44046
44075
|
);
|
|
44047
44076
|
const setTransactionDetailsAtom = atom$1(
|
|
44048
44077
|
null,
|
|
44049
|
-
(get, set, transactionDetails, transactionHistoryIndex) => {
|
|
44078
|
+
(get, set, { transactionDetails, transactionHistoryIndex, status }) => {
|
|
44050
44079
|
const swapExecutionState = get(swapExecutionStateAtom);
|
|
44051
44080
|
const { transactionDetailsArray, route: route2 } = swapExecutionState;
|
|
44052
|
-
const newTransactionDetailsArray = transactionDetailsArray;
|
|
44081
|
+
const newTransactionDetailsArray = [...transactionDetailsArray];
|
|
44053
44082
|
const transactionIndexFound = newTransactionDetailsArray.findIndex(
|
|
44054
44083
|
(transaction) => transaction.txHash.toLowerCase() === transactionDetails.txHash.toLowerCase()
|
|
44055
44084
|
);
|
|
@@ -44065,11 +44094,16 @@ const setTransactionDetailsAtom = atom$1(
|
|
|
44065
44094
|
...swapExecutionState,
|
|
44066
44095
|
transactionDetailsArray: newTransactionDetailsArray
|
|
44067
44096
|
});
|
|
44097
|
+
const transactionHistoryItem = get(transactionHistoryAtom)[transactionHistoryIndex];
|
|
44068
44098
|
set(setTransactionHistoryAtom, transactionHistoryIndex, {
|
|
44099
|
+
...transactionHistoryItem,
|
|
44069
44100
|
route: route2,
|
|
44070
44101
|
transactionDetails: newTransactionDetailsArray,
|
|
44102
|
+
transferEvents: [],
|
|
44071
44103
|
timestamp: Date.now(),
|
|
44072
|
-
|
|
44104
|
+
isSettled: false,
|
|
44105
|
+
isSuccess: false,
|
|
44106
|
+
...status && { status }
|
|
44073
44107
|
});
|
|
44074
44108
|
}
|
|
44075
44109
|
);
|
|
@@ -44213,7 +44247,7 @@ const UnexpectedErrorPageTimeout = ({
|
|
|
44213
44247
|
}, [data == null ? void 0 : data.isSettled, errorWarning, setErrorWarning]);
|
|
44214
44248
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
44215
44249
|
/* @__PURE__ */ jsx(
|
|
44216
|
-
|
|
44250
|
+
PageHeader,
|
|
44217
44251
|
{
|
|
44218
44252
|
leftButton: {
|
|
44219
44253
|
label: "Back",
|
|
@@ -44283,7 +44317,7 @@ const WarningPageTradeAdditionalSigningRequired = ({
|
|
|
44283
44317
|
};
|
|
44284
44318
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
44285
44319
|
/* @__PURE__ */ jsx(
|
|
44286
|
-
|
|
44320
|
+
PageHeader,
|
|
44287
44321
|
{
|
|
44288
44322
|
leftButton: {
|
|
44289
44323
|
label: "Back",
|
|
@@ -44342,7 +44376,7 @@ const UnexpectedErrorPageTransactionReverted = ({
|
|
|
44342
44376
|
});
|
|
44343
44377
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
44344
44378
|
/* @__PURE__ */ jsx(
|
|
44345
|
-
|
|
44379
|
+
PageHeader,
|
|
44346
44380
|
{
|
|
44347
44381
|
leftButton: {
|
|
44348
44382
|
label: "Back",
|
|
@@ -44416,7 +44450,7 @@ const WarningPageCosmosLedger = ({ onClickBack }) => {
|
|
|
44416
44450
|
const theme = nt();
|
|
44417
44451
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
44418
44452
|
/* @__PURE__ */ jsx(
|
|
44419
|
-
|
|
44453
|
+
PageHeader,
|
|
44420
44454
|
{
|
|
44421
44455
|
leftButton: {
|
|
44422
44456
|
label: "Back",
|
|
@@ -44965,7 +44999,7 @@ const filterOutAtom = atom$1();
|
|
|
44965
44999
|
const filterOutUnlessUserHasBalanceAtom = atom$1();
|
|
44966
45000
|
const useGroupedAssetByRecommendedSymbol = ({
|
|
44967
45001
|
context
|
|
44968
|
-
}) => {
|
|
45002
|
+
} = {}) => {
|
|
44969
45003
|
const { data: _assets } = useAtomValue(skipAssetsAtom);
|
|
44970
45004
|
const getBalance = useGetBalance();
|
|
44971
45005
|
const filter2 = useAtomValue(filterAtom);
|
|
@@ -45003,7 +45037,7 @@ const useGroupedAssetByRecommendedSymbol = ({
|
|
|
45003
45037
|
});
|
|
45004
45038
|
return isAllowed && !isBlocked && !isBlockedUnlessUserHasBalance;
|
|
45005
45039
|
});
|
|
45006
|
-
}, [
|
|
45040
|
+
}, [context, filter2, filterOut, filterOutUnlessUserHasBalance, _assets, getBalance]);
|
|
45007
45041
|
const groupedAssetsByRecommendedSymbol = useMemo(() => {
|
|
45008
45042
|
if (!assets2) return;
|
|
45009
45043
|
const groupedAssets = [];
|
|
@@ -45130,9 +45164,7 @@ const SwapExecutionPageRouteDetailedRow = ({
|
|
|
45130
45164
|
chainId,
|
|
45131
45165
|
tokenAmount
|
|
45132
45166
|
});
|
|
45133
|
-
const groupedAssets = useGroupedAssetByRecommendedSymbol(
|
|
45134
|
-
context: void 0
|
|
45135
|
-
});
|
|
45167
|
+
const groupedAssets = useGroupedAssetByRecommendedSymbol();
|
|
45136
45168
|
const groupedAsset = groupedAssets == null ? void 0 : groupedAssets.find((i) => i.id === (assetDetails == null ? void 0 : assetDetails.symbol));
|
|
45137
45169
|
const chainAddresses = useAtomValue(chainAddressesAtom);
|
|
45138
45170
|
const shouldRenderEditDestinationWallet = context === "destination" && onClickEditDestinationWallet !== void 0;
|
|
@@ -45957,7 +45989,7 @@ const useCreateCosmosWallets = () => {
|
|
|
45957
45989
|
setCosmosWallet({
|
|
45958
45990
|
id: currentCosmosId,
|
|
45959
45991
|
walletName: wallet,
|
|
45960
|
-
chainType: ChainType.
|
|
45992
|
+
chainType: ChainType.Cosmos
|
|
45961
45993
|
});
|
|
45962
45994
|
}
|
|
45963
45995
|
track("wallet connected", {
|
|
@@ -47729,7 +47761,7 @@ const RowLayout = ({ image, mainText, subText, eureka }) => {
|
|
|
47729
47761
|
flexDirection: isMobileScreenSize ? "column" : "row",
|
|
47730
47762
|
gap: isMobileScreenSize ? void 0 : 8,
|
|
47731
47763
|
children: [
|
|
47732
|
-
/* @__PURE__ */ jsx(Text, { children: mainText }),
|
|
47764
|
+
/* @__PURE__ */ jsx(Text, { useWindowsTextHack: true, children: mainText }),
|
|
47733
47765
|
/* @__PURE__ */ jsxs(Row, { align: "center", gap: 6, children: [
|
|
47734
47766
|
subText,
|
|
47735
47767
|
eureka && /* @__PURE__ */ jsx(SmallText, { normalTextColor: true, children: " IBC Eureka " })
|
|
@@ -47890,7 +47922,6 @@ const SwapPageAssetChainInput = ({
|
|
|
47890
47922
|
priceChangePercentage,
|
|
47891
47923
|
isWaitingToUpdateInputValue,
|
|
47892
47924
|
badPriceWarning,
|
|
47893
|
-
context,
|
|
47894
47925
|
disabled
|
|
47895
47926
|
}) => {
|
|
47896
47927
|
const theme = nt();
|
|
@@ -47902,7 +47933,7 @@ const SwapPageAssetChainInput = ({
|
|
|
47902
47933
|
amount: value,
|
|
47903
47934
|
chainId: selectedAsset == null ? void 0 : selectedAsset.chainId
|
|
47904
47935
|
});
|
|
47905
|
-
const groupedAssetsByRecommendedSymbol = useGroupedAssetByRecommendedSymbol(
|
|
47936
|
+
const groupedAssetsByRecommendedSymbol = useGroupedAssetByRecommendedSymbol();
|
|
47906
47937
|
const groupedAsset = groupedAssetsByRecommendedSymbol == null ? void 0 : groupedAssetsByRecommendedSymbol.find(
|
|
47907
47938
|
(group) => {
|
|
47908
47939
|
var _a;
|
|
@@ -47996,7 +48027,7 @@ const SwapPageAssetChainInput = ({
|
|
|
47996
48027
|
/* @__PURE__ */ jsxs(StyledAssetButton, { onClick: handleChangeAsset, disabled, gap: 5, children: [
|
|
47997
48028
|
(assetDetails == null ? void 0 : assetDetails.assetImage) && assetDetails.symbol ? /* @__PURE__ */ jsxs(StyledAssetLabel, { align: "center", justify: "center", gap: 7, children: [
|
|
47998
48029
|
/* @__PURE__ */ jsx(GroupedAssetImage, { height: 23, width: 23, groupedAsset }),
|
|
47999
|
-
/* @__PURE__ */ jsx(Text, { children: assetDetails.symbol }),
|
|
48030
|
+
/* @__PURE__ */ jsx(Text, { useWindowsTextHack: true, children: assetDetails.symbol }),
|
|
48000
48031
|
isMobileScreenSize && /* @__PURE__ */ jsx(
|
|
48001
48032
|
ChevronIcon,
|
|
48002
48033
|
{
|
|
@@ -48211,7 +48242,7 @@ const AssetAndChainSelectorModalSearchInput = ({
|
|
|
48211
48242
|
/* @__PURE__ */ jsx(Button, { onClick: onClickBack, children: /* @__PURE__ */ jsx(StyledLeftArrowIcon, { color: theme.primary.text.normal, maskedVersion: false }) }),
|
|
48212
48243
|
/* @__PURE__ */ jsxs(StyledSelectedAsset, { gap: 5, align: "center", justify: "center", children: [
|
|
48213
48244
|
/* @__PURE__ */ jsx(GroupedAssetImage, { groupedAsset, width: 20, height: 20 }),
|
|
48214
|
-
/* @__PURE__ */ jsx(Text, { children: asset == null ? void 0 : asset.recommendedSymbol })
|
|
48245
|
+
/* @__PURE__ */ jsx(Text, { useWindowsTextHack: true, children: asset == null ? void 0 : asset.recommendedSymbol })
|
|
48215
48246
|
] })
|
|
48216
48247
|
] }) : /* @__PURE__ */ jsx(StyledSearchIcon, { color: theme.primary.text.normal }),
|
|
48217
48248
|
/* @__PURE__ */ jsx(
|
|
@@ -48888,7 +48919,7 @@ const WarningPageGoFast = ({ onClickBack, onClickContinue }) => {
|
|
|
48888
48919
|
},
|
|
48889
48920
|
children: [
|
|
48890
48921
|
/* @__PURE__ */ jsx(
|
|
48891
|
-
|
|
48922
|
+
PageHeader,
|
|
48892
48923
|
{
|
|
48893
48924
|
leftButton: {
|
|
48894
48925
|
label: "Back",
|
|
@@ -48963,7 +48994,7 @@ const WarningPageLowInfo = ({
|
|
|
48963
48994
|
});
|
|
48964
48995
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
48965
48996
|
/* @__PURE__ */ jsx(
|
|
48966
|
-
|
|
48997
|
+
PageHeader,
|
|
48967
48998
|
{
|
|
48968
48999
|
leftButton: {
|
|
48969
49000
|
label: "Back",
|
|
@@ -49038,7 +49069,7 @@ const ExpectedErrorPageInsufficientGasBalance = ({
|
|
|
49038
49069
|
};
|
|
49039
49070
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
49040
49071
|
/* @__PURE__ */ jsx(
|
|
49041
|
-
|
|
49072
|
+
PageHeader,
|
|
49042
49073
|
{
|
|
49043
49074
|
leftButton: {
|
|
49044
49075
|
label: "Back",
|
|
@@ -49076,7 +49107,10 @@ const ExpectedErrorPageInsufficientGasBalance = ({
|
|
|
49076
49107
|
)
|
|
49077
49108
|
] });
|
|
49078
49109
|
};
|
|
49079
|
-
const ExpectedErrorPageRelayFeeQuoteExpired = ({
|
|
49110
|
+
const ExpectedErrorPageRelayFeeQuoteExpired = ({
|
|
49111
|
+
error,
|
|
49112
|
+
onClickBack
|
|
49113
|
+
}) => {
|
|
49080
49114
|
const theme = nt();
|
|
49081
49115
|
const setErrorAtom = useSetAtom(errorWarningAtom);
|
|
49082
49116
|
const setCurrentPage = useSetAtom(currentPageAtom);
|
|
@@ -49089,7 +49123,7 @@ const ExpectedErrorPageRelayFeeQuoteExpired = ({ error, onClickBack }) => {
|
|
|
49089
49123
|
};
|
|
49090
49124
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
49091
49125
|
/* @__PURE__ */ jsx(
|
|
49092
|
-
|
|
49126
|
+
PageHeader,
|
|
49093
49127
|
{
|
|
49094
49128
|
leftButton: {
|
|
49095
49129
|
label: "Back",
|
|
@@ -49180,9 +49214,7 @@ const SwapExecutionPageRouteSimpleRow = ({
|
|
|
49180
49214
|
chainId,
|
|
49181
49215
|
tokenAmount
|
|
49182
49216
|
});
|
|
49183
|
-
const groupedAssets = useGroupedAssetByRecommendedSymbol(
|
|
49184
|
-
context: void 0
|
|
49185
|
-
});
|
|
49217
|
+
const groupedAssets = useGroupedAssetByRecommendedSymbol();
|
|
49186
49218
|
const groupedAsset = groupedAssets == null ? void 0 : groupedAssets.find((i) => i.id === (assetDetails == null ? void 0 : assetDetails.symbol));
|
|
49187
49219
|
const chainAddresses = useAtomValue(chainAddressesAtom);
|
|
49188
49220
|
const source = useMemo(() => {
|
|
@@ -49861,7 +49893,12 @@ const useSyncTxStatus = ({
|
|
|
49861
49893
|
}) => {
|
|
49862
49894
|
const transferEvents = statusData == null ? void 0 : statusData.transferEvents;
|
|
49863
49895
|
const setOverallStatus = useSetAtom(setOverallStatusAtom);
|
|
49864
|
-
const {
|
|
49896
|
+
const {
|
|
49897
|
+
route: route2,
|
|
49898
|
+
transactionDetailsArray,
|
|
49899
|
+
overallStatus,
|
|
49900
|
+
transactionHistoryIndex: currentTransactionHistoryIndex
|
|
49901
|
+
} = useAtomValue(swapExecutionStateAtom);
|
|
49865
49902
|
const setTransactionHistory = useSetAtom(setTransactionHistoryAtom);
|
|
49866
49903
|
const txHistory = useAtomValue(transactionHistoryAtom);
|
|
49867
49904
|
const { isPending } = useAtomValue(skipSubmitSwapExecutionAtom);
|
|
@@ -49870,15 +49907,12 @@ const useSyncTxStatus = ({
|
|
|
49870
49907
|
return getClientOperations(route2.operations);
|
|
49871
49908
|
}, [route2 == null ? void 0 : route2.operations]);
|
|
49872
49909
|
const computedSwapStatus = useMemo(() => {
|
|
49873
|
-
if ((statusData == null ? void 0 : statusData.lastTxStatus) === "pending") {
|
|
49874
|
-
if (isPending) {
|
|
49875
|
-
setOverallStatus("pending");
|
|
49876
|
-
}
|
|
49910
|
+
if ((statusData == null ? void 0 : statusData.lastTxStatus) === "pending" || isPending) {
|
|
49877
49911
|
return "pending";
|
|
49878
49912
|
}
|
|
49879
49913
|
if ((transferEvents == null ? void 0 : transferEvents.length) === 0 && !(statusData == null ? void 0 : statusData.isSettled)) {
|
|
49880
49914
|
if (isPending && overallStatus !== "pending") {
|
|
49881
|
-
|
|
49915
|
+
return "signing";
|
|
49882
49916
|
}
|
|
49883
49917
|
return;
|
|
49884
49918
|
}
|
|
@@ -49897,7 +49931,6 @@ const useSyncTxStatus = ({
|
|
|
49897
49931
|
}
|
|
49898
49932
|
}, [
|
|
49899
49933
|
isPending,
|
|
49900
|
-
setOverallStatus,
|
|
49901
49934
|
statusData == null ? void 0 : statusData.isSettled,
|
|
49902
49935
|
statusData == null ? void 0 : statusData.isSuccess,
|
|
49903
49936
|
statusData == null ? void 0 : statusData.lastTxStatus,
|
|
@@ -49906,13 +49939,15 @@ const useSyncTxStatus = ({
|
|
|
49906
49939
|
]);
|
|
49907
49940
|
useEffect(() => {
|
|
49908
49941
|
if (computedSwapStatus) {
|
|
49909
|
-
const index = historyIndex ??
|
|
49910
|
-
|
|
49942
|
+
const index = historyIndex ?? currentTransactionHistoryIndex;
|
|
49943
|
+
const newTxHistoryItem = {
|
|
49911
49944
|
...txHistory[index],
|
|
49912
49945
|
...statusData,
|
|
49913
49946
|
status: computedSwapStatus
|
|
49914
|
-
}
|
|
49915
|
-
|
|
49947
|
+
};
|
|
49948
|
+
const oldTxHistoryItem = txHistory[index];
|
|
49949
|
+
if (JSON.stringify(newTxHistoryItem) !== JSON.stringify(oldTxHistoryItem)) {
|
|
49950
|
+
setTransactionHistory(index, newTxHistoryItem);
|
|
49916
49951
|
setOverallStatus(computedSwapStatus);
|
|
49917
49952
|
}
|
|
49918
49953
|
}
|
|
@@ -49922,11 +49957,11 @@ const useSyncTxStatus = ({
|
|
|
49922
49957
|
computedSwapStatus,
|
|
49923
49958
|
setOverallStatus,
|
|
49924
49959
|
transactionDetailsArray.length,
|
|
49960
|
+
txHistory,
|
|
49961
|
+
statusData,
|
|
49925
49962
|
setTransactionHistory,
|
|
49926
|
-
transactionHistoryIndex,
|
|
49927
49963
|
historyIndex,
|
|
49928
|
-
|
|
49929
|
-
statusData
|
|
49964
|
+
currentTransactionHistoryIndex
|
|
49930
49965
|
]);
|
|
49931
49966
|
};
|
|
49932
49967
|
function useSwapExecutionState({
|
|
@@ -49953,7 +49988,7 @@ function useSwapExecutionState({
|
|
|
49953
49988
|
if (overallStatus === "completed") {
|
|
49954
49989
|
return SwapExecutionState.confirmed;
|
|
49955
49990
|
}
|
|
49956
|
-
if (overallStatus === "pending") {
|
|
49991
|
+
if (overallStatus === "pending" || overallStatus === "failed") {
|
|
49957
49992
|
if (signaturesRemaining > 0) {
|
|
49958
49993
|
return SwapExecutionState.signaturesRemaining;
|
|
49959
49994
|
}
|
|
@@ -50193,76 +50228,113 @@ const SwapExecutionButton = ({
|
|
|
50193
50228
|
return null;
|
|
50194
50229
|
}
|
|
50195
50230
|
};
|
|
50196
|
-
const
|
|
50197
|
-
|
|
50231
|
+
const DELAY_EXPECTING_TRANSFER_ASSET_RELEASE = 15e3;
|
|
50232
|
+
const useHandleTransactionFailed = (error, statusData) => {
|
|
50198
50233
|
const setErrorWarning = useSetAtom(errorWarningAtom);
|
|
50199
50234
|
const setCurrentPage = useSetAtom(currentPageAtom);
|
|
50200
|
-
const
|
|
50201
|
-
const
|
|
50235
|
+
const setSourceAsset = useSetAtom(sourceAssetAtom);
|
|
50236
|
+
const setDebouncedSourceAssetAmount = useSetAtom(debouncedSourceAssetAmountAtom);
|
|
50237
|
+
const setOverallStatus = useSetAtom(setOverallStatusAtom);
|
|
50202
50238
|
const [{ data: assets2 }] = useAtom(skipAssetsAtom);
|
|
50203
|
-
const { transactionDetailsArray } = useAtomValue(swapExecutionStateAtom);
|
|
50204
|
-
const lastTransaction = transactionDetailsArray
|
|
50239
|
+
const { transactionDetailsArray, route: route2 } = useAtomValue(swapExecutionStateAtom);
|
|
50240
|
+
const lastTransaction = transactionDetailsArray.at(-1);
|
|
50241
|
+
const lastTxHash = lastTransaction == null ? void 0 : lastTransaction.txHash;
|
|
50205
50242
|
const getClientAsset = useCallback(
|
|
50206
50243
|
(denom, chainId) => {
|
|
50207
|
-
if (!denom || !chainId) return;
|
|
50208
|
-
if (!assets2) return;
|
|
50244
|
+
if (!denom || !chainId || !assets2) return;
|
|
50209
50245
|
return assets2.find(
|
|
50210
50246
|
(a) => a.denom.toLowerCase() === denom.toLowerCase() && a.chainId === chainId
|
|
50211
50247
|
);
|
|
50212
50248
|
},
|
|
50213
50249
|
[assets2]
|
|
50214
50250
|
);
|
|
50215
|
-
const
|
|
50216
|
-
|
|
50217
|
-
|
|
50218
|
-
|
|
50219
|
-
|
|
50220
|
-
|
|
50221
|
-
|
|
50222
|
-
|
|
50223
|
-
|
|
50224
|
-
|
|
50225
|
-
|
|
50226
|
-
|
|
50227
|
-
|
|
50228
|
-
|
|
50229
|
-
|
|
50230
|
-
|
|
50231
|
-
|
|
50232
|
-
|
|
50233
|
-
|
|
50234
|
-
|
|
50235
|
-
|
|
50236
|
-
|
|
50237
|
-
|
|
50238
|
-
|
|
50239
|
-
|
|
50240
|
-
|
|
50241
|
-
|
|
50242
|
-
return;
|
|
50243
|
-
}
|
|
50251
|
+
const explorerLink = createSkipExplorerLink(transactionDetailsArray);
|
|
50252
|
+
const handleTransactionFailed = useCallback(() => {
|
|
50253
|
+
var _a, _b;
|
|
50254
|
+
const sourceClientAsset = getClientAsset(
|
|
50255
|
+
(_a = statusData == null ? void 0 : statusData.transferAssetRelease) == null ? void 0 : _a.denom,
|
|
50256
|
+
(_b = statusData == null ? void 0 : statusData.transferAssetRelease) == null ? void 0 : _b.chainId
|
|
50257
|
+
);
|
|
50258
|
+
if (sourceClientAsset) {
|
|
50259
|
+
track("unexpected error page: transaction reverted", {
|
|
50260
|
+
transferAssetRelease: statusData == null ? void 0 : statusData.transferAssetRelease,
|
|
50261
|
+
lastTransaction
|
|
50262
|
+
});
|
|
50263
|
+
setErrorWarning({
|
|
50264
|
+
errorWarningType: ErrorWarningType.TransactionReverted,
|
|
50265
|
+
onClickContinueTransaction: () => {
|
|
50266
|
+
var _a2;
|
|
50267
|
+
setSourceAsset({
|
|
50268
|
+
...sourceClientAsset
|
|
50269
|
+
});
|
|
50270
|
+
setDebouncedSourceAssetAmount((_a2 = statusData == null ? void 0 : statusData.transferAssetRelease) == null ? void 0 : _a2.amount, void 0, true);
|
|
50271
|
+
setCurrentPage(Routes.SwapPage);
|
|
50272
|
+
setErrorWarning(void 0);
|
|
50273
|
+
},
|
|
50274
|
+
explorerUrl: explorerLink,
|
|
50275
|
+
transferAssetRelease: statusData == null ? void 0 : statusData.transferAssetRelease
|
|
50276
|
+
});
|
|
50277
|
+
} else if (explorerLink) {
|
|
50244
50278
|
track("unexpected error page: transaction failed", { lastTransaction });
|
|
50245
50279
|
setErrorWarning({
|
|
50246
50280
|
errorWarningType: ErrorWarningType.TransactionFailed,
|
|
50247
50281
|
onClickContactSupport: () => window.open("https://skip.build/discord", "_blank"),
|
|
50248
|
-
explorerLink
|
|
50249
|
-
txHash:
|
|
50282
|
+
explorerLink,
|
|
50283
|
+
txHash: lastTxHash ?? ""
|
|
50284
|
+
});
|
|
50285
|
+
} else {
|
|
50286
|
+
track("unexpected error page: unexpected error", { error, route: route2 });
|
|
50287
|
+
setErrorWarning({
|
|
50288
|
+
errorWarningType: ErrorWarningType.Unexpected,
|
|
50289
|
+
error,
|
|
50290
|
+
onClickBack: () => setOverallStatus("unconfirmed")
|
|
50250
50291
|
});
|
|
50251
50292
|
}
|
|
50252
50293
|
}, [
|
|
50294
|
+
error,
|
|
50295
|
+
explorerLink,
|
|
50296
|
+
getClientAsset,
|
|
50253
50297
|
lastTransaction,
|
|
50254
|
-
|
|
50255
|
-
|
|
50298
|
+
lastTxHash,
|
|
50299
|
+
route2,
|
|
50256
50300
|
setCurrentPage,
|
|
50257
|
-
|
|
50301
|
+
setDebouncedSourceAssetAmount,
|
|
50258
50302
|
setErrorWarning,
|
|
50259
|
-
|
|
50260
|
-
|
|
50303
|
+
setOverallStatus,
|
|
50304
|
+
setSourceAsset,
|
|
50305
|
+
statusData == null ? void 0 : statusData.transferAssetRelease
|
|
50306
|
+
]);
|
|
50307
|
+
useEffect(() => {
|
|
50308
|
+
if ((statusData == null ? void 0 : statusData.isSuccess) || !(statusData == null ? void 0 : statusData.isSettled)) return;
|
|
50309
|
+
const timeout = setTimeout(() => {
|
|
50310
|
+
handleTransactionFailed();
|
|
50311
|
+
}, DELAY_EXPECTING_TRANSFER_ASSET_RELEASE);
|
|
50312
|
+
if (statusData.transferAssetRelease) {
|
|
50313
|
+
clearTimeout(timeout);
|
|
50314
|
+
handleTransactionFailed();
|
|
50315
|
+
}
|
|
50316
|
+
return () => clearTimeout(timeout);
|
|
50317
|
+
}, [
|
|
50261
50318
|
statusData == null ? void 0 : statusData.isSettled,
|
|
50262
50319
|
statusData == null ? void 0 : statusData.isSuccess,
|
|
50263
|
-
statusData == null ? void 0 : statusData.transferAssetRelease
|
|
50320
|
+
statusData == null ? void 0 : statusData.transferAssetRelease,
|
|
50321
|
+
handleTransactionFailed
|
|
50264
50322
|
]);
|
|
50265
50323
|
};
|
|
50324
|
+
function usePreventPageUnload(shouldWarn) {
|
|
50325
|
+
useEffect(() => {
|
|
50326
|
+
const handleBeforeUnload = (e) => {
|
|
50327
|
+
if (shouldWarn) {
|
|
50328
|
+
track("Prevent user leaving the page before all txs are signed");
|
|
50329
|
+
e.preventDefault();
|
|
50330
|
+
e.returnValue = "Please complete the required transaction signatures to complete this trade. Leaving this page before signing both may cause your trade to fail.";
|
|
50331
|
+
return "Please complete the required transaction signatures to complete this trade. Leaving this page before signing both may cause your trade to fail.";
|
|
50332
|
+
}
|
|
50333
|
+
};
|
|
50334
|
+
window.addEventListener("beforeunload", handleBeforeUnload);
|
|
50335
|
+
return () => window.removeEventListener("beforeunload", handleBeforeUnload);
|
|
50336
|
+
}, [shouldWarn]);
|
|
50337
|
+
}
|
|
50266
50338
|
var SwapExecutionState = /* @__PURE__ */ ((SwapExecutionState2) => {
|
|
50267
50339
|
SwapExecutionState2[SwapExecutionState2["recoveryAddressUnset"] = 0] = "recoveryAddressUnset";
|
|
50268
50340
|
SwapExecutionState2[SwapExecutionState2["destinationAddressUnset"] = 1] = "destinationAddressUnset";
|
|
@@ -50289,13 +50361,16 @@ const SwapExecutionPage = () => {
|
|
|
50289
50361
|
const chainAddresses = useAtomValue(chainAddressesAtom);
|
|
50290
50362
|
const { connectRequiredChains, isLoading } = useAutoSetAddress();
|
|
50291
50363
|
const [simpleRoute, setSimpleRoute] = useState(true);
|
|
50292
|
-
const { mutate: submitExecuteRouteMutation } = useAtomValue(skipSubmitSwapExecutionAtom);
|
|
50364
|
+
const { mutate: submitExecuteRouteMutation, error } = useAtomValue(skipSubmitSwapExecutionAtom);
|
|
50293
50365
|
const shouldDisplaySignaturesRemaining = (route2 == null ? void 0 : route2.txsRequired) && route2.txsRequired > 1;
|
|
50294
50366
|
const signaturesRemaining = shouldDisplaySignaturesRemaining ? route2.txsRequired - transactionsSigned : 0;
|
|
50295
50367
|
const { data: statusData } = useBroadcastedTxsStatus({
|
|
50296
50368
|
txsRequired: route2 == null ? void 0 : route2.txsRequired,
|
|
50297
50369
|
txs: transactionDetailsArray
|
|
50298
50370
|
});
|
|
50371
|
+
const lastTransaction = transactionDetailsArray.at(-1);
|
|
50372
|
+
const lastTxHash = lastTransaction == null ? void 0 : lastTransaction.txHash;
|
|
50373
|
+
const lastTxChainId = lastTransaction == null ? void 0 : lastTransaction.chainId;
|
|
50299
50374
|
useSyncTxStatus({
|
|
50300
50375
|
statusData
|
|
50301
50376
|
});
|
|
@@ -50308,7 +50383,11 @@ const SwapExecutionPage = () => {
|
|
|
50308
50383
|
signaturesRemaining,
|
|
50309
50384
|
isLoading
|
|
50310
50385
|
});
|
|
50311
|
-
|
|
50386
|
+
usePreventPageUnload(
|
|
50387
|
+
swapExecutionState === 5 || swapExecutionState === 4 || swapExecutionState === 8 || swapExecutionState === 7
|
|
50388
|
+
/* validatingGasBalance */
|
|
50389
|
+
);
|
|
50390
|
+
useHandleTransactionFailed(error, statusData);
|
|
50312
50391
|
useHandleTransactionTimeout(swapExecutionState);
|
|
50313
50392
|
const firstOperationStatus = useMemo(() => {
|
|
50314
50393
|
if (swapExecutionState === 6 || swapExecutionState === 3 || swapExecutionState === 5) {
|
|
@@ -50349,9 +50428,10 @@ const SwapExecutionPage = () => {
|
|
|
50349
50428
|
};
|
|
50350
50429
|
}, [swapExecutionState, route2]);
|
|
50351
50430
|
const SwapExecutionPageRoute = simpleRoute ? SwapExecutionPageRouteSimple : SwapExecutionPageRouteDetailed;
|
|
50431
|
+
const shouldRenderTrackProgressButton = lastTxHash && lastTxChainId && (route2 == null ? void 0 : route2.txsRequired) === transactionDetailsArray.length;
|
|
50352
50432
|
return /* @__PURE__ */ jsxs(Column, { gap: 5, children: [
|
|
50353
50433
|
/* @__PURE__ */ jsx(
|
|
50354
|
-
|
|
50434
|
+
PageHeader,
|
|
50355
50435
|
{
|
|
50356
50436
|
leftButton: simpleRoute ? {
|
|
50357
50437
|
label: "Back",
|
|
@@ -50361,6 +50441,15 @@ const SwapExecutionPage = () => {
|
|
|
50361
50441
|
setCurrentPage(Routes.SwapPage);
|
|
50362
50442
|
}
|
|
50363
50443
|
} : void 0,
|
|
50444
|
+
centerButton: shouldRenderTrackProgressButton ? {
|
|
50445
|
+
label: "Track progress",
|
|
50446
|
+
onClick: () => {
|
|
50447
|
+
window.open(createSkipExplorerLink(transactionDetailsArray), "_blank");
|
|
50448
|
+
track("swap execution page: track progress button - clicked", {
|
|
50449
|
+
txHash: lastTxHash
|
|
50450
|
+
});
|
|
50451
|
+
}
|
|
50452
|
+
} : void 0,
|
|
50364
50453
|
rightButton: {
|
|
50365
50454
|
label: simpleRoute ? "Details" : "Hide details",
|
|
50366
50455
|
icon: simpleRoute ? ICONS.hamburger : ICONS.horizontalLine,
|
|
@@ -50768,107 +50857,6 @@ const useInsufficientSourceBalance = () => {
|
|
|
50768
50857
|
}
|
|
50769
50858
|
return true;
|
|
50770
50859
|
};
|
|
50771
|
-
const SpinnerIcon = (props) => {
|
|
50772
|
-
return /* @__PURE__ */ jsxs("svg", { fill: "none", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
|
|
50773
|
-
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", opacity: ".25", r: "10", stroke: "currentColor", strokeWidth: "4" }),
|
|
50774
|
-
/* @__PURE__ */ jsx(
|
|
50775
|
-
"path",
|
|
50776
|
-
{
|
|
50777
|
-
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",
|
|
50778
|
-
fill: "currentColor",
|
|
50779
|
-
opacity: ".75"
|
|
50780
|
-
}
|
|
50781
|
-
)
|
|
50782
|
-
] });
|
|
50783
|
-
};
|
|
50784
|
-
const ConnectedWalletContent = () => {
|
|
50785
|
-
const sourceAsset = useAtomValue(sourceAssetAtom);
|
|
50786
|
-
const getAccount = useGetAccount();
|
|
50787
|
-
const sourceAccount = getAccount(sourceAsset == null ? void 0 : sourceAsset.chainId);
|
|
50788
|
-
const sourceDetails = useGetAssetDetails({
|
|
50789
|
-
assetDenom: sourceAsset == null ? void 0 : sourceAsset.denom,
|
|
50790
|
-
amount: sourceAsset == null ? void 0 : sourceAsset.amount,
|
|
50791
|
-
chainId: sourceAsset == null ? void 0 : sourceAsset.chainId
|
|
50792
|
-
});
|
|
50793
|
-
const { data: sourceBalance, isLoading } = useGetSourceBalance();
|
|
50794
|
-
const handleMaxButton = useSetMaxAmount();
|
|
50795
|
-
const maxAmountTokenMinusFees = useMaxAmountTokenMinusFees();
|
|
50796
|
-
const formattedBalance = useMemo(() => {
|
|
50797
|
-
var _a;
|
|
50798
|
-
const symbol = (sourceDetails == null ? void 0 : sourceDetails.symbol) ? ` ${sourceDetails == null ? void 0 : sourceDetails.symbol}` : "";
|
|
50799
|
-
if ((_a = sourceBalance == null ? void 0 : sourceBalance.error) == null ? void 0 : _a.message) return "--";
|
|
50800
|
-
if (sourceBalance === void 0) return;
|
|
50801
|
-
const formattedBalanceAmount = formatDisplayAmount(sourceBalance == null ? void 0 : sourceBalance.formattedAmount);
|
|
50802
|
-
return formattedBalanceAmount + symbol;
|
|
50803
|
-
}, [sourceBalance, sourceDetails == null ? void 0 : sourceDetails.symbol]);
|
|
50804
|
-
if (!sourceAccount) return null;
|
|
50805
|
-
return /* @__PURE__ */ jsxs(
|
|
50806
|
-
Row,
|
|
50807
|
-
{
|
|
50808
|
-
style: {
|
|
50809
|
-
paddingRight: 8,
|
|
50810
|
-
gap: 1
|
|
50811
|
-
},
|
|
50812
|
-
children: [
|
|
50813
|
-
/* @__PURE__ */ jsxs(
|
|
50814
|
-
GhostButton,
|
|
50815
|
-
{
|
|
50816
|
-
onClick: () => {
|
|
50817
|
-
track("swap page: connected wallet balance - clicked");
|
|
50818
|
-
NiceModal.show(Modals.ConnectedWalletModal);
|
|
50819
|
-
},
|
|
50820
|
-
align: "center",
|
|
50821
|
-
gap: 8,
|
|
50822
|
-
children: [
|
|
50823
|
-
(sourceAccount == null ? void 0 : sourceAccount.wallet.logo) && /* @__PURE__ */ jsx(
|
|
50824
|
-
"img",
|
|
50825
|
-
{
|
|
50826
|
-
style: { objectFit: "cover" },
|
|
50827
|
-
src: sourceAccount == null ? void 0 : sourceAccount.wallet.logo,
|
|
50828
|
-
height: 16,
|
|
50829
|
-
width: 16
|
|
50830
|
-
}
|
|
50831
|
-
),
|
|
50832
|
-
isLoading ? /* @__PURE__ */ jsx(
|
|
50833
|
-
"div",
|
|
50834
|
-
{
|
|
50835
|
-
style: {
|
|
50836
|
-
marginLeft: "8px",
|
|
50837
|
-
marginRight: "8px",
|
|
50838
|
-
position: "relative"
|
|
50839
|
-
},
|
|
50840
|
-
children: /* @__PURE__ */ jsx(
|
|
50841
|
-
SpinnerIcon,
|
|
50842
|
-
{
|
|
50843
|
-
style: {
|
|
50844
|
-
animation: "spin 1s linear infinite",
|
|
50845
|
-
position: "absolute",
|
|
50846
|
-
height: 14,
|
|
50847
|
-
width: 14
|
|
50848
|
-
}
|
|
50849
|
-
}
|
|
50850
|
-
)
|
|
50851
|
-
}
|
|
50852
|
-
) : formattedBalance
|
|
50853
|
-
]
|
|
50854
|
-
}
|
|
50855
|
-
),
|
|
50856
|
-
/* @__PURE__ */ jsx(
|
|
50857
|
-
GhostButton,
|
|
50858
|
-
{
|
|
50859
|
-
disabled: !sourceBalance || (sourceBalance == null ? void 0 : sourceBalance.amount) === "0" || maxAmountTokenMinusFees === "0",
|
|
50860
|
-
onClick: () => {
|
|
50861
|
-
track("swap page: max button - clicked");
|
|
50862
|
-
handleMaxButton();
|
|
50863
|
-
},
|
|
50864
|
-
align: "center",
|
|
50865
|
-
children: "Max"
|
|
50866
|
-
}
|
|
50867
|
-
)
|
|
50868
|
-
]
|
|
50869
|
-
}
|
|
50870
|
-
);
|
|
50871
|
-
};
|
|
50872
50860
|
const useFetchAllBalances = () => {
|
|
50873
50861
|
const getAccount = useGetAccount();
|
|
50874
50862
|
const { data: assets2 } = useAtomValue(skipAssetsAtom);
|
|
@@ -50985,7 +50973,7 @@ const useShowCosmosLedgerWarning = () => {
|
|
|
50985
50973
|
};
|
|
50986
50974
|
const name = "@skip-go/widget";
|
|
50987
50975
|
const description = "Swap widget";
|
|
50988
|
-
const version = "3.10.
|
|
50976
|
+
const version = "3.10.8";
|
|
50989
50977
|
const repository = {
|
|
50990
50978
|
url: "https://github.com/skip-mev/skip-go",
|
|
50991
50979
|
directory: "packages/widget"
|
|
@@ -51154,6 +51142,231 @@ const startAmplitudeSessionReplay = () => {
|
|
|
51154
51142
|
add(plugin);
|
|
51155
51143
|
}
|
|
51156
51144
|
};
|
|
51145
|
+
const SpinnerIcon = (props) => {
|
|
51146
|
+
return /* @__PURE__ */ jsxs("svg", { fill: "none", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
|
|
51147
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", opacity: ".25", r: "10", stroke: "currentColor", strokeWidth: "4" }),
|
|
51148
|
+
/* @__PURE__ */ jsx(
|
|
51149
|
+
"path",
|
|
51150
|
+
{
|
|
51151
|
+
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",
|
|
51152
|
+
fill: "currentColor",
|
|
51153
|
+
opacity: ".75"
|
|
51154
|
+
}
|
|
51155
|
+
)
|
|
51156
|
+
] });
|
|
51157
|
+
};
|
|
51158
|
+
const ConnectedWalletContent = () => {
|
|
51159
|
+
const sourceAsset = useAtomValue(sourceAssetAtom);
|
|
51160
|
+
const getAccount = useGetAccount();
|
|
51161
|
+
const sourceAccount = getAccount(sourceAsset == null ? void 0 : sourceAsset.chainId);
|
|
51162
|
+
const sourceDetails = useGetAssetDetails({
|
|
51163
|
+
assetDenom: sourceAsset == null ? void 0 : sourceAsset.denom,
|
|
51164
|
+
amount: sourceAsset == null ? void 0 : sourceAsset.amount,
|
|
51165
|
+
chainId: sourceAsset == null ? void 0 : sourceAsset.chainId
|
|
51166
|
+
});
|
|
51167
|
+
const { data: sourceBalance, isLoading } = useGetSourceBalance();
|
|
51168
|
+
const handleMaxButton = useSetMaxAmount();
|
|
51169
|
+
const maxAmountTokenMinusFees = useMaxAmountTokenMinusFees();
|
|
51170
|
+
const formattedBalance = useMemo(() => {
|
|
51171
|
+
var _a;
|
|
51172
|
+
const symbol = (sourceDetails == null ? void 0 : sourceDetails.symbol) ? ` ${sourceDetails == null ? void 0 : sourceDetails.symbol}` : "";
|
|
51173
|
+
if ((_a = sourceBalance == null ? void 0 : sourceBalance.error) == null ? void 0 : _a.message) return "--";
|
|
51174
|
+
if (sourceBalance === void 0) return;
|
|
51175
|
+
const formattedBalanceAmount = formatDisplayAmount(sourceBalance == null ? void 0 : sourceBalance.formattedAmount);
|
|
51176
|
+
return formattedBalanceAmount + symbol;
|
|
51177
|
+
}, [sourceBalance, sourceDetails == null ? void 0 : sourceDetails.symbol]);
|
|
51178
|
+
if (!sourceAccount) return null;
|
|
51179
|
+
return /* @__PURE__ */ jsxs(
|
|
51180
|
+
Row,
|
|
51181
|
+
{
|
|
51182
|
+
style: {
|
|
51183
|
+
paddingRight: 8,
|
|
51184
|
+
gap: 1
|
|
51185
|
+
},
|
|
51186
|
+
children: [
|
|
51187
|
+
/* @__PURE__ */ jsxs(
|
|
51188
|
+
GhostButton,
|
|
51189
|
+
{
|
|
51190
|
+
onClick: () => {
|
|
51191
|
+
track("swap page: connected wallet balance - clicked");
|
|
51192
|
+
NiceModal.show(Modals.ConnectedWalletModal);
|
|
51193
|
+
},
|
|
51194
|
+
align: "center",
|
|
51195
|
+
gap: 8,
|
|
51196
|
+
children: [
|
|
51197
|
+
(sourceAccount == null ? void 0 : sourceAccount.wallet.logo) && /* @__PURE__ */ jsx(
|
|
51198
|
+
"img",
|
|
51199
|
+
{
|
|
51200
|
+
style: { objectFit: "cover" },
|
|
51201
|
+
src: sourceAccount == null ? void 0 : sourceAccount.wallet.logo,
|
|
51202
|
+
height: 16,
|
|
51203
|
+
width: 16
|
|
51204
|
+
}
|
|
51205
|
+
),
|
|
51206
|
+
isLoading ? /* @__PURE__ */ jsx(
|
|
51207
|
+
"div",
|
|
51208
|
+
{
|
|
51209
|
+
style: {
|
|
51210
|
+
marginLeft: "8px",
|
|
51211
|
+
marginRight: "8px",
|
|
51212
|
+
position: "relative"
|
|
51213
|
+
},
|
|
51214
|
+
children: /* @__PURE__ */ jsx(
|
|
51215
|
+
SpinnerIcon,
|
|
51216
|
+
{
|
|
51217
|
+
style: {
|
|
51218
|
+
animation: "spin 1s linear infinite",
|
|
51219
|
+
position: "absolute",
|
|
51220
|
+
height: 14,
|
|
51221
|
+
width: 14
|
|
51222
|
+
}
|
|
51223
|
+
}
|
|
51224
|
+
)
|
|
51225
|
+
}
|
|
51226
|
+
) : formattedBalance
|
|
51227
|
+
]
|
|
51228
|
+
}
|
|
51229
|
+
),
|
|
51230
|
+
/* @__PURE__ */ jsx(
|
|
51231
|
+
GhostButton,
|
|
51232
|
+
{
|
|
51233
|
+
disabled: !sourceBalance || (sourceBalance == null ? void 0 : sourceBalance.amount) === "0" || maxAmountTokenMinusFees === "0",
|
|
51234
|
+
onClick: () => {
|
|
51235
|
+
track("swap page: max button - clicked");
|
|
51236
|
+
handleMaxButton();
|
|
51237
|
+
},
|
|
51238
|
+
align: "center",
|
|
51239
|
+
children: "Max"
|
|
51240
|
+
}
|
|
51241
|
+
)
|
|
51242
|
+
]
|
|
51243
|
+
}
|
|
51244
|
+
);
|
|
51245
|
+
};
|
|
51246
|
+
const useTxHistory = ({ txHistoryItem, index }) => {
|
|
51247
|
+
var _a, _b, _c;
|
|
51248
|
+
const { data: chains2 } = useAtomValue(skipChainsAtom);
|
|
51249
|
+
const txs = (_a = txHistoryItem == null ? void 0 : txHistoryItem.transactionDetails) == null ? void 0 : _a.map((tx) => ({
|
|
51250
|
+
chainId: tx.chainId,
|
|
51251
|
+
txHash: tx.txHash
|
|
51252
|
+
}));
|
|
51253
|
+
const chainIdFound = chains2 == null ? void 0 : chains2.some(
|
|
51254
|
+
(chain) => txs == null ? void 0 : txs.map((tx) => tx.chainId).includes(chain.chainId ?? "")
|
|
51255
|
+
);
|
|
51256
|
+
const txsRequired = (_b = txHistoryItem == null ? void 0 : txHistoryItem.route) == null ? void 0 : _b.txsRequired;
|
|
51257
|
+
let statusData = {
|
|
51258
|
+
isSuccess: false,
|
|
51259
|
+
isSettled: false,
|
|
51260
|
+
transferEvents: [],
|
|
51261
|
+
...txHistoryItem
|
|
51262
|
+
};
|
|
51263
|
+
const shouldFetchStatus = !(txHistoryItem == null ? void 0 : txHistoryItem.isSettled) && txs !== void 0 && chainIdFound;
|
|
51264
|
+
const { data, isFetching, isPending } = useBroadcastedTxsStatus({
|
|
51265
|
+
txsRequired,
|
|
51266
|
+
txs,
|
|
51267
|
+
enabled: shouldFetchStatus
|
|
51268
|
+
});
|
|
51269
|
+
if (data !== void 0) {
|
|
51270
|
+
statusData = data;
|
|
51271
|
+
}
|
|
51272
|
+
useSyncTxStatus({
|
|
51273
|
+
statusData,
|
|
51274
|
+
historyIndex: index
|
|
51275
|
+
});
|
|
51276
|
+
const explorerLinks = /* @__PURE__ */ new Set();
|
|
51277
|
+
(_c = statusData == null ? void 0 : statusData.transferEvents) == null ? void 0 : _c.forEach((transferEvent) => {
|
|
51278
|
+
explorerLinks.add(transferEvent.fromExplorerLink);
|
|
51279
|
+
explorerLinks.add(transferEvent.toExplorerLink);
|
|
51280
|
+
});
|
|
51281
|
+
const query = useQuery({
|
|
51282
|
+
queryKey: ["tx-history-status", { txs, txsRequired, statusData }],
|
|
51283
|
+
queryFn: () => {
|
|
51284
|
+
if ((txs == null ? void 0 : txs.length) !== txsRequired) return "incomplete";
|
|
51285
|
+
if (isFetching && isPending) return "unconfirmed";
|
|
51286
|
+
if ((statusData == null ? void 0 : statusData.isSettled) && (statusData == null ? void 0 : statusData.isSuccess)) return "completed";
|
|
51287
|
+
if ((statusData == null ? void 0 : statusData.isSettled) && !(statusData == null ? void 0 : statusData.isSuccess) || !chainIdFound) return "failed";
|
|
51288
|
+
return "pending";
|
|
51289
|
+
},
|
|
51290
|
+
enabled: txs !== void 0 && txsRequired !== void 0 && statusData !== void 0
|
|
51291
|
+
});
|
|
51292
|
+
return {
|
|
51293
|
+
status: query.data,
|
|
51294
|
+
explorerLinks: Array.from(explorerLinks).filter((link) => link),
|
|
51295
|
+
transferAssetRelease: (statusData == null ? void 0 : statusData.transferAssetRelease) ?? (txHistoryItem == null ? void 0 : txHistoryItem.transferAssetRelease)
|
|
51296
|
+
};
|
|
51297
|
+
};
|
|
51298
|
+
const SwapPageHeader = memo(() => {
|
|
51299
|
+
const setCurrentPage = useSetAtom(currentPageAtom);
|
|
51300
|
+
const sourceAsset = useAtomValue(sourceAssetAtom);
|
|
51301
|
+
const getAccount = useGetAccount();
|
|
51302
|
+
const sourceAccount = getAccount(sourceAsset == null ? void 0 : sourceAsset.chainId);
|
|
51303
|
+
const noHistoryItems = useAtomValue(noHistoryItemsAtom);
|
|
51304
|
+
const isFetchingLastTransactionStatus = useAtomValue(isFetchingLastTransactionStatusAtom);
|
|
51305
|
+
const historyPageButton = useMemo(() => {
|
|
51306
|
+
if (noHistoryItems) return;
|
|
51307
|
+
const getHistoryPageIcon = () => {
|
|
51308
|
+
if (isFetchingLastTransactionStatus) {
|
|
51309
|
+
return /* @__PURE__ */ jsx(
|
|
51310
|
+
"div",
|
|
51311
|
+
{
|
|
51312
|
+
style: {
|
|
51313
|
+
marginLeft: "8px",
|
|
51314
|
+
marginRight: "8px",
|
|
51315
|
+
position: "relative"
|
|
51316
|
+
},
|
|
51317
|
+
children: /* @__PURE__ */ jsx(
|
|
51318
|
+
SpinnerIcon,
|
|
51319
|
+
{
|
|
51320
|
+
style: {
|
|
51321
|
+
animation: "spin 1s linear infinite",
|
|
51322
|
+
position: "absolute",
|
|
51323
|
+
height: 14,
|
|
51324
|
+
width: 14
|
|
51325
|
+
}
|
|
51326
|
+
}
|
|
51327
|
+
)
|
|
51328
|
+
}
|
|
51329
|
+
);
|
|
51330
|
+
}
|
|
51331
|
+
return ICONS.history;
|
|
51332
|
+
};
|
|
51333
|
+
return {
|
|
51334
|
+
label: "History",
|
|
51335
|
+
icon: getHistoryPageIcon(),
|
|
51336
|
+
onClick: () => {
|
|
51337
|
+
track("swap page: history button - clicked");
|
|
51338
|
+
setCurrentPage(Routes.TransactionHistoryPage);
|
|
51339
|
+
}
|
|
51340
|
+
};
|
|
51341
|
+
}, [isFetchingLastTransactionStatus, noHistoryItems, setCurrentPage]);
|
|
51342
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
51343
|
+
isFetchingLastTransactionStatus && /* @__PURE__ */ jsx(TrackLatestTxHistoryItemStatus, {}),
|
|
51344
|
+
/* @__PURE__ */ jsx(
|
|
51345
|
+
PageHeader,
|
|
51346
|
+
{
|
|
51347
|
+
leftButton: historyPageButton,
|
|
51348
|
+
rightContent: sourceAccount ? /* @__PURE__ */ jsx(ConnectedWalletContent, {}) : null
|
|
51349
|
+
}
|
|
51350
|
+
)
|
|
51351
|
+
] });
|
|
51352
|
+
});
|
|
51353
|
+
const TrackLatestTxHistoryItemStatus = memo(() => {
|
|
51354
|
+
const transactionhistory = useAtomValue(transactionHistoryAtom);
|
|
51355
|
+
const lastTxHistoryItem = transactionhistory.at(-1);
|
|
51356
|
+
useTxHistory({
|
|
51357
|
+
txHistoryItem: lastTxHistoryItem,
|
|
51358
|
+
index: transactionhistory.length - 1
|
|
51359
|
+
});
|
|
51360
|
+
return null;
|
|
51361
|
+
});
|
|
51362
|
+
const noHistoryItemsAtom = atom$1((get) => {
|
|
51363
|
+
const txHistoryItems = get(transactionHistoryAtom);
|
|
51364
|
+
return (txHistoryItems == null ? void 0 : txHistoryItems.length) === 0;
|
|
51365
|
+
});
|
|
51366
|
+
const isFetchingLastTransactionStatusAtom = atom$1((get) => {
|
|
51367
|
+
const { overallStatus, route: route2, transactionsSigned } = get(swapExecutionStateAtom);
|
|
51368
|
+
return overallStatus === "pending" && transactionsSigned === (route2 == null ? void 0 : route2.txsRequired);
|
|
51369
|
+
});
|
|
51157
51370
|
const SwapPage = () => {
|
|
51158
51371
|
var _a;
|
|
51159
51372
|
const { SettingsFooter, drawerOpen } = useSettingsDrawer();
|
|
@@ -51188,7 +51401,6 @@ const SwapPage = () => {
|
|
|
51188
51401
|
const switchEvmchainId = useSwitchEvmChain();
|
|
51189
51402
|
const getAccount = useGetAccount();
|
|
51190
51403
|
const sourceAccount = getAccount(sourceAsset == null ? void 0 : sourceAsset.chainId);
|
|
51191
|
-
const txHistory = useAtomValue(transactionHistoryAtom);
|
|
51192
51404
|
const isSwapOperation = useIsSwapOperation(route2);
|
|
51193
51405
|
const getClientAsset = useCallback(
|
|
51194
51406
|
(denom, chainId) => {
|
|
@@ -51444,17 +51656,6 @@ const SwapPage = () => {
|
|
|
51444
51656
|
setSwapExecutionState,
|
|
51445
51657
|
setError
|
|
51446
51658
|
]);
|
|
51447
|
-
const historyPageButton = useMemo(() => {
|
|
51448
|
-
if (txHistory.length === 0) return;
|
|
51449
|
-
return {
|
|
51450
|
-
label: "History",
|
|
51451
|
-
icon: ICONS.history,
|
|
51452
|
-
onClick: () => {
|
|
51453
|
-
track("swap page: history button - clicked");
|
|
51454
|
-
setCurrentPage(Routes.TransactionHistoryPage);
|
|
51455
|
-
}
|
|
51456
|
-
};
|
|
51457
|
-
}, [setCurrentPage, txHistory]);
|
|
51458
51659
|
return /* @__PURE__ */ jsxs(
|
|
51459
51660
|
Column,
|
|
51460
51661
|
{
|
|
@@ -51463,13 +51664,7 @@ const SwapPage = () => {
|
|
|
51463
51664
|
opacity: drawerOpen ? 0.3 : 1
|
|
51464
51665
|
},
|
|
51465
51666
|
children: [
|
|
51466
|
-
/* @__PURE__ */ jsx(
|
|
51467
|
-
SwapPageHeader,
|
|
51468
|
-
{
|
|
51469
|
-
leftButton: historyPageButton,
|
|
51470
|
-
rightContent: sourceAccount ? /* @__PURE__ */ jsx(ConnectedWalletContent, {}) : null
|
|
51471
|
-
}
|
|
51472
|
-
),
|
|
51667
|
+
/* @__PURE__ */ jsx(SwapPageHeader, {}),
|
|
51473
51668
|
/* @__PURE__ */ jsxs(Column, { align: "center", children: [
|
|
51474
51669
|
/* @__PURE__ */ jsx(
|
|
51475
51670
|
SwapPageAssetChainInput,
|
|
@@ -51484,7 +51679,6 @@ const SwapPage = () => {
|
|
|
51484
51679
|
track("swap page: source asset amount input - changed", { amount: v2 });
|
|
51485
51680
|
setSourceAssetAmount(v2);
|
|
51486
51681
|
},
|
|
51487
|
-
context: "source",
|
|
51488
51682
|
disabled: sourceAsset == null ? void 0 : sourceAsset.locked
|
|
51489
51683
|
}
|
|
51490
51684
|
),
|
|
@@ -51504,7 +51698,6 @@ const SwapPage = () => {
|
|
|
51504
51698
|
track("swap page: destination asset amount input - changed", { amount: v2 });
|
|
51505
51699
|
setDestinationAssetAmount(v2);
|
|
51506
51700
|
},
|
|
51507
|
-
context: "destination",
|
|
51508
51701
|
disabled: destinationAsset == null ? void 0 : destinationAsset.locked
|
|
51509
51702
|
}
|
|
51510
51703
|
)
|
|
@@ -51560,10 +51753,12 @@ const TransactionHistoryPageHistoryItemDetails = ({
|
|
|
51560
51753
|
destinationChainName,
|
|
51561
51754
|
absoluteTimeString,
|
|
51562
51755
|
onClickDelete,
|
|
51563
|
-
|
|
51564
|
-
|
|
51756
|
+
transferAssetRelease,
|
|
51757
|
+
transactionDetails
|
|
51565
51758
|
}) => {
|
|
51759
|
+
var _a;
|
|
51566
51760
|
const theme = nt();
|
|
51761
|
+
const initialTxHash = (_a = transactionDetails == null ? void 0 : transactionDetails[0]) == null ? void 0 : _a.txHash;
|
|
51567
51762
|
const statusColor = useMemo(() => {
|
|
51568
51763
|
if (status === "failed" || status === "incomplete") {
|
|
51569
51764
|
if (transferAssetRelease) {
|
|
@@ -51575,47 +51770,6 @@ const TransactionHistoryPageHistoryItemDetails = ({
|
|
|
51575
51770
|
}
|
|
51576
51771
|
return;
|
|
51577
51772
|
}, [status, theme.error.text, theme.success.text, theme.warning.text, transferAssetRelease]);
|
|
51578
|
-
const handleClickingLinkIfNoExplorerLink = (txHash, explorerLink) => {
|
|
51579
|
-
if (!explorerLink) {
|
|
51580
|
-
copyToClipboard(txHash);
|
|
51581
|
-
}
|
|
51582
|
-
};
|
|
51583
|
-
const getTxHashFromLink = (link) => {
|
|
51584
|
-
const splitLinkBySlash = link == null ? void 0 : link.split("/");
|
|
51585
|
-
if (!splitLinkBySlash) return;
|
|
51586
|
-
return splitLinkBySlash[splitLinkBySlash.length - 1];
|
|
51587
|
-
};
|
|
51588
|
-
const renderTransactionIds = useMemo(() => {
|
|
51589
|
-
return explorerLinks == null ? void 0 : explorerLinks.map((link, index) => {
|
|
51590
|
-
const txHash = getTxHashFromLink(link);
|
|
51591
|
-
const getTransactionIdLabel = () => {
|
|
51592
|
-
if (index === 0) {
|
|
51593
|
-
return "Initial transaction ";
|
|
51594
|
-
}
|
|
51595
|
-
if (index === explorerLinks.length - 1) {
|
|
51596
|
-
return "Final transaction ";
|
|
51597
|
-
}
|
|
51598
|
-
return "Transaction ";
|
|
51599
|
-
};
|
|
51600
|
-
return /* @__PURE__ */ jsxs(StyledHistoryItemDetailRow, { align: "center", children: [
|
|
51601
|
-
/* @__PURE__ */ jsx(StyledDetailsLabel, { children: getTransactionIdLabel() }),
|
|
51602
|
-
/* @__PURE__ */ jsxs(
|
|
51603
|
-
Link,
|
|
51604
|
-
{
|
|
51605
|
-
onClick: () => handleClickingLinkIfNoExplorerLink(txHash, link),
|
|
51606
|
-
href: link,
|
|
51607
|
-
title: txHash,
|
|
51608
|
-
target: "_blank",
|
|
51609
|
-
gap: 5,
|
|
51610
|
-
children: [
|
|
51611
|
-
/* @__PURE__ */ jsx(SmallText, { normalTextColor: true, children: getTruncatedAddress(txHash) }),
|
|
51612
|
-
/* @__PURE__ */ jsx(SmallText, { children: /* @__PURE__ */ jsx(ChainIcon, {}) })
|
|
51613
|
-
]
|
|
51614
|
-
}
|
|
51615
|
-
)
|
|
51616
|
-
] }, `${index}-${txHash}`);
|
|
51617
|
-
});
|
|
51618
|
-
}, [explorerLinks]);
|
|
51619
51773
|
const showTransferAssetRelease = Boolean(
|
|
51620
51774
|
transferAssetRelease && transferAssetRelease.released && (status === "failed" || status === "incomplete")
|
|
51621
51775
|
);
|
|
@@ -51623,6 +51777,7 @@ const TransactionHistoryPageHistoryItemDetails = ({
|
|
|
51623
51777
|
assetDenom: transferAssetRelease == null ? void 0 : transferAssetRelease.denom,
|
|
51624
51778
|
chainId: transferAssetRelease == null ? void 0 : transferAssetRelease.chainId
|
|
51625
51779
|
});
|
|
51780
|
+
const skipExplorerLink = createSkipExplorerLink(transactionDetails);
|
|
51626
51781
|
return /* @__PURE__ */ jsxs(Column, { padding: 10, gap: 10, style: { paddingTop: showTransferAssetRelease ? 0 : 10 }, children: [
|
|
51627
51782
|
showTransferAssetRelease && /* @__PURE__ */ jsx(StyledTransferAssetRelease, { children: /* @__PURE__ */ jsxs(SmallText, { color: theme.warning.text, children: [
|
|
51628
51783
|
"This transaction did not complete. Your assets have been released as:",
|
|
@@ -51649,7 +51804,17 @@ const TransactionHistoryPageHistoryItemDetails = ({
|
|
|
51649
51804
|
/* @__PURE__ */ jsx(SmallText, { normalTextColor: true, children: destinationChainName })
|
|
51650
51805
|
] })
|
|
51651
51806
|
] }),
|
|
51652
|
-
|
|
51807
|
+
/* @__PURE__ */ jsxs(StyledHistoryItemDetailRow, { align: "center", children: [
|
|
51808
|
+
/* @__PURE__ */ jsx(StyledDetailsLabel, { children: "Route explorer" }),
|
|
51809
|
+
/* @__PURE__ */ jsxs(Link, { href: skipExplorerLink, target: "_blank", gap: 5, onClick: () => {
|
|
51810
|
+
track("transaction history page: view route explorer - clicked", {
|
|
51811
|
+
txHash: initialTxHash
|
|
51812
|
+
});
|
|
51813
|
+
}, children: [
|
|
51814
|
+
/* @__PURE__ */ jsx(SmallText, { normalTextColor: true, children: getTruncatedAddress(initialTxHash) }),
|
|
51815
|
+
/* @__PURE__ */ jsx(SmallText, { children: /* @__PURE__ */ jsx(ChainIcon, {}) })
|
|
51816
|
+
] })
|
|
51817
|
+
] }),
|
|
51653
51818
|
/* @__PURE__ */ jsx(Row, { align: "center", style: { marginTop: 10, padding: "0px 10px" }, children: /* @__PURE__ */ jsxs(Button, { onClick: onClickDelete, gap: 5, align: "center", children: [
|
|
51654
51819
|
/* @__PURE__ */ jsx(SmallText, { color: theme.error.text, children: "Delete" }),
|
|
51655
51820
|
/* @__PURE__ */ jsx(TrashIcon, { color: theme.error.text })
|
|
@@ -52295,59 +52460,6 @@ const getMobileDateFormat = (date, timeZone) => {
|
|
|
52295
52460
|
const year = lookup("year");
|
|
52296
52461
|
return `${hours}:${minutes} ${tz} ${month}/${day}/${year}`;
|
|
52297
52462
|
};
|
|
52298
|
-
const useTxHistory = ({
|
|
52299
|
-
txHistoryItem,
|
|
52300
|
-
index
|
|
52301
|
-
}) => {
|
|
52302
|
-
var _a, _b, _c;
|
|
52303
|
-
const { data: chains2 } = useAtomValue(skipChainsAtom);
|
|
52304
|
-
const txs = (_a = txHistoryItem.transactionDetails) == null ? void 0 : _a.map((tx) => ({
|
|
52305
|
-
chainId: tx.chainId,
|
|
52306
|
-
txHash: tx.txHash
|
|
52307
|
-
}));
|
|
52308
|
-
const chainIdFound = chains2 == null ? void 0 : chains2.some(
|
|
52309
|
-
(chain) => txs.map((tx) => tx.chainId).includes(chain.chainId ?? "")
|
|
52310
|
-
);
|
|
52311
|
-
const txsRequired = (_b = txHistoryItem == null ? void 0 : txHistoryItem.route) == null ? void 0 : _b.txsRequired;
|
|
52312
|
-
let statusData = {
|
|
52313
|
-
isSuccess: false,
|
|
52314
|
-
isSettled: false,
|
|
52315
|
-
transferEvents: [],
|
|
52316
|
-
...txHistoryItem
|
|
52317
|
-
};
|
|
52318
|
-
const { data, isFetching, isPending } = useBroadcastedTxsStatus({
|
|
52319
|
-
txsRequired,
|
|
52320
|
-
txs,
|
|
52321
|
-
enabled: !txHistoryItem.isSettled && chainIdFound
|
|
52322
|
-
});
|
|
52323
|
-
if (data !== void 0) {
|
|
52324
|
-
statusData = data;
|
|
52325
|
-
}
|
|
52326
|
-
useSyncTxStatus({
|
|
52327
|
-
statusData,
|
|
52328
|
-
historyIndex: index
|
|
52329
|
-
});
|
|
52330
|
-
const explorerLinks = /* @__PURE__ */ new Set();
|
|
52331
|
-
(_c = statusData == null ? void 0 : statusData.transferEvents) == null ? void 0 : _c.forEach((transferEvent) => {
|
|
52332
|
-
explorerLinks.add(transferEvent.fromExplorerLink);
|
|
52333
|
-
explorerLinks.add(transferEvent.toExplorerLink);
|
|
52334
|
-
});
|
|
52335
|
-
const query = useQuery({
|
|
52336
|
-
queryKey: ["tx-history-status", { txs, txsRequired, statusData }],
|
|
52337
|
-
queryFn: () => {
|
|
52338
|
-
if (txs.length !== txsRequired) return "incomplete";
|
|
52339
|
-
if (isFetching && isPending) return "unconfirmed";
|
|
52340
|
-
if ((statusData == null ? void 0 : statusData.isSettled) && (statusData == null ? void 0 : statusData.isSuccess)) return "completed";
|
|
52341
|
-
if ((statusData == null ? void 0 : statusData.isSettled) && !(statusData == null ? void 0 : statusData.isSuccess) || !chainIdFound) return "failed";
|
|
52342
|
-
return "pending";
|
|
52343
|
-
}
|
|
52344
|
-
});
|
|
52345
|
-
return {
|
|
52346
|
-
status: query.data,
|
|
52347
|
-
explorerLinks: Array.from(explorerLinks).filter((link) => link),
|
|
52348
|
-
transferAssetRelease: (statusData == null ? void 0 : statusData.transferAssetRelease) ?? txHistoryItem.transferAssetRelease
|
|
52349
|
-
};
|
|
52350
|
-
};
|
|
52351
52463
|
const FilledWarningIcon = ({
|
|
52352
52464
|
color = "currentColor",
|
|
52353
52465
|
backgroundColor = "transparent"
|
|
@@ -52363,15 +52475,9 @@ const FilledWarningIcon = ({
|
|
|
52363
52475
|
] });
|
|
52364
52476
|
const TransactionHistoryPageHistoryItem = forwardRef(
|
|
52365
52477
|
({ index, txHistoryItem, showDetails, onClickRow }, ref) => {
|
|
52366
|
-
var _a, _b, _c;
|
|
52367
52478
|
const theme = nt();
|
|
52368
52479
|
const isMobileScreenSize = useIsMobileScreenSize();
|
|
52369
|
-
const {
|
|
52370
|
-
const {
|
|
52371
|
-
status: historyStatus,
|
|
52372
|
-
explorerLinks: txHistoryExplorerLinks,
|
|
52373
|
-
transferAssetRelease
|
|
52374
|
-
} = useTxHistory({
|
|
52480
|
+
const { status: historyStatus, transferAssetRelease } = useTxHistory({
|
|
52375
52481
|
txHistoryItem,
|
|
52376
52482
|
index
|
|
52377
52483
|
});
|
|
@@ -52384,24 +52490,10 @@ const TransactionHistoryPageHistoryItem = forwardRef(
|
|
|
52384
52490
|
sourceAssetChainId,
|
|
52385
52491
|
destAssetDenom,
|
|
52386
52492
|
destAssetChainId
|
|
52387
|
-
},
|
|
52493
|
+
} = {},
|
|
52388
52494
|
timestamp,
|
|
52389
52495
|
transactionDetails
|
|
52390
52496
|
} = txHistoryItem;
|
|
52391
|
-
const initialTxHash = (_a = transactionDetails == null ? void 0 : transactionDetails[0]) == null ? void 0 : _a.txHash;
|
|
52392
|
-
const chainId = (_b = transactionDetails == null ? void 0 : transactionDetails[0]) == null ? void 0 : _b.chainId;
|
|
52393
|
-
const chainType = (_c = chains2 == null ? void 0 : chains2.find((chain) => chain.chainId === chainId)) == null ? void 0 : _c.chainType;
|
|
52394
|
-
const derivedExplorerLink = createExplorerLink({
|
|
52395
|
-
txHash: initialTxHash,
|
|
52396
|
-
chainId,
|
|
52397
|
-
chainType
|
|
52398
|
-
});
|
|
52399
|
-
const explorerLinks = useMemo(() => {
|
|
52400
|
-
if (txHistoryExplorerLinks.length === 0 && derivedExplorerLink) {
|
|
52401
|
-
return [derivedExplorerLink];
|
|
52402
|
-
}
|
|
52403
|
-
return txHistoryExplorerLinks;
|
|
52404
|
-
}, [derivedExplorerLink, txHistoryExplorerLinks]);
|
|
52405
52497
|
const sourceAssetDetails = useGetAssetDetails({
|
|
52406
52498
|
assetDenom: sourceAssetDenom,
|
|
52407
52499
|
chainId: sourceAssetChainId,
|
|
@@ -52485,11 +52577,11 @@ const TransactionHistoryPageHistoryItem = forwardRef(
|
|
|
52485
52577
|
TransactionHistoryPageHistoryItemDetails,
|
|
52486
52578
|
{
|
|
52487
52579
|
status: historyStatus,
|
|
52580
|
+
transactionDetails,
|
|
52488
52581
|
sourceChainName: sourceAssetDetails.chainName ?? "--",
|
|
52489
52582
|
destinationChainName: destinationAssetDetails.chainName ?? "--",
|
|
52490
52583
|
absoluteTimeString,
|
|
52491
52584
|
onClickDelete: () => removeTransactionHistoryItem(index),
|
|
52492
|
-
explorerLinks,
|
|
52493
52585
|
transferAssetRelease
|
|
52494
52586
|
}
|
|
52495
52587
|
)
|
|
@@ -52558,7 +52650,7 @@ const TransactionHistoryPage = () => {
|
|
|
52558
52650
|
);
|
|
52559
52651
|
return /* @__PURE__ */ jsxs(Column, { gap: 5, children: [
|
|
52560
52652
|
/* @__PURE__ */ jsx(
|
|
52561
|
-
|
|
52653
|
+
PageHeader,
|
|
52562
52654
|
{
|
|
52563
52655
|
leftButton: {
|
|
52564
52656
|
label: "Back",
|
|
@@ -52597,7 +52689,7 @@ const TransactionHistoryPage = () => {
|
|
|
52597
52689
|
),
|
|
52598
52690
|
itemKey: (item) => {
|
|
52599
52691
|
var _a2, _b2;
|
|
52600
|
-
return (_b2 = (_a2 = item == null ? void 0 : item.transactionDetails) == null ? void 0 : _a2[0]) == null ? void 0 : _b2.txHash;
|
|
52692
|
+
return ((_b2 = (_a2 = item == null ? void 0 : item.transactionDetails) == null ? void 0 : _a2[0]) == null ? void 0 : _b2.txHash) ?? item.timestamp;
|
|
52601
52693
|
},
|
|
52602
52694
|
expandedItemKey: itemIndexToShowDetail ? (_d = (_c = (_b = historyList[itemIndexToShowDetail]) == null ? void 0 : _b.transactionDetails) == null ? void 0 : _c[0]) == null ? void 0 : _d.txHash : void 0
|
|
52603
52695
|
},
|