@xswap-link/sdk 0.2.6 → 0.3.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.
Files changed (34) hide show
  1. package/.github/workflows/main.yml +2 -2
  2. package/.github/workflows/publish.yml +2 -2
  3. package/CHANGELOG.md +6 -0
  4. package/dist/index.css +99 -2
  5. package/dist/index.d.mts +4 -2
  6. package/dist/index.d.ts +4 -2
  7. package/dist/index.js +1178 -409
  8. package/dist/index.mjs +1205 -430
  9. package/package.json +1 -1
  10. package/src/components/Skeleton/index.tsx +1 -1
  11. package/src/components/Spinner/index.tsx +28 -0
  12. package/src/components/TxConfigForm/ConfirmationAmount.tsx +91 -0
  13. package/src/components/TxConfigForm/Description.tsx +5 -3
  14. package/src/components/TxConfigForm/FeesDetails.tsx +5 -11
  15. package/src/components/TxConfigForm/Form.tsx +763 -118
  16. package/src/components/TxConfigForm/HistoryCard.tsx +1 -1
  17. package/src/components/TxConfigForm/Summary.tsx +9 -8
  18. package/src/components/TxConfigForm/SwapPanel.tsx +1 -4
  19. package/src/components/TxConfigForm/UsdPrice.tsx +3 -13
  20. package/src/components/TxConfigForm/index.tsx +33 -6
  21. package/src/components/TxStatusButton/index.tsx +12 -2
  22. package/src/components/icons/ErrorIcon.tsx +32 -0
  23. package/src/components/icons/SignIcon.tsx +17 -0
  24. package/src/components/icons/SuccessIcon.tsx +29 -0
  25. package/src/components/icons/index.ts +3 -0
  26. package/src/config/init.tsx +27 -10
  27. package/src/constants/index.ts +2 -2
  28. package/src/models/payloads/GetSwapTxPayload.ts +2 -0
  29. package/src/services/integrations/monitoring.ts +10 -3
  30. package/src/services/integrations/transactions.ts +9 -3
  31. package/src/utils/contracts.ts +18 -0
  32. package/src/utils/index.ts +1 -0
  33. package/src/utils/parseWeb3Error.ts +93 -0
  34. package/tailwind.config.js +39 -0
package/dist/index.mjs CHANGED
@@ -23,7 +23,7 @@ var xswap_config_default = {
23
23
  };
24
24
 
25
25
  // package.json
26
- var version = "0.2.6";
26
+ var version = "0.3.0";
27
27
 
28
28
  // src/components/WaitingForInit/index.tsx
29
29
  import { jsx } from "react/jsx-runtime";
@@ -50,13 +50,14 @@ var WaitingForInit = () => {
50
50
 
51
51
  // src/config/init.tsx
52
52
  import { jsx as jsx2 } from "react/jsx-runtime";
53
- var xpayRoot;
54
- var xpayInitIndicatorRoot;
55
- var xpayTxStatusRoot;
56
- var initCompleted = false;
53
+ var xpayRoot = null;
54
+ var xpayInitIndicatorRoot = null;
55
+ var xpayTxStatusRoot = null;
56
+ var xPayInitCompleted = false;
57
+ var isServer = typeof window === "undefined";
57
58
  var initDocument = () => {
58
- if (typeof document === "undefined") {
59
- throw new Error("Can't render XPay components from server side.");
59
+ if (isServer) {
60
+ return;
60
61
  }
61
62
  createXPayInitIndicatorRoot();
62
63
  Promise.all([
@@ -64,19 +65,22 @@ var initDocument = () => {
64
65
  createXPayRoot(),
65
66
  createXPayTxStatusRoot()
66
67
  ]).then(() => {
67
- initCompleted = true;
68
+ xPayInitCompleted = true;
68
69
  });
69
70
  };
70
71
  var waitForInitialization = async () => {
71
- if (!initCompleted) {
72
+ if (!xPayInitCompleted) {
72
73
  displayInitIndicator(true);
73
- while (!initCompleted) {
74
+ while (!xPayInitCompleted) {
74
75
  await new Promise((resolve) => setTimeout(resolve, 10));
75
76
  }
76
77
  displayInitIndicator(false);
77
78
  }
78
79
  };
79
80
  var createStyleElement = async () => {
81
+ if (isServer) {
82
+ return;
83
+ }
80
84
  const css = await fetch(
81
85
  `${xswap_config_default.apiUrl}/sdk/css?${new URLSearchParams({
82
86
  data: JSON.stringify({ version })
@@ -88,6 +92,9 @@ var createStyleElement = async () => {
88
92
  document.body.appendChild(style);
89
93
  };
90
94
  var createXPayRoot = async () => {
95
+ if (isServer) {
96
+ return;
97
+ }
91
98
  const xswapElement = document.createElement("div");
92
99
  xswapElement.setAttribute("id", "xpay-root");
93
100
  xswapElement.setAttribute("class", "xpay");
@@ -95,6 +102,9 @@ var createXPayRoot = async () => {
95
102
  xpayRoot = createRoot(xswapElement);
96
103
  };
97
104
  var createXPayTxStatusRoot = async () => {
105
+ if (isServer) {
106
+ return;
107
+ }
98
108
  const txStatusElement = document.createElement("div");
99
109
  txStatusElement.setAttribute("id", "xpay-tx-status");
100
110
  txStatusElement.setAttribute("class", "xpay-tx-status");
@@ -102,13 +112,19 @@ var createXPayTxStatusRoot = async () => {
102
112
  xpayTxStatusRoot = createRoot(txStatusElement);
103
113
  };
104
114
  var createXPayInitIndicatorRoot = () => {
115
+ if (isServer) {
116
+ return;
117
+ }
105
118
  const initIndicatorElement = document.createElement("div");
106
119
  initIndicatorElement.setAttribute("id", "xpay-init-indicator");
107
120
  document.body.appendChild(initIndicatorElement);
108
121
  xpayInitIndicatorRoot = createRoot(initIndicatorElement);
109
122
  };
110
123
  var displayInitIndicator = (display) => {
111
- display ? xpayInitIndicatorRoot.render(/* @__PURE__ */ jsx2(WaitingForInit, {})) : xpayInitIndicatorRoot.render("");
124
+ if (isServer || !xpayInitIndicatorRoot) {
125
+ return;
126
+ }
127
+ display ? xpayInitIndicatorRoot.render(/* @__PURE__ */ jsx2(WaitingForInit, {})) : xpayInitIndicatorRoot.render(null);
112
128
  };
113
129
 
114
130
  // src/services/api.ts
@@ -163,7 +179,7 @@ async function getTxStatus(payload) {
163
179
  }
164
180
 
165
181
  // src/services/integrations/customCalls/staking.ts
166
- import { ethers as ethers2 } from "ethers";
182
+ import { ethers as ethers3 } from "ethers";
167
183
 
168
184
  // src/models/Addresses.ts
169
185
  var ContractName = /* @__PURE__ */ ((ContractName2) => {
@@ -535,13 +551,12 @@ var NUMBER_INPUT_REGEX = /^[0-9]*[.,]?[0-9]*$/;
535
551
  var SLIPPAGE_PRESETS = [0.5, 1.5, 3];
536
552
  var DELIVERY_TIME = 30 * 1e3 * 60;
537
553
  var EXPRESS_DELIVERY_TIME = 30 * 1e3;
538
- var EXPRESS_DELIVERY_LIMIT = 1e3;
539
554
  var BALANCES_CHUNK_SIZE = 500;
540
- var ROUTE_TIMEOUT_MS = 5e3;
555
+ var ROUTE_TIMEOUT_MS = 1e4;
541
556
  var MINIMUM_DISPLAYED_TOKEN_AMOUNT = 1e-4;
542
557
  var DEFAULT_SOURCE_CHAIN_ID = "1";
543
558
  var CCIP_EXPLORER = "https://ccip.chain.link/";
544
- var TX_RECEIPT_STATUS_LIFETIME = 1e4;
559
+ var TX_RECEIPT_STATUS_LIFETIME = 6e4;
545
560
  var MSG_SENT_EVENT_SIG = "MessageSent(bytes32,uint64,address,bytes,address,uint256,uint256,address,uint256)";
546
561
  var MSG_SENT_EVENT_ABI = [
547
562
  "event MessageSent(bytes32 indexed messageId, uint64 indexed destinationChainSelector, address indexed sender, bytes data, address token, uint256 tokenAmount, uint256 valueForInstantCcipRecieve, address transferedToken, uint256 transferedTokenAmount)"
@@ -553,6 +568,17 @@ var MSG_RECEIVED_EVENT_ABI = [
553
568
 
554
569
  // src/utils/contracts.ts
555
570
  var IERC20 = new ethers.utils.Interface(ERC20Abi);
571
+ var getAllowanceOf = async (token, wallet, spender, rpcUrl) => {
572
+ const provider = ethers.getDefaultProvider(rpcUrl);
573
+ if (token === ethers.constants.AddressZero) {
574
+ return ethers.constants.MaxUint256.toString();
575
+ }
576
+ const contract = new ethers.Contract(token, ERC20Abi, provider);
577
+ return ethers.utils.formatUnits(
578
+ await contract.allowance(wallet, spender),
579
+ await contract.decimals()
580
+ );
581
+ };
556
582
  var getBalances = async (chain, wallet) => {
557
583
  return {
558
584
  ...await getNativeBalance(chain, wallet),
@@ -639,6 +665,60 @@ var isETHAddressValid = (address) => {
639
665
  return /^0x[a-fA-F0-9]{40}$/.test(address);
640
666
  };
641
667
 
668
+ // src/utils/parseWeb3Error.ts
669
+ import { ethers as ethers2 } from "ethers";
670
+ function parseWeb3Error(error) {
671
+ const errorMessage = typeof error === "string" ? error : error?.message || "An unknown error occurred";
672
+ if (errorMessage.includes("User denied transaction signature") || errorMessage.includes("User rejected the request")) {
673
+ return "Transaction was cancelled.";
674
+ }
675
+ if (errorMessage.includes("insufficient funds")) {
676
+ return "Insufficient funds to complete the transaction.";
677
+ }
678
+ if (errorMessage.includes("gas price too low")) {
679
+ return "Gas price is too low. Please increase the gas price and try again.";
680
+ }
681
+ if (errorMessage.includes("nonce too low")) {
682
+ return "Transaction nonce is too low. Please reset your account in MetaMask and try again.";
683
+ }
684
+ if (errorMessage.includes("execution reverted")) {
685
+ const revertReason = errorMessage.match(/reason: (.+?)(?:, method|$)/)?.[1];
686
+ return revertReason ? `Transaction failed: ${revertReason}` : "Transaction failed during contract execution.";
687
+ }
688
+ if (errorMessage.includes("exceeds block gas limit")) {
689
+ return "Transaction exceeded gas limit. Please try again with a higher gas limit.";
690
+ }
691
+ if (errorMessage.includes("network error") || errorMessage.includes("connection error")) {
692
+ return "Network error. Please check your internet connection and try again.";
693
+ }
694
+ if (errorMessage.includes("MetaMask Tx Signature:")) {
695
+ return "MetaMask error: " + errorMessage.split("MetaMask Tx Signature:")[1].trim();
696
+ }
697
+ if (error.code) {
698
+ switch (error.code) {
699
+ case ethers2.errors.INVALID_ARGUMENT:
700
+ return "Invalid argument provided to the transaction.";
701
+ case ethers2.errors.MISSING_ARGUMENT:
702
+ return "Missing required argument for the transaction.";
703
+ case ethers2.errors.UNEXPECTED_ARGUMENT:
704
+ return "Unexpected argument provided to the transaction.";
705
+ case ethers2.errors.CALL_EXCEPTION:
706
+ return "Contract call failed. The transaction might have been reverted.";
707
+ case ethers2.errors.INSUFFICIENT_FUNDS:
708
+ return "Insufficient funds to complete the transaction.";
709
+ case ethers2.errors.NONCE_EXPIRED:
710
+ return "Transaction nonce has expired. Please try again.";
711
+ case ethers2.errors.REPLACEMENT_UNDERPRICED:
712
+ return "Replacement transaction underpriced. Please increase the gas price.";
713
+ case ethers2.errors.UNPREDICTABLE_GAS_LIMIT:
714
+ return "Unable to estimate gas limit. The transaction might fail.";
715
+ default:
716
+ return "An error occurred: " + error.message;
717
+ }
718
+ }
719
+ return "An error occurred while processing the transaction. Please try again.";
720
+ }
721
+
642
722
  // src/utils/index.ts
643
723
  import { format } from "date-fns";
644
724
  var deepMergeObjects = (obj1, obj2) => {
@@ -666,7 +746,7 @@ var getDate = (blockTimestamp) => {
666
746
  };
667
747
 
668
748
  // src/services/integrations/monitoring.ts
669
- import { ethers as ethers5 } from "ethers";
749
+ import { ethers as ethers6 } from "ethers";
670
750
 
671
751
  // src/components/Alert/index.tsx
672
752
  import { jsxs } from "react/jsx-runtime";
@@ -678,7 +758,7 @@ var Alert = ({ desc }) => {
678
758
  };
679
759
 
680
760
  // src/components/TxConfigForm/index.tsx
681
- import { useMemo as useMemo8 } from "react";
761
+ import { useMemo as useMemo8, useState as useState10 } from "react";
682
762
  import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
683
763
  import { WagmiProvider } from "wagmi";
684
764
 
@@ -1155,21 +1235,129 @@ var XSwapLogo = () => {
1155
1235
  );
1156
1236
  };
1157
1237
 
1238
+ // src/components/icons/SignIcon.tsx
1239
+ import { jsx as jsx25 } from "react/jsx-runtime";
1240
+ var SignIcon = () => {
1241
+ return /* @__PURE__ */ jsx25(
1242
+ "svg",
1243
+ {
1244
+ width: "24",
1245
+ height: "24",
1246
+ viewBox: "0 0 24 24",
1247
+ fill: "none",
1248
+ xmlns: "http://www.w3.org/2000/svg",
1249
+ children: /* @__PURE__ */ jsx25(
1250
+ "path",
1251
+ {
1252
+ d: "M4 21V16.75L17.175 3.6C17.375 3.4 17.6 3.25 17.85 3.15C18.1 3.05 18.35 3 18.6 3C18.8667 3 19.1208 3.05 19.3625 3.15C19.6042 3.25 19.8167 3.4 20 3.6L21.4 5C21.6 5.18333 21.75 5.39583 21.85 5.6375C21.95 5.87917 22 6.13333 22 6.4C22 6.65 21.95 6.9 21.85 7.15C21.75 7.4 21.6 7.625 21.4 7.825L8.25 21H4ZM6 19H7.4L17.225 9.2L16.525 8.475L15.8 7.775L6 17.6V19ZM16.525 8.475L15.8 7.775L17.225 9.2L16.525 8.475ZM14 21C15.2333 21 16.375 20.6917 17.425 20.075C18.475 19.4583 19 18.6 19 17.5C19 16.9 18.8417 16.3833 18.525 15.95C18.2083 15.5167 17.7833 15.1417 17.25 14.825L15.775 16.3C16.1583 16.4667 16.4583 16.65 16.675 16.85C16.8917 17.05 17 17.2667 17 17.5C17 17.8833 16.6958 18.2292 16.0875 18.5375C15.4792 18.8458 14.7833 19 14 19C13.7167 19 13.4792 19.0958 13.2875 19.2875C13.0958 19.4792 13 19.7167 13 20C13 20.2833 13.0958 20.5208 13.2875 20.7125C13.4792 20.9042 13.7167 21 14 21ZM4.575 13.35L6.075 11.85C5.74167 11.7167 5.47917 11.5792 5.2875 11.4375C5.09583 11.2958 5 11.15 5 11C5 10.8 5.15 10.6 5.45 10.4C5.75 10.2 6.38333 9.89167 7.35 9.475C8.81667 8.84167 9.79167 8.26667 10.275 7.75C10.7583 7.23333 11 6.65 11 6C11 5.08333 10.6333 4.35417 9.9 3.8125C9.16667 3.27083 8.2 3 7 3C6.25 3 5.57917 3.13333 4.9875 3.4C4.39583 3.66667 3.94167 3.99167 3.625 4.375C3.44167 4.59167 3.36667 4.83333 3.4 5.1C3.43333 5.36667 3.55833 5.58333 3.775 5.75C3.99167 5.93333 4.23333 6.00833 4.5 5.975C4.76667 5.94167 4.99167 5.83333 5.175 5.65C5.40833 5.41667 5.66667 5.25 5.95 5.15C6.23333 5.05 6.58333 5 7 5C7.68333 5 8.1875 5.1 8.5125 5.3C8.8375 5.5 9 5.73333 9 6C9 6.23333 8.85417 6.44583 8.5625 6.6375C8.27083 6.82917 7.6 7.16667 6.55 7.65C5.21667 8.23333 4.29167 8.7625 3.775 9.2375C3.25833 9.7125 3 10.3 3 11C3 11.5333 3.14167 11.9875 3.425 12.3625C3.70833 12.7375 4.09167 13.0667 4.575 13.35Z",
1253
+ fill: "white",
1254
+ fillOpacity: "0.5"
1255
+ }
1256
+ )
1257
+ }
1258
+ );
1259
+ };
1260
+
1261
+ // src/components/icons/SuccessIcon.tsx
1262
+ import { jsx as jsx26, jsxs as jsxs6 } from "react/jsx-runtime";
1263
+ var SuccessIcon = () => {
1264
+ return /* @__PURE__ */ jsxs6(
1265
+ "svg",
1266
+ {
1267
+ width: "86",
1268
+ height: "85",
1269
+ viewBox: "0 0 86 85",
1270
+ fill: "none",
1271
+ xmlns: "http://www.w3.org/2000/svg",
1272
+ children: [
1273
+ /* @__PURE__ */ jsx26(
1274
+ "path",
1275
+ {
1276
+ d: "M38.0416 58.7916L63.0103 33.8228L58.052 28.8645L38.0416 48.8749L27.9478 38.7812L22.9895 43.7395L38.0416 58.7916ZM42.9999 77.9166C38.1006 77.9166 33.4964 76.9869 29.1874 75.1275C24.8784 73.2681 21.1301 70.7447 17.9426 67.5572C14.7551 64.3697 12.2317 60.6214 10.3723 56.3124C8.51294 52.0034 7.58325 47.3992 7.58325 42.4999C7.58325 37.6006 8.51294 32.9964 10.3723 28.6874C12.2317 24.3784 14.7551 20.6301 17.9426 17.4426C21.1301 14.2551 24.8784 11.7317 29.1874 9.87231C33.4964 8.01294 38.1006 7.08325 42.9999 7.08325C47.8992 7.08325 52.5034 8.01294 56.8124 9.87231C61.1214 11.7317 64.8697 14.2551 68.0572 17.4426C71.2447 20.6301 73.7681 24.3784 75.6275 28.6874C77.4869 32.9964 78.4166 37.6006 78.4166 42.4999C78.4166 47.3992 77.4869 52.0034 75.6275 56.3124C73.7681 60.6214 71.2447 64.3697 68.0572 67.5572C64.8697 70.7447 61.1214 73.2681 56.8124 75.1275C52.5034 76.9869 47.8992 77.9166 42.9999 77.9166ZM42.9999 70.8332C50.9096 70.8332 57.6093 68.0885 63.0989 62.5989C68.5885 57.1093 71.3332 50.4096 71.3332 42.4999C71.3332 34.5902 68.5885 27.8905 63.0989 22.401C57.6093 16.9114 50.9096 14.1666 42.9999 14.1666C35.0902 14.1666 28.3905 16.9114 22.901 22.401C17.4114 27.8905 14.6666 34.5902 14.6666 42.4999C14.6666 50.4096 17.4114 57.1093 22.901 62.5989C28.3905 68.0885 35.0902 70.8332 42.9999 70.8332Z",
1277
+ fill: "url(#paint0_linear_1287_1610)"
1278
+ }
1279
+ ),
1280
+ /* @__PURE__ */ jsx26("defs", { children: /* @__PURE__ */ jsxs6(
1281
+ "linearGradient",
1282
+ {
1283
+ id: "paint0_linear_1287_1610",
1284
+ x1: "7.58325",
1285
+ y1: "7.08325",
1286
+ x2: "82.2668",
1287
+ y2: "11.4066",
1288
+ gradientUnits: "userSpaceOnUse",
1289
+ children: [
1290
+ /* @__PURE__ */ jsx26("stop", { stopColor: "#4CAF50" }),
1291
+ /* @__PURE__ */ jsx26("stop", { offset: "1", stopColor: "#2E7D32" })
1292
+ ]
1293
+ }
1294
+ ) })
1295
+ ]
1296
+ }
1297
+ );
1298
+ };
1299
+
1300
+ // src/components/icons/ErrorIcon.tsx
1301
+ import { jsx as jsx27, jsxs as jsxs7 } from "react/jsx-runtime";
1302
+ var ErrorIcon = () => {
1303
+ return /* @__PURE__ */ jsxs7(
1304
+ "svg",
1305
+ {
1306
+ width: "81",
1307
+ height: "80",
1308
+ viewBox: "0 0 81 80",
1309
+ fill: "none",
1310
+ xmlns: "http://www.w3.org/2000/svg",
1311
+ children: [
1312
+ /* @__PURE__ */ jsx27("g", { id: "error_FILL0_wght400_GRAD0_opsz24 1", children: /* @__PURE__ */ jsx27(
1313
+ "path",
1314
+ {
1315
+ id: "Vector",
1316
+ d: "M40.5001 56.6667C41.4445 56.6667 42.2362 56.3473 42.8751 55.7084C43.514 55.0695 43.8334 54.2779 43.8334 53.3334C43.8334 52.389 43.514 51.5973 42.8751 50.9584C42.2362 50.3195 41.4445 50.0001 40.5001 50.0001C39.5556 50.0001 38.764 50.3195 38.1251 50.9584C37.4862 51.5973 37.1667 52.389 37.1667 53.3334C37.1667 54.2779 37.4862 55.0695 38.1251 55.7084C38.764 56.3473 39.5556 56.6667 40.5001 56.6667ZM37.1667 43.3334H43.8334V23.3334H37.1667V43.3334ZM40.5001 73.3334C35.889 73.3334 31.5556 72.4584 27.5001 70.7084C23.4445 68.9584 19.9167 66.5834 16.9167 63.5834C13.9167 60.5834 11.5417 57.0556 9.79175 53.0001C8.04175 48.9445 7.16675 44.6112 7.16675 40.0001C7.16675 35.389 8.04175 31.0556 9.79175 27.0001C11.5417 22.9445 13.9167 19.4167 16.9167 16.4167C19.9167 13.4167 23.4445 11.0417 27.5001 9.29175C31.5556 7.54175 35.889 6.66675 40.5001 6.66675C45.1112 6.66675 49.4445 7.54175 53.5001 9.29175C57.5556 11.0417 61.0834 13.4167 64.0834 16.4167C67.0834 19.4167 69.4584 22.9445 71.2084 27.0001C72.9584 31.0556 73.8334 35.389 73.8334 40.0001C73.8334 44.6112 72.9584 48.9445 71.2084 53.0001C69.4584 57.0556 67.0834 60.5834 64.0834 63.5834C61.0834 66.5834 57.5556 68.9584 53.5001 70.7084C49.4445 72.4584 45.1112 73.3334 40.5001 73.3334ZM40.5001 66.6667C47.9445 66.6667 54.2501 64.0834 59.4167 58.9167C64.5834 53.7501 67.1667 47.4445 67.1667 40.0001C67.1667 32.5556 64.5834 26.2501 59.4167 21.0834C54.2501 15.9167 47.9445 13.3334 40.5001 13.3334C33.0556 13.3334 26.7501 15.9167 21.5834 21.0834C16.4167 26.2501 13.8334 32.5556 13.8334 40.0001C13.8334 47.4445 16.4167 53.7501 21.5834 58.9167C26.7501 64.0834 33.0556 66.6667 40.5001 66.6667Z",
1317
+ fill: "url(#paint0_linear_230_166)"
1318
+ }
1319
+ ) }),
1320
+ /* @__PURE__ */ jsx27("defs", { children: /* @__PURE__ */ jsxs7(
1321
+ "linearGradient",
1322
+ {
1323
+ id: "paint0_linear_230_166",
1324
+ x1: "7.16675",
1325
+ y1: "6.66675",
1326
+ x2: "77.4571",
1327
+ y2: "10.7358",
1328
+ gradientUnits: "userSpaceOnUse",
1329
+ children: [
1330
+ /* @__PURE__ */ jsx27("stop", { stopColor: "#F44336" }),
1331
+ /* @__PURE__ */ jsx27("stop", { offset: "1", stopColor: "#C62828" })
1332
+ ]
1333
+ }
1334
+ ) })
1335
+ ]
1336
+ }
1337
+ );
1338
+ };
1339
+
1158
1340
  // src/components/TxConfigForm/PoweredBy.tsx
1159
- import { jsx as jsx25, jsxs as jsxs6 } from "react/jsx-runtime";
1341
+ import { jsx as jsx28, jsxs as jsxs8 } from "react/jsx-runtime";
1160
1342
  var PoweredBy = () => {
1161
- return /* @__PURE__ */ jsxs6("div", { className: "xpay-flex xpay-justify-center xpay-items-center xpay-gap-2 xpay-my-3", children: [
1162
- /* @__PURE__ */ jsx25("span", { className: "xpay-text-x_grey", children: "Powered by" }),
1163
- /* @__PURE__ */ jsx25(XSwapBadgeIcon, {}),
1164
- /* @__PURE__ */ jsx25("span", { children: "\u2715" }),
1165
- /* @__PURE__ */ jsx25(ChainlinkCCIPIcon, {})
1343
+ return /* @__PURE__ */ jsxs8("div", { className: "xpay-flex xpay-justify-center xpay-items-center xpay-gap-2 xpay-my-3", children: [
1344
+ /* @__PURE__ */ jsx28("span", { className: "xpay-text-x_grey", children: "Powered by" }),
1345
+ /* @__PURE__ */ jsx28(XSwapBadgeIcon, {}),
1346
+ /* @__PURE__ */ jsx28("span", { children: "\u2715" }),
1347
+ /* @__PURE__ */ jsx28(ChainlinkCCIPIcon, {})
1166
1348
  ] });
1167
1349
  };
1168
1350
 
1169
1351
  // src/components/TxConfigForm/Form.tsx
1170
- import { useEffect as useEffect7, useState as useState8 } from "react";
1171
- import { ethers as ethers3 } from "ethers";
1172
- import { useAccount, useSwitchChain } from "wagmi";
1352
+ import {
1353
+ useCallback as useCallback3,
1354
+ useEffect as useEffect8,
1355
+ useMemo as useMemo7,
1356
+ useRef as useRef3,
1357
+ useState as useState9
1358
+ } from "react";
1359
+ import { ethers as ethers4 } from "ethers";
1360
+ import { useAccount, useSendTransaction, useSwitchChain } from "wagmi";
1173
1361
 
1174
1362
  // src/hooks/useDebounce.tsx
1175
1363
  import { useEffect, useRef, useState } from "react";
@@ -1194,7 +1382,7 @@ import BigNumberJS2 from "bignumber.js";
1194
1382
 
1195
1383
  // src/components/TxConfigForm/HistoryCard.tsx
1196
1384
  import { useCallback, useMemo } from "react";
1197
- import { Fragment, jsx as jsx26, jsxs as jsxs7 } from "react/jsx-runtime";
1385
+ import { Fragment, jsx as jsx29, jsxs as jsxs9 } from "react/jsx-runtime";
1198
1386
  var HistoryCard = ({ transaction, supportedChains }) => {
1199
1387
  const date = getDate(transaction.timestamp);
1200
1388
  const supportedTokens = useMemo(() => {
@@ -1240,14 +1428,14 @@ var HistoryCard = ({ transaction, supportedChains }) => {
1240
1428
  const targetChainData = supportedChains.find(
1241
1429
  (chain) => chain.chainId === transaction.targetChainId
1242
1430
  );
1243
- return /* @__PURE__ */ jsxs7("div", { className: "xpay-flex xpay-flex-col xpay-global-border xpay-rounded-xl xpay-bg-[rgb(15,15,15)] xpay-text-white xpay-text-xs sm:xpay-text-sm xpay-p-4 xpay-gap-3 xpay-mb-2", children: [
1244
- /* @__PURE__ */ jsxs7("div", { className: "xpay-flex xpay-w-full xpay-items-center xpay-justify-between", children: [
1245
- /* @__PURE__ */ jsx26("div", { className: "xpay-text-sm sm:xpay-text-base", children: date }),
1246
- /* @__PURE__ */ jsxs7("div", { className: "xpay-flex xpay-items-center", children: [
1247
- transaction.status === "IN_PROGRESS" && /* @__PURE__ */ jsx26("div", { className: "xpay-flex xpay-items-center", children: /* @__PURE__ */ jsx26("div", { className: "xpay-text-[rgb(250,200,100)]", children: "In progress" }) }),
1248
- transaction.status === "DONE" && /* @__PURE__ */ jsx26("div", { className: "xpay-flex xpay-items-center", children: /* @__PURE__ */ jsx26("div", { className: "xpay-text-[rgb(100,200,100)]", children: "Done" }) }),
1249
- transaction.status === "REVERTED" && /* @__PURE__ */ jsx26("div", { className: "xpay-flex xpay-items-center", children: /* @__PURE__ */ jsx26("div", { className: "xpay-text-[rgb(255,100,100)]", children: "Reverted" }) }),
1250
- /* @__PURE__ */ jsx26(
1431
+ return /* @__PURE__ */ jsxs9("div", { className: "xpay-flex xpay-flex-col xpay-global-border xpay-rounded-xl xpay-bg-[rgb(15,15,15)] xpay-text-white xpay-text-xs sm:xpay-text-sm xpay-p-4 xpay-gap-3 xpay-mb-2", children: [
1432
+ /* @__PURE__ */ jsxs9("div", { className: "xpay-flex xpay-w-full xpay-items-center xpay-justify-between", children: [
1433
+ /* @__PURE__ */ jsx29("div", { className: "xpay-text-sm sm:xpay-text-base", children: date }),
1434
+ /* @__PURE__ */ jsxs9("div", { className: "xpay-flex xpay-items-center", children: [
1435
+ transaction.status === "IN_PROGRESS" && /* @__PURE__ */ jsx29("div", { className: "xpay-flex xpay-items-center", children: /* @__PURE__ */ jsx29("div", { className: "xpay-text-[rgb(250,200,100)]", children: "In progress" }) }),
1436
+ transaction.status === "DONE" && /* @__PURE__ */ jsx29("div", { className: "xpay-flex xpay-items-center", children: /* @__PURE__ */ jsx29("div", { className: "xpay-text-[rgb(100,200,100)]", children: "Done" }) }),
1437
+ transaction.status === "REVERTED" && /* @__PURE__ */ jsx29("div", { className: "xpay-flex xpay-items-center", children: /* @__PURE__ */ jsx29("div", { className: "xpay-text-[rgb(255,100,100)]", children: "Reverted" }) }),
1438
+ /* @__PURE__ */ jsx29(
1251
1439
  "a",
1252
1440
  {
1253
1441
  href: `${supportedChains.find(
@@ -1255,17 +1443,17 @@ var HistoryCard = ({ transaction, supportedChains }) => {
1255
1443
  )?.transactionExplorer}/${transaction.hash}`,
1256
1444
  target: "_blank",
1257
1445
  rel: "noreferrer",
1258
- className: "xpay-ml-2 xpay-no-underline",
1446
+ className: "xpay-ml-2 xpay-no-underline visited:xpay-text-white hover:xpay-text-white",
1259
1447
  "aria-label": "Show the transaction in the chain explorer",
1260
- children: /* @__PURE__ */ jsx26("div", { className: "xpay-w-3.5 xpay-h-3.5", children: /* @__PURE__ */ jsx26(ArrowUpRightIcon, {}) })
1448
+ children: /* @__PURE__ */ jsx29("div", { className: "xpay-w-3.5 xpay-h-3.5", children: /* @__PURE__ */ jsx29(ArrowUpRightIcon, {}) })
1261
1449
  }
1262
1450
  )
1263
1451
  ] })
1264
1452
  ] }),
1265
- /* @__PURE__ */ jsxs7("div", { className: "xpay-flex xpay-justify-between xpay-flex-wrap xpay-gap-2", children: [
1266
- /* @__PURE__ */ jsxs7("div", { className: "xpay-flex xpay-items-center", children: [
1267
- /* @__PURE__ */ jsxs7("div", { className: "xpay-flex xpay-items-center", children: [
1268
- /* @__PURE__ */ jsx26(
1453
+ /* @__PURE__ */ jsxs9("div", { className: "xpay-flex xpay-justify-between xpay-flex-wrap xpay-gap-2", children: [
1454
+ /* @__PURE__ */ jsxs9("div", { className: "xpay-flex xpay-items-center", children: [
1455
+ /* @__PURE__ */ jsxs9("div", { className: "xpay-flex xpay-items-center", children: [
1456
+ /* @__PURE__ */ jsx29(
1269
1457
  "img",
1270
1458
  {
1271
1459
  src: sourceChainData?.image,
@@ -1273,11 +1461,11 @@ var HistoryCard = ({ transaction, supportedChains }) => {
1273
1461
  className: "xpay-w-5 xpay-h-5 xpay-mr-1"
1274
1462
  }
1275
1463
  ),
1276
- /* @__PURE__ */ jsx26("div", { children: sourceChainData?.displayName })
1464
+ /* @__PURE__ */ jsx29("div", { children: sourceChainData?.displayName })
1277
1465
  ] }),
1278
- /* @__PURE__ */ jsx26("div", { className: "xpay-w-3.5 xpay-h-3.5 xpay-my-0 xpay-mx-1.5", children: /* @__PURE__ */ jsx26(ArrowRightIcon, {}) }),
1279
- /* @__PURE__ */ jsxs7("div", { className: "xpay-flex xpay-items-center", children: [
1280
- /* @__PURE__ */ jsx26(
1466
+ /* @__PURE__ */ jsx29("div", { className: "xpay-w-3.5 xpay-h-3.5 xpay-my-0 xpay-mx-1.5", children: /* @__PURE__ */ jsx29(ArrowRightIcon, {}) }),
1467
+ /* @__PURE__ */ jsxs9("div", { className: "xpay-flex xpay-items-center", children: [
1468
+ /* @__PURE__ */ jsx29(
1281
1469
  "img",
1282
1470
  {
1283
1471
  src: targetChainData?.image,
@@ -1285,35 +1473,35 @@ var HistoryCard = ({ transaction, supportedChains }) => {
1285
1473
  className: "xpay-w-5 xpay-h-5 xpay-mr-1"
1286
1474
  }
1287
1475
  ),
1288
- /* @__PURE__ */ jsx26("div", { children: targetChainData?.displayName })
1476
+ /* @__PURE__ */ jsx29("div", { children: targetChainData?.displayName })
1289
1477
  ] })
1290
1478
  ] }),
1291
- /* @__PURE__ */ jsx26("div", { className: "xpay-flex xpay-items-center xpay-mb-2 last:xpay-mb-0", children: /* @__PURE__ */ jsxs7("div", { className: "xpay-flex xpay-items-center xpay-flex-wrap", children: [
1292
- /* @__PURE__ */ jsxs7("div", { className: "xpay-flex xpay-items-center", children: [
1479
+ /* @__PURE__ */ jsx29("div", { className: "xpay-flex xpay-items-center xpay-mb-2 last:xpay-mb-0", children: /* @__PURE__ */ jsxs9("div", { className: "xpay-flex xpay-items-center xpay-flex-wrap", children: [
1480
+ /* @__PURE__ */ jsxs9("div", { className: "xpay-flex xpay-items-center", children: [
1293
1481
  Number(transferredAmount) < MINIMUM_DISPLAYED_TOKEN_AMOUNT ? `<${MINIMUM_DISPLAYED_TOKEN_AMOUNT}` : transferredAmount,
1294
- /* @__PURE__ */ jsx26("div", { className: "xpay-ml-1", children: tokenData?.symbol }),
1295
- tokenData?.image ? /* @__PURE__ */ jsx26(
1482
+ /* @__PURE__ */ jsx29("div", { className: "xpay-ml-1", children: tokenData?.symbol }),
1483
+ tokenData?.image ? /* @__PURE__ */ jsx29(
1296
1484
  "img",
1297
1485
  {
1298
1486
  src: tokenData?.image,
1299
1487
  alt: tokenData?.name || "",
1300
1488
  className: "xpay-w-5 xpay-h-5 xpay-ml-1"
1301
1489
  }
1302
- ) : /* @__PURE__ */ jsx26("div", { className: "xpay-flex xpay-items-center xpay-justify-center xpay-w-5 xpay-h-5 xpay-text-[10px] xpay-ml-1 xpay-rounded-full xpay-bg-[#272e40] xpay-text-[#e0e7fa]", children: tokenData?.symbol.substring(0, 1) })
1490
+ ) : /* @__PURE__ */ jsx29("div", { className: "xpay-flex xpay-items-center xpay-justify-center xpay-w-5 xpay-h-5 xpay-text-[10px] xpay-ml-1 xpay-rounded-full xpay-bg-[#272e40] xpay-text-[#e0e7fa]", children: tokenData?.symbol.substring(0, 1) })
1303
1491
  ] }),
1304
- transaction.tokenOutAddress && /* @__PURE__ */ jsxs7(Fragment, { children: [
1305
- /* @__PURE__ */ jsx26("div", { className: "xpay-w-3.5 xpay-h-3.5 xpay-my-0 xpay-mx-1.5", children: /* @__PURE__ */ jsx26(ArrowRightIcon, {}) }),
1306
- /* @__PURE__ */ jsxs7("div", { className: "xpay-flex xpay-items-center", children: [
1492
+ transaction.tokenOutAddress && /* @__PURE__ */ jsxs9(Fragment, { children: [
1493
+ /* @__PURE__ */ jsx29("div", { className: "xpay-w-3.5 xpay-h-3.5 xpay-my-0 xpay-mx-1.5", children: /* @__PURE__ */ jsx29(ArrowRightIcon, {}) }),
1494
+ /* @__PURE__ */ jsxs9("div", { className: "xpay-flex xpay-items-center", children: [
1307
1495
  Number(receivedAmount) < 1e-4 ? "<0.0001" : receivedAmount,
1308
- /* @__PURE__ */ jsx26("div", { className: "xpay-ml-1", children: tokenOutData?.symbol }),
1309
- tokenOutData?.image ? /* @__PURE__ */ jsx26(
1496
+ /* @__PURE__ */ jsx29("div", { className: "xpay-ml-1", children: tokenOutData?.symbol }),
1497
+ tokenOutData?.image ? /* @__PURE__ */ jsx29(
1310
1498
  "img",
1311
1499
  {
1312
1500
  src: tokenOutData?.image,
1313
1501
  alt: tokenOutData?.name || "",
1314
1502
  className: "xpay-w-5 xpay-h-5 xpay-ml-1"
1315
1503
  }
1316
- ) : /* @__PURE__ */ jsx26("div", { className: "xpay-flex xpay-items-center xpay-justify-center xpay-w-5 xpay-h-5 xpay-text-[10px] xpay-ml-1 xpay-rounded-full xpay-bg-[#272e40] xpay-text-[#e0e7fa]", children: tokenData?.symbol.substring(0, 1) })
1504
+ ) : /* @__PURE__ */ jsx29("div", { className: "xpay-flex xpay-items-center xpay-justify-center xpay-w-5 xpay-h-5 xpay-text-[10px] xpay-ml-1 xpay-rounded-full xpay-bg-[#272e40] xpay-text-[#e0e7fa]", children: tokenData?.symbol.substring(0, 1) })
1317
1505
  ] })
1318
1506
  ] })
1319
1507
  ] }) })
@@ -1322,7 +1510,7 @@ var HistoryCard = ({ transaction, supportedChains }) => {
1322
1510
  };
1323
1511
 
1324
1512
  // src/components/TxConfigForm/History.tsx
1325
- import { jsx as jsx27, jsxs as jsxs8 } from "react/jsx-runtime";
1513
+ import { jsx as jsx30, jsxs as jsxs10 } from "react/jsx-runtime";
1326
1514
  var History = ({ signer, supportedChains }) => {
1327
1515
  const [fetchedHistory, setFetchedHistory] = useState2();
1328
1516
  const [historyLoadedOnce, setHistoryLoadedOnce] = useState2(false);
@@ -1394,11 +1582,11 @@ var History = ({ signer, supportedChains }) => {
1394
1582
  return () => clearInterval(timer);
1395
1583
  }, [signer, fetchHistory, getHistory, historyLoadedOnce]);
1396
1584
  if (!signer)
1397
- return /* @__PURE__ */ jsx27("div", { className: "xpay-flex xpay-items-center xpay-justify-center xpay-w-full xpay-h-[30vh]", children: "Connect a wallet to browse history" });
1398
- return /* @__PURE__ */ jsx27("div", { className: "xpay-flex xpay-items-center xpay-justify-center xpay-w-full", children: /* @__PURE__ */ jsxs8("div", { className: "xpay-w-full xpay-h-96 xpay-overflow-scroll xpay-overflow-x-hidden", children: [
1399
- fetchedHistory?.length === 0 && historyLoadedOnce && /* @__PURE__ */ jsx27("div", { className: "xpay-w-full xpay-text-center xpay-py-4 xpay-px-0 xpay-text-[rgb(158,158,158)]", children: "Your history is empty..." }),
1400
- !fetchedHistory && !historyLoadedOnce && /* @__PURE__ */ jsx27("div", { className: "xpay-flex xpay-w-full xpay-h-full xpay-items-center xpay-justify-center", children: /* @__PURE__ */ jsx27(CircularProgressIcon, {}) }),
1401
- fetchedHistory?.map((transaction, index) => /* @__PURE__ */ jsx27(
1585
+ return /* @__PURE__ */ jsx30("div", { className: "xpay-flex xpay-items-center xpay-justify-center xpay-w-full xpay-h-[30vh]", children: "Connect a wallet to browse history" });
1586
+ return /* @__PURE__ */ jsx30("div", { className: "xpay-flex xpay-items-center xpay-justify-center xpay-w-full", children: /* @__PURE__ */ jsxs10("div", { className: "xpay-w-full xpay-h-96 xpay-overflow-scroll xpay-overflow-x-hidden", children: [
1587
+ fetchedHistory?.length === 0 && historyLoadedOnce && /* @__PURE__ */ jsx30("div", { className: "xpay-w-full xpay-text-center xpay-py-4 xpay-px-0 xpay-text-[rgb(158,158,158)]", children: "Your history is empty..." }),
1588
+ !fetchedHistory && !historyLoadedOnce && /* @__PURE__ */ jsx30("div", { className: "xpay-flex xpay-w-full xpay-h-full xpay-items-center xpay-justify-center", children: /* @__PURE__ */ jsx30(CircularProgressIcon, {}) }),
1589
+ fetchedHistory?.map((transaction, index) => /* @__PURE__ */ jsx30(
1402
1590
  HistoryCard,
1403
1591
  {
1404
1592
  transaction,
@@ -1410,7 +1598,7 @@ var History = ({ signer, supportedChains }) => {
1410
1598
  };
1411
1599
 
1412
1600
  // src/components/TxConfigForm/TopBar.tsx
1413
- import { Fragment as Fragment2, jsx as jsx28, jsxs as jsxs9 } from "react/jsx-runtime";
1601
+ import { Fragment as Fragment2, jsx as jsx31, jsxs as jsxs11 } from "react/jsx-runtime";
1414
1602
  var TopBar = ({
1415
1603
  signer,
1416
1604
  setSettingsShown,
@@ -1418,33 +1606,33 @@ var TopBar = ({
1418
1606
  historyTabShown,
1419
1607
  onClose
1420
1608
  }) => {
1421
- return /* @__PURE__ */ jsxs9("div", { className: "xpay-flex xpay-w-full xpay-justify-between xpay-items-center xpay-mx-auto xpay-p-2", children: [
1422
- /* @__PURE__ */ jsx28("div", { className: "xpay-rounded-lg xpay-text-[rgba(255,255,255,0.6)] xpay-text-xs sm:xpay-text-base xpay-whitespace-nowrap", children: signer ? `Connected wallet: ${shortAddress(signer)}` : `Wallet disconnected` }),
1423
- /* @__PURE__ */ jsxs9("div", { className: "xpay-flex xpay-gap-2 xpay-justify-center xpay-items-center", children: [
1424
- !historyTabShown && /* @__PURE__ */ jsx28(
1609
+ return /* @__PURE__ */ jsxs11("div", { className: "xpay-flex xpay-w-full xpay-justify-between xpay-items-center xpay-mx-auto xpay-p-2", children: [
1610
+ /* @__PURE__ */ jsx31("div", { className: "xpay-rounded-lg xpay-text-[rgba(255,255,255,0.6)] xpay-text-xs sm:xpay-text-base xpay-whitespace-nowrap", children: signer ? `Connected wallet: ${shortAddress(signer)}` : `Wallet disconnected` }),
1611
+ /* @__PURE__ */ jsxs11("div", { className: "xpay-flex xpay-gap-2 xpay-justify-center xpay-items-center", children: [
1612
+ !historyTabShown && /* @__PURE__ */ jsx31(
1425
1613
  "div",
1426
1614
  {
1427
1615
  onClick: () => setSettingsShown(true),
1428
1616
  className: "xpay-flex xpay-items-center xpay-text-xs xpay-gap-1 xpay-cursor-pointer",
1429
- children: /* @__PURE__ */ jsx28("div", { className: "xpay-w-7 xpay-h-7 xpay-rounded-full xpay-bg-gradient-to-r xpay-from-x_blue_light xpay-to-x_blue_dark xpay-flex xpay-items-center xpay-justify-center", children: /* @__PURE__ */ jsx28(SettingsIcon, {}) })
1617
+ children: /* @__PURE__ */ jsx31("div", { className: "xpay-w-7 xpay-h-7 xpay-rounded-full xpay-bg-gradient-to-r xpay-from-x_blue_light xpay-to-x_blue_dark xpay-flex xpay-items-center xpay-justify-center", children: /* @__PURE__ */ jsx31(SettingsIcon, {}) })
1430
1618
  }
1431
1619
  ),
1432
- /* @__PURE__ */ jsx28(
1620
+ /* @__PURE__ */ jsx31(
1433
1621
  "div",
1434
1622
  {
1435
1623
  onClick: () => setHistoryTabShown((x) => !x),
1436
1624
  className: "xpay-flex xpay-items-center xpay-text-sm xpay-gap-1 xpay-cursor-pointer",
1437
- children: !historyTabShown ? /* @__PURE__ */ jsx28(Fragment2, { children: /* @__PURE__ */ jsx28("div", { className: "xpay-w-7 xpay-h-7 xpay-rounded-full xpay-bg-gradient-to-r xpay-from-x_blue_light xpay-to-x_blue_dark xpay-flex xpay-items-center xpay-justify-center", children: /* @__PURE__ */ jsx28(HistoryIcon, {}) }) }) : /* @__PURE__ */ jsx28("div", { children: "Back" })
1625
+ children: !historyTabShown ? /* @__PURE__ */ jsx31(Fragment2, { children: /* @__PURE__ */ jsx31("div", { className: "xpay-w-7 xpay-h-7 xpay-rounded-full xpay-bg-gradient-to-r xpay-from-x_blue_light xpay-to-x_blue_dark xpay-flex xpay-items-center xpay-justify-center", children: /* @__PURE__ */ jsx31(HistoryIcon, {}) }) }) : /* @__PURE__ */ jsx31("div", { children: "Back" })
1438
1626
  }
1439
1627
  ),
1440
- /* @__PURE__ */ jsx28("div", { className: "xpay-cursor-pointer xpay-text-white", onClick: onClose, children: /* @__PURE__ */ jsx28(CloseIcon, {}) })
1628
+ /* @__PURE__ */ jsx31("div", { className: "xpay-cursor-pointer xpay-text-white", onClick: onClose, children: /* @__PURE__ */ jsx31(CloseIcon, {}) })
1441
1629
  ] })
1442
1630
  ] });
1443
1631
  };
1444
1632
 
1445
1633
  // src/components/TxConfigForm/Settings.tsx
1446
1634
  import { useState as useState3, useEffect as useEffect3 } from "react";
1447
- import { jsx as jsx29, jsxs as jsxs10 } from "react/jsx-runtime";
1635
+ import { jsx as jsx32, jsxs as jsxs12 } from "react/jsx-runtime";
1448
1636
  var Settings = ({
1449
1637
  setSlippage,
1450
1638
  setSettingsShown,
@@ -1461,22 +1649,22 @@ var Settings = ({
1461
1649
  );
1462
1650
  }
1463
1651
  }, [slippageActivePresetIndex, usingSlippageInput]);
1464
- return /* @__PURE__ */ jsx29("div", { className: "xpay-absolute xpay-w-[310px] xpay-right-0 xpay-top-[46px] xpay-z-10 xpay-bg-black xpay-border xpay-border-solid xpay-border-[rgba(54,129,198,1)] xpay-p-4 xpay-rounded-xl", children: /* @__PURE__ */ jsxs10("div", { className: "xpay-flex xpay-flex-col xpay-gap-4 xpay-justify-between", children: [
1465
- /* @__PURE__ */ jsxs10("div", { className: "xpay-flex xpay-justify-between", children: [
1466
- /* @__PURE__ */ jsx29("div", { className: "xpay-text-base", children: "Settings" }),
1467
- /* @__PURE__ */ jsx29(
1652
+ return /* @__PURE__ */ jsx32("div", { className: "xpay-absolute xpay-w-[310px] xpay-right-0 xpay-top-[46px] xpay-z-10 xpay-bg-black xpay-border xpay-border-solid xpay-border-[rgba(54,129,198,1)] xpay-p-4 xpay-rounded-xl", children: /* @__PURE__ */ jsxs12("div", { className: "xpay-flex xpay-flex-col xpay-gap-4 xpay-justify-between", children: [
1653
+ /* @__PURE__ */ jsxs12("div", { className: "xpay-flex xpay-justify-between", children: [
1654
+ /* @__PURE__ */ jsx32("div", { className: "xpay-text-base", children: "Settings" }),
1655
+ /* @__PURE__ */ jsx32(
1468
1656
  "div",
1469
1657
  {
1470
1658
  className: "xpay-cursor-pointer",
1471
1659
  onClick: () => setSettingsShown(false),
1472
- children: /* @__PURE__ */ jsx29(CloseIcon, {})
1660
+ children: /* @__PURE__ */ jsx32(CloseIcon, {})
1473
1661
  }
1474
1662
  )
1475
1663
  ] }),
1476
- /* @__PURE__ */ jsxs10("div", { children: [
1477
- /* @__PURE__ */ jsxs10("div", { className: "xpay-flex xpay-gap-2 xpay-items-center", children: [
1478
- /* @__PURE__ */ jsx29("div", { className: "xpay-text-sm xpay-text-[rgba(255,255,255,0.6)]", children: "Express delivery" }),
1479
- /* @__PURE__ */ jsx29("div", { children: /* @__PURE__ */ jsxs10(
1664
+ /* @__PURE__ */ jsxs12("div", { children: [
1665
+ /* @__PURE__ */ jsxs12("div", { className: "xpay-flex xpay-gap-2 xpay-items-center", children: [
1666
+ /* @__PURE__ */ jsx32("div", { className: "xpay-text-sm xpay-text-[rgba(255,255,255,0.6)]", children: "Express delivery" }),
1667
+ /* @__PURE__ */ jsx32("div", { children: /* @__PURE__ */ jsxs12(
1480
1668
  "span",
1481
1669
  {
1482
1670
  className: "xpay-inline-flex xpay-w-14 xpay-h-9 xpay-p-3 xpay-relative xpay-align-middle xpay-box-border xpay-overflow-hidden xpay-cursor-pointer",
@@ -1484,8 +1672,8 @@ var Settings = ({
1484
1672
  setExpressChecked((x) => !x);
1485
1673
  },
1486
1674
  children: [
1487
- /* @__PURE__ */ jsx29("span", { className: "xpay-h-full, xpay-w-full xpay-rounded-lg xpay-bg-[rgba(255,255,255,0.3)]" }),
1488
- /* @__PURE__ */ jsx29(
1675
+ /* @__PURE__ */ jsx32("span", { className: "xpay-h-full, xpay-w-full xpay-rounded-lg xpay-bg-[rgba(255,255,255,0.3)]" }),
1676
+ /* @__PURE__ */ jsx32(
1489
1677
  "span",
1490
1678
  {
1491
1679
  className: `xpay-transition-all xpay-w-5 xpay-h-5 xpay-rounded-full xpay-absolute xpay-translate-y-[-4px]
@@ -1496,15 +1684,15 @@ var Settings = ({
1496
1684
  }
1497
1685
  ) })
1498
1686
  ] }),
1499
- /* @__PURE__ */ jsxs10("div", { className: "xpay-flex xpay-gap-4", children: [
1500
- /* @__PURE__ */ jsx29("div", { className: "xpay-min-w-[26px] xpay-min-h-[26px] xpay-text-[#ffa726]", children: /* @__PURE__ */ jsx29(InfoIcon, {}) }),
1501
- /* @__PURE__ */ jsx29("div", { className: "xpay-text-xs xpay-text-left", children: "Express delivery is a special feature of XSwap that reduces transaction time across chains to around 30 seconds. It is currently available for swaps below a value of $ 1000 USD." })
1687
+ /* @__PURE__ */ jsxs12("div", { className: "xpay-flex xpay-gap-4", children: [
1688
+ /* @__PURE__ */ jsx32("div", { className: "xpay-min-w-[26px] xpay-min-h-[26px] xpay-text-[#ffa726]", children: /* @__PURE__ */ jsx32(InfoIcon, {}) }),
1689
+ /* @__PURE__ */ jsx32("div", { className: "xpay-text-xs xpay-text-left", children: "Express delivery is a special feature of XSwap that reduces transaction time across chains to around 30 seconds. It is currently available for swaps below a value of $ 1000 USD." })
1502
1690
  ] })
1503
1691
  ] }),
1504
- /* @__PURE__ */ jsxs10("div", { className: "xpay-flex xpay-flex-col xpay-gap-2", children: [
1505
- /* @__PURE__ */ jsx29("div", { className: "xpay-text-[rgba(255,255,255,0.6)] xpay-text-sm", children: "Slippage" }),
1506
- /* @__PURE__ */ jsxs10("div", { className: "xpay-flex xpay-gap-2", children: [
1507
- /* @__PURE__ */ jsx29("div", { className: "xpay-flex xpay-items-center xpay-bg-[rgba(15,15,15,1)] p-1 xpay-global-border xpay-rounded-xl", children: SLIPPAGE_PRESETS.map((preset, index) => /* @__PURE__ */ jsx29(
1692
+ /* @__PURE__ */ jsxs12("div", { className: "xpay-flex xpay-flex-col xpay-gap-2", children: [
1693
+ /* @__PURE__ */ jsx32("div", { className: "xpay-text-[rgba(255,255,255,0.6)] xpay-text-sm", children: "Slippage" }),
1694
+ /* @__PURE__ */ jsxs12("div", { className: "xpay-flex xpay-gap-2", children: [
1695
+ /* @__PURE__ */ jsx32("div", { className: "xpay-flex xpay-items-center xpay-bg-[rgba(15,15,15,1)] p-1 xpay-global-border xpay-rounded-xl", children: SLIPPAGE_PRESETS.map((preset, index) => /* @__PURE__ */ jsx32(
1508
1696
  "div",
1509
1697
  {
1510
1698
  className: `xpay-transition-all xpay-cursor-pointer xpay-block xpay-rounded-lg xpay-p-2 xpay-border-none xpay-text-sm xpay-leading-[10px] ${index === slippageActivePresetIndex && !usingSlippageInput ? "xpay-text-white" : "xpay-text-[rgba(255,255,255,0.2)]"} ${index === slippageActivePresetIndex && !usingSlippageInput ? "xpay-bg-gradient-to-r xpay-from-[#3681c6] xpay-to-[#2b4a9d]" : ""}`,
@@ -1516,8 +1704,8 @@ var Settings = ({
1516
1704
  },
1517
1705
  index
1518
1706
  )) }),
1519
- /* @__PURE__ */ jsxs10("div", { className: "xpay-bg-[rgba(39,39,39,1)] xpay-p-2 xpay-border xpay-border-solid xpay-border-[rgba(82,82,82,1)] xpay-rounded-xl xpay-text-white xpay-flex xpay-items-center", children: [
1520
- /* @__PURE__ */ jsx29(
1707
+ /* @__PURE__ */ jsxs12("div", { className: "xpay-bg-[rgba(39,39,39,1)] xpay-p-2 xpay-border xpay-border-solid xpay-border-[rgba(82,82,82,1)] xpay-rounded-xl xpay-text-white xpay-flex xpay-items-center", children: [
1708
+ /* @__PURE__ */ jsx32(
1521
1709
  "input",
1522
1710
  {
1523
1711
  className: "xpay-text-white xpay-border-none xpay-bg-[rgba(39,39,39,1)] xpay-w-10 placeholder:xpay-text-[rgba(255,255,255,0.2)] focus:xpay-outline-none xpay-text-sm xpay-leading-none",
@@ -1536,16 +1724,16 @@ var Settings = ({
1536
1724
  }
1537
1725
  }
1538
1726
  ),
1539
- /* @__PURE__ */ jsx29(PercentageIcon, {})
1727
+ /* @__PURE__ */ jsx32(PercentageIcon, {})
1540
1728
  ] })
1541
1729
  ] }),
1542
- /* @__PURE__ */ jsxs10("div", { className: "xpay-flex xpay-gap-4", children: [
1543
- /* @__PURE__ */ jsx29("div", { className: "xpay-min-w-[26px] xpay-min-h-[26px] xpay-text-[#ffa726]", children: /* @__PURE__ */ jsx29(InfoIcon, {}) }),
1544
- /* @__PURE__ */ jsxs10("div", { className: "xpay-text-xs xpay-text-left", children: [
1730
+ /* @__PURE__ */ jsxs12("div", { className: "xpay-flex xpay-gap-4", children: [
1731
+ /* @__PURE__ */ jsx32("div", { className: "xpay-min-w-[26px] xpay-min-h-[26px] xpay-text-[#ffa726]", children: /* @__PURE__ */ jsx32(InfoIcon, {}) }),
1732
+ /* @__PURE__ */ jsxs12("div", { className: "xpay-text-xs xpay-text-left", children: [
1545
1733
  "Slippage is the price variation you are willing to accept in the event that the price of the trade changes while it is processing.",
1546
- /* @__PURE__ */ jsx29("br", {}),
1734
+ /* @__PURE__ */ jsx32("br", {}),
1547
1735
  " ",
1548
- /* @__PURE__ */ jsx29("br", {}),
1736
+ /* @__PURE__ */ jsx32("br", {}),
1549
1737
  "If the trade fails due to too-low slippage, you will receive USDC on the destination chain."
1550
1738
  ] })
1551
1739
  ] })
@@ -1554,28 +1742,23 @@ var Settings = ({
1554
1742
  };
1555
1743
 
1556
1744
  // src/components/TxConfigForm/FeesDetails.tsx
1557
- import { useMemo as useMemo2 } from "react";
1558
- import { jsx as jsx30, jsxs as jsxs11 } from "react/jsx-runtime";
1745
+ import { jsx as jsx33, jsxs as jsxs13 } from "react/jsx-runtime";
1559
1746
  var FeesDetails = ({
1560
1747
  isGettingRoute,
1561
1748
  route,
1562
1749
  paymentToken,
1563
1750
  dstToken,
1564
- expressChecked,
1565
- exceedsExpressDeliveryLimit,
1566
1751
  slippage,
1567
1752
  feesDetailsShown,
1753
+ isExpressDelivery,
1568
1754
  setFeesDetailsShown
1569
1755
  }) => {
1570
- const isExpressDeliveryPossible = useMemo2(() => {
1571
- return expressChecked && !exceedsExpressDeliveryLimit;
1572
- }, [expressChecked, exceedsExpressDeliveryLimit]);
1573
- return /* @__PURE__ */ jsxs11("div", { className: "xpay-flex xpay-flex-col xpay-gap-3 xpay-global-border xpay-rounded-lg xpay-bg-[rgba(15,15,15,1)] xpay-p-2 sm:xpay-p-4 xpay-mb-1", children: [
1574
- /* @__PURE__ */ jsxs11("div", { className: "xpay-flex xpay-w-full xpay-items-center xpay-justify-between xpay-text-xs sm:xpay-text-sm", children: [
1575
- /* @__PURE__ */ jsxs11("div", { className: "xpay-flex xpay-items-center xpay-gap-1 xpay-font-medium xpay-text-white xpay-opacity-60", children: [
1576
- /* @__PURE__ */ jsx30(CoinsIcon, {}),
1577
- /* @__PURE__ */ jsx30("div", { className: "xpay-mr-1", children: "Fees:" }),
1578
- isGettingRoute ? /* @__PURE__ */ jsx30(Skeleton, { width: "xpay-w-20", height: "xpay-h-4" }) : ` ${weiToHumanReadable({
1756
+ return /* @__PURE__ */ jsxs13("div", { className: "xpay-flex xpay-flex-col xpay-gap-3 xpay-global-border xpay-rounded-lg xpay-bg-[rgba(15,15,15,1)] xpay-p-2 sm:xpay-p-4 ", children: [
1757
+ /* @__PURE__ */ jsxs13("div", { className: "xpay-flex xpay-w-full xpay-items-center xpay-justify-between xpay-text-xs sm:xpay-text-sm", children: [
1758
+ /* @__PURE__ */ jsxs13("div", { className: "xpay-flex xpay-items-center xpay-gap-1 xpay-font-medium xpay-text-white xpay-opacity-60", children: [
1759
+ /* @__PURE__ */ jsx33(CoinsIcon, {}),
1760
+ /* @__PURE__ */ jsx33("div", { className: "xpay-mr-1", children: "Fees:" }),
1761
+ isGettingRoute ? /* @__PURE__ */ jsx33(Skeleton, { width: "xpay-w-20", height: "xpay-h-4" }) : ` ${weiToHumanReadable({
1579
1762
  amount: safeBigNumberFrom(
1580
1763
  route?.xSwapFees.xSwapFee.nativeFee || "0"
1581
1764
  ).add(safeBigNumberFrom(route?.xSwapFees.ccipFee || "0")).add(
@@ -1585,54 +1768,54 @@ var FeesDetails = ({
1585
1768
  precisionFractionalPlaces: 5
1586
1769
  })} ${paymentToken?.symbol}`
1587
1770
  ] }),
1588
- /* @__PURE__ */ jsxs11("div", { className: "xpay-flex xpay-gap-1 xpay-items-center", children: [
1589
- route?.xSwapFees.expressDeliveryFee && !isGettingRoute && /* @__PURE__ */ jsxs11(
1771
+ /* @__PURE__ */ jsxs13("div", { className: "xpay-flex xpay-gap-1 xpay-items-center", children: [
1772
+ route?.xSwapFees.expressDeliveryFee && !isGettingRoute && /* @__PURE__ */ jsxs13(
1590
1773
  "div",
1591
1774
  {
1592
- className: `xpay-flex xpay-gap-1 xpay-items-center xpay-font-medium ${isExpressDeliveryPossible ? "xpay-text-x_green" : "xpay-text-white xpay-opacity-60"}`,
1775
+ className: `xpay-flex xpay-gap-1 xpay-items-center xpay-font-medium ${isExpressDelivery ? "xpay-text-x_green" : "xpay-text-white xpay-opacity-60"}`,
1593
1776
  children: [
1594
- /* @__PURE__ */ jsx30(TimerIcon, {}),
1595
- isExpressDeliveryPossible ? "Fast ~ 30sec " : "Normal ~ 30min"
1777
+ /* @__PURE__ */ jsx33(TimerIcon, {}),
1778
+ isExpressDelivery ? "Fast ~ 30sec " : "Normal ~ 30min"
1596
1779
  ]
1597
1780
  }
1598
1781
  ),
1599
- /* @__PURE__ */ jsx30(
1782
+ /* @__PURE__ */ jsx33(
1600
1783
  "div",
1601
1784
  {
1602
1785
  onClick: () => setFeesDetailsShown((x) => !x),
1603
1786
  className: "xpay-font-medium xpay-text-white xpay-opacity-60 xpay-cursor-pointer xpay-flex xpay-items-center xpay-w-[15px] xpay-h-[9px]",
1604
- children: feesDetailsShown ? /* @__PURE__ */ jsx30(ChevronUpIcon, {}) : /* @__PURE__ */ jsx30(ChevronDownIcon, {})
1787
+ children: feesDetailsShown ? /* @__PURE__ */ jsx33(ChevronUpIcon, {}) : /* @__PURE__ */ jsx33(ChevronDownIcon, {})
1605
1788
  }
1606
1789
  )
1607
1790
  ] })
1608
1791
  ] }),
1609
- feesDetailsShown && /* @__PURE__ */ jsxs11("div", { className: "xpay-flex xpay-w-full xpay-items-center xpay-justify-between xpay-gap-2", children: [
1610
- /* @__PURE__ */ jsxs11("div", { className: "xpay-flex xpay-flex-col xpay-text-[10px] xpay-gap-1", children: [
1611
- /* @__PURE__ */ jsxs11("div", { className: "xpay-flex xpay-justify-between xpay-font-medium xpay-text-white xpay-opacity-60 xpay-gap-1", children: [
1612
- /* @__PURE__ */ jsx30("div", { children: "CCIP Fee:" }),
1613
- /* @__PURE__ */ jsx30("div", { className: "xpay-whitespace-nowrap", children: ` ${weiToHumanReadable({
1792
+ feesDetailsShown && /* @__PURE__ */ jsxs13("div", { className: "xpay-flex xpay-w-full xpay-items-center xpay-justify-between xpay-gap-2", children: [
1793
+ /* @__PURE__ */ jsxs13("div", { className: "xpay-flex xpay-flex-col xpay-text-[10px] xpay-gap-1", children: [
1794
+ /* @__PURE__ */ jsxs13("div", { className: "xpay-flex xpay-justify-between xpay-font-medium xpay-text-white xpay-opacity-60 xpay-gap-1", children: [
1795
+ /* @__PURE__ */ jsx33("div", { children: "CCIP Fee:" }),
1796
+ /* @__PURE__ */ jsx33("div", { className: "xpay-whitespace-nowrap", children: ` ${weiToHumanReadable({
1614
1797
  amount: route?.xSwapFees.ccipFee || "0",
1615
1798
  decimals: 18,
1616
1799
  precisionFractionalPlaces: 5
1617
1800
  })} ${paymentToken?.symbol}` })
1618
1801
  ] }),
1619
- /* @__PURE__ */ jsxs11("div", { className: "xpay-flex xpay-justify-between xpay-font-medium xpay-text-white xpay-opacity-60 xpay-gap-1", children: [
1620
- /* @__PURE__ */ jsx30("div", { children: "Native Fee:" }),
1621
- /* @__PURE__ */ jsx30("div", { className: "xpay-whitespace-nowrap", children: ` ${weiToHumanReadable({
1802
+ /* @__PURE__ */ jsxs13("div", { className: "xpay-flex xpay-justify-between xpay-font-medium xpay-text-white xpay-opacity-60 xpay-gap-1", children: [
1803
+ /* @__PURE__ */ jsx33("div", { children: "Native Fee:" }),
1804
+ /* @__PURE__ */ jsx33("div", { className: "xpay-whitespace-nowrap", children: ` ${weiToHumanReadable({
1622
1805
  amount: route?.xSwapFees.xSwapFee.nativeFee || "0",
1623
1806
  decimals: 18,
1624
1807
  precisionFractionalPlaces: 5
1625
1808
  })} ${paymentToken?.symbol}` })
1626
1809
  ] })
1627
1810
  ] }),
1628
- /* @__PURE__ */ jsxs11("div", { className: "xpay-flex xpay-flex-col xpay-text-[10px] xpay-gap-1", children: [
1629
- /* @__PURE__ */ jsxs11("div", { className: "xpay-flex xpay-justify-between xpay-font-medium xpay-text-white xpay-opacity-60 xpay-gap-1", children: [
1630
- /* @__PURE__ */ jsx30("div", { children: "Slippage:" }),
1631
- /* @__PURE__ */ jsx30("div", { className: "xpay-whitespace-nowrap", children: `${slippage}%` })
1811
+ /* @__PURE__ */ jsxs13("div", { className: "xpay-flex xpay-flex-col xpay-text-[10px] xpay-gap-1", children: [
1812
+ /* @__PURE__ */ jsxs13("div", { className: "xpay-flex xpay-justify-between xpay-font-medium xpay-text-white xpay-opacity-60 xpay-gap-1", children: [
1813
+ /* @__PURE__ */ jsx33("div", { children: "Slippage:" }),
1814
+ /* @__PURE__ */ jsx33("div", { className: "xpay-whitespace-nowrap", children: `${slippage}%` })
1632
1815
  ] }),
1633
- /* @__PURE__ */ jsxs11("div", { className: "xpay-flex xpay-justify-between xpay-font-medium xpay-text-white xpay-opacity-60 xpay-gap-1", children: [
1634
- /* @__PURE__ */ jsx30("div", { children: "Min amount out:" }),
1635
- /* @__PURE__ */ jsxs11("div", { className: "xpay-whitespace-nowrap", children: [
1816
+ /* @__PURE__ */ jsxs13("div", { className: "xpay-flex xpay-justify-between xpay-font-medium xpay-text-white xpay-opacity-60 xpay-gap-1", children: [
1817
+ /* @__PURE__ */ jsx33("div", { children: "Min amount out:" }),
1818
+ /* @__PURE__ */ jsxs13("div", { className: "xpay-whitespace-nowrap", children: [
1636
1819
  weiToHumanReadable({
1637
1820
  amount: route?.minAmountOut || "0",
1638
1821
  decimals: dstToken?.decimals || 18,
@@ -1648,38 +1831,31 @@ var FeesDetails = ({
1648
1831
  };
1649
1832
 
1650
1833
  // src/components/TxConfigForm/Summary.tsx
1651
- import { useEffect as useEffect5, useMemo as useMemo4, useState as useState5 } from "react";
1834
+ import { useEffect as useEffect5, useMemo as useMemo2, useState as useState5 } from "react";
1652
1835
 
1653
1836
  // src/components/TxConfigForm/UsdPrice.tsx
1654
1837
  import { useEffect as useEffect4, useState as useState4 } from "react";
1655
- import { Fragment as Fragment3, jsx as jsx31 } from "react/jsx-runtime";
1838
+ import { Fragment as Fragment3, jsx as jsx34 } from "react/jsx-runtime";
1656
1839
  var UsdPrice = ({
1657
1840
  prices,
1658
1841
  token,
1659
1842
  amount = "0",
1660
- loading = false,
1661
- type,
1662
- setExceedsExpressDeliveryLimit
1843
+ loading = false
1663
1844
  }) => {
1664
1845
  const [usdPrice, setUsdPrice] = useState4("0.00");
1665
1846
  useEffect4(() => {
1666
1847
  if (token && prices && prices[token.address]) {
1667
- const newUsdPrice = (Number(amount) * Number(prices[token.address])).toFixed(2);
1668
- if (type === "src" && setExceedsExpressDeliveryLimit) {
1669
- setExceedsExpressDeliveryLimit(
1670
- Number(newUsdPrice) > EXPRESS_DELIVERY_LIMIT
1671
- );
1672
- }
1848
+ const newUsdPrice = (Number(amount) * Number(prices[token.address.toLowerCase()])).toFixed(2);
1673
1849
  setUsdPrice(newUsdPrice);
1674
1850
  }
1675
1851
  }, [token, prices, amount]);
1676
- return /* @__PURE__ */ jsx31("div", { className: "xpay-opacity-60 xpay-py-4", children: loading ? /* @__PURE__ */ jsx31(Skeleton, { width: "xpay-w-12", height: "xpay-h-4" }) : token ? prices && prices[token.address] ? /* @__PURE__ */ jsx31("div", { children: `$${usdPrice}` }) : /* @__PURE__ */ jsx31(Alert, { desc: "Unknown price" }) : /* @__PURE__ */ jsx31(Fragment3, { children: "$0.00" }) });
1852
+ return /* @__PURE__ */ jsx34("div", { className: "xpay-opacity-60", children: loading ? /* @__PURE__ */ jsx34(Skeleton, { width: "xpay-w-12", height: "xpay-h-4" }) : token ? prices && prices[token.address] ? /* @__PURE__ */ jsx34("div", { children: `$${usdPrice}` }) : /* @__PURE__ */ jsx34(Alert, { desc: "Unknown price" }) : /* @__PURE__ */ jsx34(Fragment3, { children: "$0.00" }) });
1677
1853
  };
1678
1854
 
1679
1855
  // src/components/UnknownTokenLogo/UnknownTokenLogo.tsx
1680
- import { jsx as jsx32 } from "react/jsx-runtime";
1856
+ import { jsx as jsx35 } from "react/jsx-runtime";
1681
1857
  var UnknownTokenLogo = ({ tokenName, className }) => {
1682
- return /* @__PURE__ */ jsx32(
1858
+ return /* @__PURE__ */ jsx35(
1683
1859
  "div",
1684
1860
  {
1685
1861
  className: `xpay-w-5 xpay-h-5 xpay-rounded-full xpay-bg-white xpay-shadow-sm xpay-flex xpay-items-center xpay-justify-center xpay-text-black ${className}`,
@@ -1689,7 +1865,7 @@ var UnknownTokenLogo = ({ tokenName, className }) => {
1689
1865
  };
1690
1866
 
1691
1867
  // src/components/TxConfigForm/Summary.tsx
1692
- import { jsx as jsx33, jsxs as jsxs12 } from "react/jsx-runtime";
1868
+ import { jsx as jsx36, jsxs as jsxs14 } from "react/jsx-runtime";
1693
1869
  var Summary = ({
1694
1870
  isGettingRoute,
1695
1871
  route,
@@ -1697,11 +1873,11 @@ var Summary = ({
1697
1873
  dstChain
1698
1874
  }) => {
1699
1875
  const [prices, setPrices] = useState5();
1700
- const amountReadable = useMemo4(
1876
+ const amountReadable = useMemo2(
1701
1877
  () => weiToHumanReadable({
1702
1878
  amount: route?.estAmountOut || "0",
1703
1879
  decimals: dstToken?.decimals || 18,
1704
- precisionFractionalPlaces: 5
1880
+ precisionFractionalPlaces: 8
1705
1881
  }),
1706
1882
  [route, dstToken]
1707
1883
  );
@@ -1712,64 +1888,63 @@ var Summary = ({
1712
1888
  );
1713
1889
  }
1714
1890
  }, [dstChain]);
1715
- return /* @__PURE__ */ jsxs12("div", { className: "xpay-flex xpay-flex-col xpay-global-border xpay-rounded-lg xpay-bg-[rgba(15,15,15,1)] xpay-p-4 xpay-relative", children: [
1716
- /* @__PURE__ */ jsxs12("div", { className: "xpay-flex xpay-justify-between", children: [
1717
- /* @__PURE__ */ jsxs12("div", { className: "xpay-flex xpay-flex-col xpay-gap-1", children: [
1718
- /* @__PURE__ */ jsx33("p", { className: "xpay-text-[rgba(255,255,255,0.6)] xpay-text-sm", children: "You receive" }),
1719
- isGettingRoute ? /* @__PURE__ */ jsx33(
1891
+ return /* @__PURE__ */ jsxs14("div", { className: "xpay-flex xpay-flex-col xpay-global-border xpay-rounded-lg xpay-bg-[rgba(15,15,15,1)] xpay-p-4 xpay-relative", children: [
1892
+ /* @__PURE__ */ jsxs14("div", { className: "xpay-flex xpay-justify-between", children: [
1893
+ /* @__PURE__ */ jsxs14("div", { className: "xpay-flex xpay-flex-col xpay-gap-1", children: [
1894
+ /* @__PURE__ */ jsx36("p", { className: "xpay-text-[rgba(255,255,255,0.6)] xpay-text-sm", children: "You receive" }),
1895
+ isGettingRoute ? /* @__PURE__ */ jsx36(
1720
1896
  Skeleton,
1721
1897
  {
1722
1898
  width: "xpay-w-[100px]",
1723
1899
  height: "xpay-h-[36px]",
1724
1900
  other: "sm:xpay-w-[190px]"
1725
1901
  }
1726
- ) : /* @__PURE__ */ jsx33("div", { className: "xpay-flex xpay-gap-2 xpay-items-center xpay-text-white xpay-text-xl sm:xpay-text-3xl", children: amountReadable })
1902
+ ) : /* @__PURE__ */ jsx36("div", { className: "xpay-flex xpay-gap-2 xpay-items-center xpay-text-white xpay-text-xl sm:xpay-text-3xl", children: amountReadable })
1727
1903
  ] }),
1728
- /* @__PURE__ */ jsxs12("div", { className: "xpay-flex xpay-flex-col xpay-items-end xpay-gap-1 xpay-text-sm", children: [
1729
- /* @__PURE__ */ jsxs12("div", { className: "xpay-flex xpay-justify-center xpay-items-center xpay-gap-1", children: [
1730
- /* @__PURE__ */ jsx33("div", { className: "xpay-w-5 xpay-h-5", children: dstToken?.image ? /* @__PURE__ */ jsx33(
1904
+ /* @__PURE__ */ jsxs14("div", { className: "xpay-flex xpay-flex-col xpay-items-end xpay-gap-1 xpay-text-sm", children: [
1905
+ /* @__PURE__ */ jsxs14("div", { className: "xpay-flex xpay-justify-center xpay-items-center xpay-gap-1", children: [
1906
+ /* @__PURE__ */ jsx36("div", { className: "xpay-w-5 xpay-h-5", children: dstToken?.image ? /* @__PURE__ */ jsx36(
1731
1907
  "img",
1732
1908
  {
1733
1909
  className: "xpay-w-5 xpay-h-5",
1734
1910
  src: dstToken?.image,
1735
1911
  alt: dstToken?.name
1736
1912
  }
1737
- ) : /* @__PURE__ */ jsx33(UnknownTokenLogo, { tokenName: "?" }) }),
1738
- /* @__PURE__ */ jsx33("p", { className: "xpay-text-base sm:xpay-text-xl", children: dstToken?.name })
1913
+ ) : /* @__PURE__ */ jsx36(UnknownTokenLogo, { tokenName: "?" }) }),
1914
+ /* @__PURE__ */ jsx36("p", { className: "xpay-text-base sm:xpay-text-xl", children: dstToken?.name })
1739
1915
  ] }),
1740
- /* @__PURE__ */ jsxs12("div", { className: "xpay-flex xpay-justify-center xpay-items-center xpay-gap-1", children: [
1741
- /* @__PURE__ */ jsxs12("p", { className: "xpay-text-[rgba(255,255,255,0.6)] xpay-text-right", children: [
1916
+ /* @__PURE__ */ jsxs14("div", { className: "xpay-flex xpay-justify-center xpay-items-center xpay-gap-1", children: [
1917
+ /* @__PURE__ */ jsxs14("p", { className: "xpay-text-[rgba(255,255,255,0.6)] xpay-text-right", children: [
1742
1918
  "on",
1743
1919
  " "
1744
1920
  ] }),
1745
- /* @__PURE__ */ jsxs12("div", { className: "xpay-flex xpay-items-center xpay-gap-1 xpay-text-white", children: [
1746
- /* @__PURE__ */ jsx33("div", { className: "xpay-w-4 xpay-h-4", children: /* @__PURE__ */ jsx33("img", { src: dstChain?.image, alt: dstChain?.name }) }),
1747
- /* @__PURE__ */ jsx33("div", { children: dstChain?.displayName })
1921
+ /* @__PURE__ */ jsxs14("div", { className: "xpay-flex xpay-items-center xpay-gap-1 xpay-text-white", children: [
1922
+ /* @__PURE__ */ jsx36("div", { className: "xpay-w-4 xpay-h-4", children: /* @__PURE__ */ jsx36("img", { src: dstChain?.image, alt: dstChain?.name }) }),
1923
+ /* @__PURE__ */ jsx36("div", { children: dstChain?.displayName })
1748
1924
  ] })
1749
1925
  ] })
1750
1926
  ] })
1751
1927
  ] }),
1752
- /* @__PURE__ */ jsx33(
1928
+ /* @__PURE__ */ jsx36("div", { className: "xpay-pt-2", children: /* @__PURE__ */ jsx36(
1753
1929
  UsdPrice,
1754
1930
  {
1755
1931
  prices,
1756
1932
  token: dstToken,
1757
1933
  amount: amountReadable,
1758
- loading: isGettingRoute,
1759
- type: "dst"
1934
+ loading: isGettingRoute
1760
1935
  }
1761
- ),
1762
- /* @__PURE__ */ jsx33("div", { className: "xpay-absolute xpay-right-[50%] xpay-top-0 xpay-translate-x-1/2 xpay-translate-y-[-60%] xpay-global-border xpay-rounded-xl p-[5px] xpay-bg-[rgba(15,15,15,1)]", children: /* @__PURE__ */ jsx33("div", { className: "xpay-flex xpay-items-center xpay-justify-center xpay-rounded-lg xpay-w-8 xpay-h-8 xpay-bg-gradient-to-l xpay-from-[rgba(54,129,198,1)] xpay-to-[rgba(43,74,157,1)] ", children: /* @__PURE__ */ jsx33(ArrowDownIcon, {}) }) })
1936
+ ) }),
1937
+ /* @__PURE__ */ jsx36("div", { className: "xpay-absolute xpay-right-[50%] xpay-top-0 xpay-translate-x-1/2 xpay-translate-y-[-60%] xpay-global-border xpay-rounded-xl p-[5px] xpay-bg-[rgba(15,15,15,1)]", children: /* @__PURE__ */ jsx36("div", { className: "xpay-flex xpay-items-center xpay-justify-center xpay-rounded-lg xpay-w-8 xpay-h-8 xpay-bg-gradient-to-l xpay-from-[rgba(54,129,198,1)] xpay-to-[rgba(43,74,157,1)] ", children: /* @__PURE__ */ jsx36(ArrowDownIcon, {}) }) })
1763
1938
  ] });
1764
1939
  };
1765
1940
 
1766
1941
  // src/components/TxConfigForm/SwapPanel.tsx
1767
- import { useState as useState7, useEffect as useEffect6, useRef as useRef2, useMemo as useMemo7 } from "react";
1942
+ import { useState as useState7, useEffect as useEffect6, useRef as useRef2, useMemo as useMemo5 } from "react";
1768
1943
 
1769
1944
  // src/components/TxConfigForm/TokenPicker.tsx
1770
- import { useState as useState6, useMemo as useMemo5 } from "react";
1945
+ import { useState as useState6, useMemo as useMemo3 } from "react";
1771
1946
  import { createPortal } from "react-dom";
1772
- import { Fragment as Fragment4, jsx as jsx34, jsxs as jsxs13 } from "react/jsx-runtime";
1947
+ import { Fragment as Fragment4, jsx as jsx37, jsxs as jsxs15 } from "react/jsx-runtime";
1773
1948
  var TokenPicker = ({
1774
1949
  onCloseClick,
1775
1950
  tokens,
@@ -1786,7 +1961,7 @@ var TokenPicker = ({
1786
1961
  onCloseClick();
1787
1962
  }
1788
1963
  };
1789
- const filteredTokens = useMemo5(() => {
1964
+ const filteredTokens = useMemo3(() => {
1790
1965
  const isMatch = (value, searchValue2) => value.toLowerCase().indexOf(searchValue2.toLowerCase()) > -1;
1791
1966
  return tokens?.filter(
1792
1967
  (token) => isMatch(token.symbol, searchValue) || isMatch(token.name, searchValue) || token.address === searchValue.toLowerCase()
@@ -1796,24 +1971,24 @@ var TokenPicker = ({
1796
1971
  }, [searchValue, tokens]);
1797
1972
  const xpayRoot2 = document.querySelector("#xpay-root");
1798
1973
  return xpayRoot2 ? createPortal(
1799
- /* @__PURE__ */ jsx34(
1974
+ /* @__PURE__ */ jsx37(
1800
1975
  "div",
1801
1976
  {
1802
1977
  onClick: onBackdropClick,
1803
1978
  className: "xpay-box-border xpay-fixed xpay-h-full xpay-w-full xpay-z-[999] xpay-top-0 xpay-left-0 xpay-bg-[rgba(0,0,0,0.8)] xpay-flex xpay-items-center xpay-justify-center xpay-p-5",
1804
- children: /* @__PURE__ */ jsxs13("div", { className: "xpay-relative xpay-bg-black xpay-rounded-3xl xpay-p-6 xpay-max-h-[70%] xpay-flex xpay-flex-col xpay-text-base xpay-text-white xpay-w-[452px] xpay-h-[70%] xpay-border xpay-border-solid xpay-border-[rgba(255,255,255,0.2)]", children: [
1805
- /* @__PURE__ */ jsx34(
1979
+ children: /* @__PURE__ */ jsxs15("div", { className: "xpay-relative xpay-bg-black xpay-rounded-3xl xpay-p-6 xpay-max-h-[70%] xpay-flex xpay-flex-col xpay-text-base xpay-text-white xpay-w-[452px] xpay-h-[70%] xpay-border xpay-border-solid xpay-border-[rgba(255,255,255,0.2)]", children: [
1980
+ /* @__PURE__ */ jsx37(
1806
1981
  "div",
1807
1982
  {
1808
1983
  onClick: onCloseClick,
1809
1984
  className: "xpay-absolute xpay-top-4 xpay-right-4 xpay-cursor-pointer",
1810
- children: /* @__PURE__ */ jsx34(CloseIcon, {})
1985
+ children: /* @__PURE__ */ jsx37(CloseIcon, {})
1811
1986
  }
1812
1987
  ),
1813
- /* @__PURE__ */ jsx34("p", { className: "xpay-text-base xpay-mb-4", children: "Pick a token" }),
1814
- /* @__PURE__ */ jsxs13("div", { className: "xpay-flex xpay-items-center xpay-border xpay-border-solid xpay-border-[rgba(255,255,255,0.1)] xpay-rounded-lg xpay-py-0 xpay-px-3 xpay-gap-2 xpay-bg-[rgba(15,15,15,1)]", children: [
1815
- /* @__PURE__ */ jsx34("div", { className: "xpay-w-6 xpay-h-6", children: /* @__PURE__ */ jsx34(SearchIcon, {}) }),
1816
- /* @__PURE__ */ jsx34(
1988
+ /* @__PURE__ */ jsx37("p", { className: "xpay-text-base xpay-mb-4", children: "Pick a token" }),
1989
+ /* @__PURE__ */ jsxs15("div", { className: "xpay-flex xpay-items-center xpay-border xpay-border-solid xpay-border-[rgba(255,255,255,0.1)] xpay-rounded-lg xpay-py-0 xpay-px-3 xpay-gap-2 xpay-bg-[rgba(15,15,15,1)]", children: [
1990
+ /* @__PURE__ */ jsx37("div", { className: "xpay-w-6 xpay-h-6", children: /* @__PURE__ */ jsx37(SearchIcon, {}) }),
1991
+ /* @__PURE__ */ jsx37(
1817
1992
  "input",
1818
1993
  {
1819
1994
  placeholder: "Search name or paste address",
@@ -1823,7 +1998,7 @@ var TokenPicker = ({
1823
1998
  }
1824
1999
  )
1825
2000
  ] }),
1826
- /* @__PURE__ */ jsx34("div", { className: "xpay-my-4 xpay-mx-0 xpay-flex xpay-flex-wrap xpay-gap-3", children: tokens?.filter((token) => token?.quickPick).map((token) => /* @__PURE__ */ jsxs13(
2001
+ /* @__PURE__ */ jsx37("div", { className: "xpay-my-4 xpay-mx-0 xpay-flex xpay-flex-wrap xpay-gap-3", children: tokens?.filter((token) => token?.quickPick).map((token) => /* @__PURE__ */ jsxs15(
1827
2002
  "div",
1828
2003
  {
1829
2004
  className: `xpay-flex xpay-gap-2 xpay-py-1 xpay-px-2 xpay-items-center xpay-bg-[rgb(15,15,15)] xpay-rounded-2xl xpay-border xpay-border-solid xpay-border-[rgba(255,255,255,0.1)] hover:xpay-bg-[rgb(25,25,25)] hover:xpay-cursor-pointer ${token.address === selectedToken?.address ? "xpay-bg-[rgb(35, 35, 35)]" : ""}`,
@@ -1832,7 +2007,7 @@ var TokenPicker = ({
1832
2007
  onCloseClick();
1833
2008
  },
1834
2009
  children: [
1835
- /* @__PURE__ */ jsx34(
2010
+ /* @__PURE__ */ jsx37(
1836
2011
  "img",
1837
2012
  {
1838
2013
  src: token.image,
@@ -1840,13 +2015,13 @@ var TokenPicker = ({
1840
2015
  className: "xpay-w-5"
1841
2016
  }
1842
2017
  ),
1843
- /* @__PURE__ */ jsx34("div", { className: "xpay-text-sm", children: token.symbol })
2018
+ /* @__PURE__ */ jsx37("div", { className: "xpay-text-sm", children: token.symbol })
1844
2019
  ]
1845
2020
  },
1846
2021
  token.address
1847
2022
  )) }),
1848
- /* @__PURE__ */ jsx34("div", { className: "xpay-h-[2px] xpay-my-0 xpay-mx-[-24px] xpay-w-[100%+48px] xpay-px-12 xpay-bg-[rgba(255,255,255,0.1)]" }),
1849
- /* @__PURE__ */ jsx34("div", { className: "xpay-overflow-y-scroll xpay-h-full xpay-mx-[-24px] xpay-w-[100%+48px] xpay-flex xpay-flex-col", children: filteredTokens && filteredTokens.length > 0 ? filteredTokens.map((token, index) => /* @__PURE__ */ jsxs13(
2023
+ /* @__PURE__ */ jsx37("div", { className: "xpay-h-[2px] xpay-my-0 xpay-mx-[-24px] xpay-w-[100%+48px] xpay-px-12 xpay-bg-[rgba(255,255,255,0.1)]" }),
2024
+ /* @__PURE__ */ jsx37("div", { className: "xpay-overflow-y-scroll xpay-h-full xpay-mx-[-24px] xpay-w-[100%+48px] xpay-flex xpay-flex-col", children: filteredTokens && filteredTokens.length > 0 ? filteredTokens.map((token, index) => /* @__PURE__ */ jsxs15(
1850
2025
  "div",
1851
2026
  {
1852
2027
  className: `xpay-flex xpay-gap-3 xpay-py-2 xpay-px-[24px] xpay-w-full xpay-items-center hover:xpay-bg-[rgb(25,25,25)] hover:xpay-cursor-pointer ${token.address === selectedToken?.address ? "xpay-bg-[rgb(35,35,35)]" : ""}`,
@@ -1855,22 +2030,22 @@ var TokenPicker = ({
1855
2030
  onCloseClick();
1856
2031
  },
1857
2032
  children: [
1858
- token.image ? /* @__PURE__ */ jsx34("img", { src: token.image, alt: token.name }) : /* @__PURE__ */ jsx34("div", { className: "xpay-flex xpay-items-center xpay-justify-center xpay-w-9 xpay-h-9 xpay-text-[15px] xpay-ml-1 xpay-rounded-full xpay-bg-[#272e40] xpay-text-[#e0e7fa]", children: token?.symbol.substring(0, 1) }),
1859
- /* @__PURE__ */ jsxs13("div", { className: "xpay-flex xpay-justify-between xpay-items-center xpay-gap-1 xpay-overflow-hidden xpay-grow", children: [
1860
- /* @__PURE__ */ jsxs13("div", { className: "xpay-flex xpay-flex-col xpay-leading-[16px]", children: [
1861
- /* @__PURE__ */ jsx34("div", { className: "xpay-overflow-hidden xpay-whitespace-nowrap xpay-text-ellipsis xpay-text-[15px]", children: token.name }),
1862
- /* @__PURE__ */ jsx34("div", { className: "xpay-text-[#888] xpay-text-[11px]", children: token.symbol })
2033
+ token.image ? /* @__PURE__ */ jsx37("img", { src: token.image, alt: token.name }) : /* @__PURE__ */ jsx37("div", { className: "xpay-flex xpay-items-center xpay-justify-center xpay-w-9 xpay-h-9 xpay-text-[15px] xpay-ml-1 xpay-rounded-full xpay-bg-[#272e40] xpay-text-[#e0e7fa]", children: token?.symbol.substring(0, 1) }),
2034
+ /* @__PURE__ */ jsxs15("div", { className: "xpay-flex xpay-justify-between xpay-items-center xpay-gap-1 xpay-overflow-hidden xpay-grow", children: [
2035
+ /* @__PURE__ */ jsxs15("div", { className: "xpay-flex xpay-flex-col xpay-leading-[16px]", children: [
2036
+ /* @__PURE__ */ jsx37("div", { className: "xpay-overflow-hidden xpay-whitespace-nowrap xpay-text-ellipsis xpay-text-[15px]", children: token.name }),
2037
+ /* @__PURE__ */ jsx37("div", { className: "xpay-text-[#888] xpay-text-[11px]", children: token.symbol })
1863
2038
  ] }),
1864
- signer && /* @__PURE__ */ jsx34(Fragment4, { children: balances && balances[token.address] && token.decimals ? /* @__PURE__ */ jsx34("div", { className: "xpay-text-xs", children: weiToHumanReadable({
2039
+ signer && /* @__PURE__ */ jsx37(Fragment4, { children: balances && balances[token.address] && token.decimals ? /* @__PURE__ */ jsx37("div", { className: "xpay-text-xs", children: weiToHumanReadable({
1865
2040
  amount: balances[token.address]?.toString() || "0",
1866
2041
  decimals: token.decimals,
1867
2042
  precisionFractionalPlaces: 4
1868
- }) }) : /* @__PURE__ */ jsx34(Skeleton, { width: "xpay-w-12", height: "xpay-h-3" }) })
2043
+ }) }) : /* @__PURE__ */ jsx37(Skeleton, { width: "xpay-w-12", height: "xpay-h-3" }) })
1869
2044
  ] })
1870
2045
  ]
1871
2046
  },
1872
2047
  `${index}_${token.address}`
1873
- )) : /* @__PURE__ */ jsx34("div", { className: "xpay-mt-4 xpay-flex xpay-justify-center", children: /* @__PURE__ */ jsx34("p", { className: "xpay-text-sm xpay-text-white", children: "No tokens found." }) }) })
2048
+ )) : /* @__PURE__ */ jsx37("div", { className: "xpay-mt-4 xpay-flex xpay-justify-center", children: /* @__PURE__ */ jsx37("p", { className: "xpay-text-sm xpay-text-white", children: "No tokens found." }) }) })
1874
2049
  ] })
1875
2050
  }
1876
2051
  ),
@@ -1879,7 +2054,7 @@ var TokenPicker = ({
1879
2054
  };
1880
2055
 
1881
2056
  // src/components/TxConfigForm/ChainListElement.tsx
1882
- import { jsx as jsx35, jsxs as jsxs14 } from "react/jsx-runtime";
2057
+ import { jsx as jsx38, jsxs as jsxs16 } from "react/jsx-runtime";
1883
2058
  var ChainListElement = ({
1884
2059
  chain,
1885
2060
  setSrcChain,
@@ -1887,8 +2062,8 @@ var ChainListElement = ({
1887
2062
  index,
1888
2063
  length
1889
2064
  }) => {
1890
- return /* @__PURE__ */ jsxs14("div", { children: [
1891
- /* @__PURE__ */ jsxs14(
2065
+ return /* @__PURE__ */ jsxs16("div", { children: [
2066
+ /* @__PURE__ */ jsxs16(
1892
2067
  "li",
1893
2068
  {
1894
2069
  className: "xpay-bg-transparent xpay-border-none xpay-flex xpay-gap-1 xpay-items-center xpay-cursor-pointer xpay-py-2 xpay-w-full",
@@ -1897,21 +2072,21 @@ var ChainListElement = ({
1897
2072
  setChainListShown(false);
1898
2073
  },
1899
2074
  children: [
1900
- /* @__PURE__ */ jsx35("img", { width: 12, height: 12, src: chain.image, alt: chain.displayName }),
2075
+ /* @__PURE__ */ jsx38("img", { width: 12, height: 12, src: chain.image, alt: chain.displayName }),
1901
2076
  chain.displayName
1902
2077
  ]
1903
2078
  }
1904
2079
  ),
1905
- index !== length - 1 && /* @__PURE__ */ jsx35("div", { className: "xpay-h-px xpay-mx-2 xpay-bg-[rgba(255,255,255,0.15)]" })
2080
+ index !== length - 1 && /* @__PURE__ */ jsx38("div", { className: "xpay-h-px xpay-mx-2 xpay-bg-[rgba(255,255,255,0.15)]" })
1906
2081
  ] }, `${chain.ecosystem}-${chain.chainId}`);
1907
2082
  };
1908
2083
 
1909
2084
  // src/components/TxConfigForm/BalanceComponent.tsx
1910
- import { useMemo as useMemo6 } from "react";
2085
+ import { useMemo as useMemo4 } from "react";
1911
2086
  import BigNumber3 from "bignumber.js";
1912
- import { Fragment as Fragment5, jsx as jsx36, jsxs as jsxs15 } from "react/jsx-runtime";
2087
+ import { Fragment as Fragment5, jsx as jsx39, jsxs as jsxs17 } from "react/jsx-runtime";
1913
2088
  var BalanceComponent = ({ srcToken, balances }) => {
1914
- const balanceText = useMemo6(() => {
2089
+ const balanceText = useMemo4(() => {
1915
2090
  if (!balances || !srcToken) return "0";
1916
2091
  if (balances[srcToken.address]?.toString() === "0") return "0";
1917
2092
  const fullHumanReadable = weiToHumanReadable({
@@ -1929,7 +2104,7 @@ var BalanceComponent = ({ srcToken, balances }) => {
1929
2104
  precisionFractionalPlaces: 5
1930
2105
  });
1931
2106
  }, [srcToken, balances]);
1932
- return /* @__PURE__ */ jsxs15(Fragment5, { children: [
2107
+ return /* @__PURE__ */ jsxs17(Fragment5, { children: [
1933
2108
  "Balance:",
1934
2109
  " ",
1935
2110
  srcToken && balances ? weiToHumanReadable({
@@ -1937,12 +2112,12 @@ var BalanceComponent = ({ srcToken, balances }) => {
1937
2112
  decimals: srcToken.decimals,
1938
2113
  precisionFractionalPlaces: 4
1939
2114
  }) : 0,
1940
- /* @__PURE__ */ jsx36("span", { className: "xpay-bg-gradient-to-r xpay-from-x_blue_light xpay-to-x_blue_dark xpay-bg-clip-text xpay-text-transparent", children: "Max" })
2115
+ /* @__PURE__ */ jsx39("span", { className: "xpay-bg-gradient-to-r xpay-from-x_blue_light xpay-to-x_blue_dark xpay-bg-clip-text xpay-text-transparent", children: "Max" })
1941
2116
  ] });
1942
2117
  };
1943
2118
 
1944
2119
  // src/components/TxConfigForm/SwapPanel.tsx
1945
- import { jsx as jsx37, jsxs as jsxs16 } from "react/jsx-runtime";
2120
+ import { jsx as jsx40, jsxs as jsxs18 } from "react/jsx-runtime";
1946
2121
  var SwapPanel = ({
1947
2122
  amount,
1948
2123
  setAmount,
@@ -1953,8 +2128,7 @@ var SwapPanel = ({
1953
2128
  signer,
1954
2129
  balances,
1955
2130
  prices,
1956
- supportedChains,
1957
- setExceedsExpressDeliveryLimit
2131
+ supportedChains
1958
2132
  }) => {
1959
2133
  const [chainListShown, setChainListShown] = useState7(false);
1960
2134
  const [tokenListShown, setTokenListShown] = useState7(false);
@@ -1984,15 +2158,15 @@ var SwapPanel = ({
1984
2158
  return () => document.removeEventListener("mousedown", handleClickOutside);
1985
2159
  }
1986
2160
  }, [chainListShown]);
1987
- const chainListOptions = useMemo7(
2161
+ const chainListOptions = useMemo5(
1988
2162
  () => supportedChains.filter((chain) => chain.chainId !== srcChain?.chainId),
1989
2163
  [supportedChains, srcChain]
1990
2164
  );
1991
- return /* @__PURE__ */ jsxs16("div", { className: "xpay-flex xpay-justify-between xpay-global-border xpay-rounded-lg xpay-bg-[rgba(15,15,15,1)] xpay-p-4", children: [
1992
- /* @__PURE__ */ jsxs16("div", { className: "xpay-flex xpay-flex-col xpay-justify-between xpay-gap-2 xpay-overflow-hidden xpay-w-1/2", children: [
1993
- /* @__PURE__ */ jsxs16("div", { className: "xpay-flex xpay-flex-col xpay-gap-1", children: [
1994
- /* @__PURE__ */ jsx37("p", { className: "xpay-text-white xpay-opacity-60 xpay-text-xs sm:xpay-text-sm xpay-font-medium", children: "You pay" }),
1995
- /* @__PURE__ */ jsx37(
2165
+ return /* @__PURE__ */ jsxs18("div", { className: "xpay-flex xpay-justify-between xpay-global-border xpay-rounded-lg xpay-bg-[rgba(15,15,15,1)] xpay-p-4", children: [
2166
+ /* @__PURE__ */ jsxs18("div", { className: "xpay-flex xpay-flex-col xpay-justify-between xpay-gap-2 xpay-overflow-hidden xpay-w-1/2", children: [
2167
+ /* @__PURE__ */ jsxs18("div", { className: "xpay-flex xpay-flex-col xpay-gap-1", children: [
2168
+ /* @__PURE__ */ jsx40("p", { className: "xpay-text-white xpay-opacity-60 xpay-text-xs sm:xpay-text-sm xpay-font-medium", children: "You pay" }),
2169
+ /* @__PURE__ */ jsx40(
1996
2170
  "input",
1997
2171
  {
1998
2172
  className: "xpay-p-0 xpay-border-none xpay-outline-none xpay-bg-transparent xpay-text-2xl xpay-overflow-ellipsis",
@@ -2011,20 +2185,18 @@ var SwapPanel = ({
2011
2185
  }
2012
2186
  )
2013
2187
  ] }),
2014
- /* @__PURE__ */ jsx37("div", { className: "xpay-flex xpay-items-center xpay-text-sm xpay-text-[rgba(255,255,255,0.6)]", children: /* @__PURE__ */ jsx37(
2188
+ /* @__PURE__ */ jsx40("div", { className: "xpay-flex xpay-items-center xpay-text-sm xpay-text-[rgba(255,255,255,0.6)]", children: /* @__PURE__ */ jsx40(
2015
2189
  UsdPrice,
2016
2190
  {
2017
2191
  prices,
2018
2192
  token: srcToken,
2019
2193
  amount,
2020
- loading: false,
2021
- type: "src",
2022
- setExceedsExpressDeliveryLimit
2194
+ loading: false
2023
2195
  }
2024
2196
  ) })
2025
2197
  ] }),
2026
- /* @__PURE__ */ jsxs16("div", { className: "xpay-flex xpay-flex-col xpay-relative xpay-items-end xpay-gap-2.5 xpay-w-1/2 xpay-text-xs", children: [
2027
- /* @__PURE__ */ jsxs16(
2198
+ /* @__PURE__ */ jsxs18("div", { className: "xpay-flex xpay-flex-col xpay-relative xpay-items-end xpay-gap-2.5 xpay-w-1/2 xpay-text-xs", children: [
2199
+ /* @__PURE__ */ jsxs18(
2028
2200
  "div",
2029
2201
  {
2030
2202
  className: "xpay-flex xpay-gap-2 xpay-items-center xpay-p-2 xpay-max-w-full xpay-cursor-pointer xpay-bg-black xpay-text-white xpay-global-border xpay-rounded-3xl xpay-whitespace-nowrap",
@@ -2032,7 +2204,7 @@ var SwapPanel = ({
2032
2204
  setTokenListShown((state) => !state);
2033
2205
  },
2034
2206
  children: [
2035
- /* @__PURE__ */ jsx37(
2207
+ /* @__PURE__ */ jsx40(
2036
2208
  "img",
2037
2209
  {
2038
2210
  height: 16,
@@ -2041,12 +2213,12 @@ var SwapPanel = ({
2041
2213
  alt: srcToken?.name
2042
2214
  }
2043
2215
  ),
2044
- /* @__PURE__ */ jsx37("div", { children: srcToken?.symbol }),
2045
- /* @__PURE__ */ jsx37(DownArrowIcon, {})
2216
+ /* @__PURE__ */ jsx40("div", { children: srcToken?.symbol }),
2217
+ /* @__PURE__ */ jsx40(DownArrowIcon, {})
2046
2218
  ]
2047
2219
  }
2048
2220
  ),
2049
- tokenListShown && /* @__PURE__ */ jsx37(
2221
+ tokenListShown && /* @__PURE__ */ jsx40(
2050
2222
  TokenPicker,
2051
2223
  {
2052
2224
  onCloseClick: () => setTokenListShown(false),
@@ -2057,22 +2229,22 @@ var SwapPanel = ({
2057
2229
  balances
2058
2230
  }
2059
2231
  ),
2060
- /* @__PURE__ */ jsx37(
2232
+ /* @__PURE__ */ jsx40(
2061
2233
  "div",
2062
2234
  {
2063
2235
  onClick: handleMaxClick,
2064
2236
  className: "xpay-flex xpay-gap-1 xpay-items-center xpay-font-medium xpay-text-white xpay-opacity-60 xpay-py-0.5 xpay-cursor-pointer",
2065
- children: signer && /* @__PURE__ */ jsx37(BalanceComponent, { balances, srcToken })
2237
+ children: signer && /* @__PURE__ */ jsx40(BalanceComponent, { balances, srcToken })
2066
2238
  }
2067
2239
  ),
2068
- /* @__PURE__ */ jsxs16(
2240
+ /* @__PURE__ */ jsxs18(
2069
2241
  "div",
2070
2242
  {
2071
2243
  ref: buttonRef,
2072
2244
  className: "xpay-bg-black xpay-global-border xpay-rounded-2xl xpay-whitespace-nowrap xpay-flex xpay-items-center xpay-p-2 xpay-cursor-pointer xpay-gap-2",
2073
2245
  onClick: () => setChainListShown((prev) => !prev),
2074
2246
  children: [
2075
- /* @__PURE__ */ jsx37(
2247
+ /* @__PURE__ */ jsx40(
2076
2248
  "img",
2077
2249
  {
2078
2250
  width: "16",
@@ -2081,17 +2253,17 @@ var SwapPanel = ({
2081
2253
  alt: srcChain?.name
2082
2254
  }
2083
2255
  ),
2084
- /* @__PURE__ */ jsx37("div", { children: srcChain?.displayName }),
2085
- /* @__PURE__ */ jsx37(DownArrowIcon, {})
2256
+ /* @__PURE__ */ jsx40("div", { children: srcChain?.displayName }),
2257
+ /* @__PURE__ */ jsx40(DownArrowIcon, {})
2086
2258
  ]
2087
2259
  }
2088
2260
  ),
2089
- chainListShown && /* @__PURE__ */ jsx37(
2261
+ chainListShown && /* @__PURE__ */ jsx40(
2090
2262
  "ul",
2091
2263
  {
2092
2264
  ref: listRef,
2093
2265
  className: "xpay-bg-black xpay-global-border xpay-rounded-lg xpay-whitespace-nowrap xpay-z-1 xpay-right-0 xpay-top-10 xpay-px-2 xpay-max-w-full xpay-max-h-[40vh] xpay-overflow-auto xpay-absolute xpay-text-sm xpay-z-20",
2094
- children: chainListOptions.map((chain, index) => /* @__PURE__ */ jsx37(
2266
+ children: chainListOptions.map((chain, index) => /* @__PURE__ */ jsx40(
2095
2267
  ChainListElement,
2096
2268
  {
2097
2269
  index,
@@ -2099,7 +2271,8 @@ var SwapPanel = ({
2099
2271
  setSrcChain,
2100
2272
  setChainListShown,
2101
2273
  chain
2102
- }
2274
+ },
2275
+ chain.chainId
2103
2276
  ))
2104
2277
  }
2105
2278
  )
@@ -2108,9 +2281,9 @@ var SwapPanel = ({
2108
2281
  };
2109
2282
 
2110
2283
  // src/components/TxConfigForm/ErrorField.tsx
2111
- import { jsx as jsx38 } from "react/jsx-runtime";
2284
+ import { jsx as jsx41 } from "react/jsx-runtime";
2112
2285
  var ErrorField = ({ error }) => {
2113
- return /* @__PURE__ */ jsx38(
2286
+ return /* @__PURE__ */ jsx41(
2114
2287
  "div",
2115
2288
  {
2116
2289
  className: `xpay-flex xpay-justify-center xpay-mb-1 xpay-items-center xpay-w-full xpay-rounded-2xl xpay-bg-x_error_background xpay-border xpay-border-solid ${error.length > 0 ? "xpay-border-x_error_border" : "xpay-border-transparent"}`,
@@ -2120,15 +2293,15 @@ var ErrorField = ({ error }) => {
2120
2293
  };
2121
2294
 
2122
2295
  // src/components/TxConfigForm/Description.tsx
2123
- import { jsx as jsx39 } from "react/jsx-runtime";
2296
+ import { jsx as jsx42 } from "react/jsx-runtime";
2124
2297
  var Description = ({ description }) => {
2125
- return /* @__PURE__ */ jsx39("div", { className: "xpay-flex xpay-flex-col xpay-items-start xpay-rounded-lg xpay-px-4 xpay-py-2", children: /* @__PURE__ */ jsx39("div", { className: "xpay-w-full xpay-flex xpay-gap-4 xpay-items-start xpay-justify-between xpay-text-xl", children: description }) });
2298
+ return /* @__PURE__ */ jsx42("div", { className: "xpay-flex xpay-flex-col xpay-gap-3 xpay-global-border xpay-rounded-lg xpay-bg-[rgba(15,15,15,1)] xpay-p-2 sm:xpay-p-4 ", children: /* @__PURE__ */ jsx42("div", { className: "xpay-flex xpay-w-full xpay-items-center xpay-justify-between xpay-text-xs sm:xpay-text-sm", children: /* @__PURE__ */ jsx42("div", { className: "xpay-flex xpay-items-center xpay-gap-1 xpay-font-medium xpay-text-white xpay-opacity-60", children: description }) }) });
2126
2299
  };
2127
2300
 
2128
2301
  // src/components/TxConfigForm/Button.tsx
2129
- import { jsx as jsx40 } from "react/jsx-runtime";
2302
+ import { jsx as jsx43 } from "react/jsx-runtime";
2130
2303
  var Button = ({ children, onClick, type, disabled }) => {
2131
- return /* @__PURE__ */ jsx40(
2304
+ return /* @__PURE__ */ jsx43(
2132
2305
  "button",
2133
2306
  {
2134
2307
  className: "xpay-text-white xpay-border-none xpay-rounded-2xl xpay-text-xl xpay-py-4 xpay-cursor-pointer xpay-w-full xpay-bg-gradient-to-r xpay-from-[#3681c6] xpay-to-[#2b4a9d] disabled:xpay-opacity-25",
@@ -2141,7 +2314,108 @@ var Button = ({ children, onClick, type, disabled }) => {
2141
2314
  };
2142
2315
 
2143
2316
  // src/components/TxConfigForm/Form.tsx
2144
- import { jsx as jsx41, jsxs as jsxs17 } from "react/jsx-runtime";
2317
+ import { getChainId, waitForTransactionReceipt } from "wagmi/actions";
2318
+
2319
+ // src/components/TxConfigForm/ConfirmationAmount.tsx
2320
+ import { useEffect as useEffect7, useMemo as useMemo6, useState as useState8 } from "react";
2321
+ import { jsx as jsx44, jsxs as jsxs19 } from "react/jsx-runtime";
2322
+ var ConfirmationAmount = ({
2323
+ amount,
2324
+ token,
2325
+ chain,
2326
+ type
2327
+ }) => {
2328
+ const [prices, setPrices] = useState8();
2329
+ const amountReadable = useMemo6(() => {
2330
+ return weiToHumanReadable({
2331
+ amount: amount || "0",
2332
+ decimals: token?.decimals || 18,
2333
+ precisionFractionalPlaces: 8
2334
+ });
2335
+ }, [amount, token]);
2336
+ useEffect7(() => {
2337
+ if (chain) {
2338
+ getPrices({ chainId: chain.chainId, currency: "USD" }).then(
2339
+ (prices2) => setPrices(prices2)
2340
+ );
2341
+ }
2342
+ }, [chain]);
2343
+ return /* @__PURE__ */ jsx44("div", { className: "xpay-flex xpay-flex-col xpay-globalBorder xpay-rounded-xl xpay-bg-gradient-to-r xpay-from-x_blue_300_20 xpay-to-x_blue_400_20 xpay-p-4 xpay-relative", children: /* @__PURE__ */ jsxs19("div", { className: "xpay-flex xpay-justify-between", children: [
2344
+ /* @__PURE__ */ jsxs19("div", { className: "xpay-flex xpay-flex-col xpay-gap-1", children: [
2345
+ /* @__PURE__ */ jsx44("p", { className: "xpay-text-white xpay-opacity-60 xpay-text-xs sm:xpay-text-sm xpay-font-medium", children: type === "src" ? "You pay" : "You receive" }),
2346
+ /* @__PURE__ */ jsx44(
2347
+ "div",
2348
+ {
2349
+ className: `xpay-flex xpay-gap-2 xpay-items-center xpay-text-xl sm:xpay-text-3xl ${type === "dst" ? "xpay-text-[rgba(54,129,198,1)]" : "xpay-text-white"}`,
2350
+ children: amountReadable
2351
+ }
2352
+ ),
2353
+ /* @__PURE__ */ jsx44(
2354
+ UsdPrice,
2355
+ {
2356
+ prices,
2357
+ token,
2358
+ amount: amountReadable,
2359
+ loading: false
2360
+ }
2361
+ )
2362
+ ] }),
2363
+ /* @__PURE__ */ jsxs19("div", { className: "xpay-flex xpay-gap-2 xpay-text-sm xpay-justify-center xpay-items-center", children: [
2364
+ /* @__PURE__ */ jsxs19("div", { className: "xpay-flex xpay-flex-col xpay-justify-center xpay-items-end xpay-gap-1", children: [
2365
+ /* @__PURE__ */ jsx44("p", { className: "xpay-text-base sm:xpay-text-xl", children: token?.name }),
2366
+ /* @__PURE__ */ jsx44("div", { className: "xpay-flex xpay-justify-center xpay-items-center xpay-gap-1", children: /* @__PURE__ */ jsx44("p", { className: "xpay-text-[rgba(255,255,255,0.6)] xpay-text-xs xpay-text-right", children: chain?.displayName }) })
2367
+ ] }),
2368
+ /* @__PURE__ */ jsx44("div", { className: "xpay-w-10 xpay-h-10", children: token?.image ? /* @__PURE__ */ jsx44(
2369
+ "img",
2370
+ {
2371
+ className: "xpay-w-10 xpay-h-10",
2372
+ src: token?.image,
2373
+ alt: token?.name
2374
+ }
2375
+ ) : /* @__PURE__ */ jsx44(
2376
+ UnknownTokenLogo,
2377
+ {
2378
+ tokenName: "?",
2379
+ className: "xpay-w-10 xpay-h-10"
2380
+ }
2381
+ ) })
2382
+ ] })
2383
+ ] }) });
2384
+ };
2385
+
2386
+ // src/components/Spinner/index.tsx
2387
+ import { jsx as jsx45, jsxs as jsxs20 } from "react/jsx-runtime";
2388
+ var Spinner = ({ width, height }) => {
2389
+ return /* @__PURE__ */ jsx45("div", { role: "status", children: /* @__PURE__ */ jsxs20(
2390
+ "svg",
2391
+ {
2392
+ "aria-hidden": "true",
2393
+ className: `xpay-w-${width} xpay-h-${height} xpay-text-gray-200 xpay-animate-spin dark:xpay-text-gray-600 xpay-fill-[rgba(54,129,198,1)]`,
2394
+ viewBox: "0 0 100 101",
2395
+ fill: "none",
2396
+ xmlns: "http://www.w3.org/2000/svg",
2397
+ children: [
2398
+ /* @__PURE__ */ jsx45(
2399
+ "path",
2400
+ {
2401
+ d: "M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",
2402
+ fill: "currentColor"
2403
+ }
2404
+ ),
2405
+ /* @__PURE__ */ jsx45(
2406
+ "path",
2407
+ {
2408
+ d: "M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",
2409
+ fill: "currentFill"
2410
+ }
2411
+ )
2412
+ ]
2413
+ }
2414
+ ) });
2415
+ };
2416
+
2417
+ // src/components/TxConfigForm/Form.tsx
2418
+ import { Fragment as Fragment6, jsx as jsx46, jsxs as jsxs21 } from "react/jsx-runtime";
2145
2419
  var Form = ({
2146
2420
  integratorId,
2147
2421
  dstChainId,
@@ -2149,34 +2423,54 @@ var Form = ({
2149
2423
  customContractCalls,
2150
2424
  desc,
2151
2425
  supportedChains,
2426
+ retrunTransactions,
2427
+ dstDisplayTokenAddr,
2428
+ wagmiConfig,
2152
2429
  onSubmit,
2153
- onClose
2430
+ onClose,
2431
+ setBackdropClickDisabled
2154
2432
  }) => {
2155
- const [signer, setSigner] = useState8();
2156
- const [dstChain, setDstChain] = useState8();
2157
- const [dstToken, setDstToken] = useState8();
2158
- const [srcChain, setSrcChain] = useState8();
2159
- const [srcToken, setSrcToken] = useState8();
2160
- const [amount, setAmount] = useState8("");
2161
- const [paymentToken, setPaymentToken] = useState8();
2162
- const [route, setRoute] = useState8();
2163
- const [expressChecked, setExpressChecked] = useState8(true);
2164
- const [historyTabShown, setHistoryTabShown] = useState8(false);
2165
- const [isGettingRoute, setIsGettingRoute] = useState8(false);
2166
- const [prices, setPrices] = useState8();
2167
- const [balances, setBalances] = useState8();
2168
- const [settingsShown, setSettingsShown] = useState8(false);
2169
- const [formError, setFormError] = useState8("");
2170
- const [slippage, setSlippage] = useState8("1.5");
2171
- const [feesDetailsShown, setFeesDetailsShown] = useState8(false);
2172
- const [exceedsExpressDeliveryLimit, setExceedsExpressDeliveryLimit] = useState8(false);
2433
+ const [signer, setSigner] = useState9();
2434
+ const [dstChain, setDstChain] = useState9();
2435
+ const [dstToken, setDstToken] = useState9();
2436
+ const [dstDisplayToken, setDstDisplayToken] = useState9();
2437
+ const [srcChain, setSrcChain] = useState9();
2438
+ const [srcToken, setSrcToken] = useState9();
2439
+ const [amount, setAmount] = useState9("");
2440
+ const [paymentToken, setPaymentToken] = useState9();
2441
+ const [route, setRoute] = useState9();
2442
+ const [expressChecked, setExpressChecked] = useState9(true);
2443
+ const [historyTabShown, setHistoryTabShown] = useState9(false);
2444
+ const [isGettingRoute, setIsGettingRoute] = useState9(false);
2445
+ const [prices, setPrices] = useState9();
2446
+ const [balances, setBalances] = useState9();
2447
+ const [settingsShown, setSettingsShown] = useState9(false);
2448
+ const [formError, setFormError] = useState9("");
2449
+ const [slippage, setSlippage] = useState9("1.5");
2450
+ const [feesDetailsShown, setFeesDetailsShown] = useState9(false);
2451
+ const [executingTransactions, setExecutingTransactions] = useState9(false);
2452
+ const [transactionSuccessHash, setTransactionSuccessHash] = useState9();
2453
+ const [txLoading, setTxLoading] = useState9(false);
2454
+ const [approveTxLoading, setApproveTxLoading] = useState9(false);
2455
+ const [approveTxDone, setApproveTxDone] = useState9(false);
2456
+ const [transactionError, setTransactionError] = useState9(null);
2457
+ const currentRouteRequestNonce = useRef3(0);
2458
+ const prevAllowanceValuesRef = useRef3({
2459
+ srcChainId: srcChain?.chainId,
2460
+ srcTokenAddress: srcToken?.address,
2461
+ routeTo: ethers4.constants.AddressZero
2462
+ });
2463
+ const currentAllowanceRequestNonce = useRef3(0);
2464
+ const [isAllowanceLoading, setIsAllowanceLoading] = useState9(false);
2465
+ const [srcTokenAllowance, setSrcTokenAllowance] = useState9("0");
2466
+ const { sendTransaction } = useSendTransaction({ config: wagmiConfig });
2173
2467
  const debouncedAmount = useDebounce(amount, 1e3);
2174
2468
  const account = useAccount();
2175
2469
  const { switchChainAsync } = useSwitchChain();
2176
- useEffect7(() => {
2470
+ useEffect8(() => {
2177
2471
  setSigner(account.address);
2178
2472
  }, [account.address]);
2179
- useEffect7(() => {
2473
+ useEffect8(() => {
2180
2474
  const defaultChain = supportedChains.find(
2181
2475
  ({ chainId }) => chainId === account.chainId?.toString()
2182
2476
  );
@@ -2186,10 +2480,10 @@ var Form = ({
2186
2480
  )
2187
2481
  );
2188
2482
  }, [account.chainId]);
2189
- useEffect7(() => {
2483
+ useEffect8(() => {
2190
2484
  setDstChain(supportedChains.find((chain) => chain.chainId === dstChainId));
2191
2485
  }, [supportedChains, dstChainId]);
2192
- useEffect7(() => {
2486
+ useEffect8(() => {
2193
2487
  (async () => {
2194
2488
  if (!dstChain) {
2195
2489
  return;
@@ -2204,43 +2498,61 @@ var Form = ({
2204
2498
  );
2205
2499
  }
2206
2500
  setDstToken(dstTokenResult);
2501
+ if (dstDisplayTokenAddr) {
2502
+ let dstDisplayTokenResult = dstChain?.tokens.find(
2503
+ (token) => token.address.toLowerCase() === dstDisplayTokenAddr.toLowerCase()
2504
+ );
2505
+ if (!dstDisplayTokenResult) {
2506
+ dstDisplayTokenResult = await getCustomTokenData(
2507
+ dstChain,
2508
+ dstDisplayTokenAddr.toLowerCase()
2509
+ );
2510
+ }
2511
+ setDstDisplayToken(dstDisplayTokenResult);
2512
+ }
2207
2513
  })();
2208
2514
  }, [dstChain]);
2209
- useEffect7(() => {
2210
- if (integratorId && srcChain && srcToken && dstChain && debouncedAmount && paymentToken && slippage) {
2211
- setFormError("");
2212
- const timeout = setTimeout(() => {
2213
- setFormError("Getting Route is taking longer than usually");
2214
- }, ROUTE_TIMEOUT_MS);
2215
- setIsGettingRoute(true);
2216
- setFeesDetailsShown(false);
2217
- if (!srcToken.decimals)
2218
- throw new Error(
2219
- `Configuration error: selected token ($${srcToken.symbol} ${srcToken.name}) has unknown decimals param.`
2220
- );
2221
- getRoute({
2222
- integratorId,
2223
- fromAmount: ethers3.utils.parseUnits(debouncedAmount, srcToken.decimals).toString(),
2224
- fromAddress: signer || ADDRESSES[srcChain.chainId].FeeCollector,
2225
- fromChain: srcChain.chainId,
2226
- fromToken: srcToken.address,
2227
- toAddress: signer || ADDRESSES[dstChain.chainId].FeeCollector,
2228
- toChain: dstChainId,
2229
- toToken: dstTokenAddr,
2230
- paymentToken: paymentToken.address,
2231
- slippage: Number(slippage),
2232
- expressDelivery: expressChecked && !exceedsExpressDeliveryLimit,
2233
- customContractCalls
2234
- }).then((response) => {
2235
- setRoute(response);
2236
- setFormError("");
2237
- }).catch((err) => {
2238
- setFormError(err.message);
2239
- }).finally(() => {
2240
- setIsGettingRoute(false);
2241
- clearTimeout(timeout);
2242
- });
2515
+ useEffect8(() => {
2516
+ if (!(integratorId && srcChain && srcToken && dstChain && debouncedAmount && paymentToken && signer && slippage)) {
2517
+ return;
2243
2518
  }
2519
+ setFormError("");
2520
+ const timeout = setTimeout(() => {
2521
+ setFormError("Getting Route is taking longer than usually");
2522
+ }, ROUTE_TIMEOUT_MS);
2523
+ setIsGettingRoute(true);
2524
+ setFeesDetailsShown(false);
2525
+ if (!srcToken.decimals)
2526
+ throw new Error(
2527
+ `Configuration error: selected token ($${srcToken.symbol} ${srcToken.name}) has unknown decimals param.`
2528
+ );
2529
+ const nonce = Date.now();
2530
+ currentRouteRequestNonce.current = nonce;
2531
+ getRoute({
2532
+ integratorId,
2533
+ fromAmount: ethers4.utils.parseUnits(debouncedAmount, srcToken.decimals).toString(),
2534
+ fromAddress: signer || ADDRESSES[srcChain.chainId].FeeCollector,
2535
+ fromChain: srcChain.chainId,
2536
+ fromToken: srcToken.address,
2537
+ toAddress: signer || ADDRESSES[dstChain.chainId].FeeCollector,
2538
+ toChain: dstChainId,
2539
+ toToken: dstTokenAddr,
2540
+ paymentToken: paymentToken.address,
2541
+ slippage: Number(slippage),
2542
+ expressDelivery: expressChecked,
2543
+ customContractCalls
2544
+ }).then((response) => {
2545
+ if (nonce !== currentRouteRequestNonce.current) {
2546
+ return;
2547
+ }
2548
+ setRoute(response);
2549
+ setFormError("");
2550
+ }).catch((err) => {
2551
+ setFormError(err.message);
2552
+ }).finally(() => {
2553
+ setIsGettingRoute(false);
2554
+ clearTimeout(timeout);
2555
+ });
2244
2556
  }, [
2245
2557
  signer,
2246
2558
  srcChain,
@@ -2250,125 +2562,546 @@ var Form = ({
2250
2562
  slippage,
2251
2563
  expressChecked
2252
2564
  ]);
2253
- useEffect7(() => {
2565
+ useEffect8(() => {
2566
+ (async () => {
2567
+ if (!signer || !srcToken?.address || !srcChain?.publicRpcUrls[0] || srcToken?.address === ethers4.constants.AddressZero) {
2568
+ return;
2569
+ }
2570
+ if (route && route.transactions.swap?.to) {
2571
+ const {
2572
+ srcChainId: prevFromChainId,
2573
+ srcTokenAddress: prevFromTokenAddress,
2574
+ routeTo: prevRouteTo
2575
+ } = prevAllowanceValuesRef.current;
2576
+ const hasChanges = srcChain?.chainId !== prevFromChainId || srcToken?.address !== prevFromTokenAddress || route.transactions.swap?.to !== prevRouteTo;
2577
+ if (!hasChanges) {
2578
+ return;
2579
+ }
2580
+ prevAllowanceValuesRef.current = {
2581
+ srcChainId: srcChain?.chainId,
2582
+ srcTokenAddress: srcToken?.address,
2583
+ routeTo: route.transactions.swap?.to
2584
+ };
2585
+ const nonce = Date.now();
2586
+ currentAllowanceRequestNonce.current = nonce;
2587
+ setIsAllowanceLoading(true);
2588
+ const allowanceResponse = await getAllowanceOf(
2589
+ srcToken?.address,
2590
+ signer,
2591
+ route.transactions.swap.to,
2592
+ srcChain?.publicRpcUrls[0]
2593
+ );
2594
+ if (nonce !== currentAllowanceRequestNonce.current) {
2595
+ return;
2596
+ }
2597
+ setSrcTokenAllowance(allowanceResponse);
2598
+ setIsAllowanceLoading(false);
2599
+ }
2600
+ })();
2601
+ }, [srcChain, srcToken?.address, signer, setSrcTokenAllowance, route]);
2602
+ useEffect8(() => {
2254
2603
  if (srcChain) {
2255
2604
  setPaymentToken(
2256
2605
  srcChain.tokens.find(
2257
- (token) => token.address.toLowerCase() === ethers3.constants.AddressZero.toLowerCase()
2606
+ (token) => token.address.toLowerCase() === ethers4.constants.AddressZero.toLowerCase()
2258
2607
  )
2259
2608
  );
2260
2609
  }
2261
2610
  }, [srcChain]);
2262
- useEffect7(() => {
2611
+ useEffect8(() => {
2263
2612
  setAmount("");
2264
2613
  setFormError("");
2614
+ setIsGettingRoute(false);
2615
+ setRoute(void 0);
2616
+ const nonce = Date.now();
2617
+ currentRouteRequestNonce.current = nonce;
2265
2618
  }, [srcToken]);
2266
- useEffect7(() => {
2619
+ useEffect8(() => {
2267
2620
  setSrcToken(srcChain?.tokens[0]);
2621
+ setAmount("");
2622
+ setIsGettingRoute(false);
2623
+ setRoute(void 0);
2624
+ const nonce = Date.now();
2625
+ currentRouteRequestNonce.current = nonce;
2268
2626
  }, [srcChain]);
2269
- useEffect7(() => {
2627
+ useEffect8(() => {
2270
2628
  if (srcChain) {
2271
2629
  getPrices({ chainId: srcChain.chainId, currency: "USD" }).then(
2272
2630
  (prices2) => setPrices(prices2)
2273
2631
  );
2274
2632
  }
2275
2633
  }, [srcChain]);
2276
- useEffect7(() => {
2634
+ useEffect8(() => {
2277
2635
  if (srcChain && signer) {
2278
2636
  getBalances(srcChain, signer).then((balances2) => setBalances(balances2));
2279
2637
  }
2280
2638
  }, [srcChain, signer]);
2639
+ useEffect8(() => {
2640
+ setBackdropClickDisabled(executingTransactions);
2641
+ }, [executingTransactions]);
2642
+ const isAllowanceOk = useMemo7(() => {
2643
+ return srcToken?.address === ethers4.constants.AddressZero || Number(srcTokenAllowance) >= Number(amount);
2644
+ }, [srcToken, amount, srcTokenAllowance]);
2645
+ const triggerTx = useCallback3(async () => {
2646
+ if (!route) {
2647
+ return;
2648
+ }
2649
+ setExecutingTransactions(true);
2650
+ setBackdropClickDisabled(true);
2651
+ setTransactionError(null);
2652
+ if (route.transactions.approve && !isAllowanceOk) {
2653
+ setApproveTxDone(false);
2654
+ const { to, data } = route.transactions.approve;
2655
+ await sendTransaction(
2656
+ {
2657
+ to,
2658
+ data
2659
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2660
+ },
2661
+ {
2662
+ onSuccess: async (hash) => {
2663
+ setApproveTxLoading(true);
2664
+ const chainId = getChainId(wagmiConfig);
2665
+ await waitForTransactionReceipt(wagmiConfig, {
2666
+ chainId,
2667
+ hash
2668
+ });
2669
+ setApproveTxLoading(false);
2670
+ setApproveTxDone(true);
2671
+ swap(route);
2672
+ },
2673
+ onError: (error) => {
2674
+ setTransactionError(`Approval failed: ${error.message}`);
2675
+ setApproveTxLoading(false);
2676
+ setBackdropClickDisabled(false);
2677
+ }
2678
+ }
2679
+ );
2680
+ } else {
2681
+ await swap(route);
2682
+ }
2683
+ }, [
2684
+ route,
2685
+ signer,
2686
+ srcChain,
2687
+ srcToken,
2688
+ debouncedAmount,
2689
+ paymentToken,
2690
+ slippage,
2691
+ expressChecked,
2692
+ amount,
2693
+ srcTokenAllowance
2694
+ ]);
2695
+ const swap = useCallback3(
2696
+ async (route2) => {
2697
+ const { to, value, data } = route2.transactions.swap;
2698
+ await sendTransaction(
2699
+ {
2700
+ to,
2701
+ value: BigInt(value),
2702
+ data
2703
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2704
+ },
2705
+ {
2706
+ onSuccess: async (hash) => {
2707
+ setTxLoading(true);
2708
+ const chainId = getChainId(wagmiConfig);
2709
+ await waitForTransactionReceipt(wagmiConfig, {
2710
+ chainId,
2711
+ hash
2712
+ });
2713
+ setTxLoading(false);
2714
+ if (srcChain?.chainId !== dstChain?.chainId) {
2715
+ renderTxStatus(chainId.toString(), hash);
2716
+ }
2717
+ setTransactionSuccessHash(hash);
2718
+ },
2719
+ onError: (error) => {
2720
+ setBackdropClickDisabled(false);
2721
+ setTransactionError(`Transaction failed: ${error.message}`);
2722
+ }
2723
+ }
2724
+ );
2725
+ },
2726
+ [
2727
+ route,
2728
+ signer,
2729
+ srcChain,
2730
+ srcToken,
2731
+ debouncedAmount,
2732
+ paymentToken,
2733
+ slippage,
2734
+ expressChecked
2735
+ ]
2736
+ );
2281
2737
  const handleSubmit = (event) => {
2282
2738
  event.preventDefault();
2283
- if (route) onSubmit(route);
2739
+ if (!route) {
2740
+ return;
2741
+ }
2742
+ if (retrunTransactions) {
2743
+ onSubmit(route);
2744
+ return;
2745
+ }
2746
+ triggerTx();
2284
2747
  };
2285
2748
  const handleSwitchChain = async () => {
2286
2749
  await switchChainAsync({ chainId: Number(srcChain?.chainId) });
2287
2750
  };
2288
- return /* @__PURE__ */ jsxs17(
2289
- "form",
2290
- {
2291
- className: "xpay-flex xpay-flex-col xpay-gap-2 xpay-z-10 xpay-my-0 xpay-p-2 md:xpay-p-4 xpay-rounded-3xl xpay-overflow-hidden xpay-font-light sm:xpay-w-x_desktop",
2292
- onSubmit: handleSubmit,
2293
- children: [
2294
- /* @__PURE__ */ jsx41(
2295
- TopBar,
2751
+ const swapButton = useMemo7(() => {
2752
+ let disabled = false;
2753
+ if (transactionError) {
2754
+ return {
2755
+ text: transactionError,
2756
+ fn: () => {
2757
+ },
2758
+ disabled: true
2759
+ };
2760
+ }
2761
+ if (!signer) {
2762
+ return {
2763
+ text: "Connect wallet",
2764
+ fn: () => {
2765
+ },
2766
+ disabled
2767
+ };
2768
+ }
2769
+ if (signer && srcChain && srcChain.chainId !== account.chainId?.toString()) {
2770
+ return {
2771
+ text: "Switch chain",
2772
+ fn: handleSwitchChain,
2773
+ disabled
2774
+ };
2775
+ }
2776
+ if (!amount) {
2777
+ return {
2778
+ text: `Enter token amount`,
2779
+ fn: () => {
2780
+ },
2781
+ disabled: true
2782
+ };
2783
+ }
2784
+ if (amount && balances && srcToken && srcToken.decimals && balances[srcToken?.address] !== void 0 && !ethers4.utils.parseUnits(amount, srcToken.decimals).lt(balances[srcToken?.address] || "0")) {
2785
+ return {
2786
+ text: "Insufficient balance",
2787
+ fn: () => {
2788
+ },
2789
+ disabled: true
2790
+ };
2791
+ }
2792
+ if (!route) {
2793
+ return {
2794
+ text: `Loading route`,
2795
+ fn: () => {
2796
+ },
2797
+ disabled: true
2798
+ };
2799
+ }
2800
+ if (isAllowanceLoading) {
2801
+ return {
2802
+ text: `Checking allowance`,
2803
+ fn: () => {
2804
+ },
2805
+ disabled: true
2806
+ };
2807
+ }
2808
+ return {
2809
+ text: "Submit",
2810
+ fn: () => {
2811
+ },
2812
+ disabled
2813
+ };
2814
+ }, [
2815
+ account,
2816
+ srcToken,
2817
+ srcChain,
2818
+ isAllowanceOk,
2819
+ amount,
2820
+ balances,
2821
+ signer,
2822
+ transactionError,
2823
+ route,
2824
+ isAllowanceLoading
2825
+ ]);
2826
+ const isExpressDelivery = useMemo7(() => {
2827
+ let expressDeliveryFee;
2828
+ if (!route?.xSwapFees || !route?.xSwapFees.expressDeliveryFee) {
2829
+ expressDeliveryFee = safeBigNumberFrom("0");
2830
+ } else {
2831
+ expressDeliveryFee = safeBigNumberFrom(
2832
+ route?.xSwapFees.expressDeliveryFee
2833
+ );
2834
+ }
2835
+ if (expressDeliveryFee.gt("0")) {
2836
+ return true;
2837
+ }
2838
+ return false;
2839
+ }, [route]);
2840
+ return /* @__PURE__ */ jsx46(Fragment6, { children: !signer ? (
2841
+ // Connect wallet modal
2842
+ /* @__PURE__ */ jsxs21("div", { className: "xpay-flex xpay-flex-col xpay-gap-2 xpay-z-10 xpay-my-0 xpay-p-2 md:xpay-p-4 xpay-rounded-3xl xpay-overflow-hidden xpay-font-light sm:xpay-w-x_desktop xpay-w-screen", children: [
2843
+ /* @__PURE__ */ jsx46("div", { className: "xpay-flex xpay-w-full xpay-justify-end xpay-items-center xpay-mx-auto xpay-p-2", children: /* @__PURE__ */ jsx46(
2844
+ "div",
2845
+ {
2846
+ className: "xpay-cursor-pointer xpay-text-white",
2847
+ onClick: onClose,
2848
+ children: /* @__PURE__ */ jsx46(CloseIcon, {})
2849
+ }
2850
+ ) }),
2851
+ " ",
2852
+ /* @__PURE__ */ jsx46("p", { className: "xpay-text-xl xpay-font-bold xpay-leading-8 xpay-text-center xpay-text-white", children: "Please connect the wallet first." })
2853
+ ] })
2854
+ ) : executingTransactions ? /* @__PURE__ */ jsx46("div", { className: "xpay-flex xpay-flex-col xpay-gap-2 xpay-z-10 xpay-my-0 xpay-p-2 md:xpay-p-4 xpay-rounded-3xl xpay-overflow-hidden xpay-font-light sm:xpay-w-x_desktop xpay-w-screen", children: transactionError ? (
2855
+ // Tx Error modal
2856
+ /* @__PURE__ */ jsxs21("div", { children: [
2857
+ /* @__PURE__ */ jsx46("div", { className: "xpay-flex xpay-w-full xpay-justify-end xpay-items-center xpay-mx-auto xpay-p-2", children: /* @__PURE__ */ jsx46(
2858
+ "div",
2859
+ {
2860
+ className: "xpay-cursor-pointer xpay-text-white",
2861
+ onClick: onClose,
2862
+ children: /* @__PURE__ */ jsx46(CloseIcon, {})
2863
+ }
2864
+ ) }),
2865
+ /* @__PURE__ */ jsxs21("div", { className: "xpay-flex xpay-flex-col xpay-w-full xpay-justify-center xpay-items-center xpay-mx-auto xpay-p-2 xpay-gap-4", children: [
2866
+ /* @__PURE__ */ jsx46("div", { children: /* @__PURE__ */ jsx46(ErrorIcon, {}) }),
2867
+ /* @__PURE__ */ jsxs21("div", { className: "xpay-flex xpay-flex-col", children: [
2868
+ /* @__PURE__ */ jsx46("div", { children: /* @__PURE__ */ jsx46("p", { className: "xpay-text-2xl xpay-font-bold xpay-leading-8 xpay-text-center xpay-text-white", children: "Transaction error!" }) }),
2869
+ /* @__PURE__ */ jsx46("div", { children: /* @__PURE__ */ jsx46("p", { className: "xpay-text-sm xpay-text-center xpay-text-white xpay-opacity-50", children: parseWeb3Error(transactionError) }) })
2870
+ ] })
2871
+ ] })
2872
+ ] })
2873
+ ) : transactionSuccessHash ? (
2874
+ // Tx Success modal
2875
+ /* @__PURE__ */ jsxs21("div", { children: [
2876
+ /* @__PURE__ */ jsx46("div", { className: "xpay-flex xpay-w-full xpay-justify-end xpay-items-center xpay-mx-auto xpay-p-2", children: /* @__PURE__ */ jsx46(
2877
+ "div",
2878
+ {
2879
+ className: "xpay-cursor-pointer xpay-text-white",
2880
+ onClick: onClose,
2881
+ children: /* @__PURE__ */ jsx46(CloseIcon, {})
2882
+ }
2883
+ ) }),
2884
+ /* @__PURE__ */ jsxs21("div", { className: "xpay-flex xpay-flex-col xpay-w-full xpay-justify-center xpay-items-center xpay-mx-auto xpay-p-2 xpay-gap-4", children: [
2885
+ /* @__PURE__ */ jsx46("div", { children: /* @__PURE__ */ jsx46(SuccessIcon, {}) }),
2886
+ /* @__PURE__ */ jsxs21("div", { className: "xpay-flex xpay-flex-col", children: [
2887
+ /* @__PURE__ */ jsx46("div", { children: /* @__PURE__ */ jsx46("p", { className: "xpay-text-2xl xpay-font-bold xpay-leading-8 xpay-text-center xpay-text-white", children: "Transaction success!" }) }),
2888
+ srcChain?.chainId !== dstChain?.chainId ? /* @__PURE__ */ jsx46("div", { children: /* @__PURE__ */ jsxs21("p", { className: "xpay-text-sm xpay-text-center xpay-text-white xpay-opacity-50", children: [
2889
+ "Approximated time of delivery:",
2890
+ " ",
2891
+ isExpressDelivery ? "30 seconds" : "30 minutes"
2892
+ ] }) }) : /* @__PURE__ */ jsx46(Fragment6, {})
2893
+ ] }),
2894
+ /* @__PURE__ */ jsxs21("div", { className: "xpay-flex xpay-gap-4 xpay-items-center", children: [
2895
+ /* @__PURE__ */ jsxs21("div", { className: "xpay-flex xpay-gap-2", children: [
2896
+ /* @__PURE__ */ jsx46("div", { className: "xpay-w-10 xpay-h-10", children: srcToken?.image ? /* @__PURE__ */ jsx46(
2897
+ "img",
2898
+ {
2899
+ className: "xpay-w-10 xpay-h-10",
2900
+ src: srcToken?.image,
2901
+ alt: srcToken?.name
2902
+ }
2903
+ ) : /* @__PURE__ */ jsx46(
2904
+ UnknownTokenLogo,
2905
+ {
2906
+ tokenName: "?",
2907
+ className: "xpay-w-10 xpay-h-10"
2908
+ }
2909
+ ) }),
2910
+ /* @__PURE__ */ jsxs21("div", { className: "xpay-flex xpay-flex-col xpay-items-start", children: [
2911
+ /* @__PURE__ */ jsx46("div", { className: "xpay-flex", children: `${debouncedAmount} ${srcToken?.symbol}` }),
2912
+ /* @__PURE__ */ jsx46("div", { className: "xpay-text-sm xpay-text-center xpay-text-white xpay-opacity-50", children: srcChain?.displayName })
2913
+ ] })
2914
+ ] }),
2915
+ /* @__PURE__ */ jsx46("div", { className: "xpay-w-3.5 xpay-h-3.5", children: /* @__PURE__ */ jsx46(ArrowRightIcon, {}) }),
2916
+ /* @__PURE__ */ jsxs21("div", { className: "xpay-flex xpay-gap-2", children: [
2917
+ /* @__PURE__ */ jsx46("div", { className: "xpay-w-10 xpay-h-10", children: (dstDisplayToken ? dstDisplayToken : dstToken)?.image ? /* @__PURE__ */ jsx46(
2918
+ "img",
2919
+ {
2920
+ className: "xpay-w-10 xpay-h-10",
2921
+ src: (dstDisplayToken ? dstDisplayToken : dstToken)?.image,
2922
+ alt: (dstDisplayToken ? dstDisplayToken : dstToken)?.name
2923
+ }
2924
+ ) : /* @__PURE__ */ jsx46(
2925
+ UnknownTokenLogo,
2926
+ {
2927
+ tokenName: "?",
2928
+ className: "xpay-w-10 xpay-h-10"
2929
+ }
2930
+ ) }),
2931
+ /* @__PURE__ */ jsxs21("div", { className: "xpay-flex xpay-flex-col xpay-items-start", children: [
2932
+ /* @__PURE__ */ jsxs21("div", { className: "xpay-flex", children: [
2933
+ weiToHumanReadable({
2934
+ amount: route?.estAmountOut || "0",
2935
+ decimals: (dstDisplayToken ? dstDisplayToken : dstToken)?.decimals || 18,
2936
+ precisionFractionalPlaces: 4
2937
+ }),
2938
+ " ",
2939
+ (dstDisplayToken ? dstDisplayToken : dstToken)?.symbol
2940
+ ] }),
2941
+ /* @__PURE__ */ jsx46("div", { className: "xpay-text-sm xpay-text-center xpay-text-white xpay-opacity-50", children: dstChain?.displayName })
2942
+ ] })
2943
+ ] })
2944
+ ] }),
2945
+ /* @__PURE__ */ jsx46("div", { children: /* @__PURE__ */ jsxs21(
2946
+ "a",
2296
2947
  {
2297
- signer,
2298
- historyTabShown,
2299
- setHistoryTabShown,
2300
- setSettingsShown,
2301
- onClose
2948
+ href: srcChain?.chainId !== dstChain?.chainId ? `${CCIP_EXPLORER}/tx/${transactionSuccessHash}` : `${supportedChains.find(
2949
+ (chain) => chain.chainId === srcChain?.chainId
2950
+ )?.transactionExplorer}/${transactionSuccessHash}`,
2951
+ target: "_blank",
2952
+ rel: "noreferrer",
2953
+ className: "xpay-flex xpay-items-center xpay-gap-2 xpay-font-bold xpay-no-underline xpay-cursor-pointer xpay-text-center",
2954
+ "aria-label": "Show the transaction in the chain explorer",
2955
+ children: [
2956
+ /* @__PURE__ */ jsx46("p", { className: "xpay-bg-gradient-to-r xpay-from-x_blue_light xpay-to-x_blue_dark xpay-bg-clip-text xpay-text-transparent xpay-underline", children: "View details on Explorer" }),
2957
+ /* @__PURE__ */ jsx46("div", { className: "xpay-w-3.5 xpay-h-3.5 xpay-bg-gradient-to-r xpay-text-x_blue_dark", children: /* @__PURE__ */ jsx46(ArrowUpRightIcon, {}) })
2958
+ ]
2302
2959
  }
2303
- ),
2304
- settingsShown && /* @__PURE__ */ jsx41(
2305
- Settings,
2960
+ ) })
2961
+ ] })
2962
+ ] })
2963
+ ) : (
2964
+ // Tx Confirmation modal
2965
+ /* @__PURE__ */ jsxs21(Fragment6, { children: [
2966
+ /* @__PURE__ */ jsxs21("div", { className: "xpay-flex xpay-w-full xpay-justify-between xpay-items-center xpay-mx-auto xpay-p-2 xpay-font-light ", children: [
2967
+ /* @__PURE__ */ jsx46("p", { className: "xpay-text-white xpay-text-xl", children: "Confirmation" }),
2968
+ /* @__PURE__ */ jsx46("div", { className: "xpay-flex xpay-w-full xpay-justify-end xpay-items-center xpay-mx-auto xpay-p-2", children: /* @__PURE__ */ jsx46(
2969
+ "div",
2306
2970
  {
2307
- expressChecked,
2308
- setExpressChecked,
2309
- setSettingsShown,
2310
- slippage,
2311
- setSlippage
2971
+ className: "xpay-cursor-pointer xpay-text-white",
2972
+ onClick: onClose,
2973
+ children: /* @__PURE__ */ jsx46(CloseIcon, {})
2312
2974
  }
2313
- ),
2314
- historyTabShown ? /* @__PURE__ */ jsx41(History, { signer, supportedChains }) : /* @__PURE__ */ jsxs17("div", { className: "xpay-flex xpay-flex-col xpay-gap-2", children: [
2315
- desc && /* @__PURE__ */ jsx41(Description, { description: desc }),
2316
- /* @__PURE__ */ jsx41(
2317
- SwapPanel,
2975
+ ) })
2976
+ ] }),
2977
+ /* @__PURE__ */ jsx46("div", { className: "xpay-flex xpay-flex-col xpay-gap-2", children: /* @__PURE__ */ jsx46(
2978
+ ConfirmationAmount,
2979
+ {
2980
+ amount: ethers4.utils.parseUnits(debouncedAmount, srcToken?.decimals).toString(),
2981
+ chain: srcChain,
2982
+ token: srcToken,
2983
+ type: "src"
2984
+ }
2985
+ ) }),
2986
+ /* @__PURE__ */ jsx46("div", { className: "xpay-flex xpay-justify-center xpay-globalBorder xpay-rounded-xl xpay-p-[5px] xpay--mt-7 xpay--mb-6 ", children: /* @__PURE__ */ jsx46("div", { className: "xpay-flex xpay-items-center xpay-justify-center xpay-rounded-lg xpay-w-8 xpay-h-8 xpay-bg-gradient-to-l xpay-from-[rgba(54,129,198,1)] xpay-to-[rgba(43,74,157,1)] ", children: /* @__PURE__ */ jsx46(ArrowDownIcon, {}) }) }),
2987
+ /* @__PURE__ */ jsx46("div", { className: "xpay-flex xpay-flex-col xpay-gap-2", children: /* @__PURE__ */ jsx46(
2988
+ ConfirmationAmount,
2989
+ {
2990
+ amount: route?.estAmountOut || "0",
2991
+ chain: dstChain,
2992
+ token: dstDisplayToken ? dstDisplayToken : dstToken,
2993
+ type: "dst"
2994
+ }
2995
+ ) }),
2996
+ /* @__PURE__ */ jsxs21("div", { className: "xpay-flex xpay-flex-col xpay-globalBorder xpay-p-4 xpay-justify-center xpay-rounded-xl xpay-bg-[rgba(15,15,15,1)] xpay-relative", children: [
2997
+ route?.transactions.approve && !isAllowanceOk && /* @__PURE__ */ jsxs21(Fragment6, { children: [
2998
+ /* @__PURE__ */ jsxs21("div", { className: "xpay-flex xpay-justify-between xpay-items-center", children: [
2999
+ /* @__PURE__ */ jsxs21("div", { className: "xpay-flex xpay-items-center xpay-gap-2", children: [
3000
+ /* @__PURE__ */ jsx46(SignIcon, {}),
3001
+ /* @__PURE__ */ jsx46("p", { className: "xpay-opacity-50", children: approveTxLoading ? "Wait for approval confirmation" : "Approve token spending" })
3002
+ ] }),
3003
+ /* @__PURE__ */ jsxs21("div", { className: "xpay-flex xpay-items-center", children: [
3004
+ approveTxLoading && /* @__PURE__ */ jsx46(Spinner, { width: "5", height: "5" }),
3005
+ approveTxDone && /* @__PURE__ */ jsx46("div", { className: "xpay-text-x_green xpay-w-5 xpay-h-5", children: /* @__PURE__ */ jsx46(CheckIcon, {}) })
3006
+ ] })
3007
+ ] }),
3008
+ /* @__PURE__ */ jsx46("div", { className: "xpay-w-px xpay-h-6 xpay-mt-1 xpay-mb-1 xpay-ml-2.5 xpay-bg-white xpay-opacity-50" })
3009
+ ] }),
3010
+ /* @__PURE__ */ jsxs21("div", { className: "xpay-flex xpay-justify-between xpay-items-center", children: [
3011
+ /* @__PURE__ */ jsxs21("div", { className: "xpay-flex xpay-items-center xpay-gap-2", children: [
3012
+ /* @__PURE__ */ jsx46(SignIcon, {}),
3013
+ /* @__PURE__ */ jsx46("p", { className: "xpay-opacity-50", children: txLoading ? "Wait for transaction confirmation" : "Confirm transaction" })
3014
+ ] }),
3015
+ /* @__PURE__ */ jsx46("div", { className: "xpay-flex xpay-items-center", children: txLoading && /* @__PURE__ */ jsx46(Spinner, { width: "5", height: "5" }) })
3016
+ ] })
3017
+ ] })
3018
+ ] })
3019
+ ) }) : (
3020
+ // XPay form
3021
+ /* @__PURE__ */ jsxs21(
3022
+ "form",
3023
+ {
3024
+ className: "xpay-flex xpay-flex-col xpay-gap-2 xpay-z-10 xpay-my-0 p-2 md:xpay-p-4 xpay-rounded-3xl xpay-overflow-hidden xpay-font-light sm:xpay-w-x_desktop",
3025
+ onSubmit: handleSubmit,
3026
+ children: [
3027
+ /* @__PURE__ */ jsx46(
3028
+ TopBar,
2318
3029
  {
2319
- amount,
2320
- setAmount,
2321
- srcToken,
2322
- setSrcToken,
2323
- srcChain,
2324
3030
  signer,
2325
- balances,
2326
- prices,
2327
- supportedChains,
2328
- setSrcChain,
2329
- setExceedsExpressDeliveryLimit
3031
+ historyTabShown,
3032
+ setHistoryTabShown,
3033
+ setSettingsShown,
3034
+ onClose
2330
3035
  }
2331
3036
  ),
2332
- /* @__PURE__ */ jsx41(
2333
- Summary,
3037
+ settingsShown && /* @__PURE__ */ jsx46(
3038
+ Settings,
2334
3039
  {
2335
- isGettingRoute,
2336
- route,
2337
- dstToken,
2338
- dstChain
2339
- }
2340
- ),
2341
- /* @__PURE__ */ jsx41(
2342
- FeesDetails,
2343
- {
2344
- route,
2345
- isGettingRoute,
2346
- paymentToken,
2347
- dstToken,
2348
3040
  expressChecked,
2349
- exceedsExpressDeliveryLimit,
3041
+ setExpressChecked,
3042
+ setSettingsShown,
2350
3043
  slippage,
2351
- feesDetailsShown,
2352
- setFeesDetailsShown
3044
+ setSlippage
2353
3045
  }
2354
3046
  ),
2355
- formError.length > 0 && /* @__PURE__ */ jsx41(ErrorField, { error: formError }),
2356
- signer && srcChain && srcChain.chainId !== account.chainId?.toString() ? /* @__PURE__ */ jsx41(Button, { type: "button", onClick: handleSwitchChain, children: "Switch chain" }) : /* @__PURE__ */ jsx41(
2357
- Button,
2358
- {
2359
- type: "submit",
2360
- disabled: !signer || !route || isGettingRoute,
2361
- children: "Submit"
2362
- }
2363
- )
2364
- ] })
2365
- ]
2366
- }
2367
- );
3047
+ historyTabShown ? /* @__PURE__ */ jsx46(History, { signer, supportedChains }) : /* @__PURE__ */ jsxs21("div", { className: "xpay-flex xpay-flex-col xpay-gap-2", children: [
3048
+ /* @__PURE__ */ jsx46(
3049
+ SwapPanel,
3050
+ {
3051
+ amount,
3052
+ setAmount,
3053
+ srcToken,
3054
+ setSrcToken,
3055
+ srcChain,
3056
+ signer,
3057
+ balances,
3058
+ prices,
3059
+ supportedChains,
3060
+ setSrcChain
3061
+ }
3062
+ ),
3063
+ /* @__PURE__ */ jsx46(
3064
+ Summary,
3065
+ {
3066
+ isGettingRoute,
3067
+ route,
3068
+ dstToken: dstDisplayToken ? dstDisplayToken : dstToken,
3069
+ dstChain
3070
+ }
3071
+ ),
3072
+ desc && /* @__PURE__ */ jsx46(Description, { description: desc }),
3073
+ /* @__PURE__ */ jsx46(
3074
+ FeesDetails,
3075
+ {
3076
+ route,
3077
+ isGettingRoute,
3078
+ paymentToken,
3079
+ dstToken,
3080
+ slippage,
3081
+ feesDetailsShown,
3082
+ setFeesDetailsShown,
3083
+ isExpressDelivery
3084
+ }
3085
+ ),
3086
+ formError.length > 0 && /* @__PURE__ */ jsx46(ErrorField, { error: formError }),
3087
+ /* @__PURE__ */ jsx46(
3088
+ Button,
3089
+ {
3090
+ type: "submit",
3091
+ disabled: swapButton.disabled,
3092
+ onClick: swapButton.fn,
3093
+ children: swapButton.text
3094
+ }
3095
+ )
3096
+ ] })
3097
+ ]
3098
+ }
3099
+ )
3100
+ ) });
2368
3101
  };
2369
3102
 
2370
3103
  // src/components/TxConfigForm/index.tsx
2371
- import { jsx as jsx42, jsxs as jsxs18 } from "react/jsx-runtime";
3104
+ import { jsx as jsx47, jsxs as jsxs22 } from "react/jsx-runtime";
2372
3105
  var TxConfigForm = ({
2373
3106
  integratorId,
2374
3107
  dstChainId,
@@ -2376,13 +3109,16 @@ var TxConfigForm = ({
2376
3109
  customContractCalls,
2377
3110
  desc,
2378
3111
  supportedChains,
3112
+ retrunTransactions,
3113
+ dstDisplayTokenAddr,
2379
3114
  onSubmit,
2380
3115
  onClose
2381
3116
  }) => {
3117
+ const [backdropClickDisabled, setBackdropClickDisabled] = useState10(false);
2382
3118
  const onBackdropClick = (e) => {
2383
3119
  e.stopPropagation();
2384
3120
  e.nativeEvent.stopImmediatePropagation();
2385
- if (e.target === e.currentTarget) {
3121
+ if (e.target === e.currentTarget && !backdropClickDisabled) {
2386
3122
  onClose();
2387
3123
  }
2388
3124
  };
@@ -2391,13 +3127,13 @@ var TxConfigForm = ({
2391
3127
  () => getWagmiConfig(supportedChains),
2392
3128
  supportedChains
2393
3129
  );
2394
- return /* @__PURE__ */ jsx42(WagmiProvider, { config: wagmiConfig, children: /* @__PURE__ */ jsx42(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx42(
3130
+ return /* @__PURE__ */ jsx47(WagmiProvider, { config: wagmiConfig, children: /* @__PURE__ */ jsx47(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx47(
2395
3131
  "div",
2396
3132
  {
2397
3133
  className: "xpay-top-0 xpay-left-0 xpay-right-0 xpay-bottom-0 xpay-bg-[rgba(0,0,0,0.8)] xpay-fixed xpay-flex xpay-items-center xpay-justify-center xpay-z-10",
2398
- onClick: onBackdropClick,
2399
- children: /* @__PURE__ */ jsxs18("div", { className: "xpay-relative xpay-bg-black xpay-rounded-3xl xpay-overflow-auto xpay-text-white xpay-border-2 xpay-border-solid xpay-border-[rgba(255,255,255,0.1)]", children: [
2400
- /* @__PURE__ */ jsx42(
3134
+ onMouseDown: onBackdropClick,
3135
+ children: /* @__PURE__ */ jsxs22("div", { className: "xpay-relative xpay-bg-black xpay-rounded-3xl xpay-overflow-auto xpay-text-white xpay-border-2 xpay-border-solid xpay-border-[rgba(255,255,255,0.1)]", children: [
3136
+ /* @__PURE__ */ jsx47(
2401
3137
  Form,
2402
3138
  {
2403
3139
  integratorId,
@@ -2406,11 +3142,15 @@ var TxConfigForm = ({
2406
3142
  customContractCalls,
2407
3143
  desc,
2408
3144
  supportedChains,
3145
+ wagmiConfig,
3146
+ retrunTransactions: !!retrunTransactions,
3147
+ dstDisplayTokenAddr,
2409
3148
  onSubmit,
2410
- onClose
3149
+ onClose,
3150
+ setBackdropClickDisabled: (disabled) => setBackdropClickDisabled(disabled)
2411
3151
  }
2412
3152
  ),
2413
- /* @__PURE__ */ jsx42(PoweredBy, {})
3153
+ /* @__PURE__ */ jsx47(PoweredBy, {})
2414
3154
  ] })
2415
3155
  }
2416
3156
  ) }) });
@@ -2421,13 +3161,21 @@ var openTxConfigForm = async ({
2421
3161
  dstTokenAddr,
2422
3162
  customContractCalls,
2423
3163
  desc,
2424
- supportedChains
3164
+ supportedChains,
3165
+ retrunTransactions,
3166
+ dstDisplayTokenAddr
2425
3167
  }) => {
2426
3168
  try {
3169
+ if (xpayRoot === null) {
3170
+ throw new Error("XPay was incorrectly initialised");
3171
+ }
2427
3172
  return await new Promise(async (resolve) => {
2428
3173
  await waitForInitialization();
3174
+ if (xpayRoot === null) {
3175
+ throw new Error("XPay was incorrectly initialised");
3176
+ }
2429
3177
  xpayRoot.render(
2430
- /* @__PURE__ */ jsx42(
3178
+ /* @__PURE__ */ jsx47(
2431
3179
  TxConfigForm,
2432
3180
  {
2433
3181
  integratorId,
@@ -2436,12 +3184,20 @@ var openTxConfigForm = async ({
2436
3184
  customContractCalls,
2437
3185
  desc,
2438
3186
  supportedChains,
3187
+ retrunTransactions,
3188
+ dstDisplayTokenAddr,
2439
3189
  onSubmit: (route) => {
2440
- resolve(route);
2441
- xpayRoot.render("");
3190
+ if (retrunTransactions) {
3191
+ resolve(route);
3192
+ }
3193
+ if (xpayRoot) {
3194
+ xpayRoot.render("");
3195
+ }
2442
3196
  },
2443
3197
  onClose: () => {
2444
- xpayRoot.render("");
3198
+ if (xpayRoot) {
3199
+ xpayRoot.render("");
3200
+ }
2445
3201
  }
2446
3202
  }
2447
3203
  )
@@ -2453,8 +3209,8 @@ var openTxConfigForm = async ({
2453
3209
  };
2454
3210
 
2455
3211
  // src/components/TxStatusButton/index.tsx
2456
- import { useMemo as useMemo9, useState as useState9 } from "react";
2457
- import { Fragment as Fragment6, jsx as jsx43, jsxs as jsxs19 } from "react/jsx-runtime";
3212
+ import { useMemo as useMemo9, useState as useState11 } from "react";
3213
+ import { Fragment as Fragment7, jsx as jsx48, jsxs as jsxs23 } from "react/jsx-runtime";
2458
3214
  var TxStatusButton = ({ transaction }) => {
2459
3215
  const {
2460
3216
  srcChain: fromChain,
@@ -2467,7 +3223,7 @@ var TxStatusButton = ({ transaction }) => {
2467
3223
  isDone,
2468
3224
  explorer
2469
3225
  } = transaction;
2470
- const [isWide, setIsWide] = useState9(false);
3226
+ const [isWide, setIsWide] = useState11(false);
2471
3227
  const background = useMemo9(
2472
3228
  () => isDone ? "xpay-bg-[rgba(2,2,2,1)] xpay-bg-gradient-to-r xpay-from-[rgba(76,175,80,0.2)] xpay-to-[rgba(46,125,50,0.2)]" : "xpay-bg-[rgba(2,2,2,1)] xpay-bg-gradient-to-r xpay-from-[rgba(54,129,198,0.2)] xpay-to-[rgba(43,74,157,0.2)]",
2473
3229
  [isDone]
@@ -2476,20 +3232,20 @@ var TxStatusButton = ({ transaction }) => {
2476
3232
  () => isDone ? "xpay-border xpay-border-solid xpay-border-x_green_dark" : "xpay-border xpay-border-solid xpay-border-x_blue_dark",
2477
3233
  [isDone]
2478
3234
  );
2479
- return /* @__PURE__ */ jsxs19(
3235
+ return /* @__PURE__ */ jsxs23(
2480
3236
  "div",
2481
3237
  {
2482
3238
  className: "xpay-flex xpay-gap-2",
2483
3239
  onClick: () => setIsWide((x) => !x),
2484
3240
  children: [
2485
- isWide && /* @__PURE__ */ jsxs19(
3241
+ isWide && /* @__PURE__ */ jsxs23(
2486
3242
  "div",
2487
3243
  {
2488
3244
  className: `xpay-flex xpay-items-center xpay-min-w-60 sm:xpay-w-[520px] xpay-text-white xpay-h-14 xpay-px-4 xpay-text-sm xpay-gap-3 xpay-rounded-xl ${background} ${border}`,
2489
3245
  children: [
2490
- /* @__PURE__ */ jsxs19("div", { className: "xpay-flex xpay-justify-between xpay-flex-col xpay-gap-2 sm:xpay-gap-5 sm:xpay-flex-row xpay-w-full", children: [
2491
- /* @__PURE__ */ jsxs19("div", { className: "xpay-flex xpay-items-center xpay-gap-2", children: [
2492
- /* @__PURE__ */ jsx43(
3246
+ /* @__PURE__ */ jsxs23("div", { className: "xpay-flex xpay-justify-between xpay-flex-col xpay-gap-2 sm:xpay-gap-5 sm:xpay-flex-row xpay-w-full", children: [
3247
+ /* @__PURE__ */ jsxs23("div", { className: "xpay-flex xpay-items-center xpay-gap-2", children: [
3248
+ /* @__PURE__ */ jsx48(
2493
3249
  "img",
2494
3250
  {
2495
3251
  className: "xpay-w-5 xpay-h-5",
@@ -2497,9 +3253,9 @@ var TxStatusButton = ({ transaction }) => {
2497
3253
  alt: "source chain"
2498
3254
  }
2499
3255
  ),
2500
- /* @__PURE__ */ jsx43("div", { children: fromChain }),
2501
- /* @__PURE__ */ jsx43("div", { className: "xpay-w-3.5 xpay-h-3.5", children: /* @__PURE__ */ jsx43(ArrowRightIcon, {}) }),
2502
- /* @__PURE__ */ jsx43(
3256
+ /* @__PURE__ */ jsx48("div", { children: fromChain }),
3257
+ /* @__PURE__ */ jsx48("div", { className: "xpay-w-3.5 xpay-h-3.5", children: /* @__PURE__ */ jsx48(ArrowRightIcon, {}) }),
3258
+ /* @__PURE__ */ jsx48(
2503
3259
  "img",
2504
3260
  {
2505
3261
  className: "xpay-w-5 xpay-h-5",
@@ -2507,23 +3263,23 @@ var TxStatusButton = ({ transaction }) => {
2507
3263
  alt: "to chain"
2508
3264
  }
2509
3265
  ),
2510
- /* @__PURE__ */ jsx43("div", { children: toChain })
3266
+ /* @__PURE__ */ jsx48("div", { children: toChain })
2511
3267
  ] }),
2512
- /* @__PURE__ */ jsxs19("div", { className: "xpay-flex xpay-items-center xpay-gap-2", children: [
2513
- /* @__PURE__ */ jsx43("div", { children: "Sent" }),
2514
- /* @__PURE__ */ jsx43("div", { children: fromAmount }),
2515
- /* @__PURE__ */ jsx43("div", { children: fromToken }),
2516
- fromTokenImage ? /* @__PURE__ */ jsx43(
3268
+ /* @__PURE__ */ jsxs23("div", { className: "xpay-flex xpay-items-center xpay-gap-2", children: [
3269
+ /* @__PURE__ */ jsx48("div", { children: "Sent" }),
3270
+ /* @__PURE__ */ jsx48("div", { children: fromAmount }),
3271
+ /* @__PURE__ */ jsx48("div", { children: fromToken }),
3272
+ fromTokenImage ? /* @__PURE__ */ jsx48(
2517
3273
  "img",
2518
3274
  {
2519
3275
  className: "xpay-w-5 xpay-h-5",
2520
3276
  src: fromTokenImage,
2521
3277
  alt: "source token"
2522
3278
  }
2523
- ) : /* @__PURE__ */ jsx43(UnknownTokenLogo, { tokenName: "?" })
3279
+ ) : /* @__PURE__ */ jsx48(UnknownTokenLogo, { tokenName: "?" })
2524
3280
  ] })
2525
3281
  ] }),
2526
- /* @__PURE__ */ jsx43(
3282
+ /* @__PURE__ */ jsx48(
2527
3283
  "a",
2528
3284
  {
2529
3285
  href: explorer,
@@ -2531,21 +3287,21 @@ var TxStatusButton = ({ transaction }) => {
2531
3287
  rel: "noreferrer",
2532
3288
  className: "xpay-no-underline xpay-cursor-pointer",
2533
3289
  "aria-label": "Show the transaction in the chain explorer",
2534
- children: /* @__PURE__ */ jsx43("div", { className: "xpay-w-3.5 xpay-h-3.5", children: /* @__PURE__ */ jsx43(ArrowUpRightIcon, {}) })
3290
+ children: /* @__PURE__ */ jsx48("div", { className: "xpay-w-3.5 xpay-h-3.5", children: /* @__PURE__ */ jsx48(ArrowUpRightIcon, {}) })
2535
3291
  }
2536
3292
  )
2537
3293
  ]
2538
3294
  }
2539
3295
  ),
2540
- /* @__PURE__ */ jsx43(
3296
+ /* @__PURE__ */ jsx48(
2541
3297
  "div",
2542
3298
  {
2543
3299
  className: `xpay-text-white xpay-rounded-xl xpay-cursor-pointer ${background} ${border}`,
2544
- children: /* @__PURE__ */ jsxs19("div", { className: "xpay-flex xpay-gap-2 xpay-items-center xpay-h-14 xpay-w-20 xpay-justify-center", children: [
2545
- /* @__PURE__ */ jsx43(ArrowLeftIcon, {}),
2546
- /* @__PURE__ */ jsx43("div", { className: "xpay-relative xpay-flex xpay-items-center xpay-justify-center xpay-w-9 xpay-h-9", children: isDone ? /* @__PURE__ */ jsx43("div", { className: "xpay-text-x_green xpay-w-5 xpay-h-5", children: /* @__PURE__ */ jsx43(CheckIcon, {}) }) : /* @__PURE__ */ jsxs19(Fragment6, { children: [
2547
- /* @__PURE__ */ jsx43("div", { className: "xpay-w-5 xpay-h-5", children: /* @__PURE__ */ jsx43(XSwapLogo, {}) }),
2548
- /* @__PURE__ */ jsx43("div", { className: "xpay-absolute xpay-flex xpay-items-center xpay-justify-center xpay-top-0 xpay-left-0 xpay-right-0 xpay-bottom-0 xpay-text-white", children: /* @__PURE__ */ jsx43(CircularProgressIcon, {}) })
3300
+ children: /* @__PURE__ */ jsxs23("div", { className: "xpay-flex xpay-gap-2 xpay-items-center xpay-h-14 xpay-w-20 xpay-justify-center", children: [
3301
+ /* @__PURE__ */ jsx48(ArrowLeftIcon, {}),
3302
+ /* @__PURE__ */ jsx48("div", { className: "xpay-relative xpay-flex xpay-items-center xpay-justify-center xpay-w-9 xpay-h-9", children: isDone ? /* @__PURE__ */ jsx48("div", { className: "xpay-text-x_green xpay-w-5 xpay-h-5", children: /* @__PURE__ */ jsx48(CheckIcon, {}) }) : /* @__PURE__ */ jsxs23(Fragment7, { children: [
3303
+ /* @__PURE__ */ jsx48("div", { className: "xpay-w-5 xpay-h-5", children: /* @__PURE__ */ jsx48(XSwapLogo, {}) }),
3304
+ /* @__PURE__ */ jsx48("div", { className: "xpay-absolute xpay-flex xpay-items-center xpay-justify-center xpay-top-0 xpay-left-0 xpay-right-0 xpay-bottom-0 xpay-text-white", children: /* @__PURE__ */ jsx48(Spinner, { width: "10", height: "10" }) })
2549
3305
  ] }) })
2550
3306
  ] })
2551
3307
  }
@@ -2574,17 +3330,22 @@ var updateTransactionDoneInRenderedTransactions = (txHash) => {
2574
3330
  }
2575
3331
  };
2576
3332
  var renderTxStatusButtons = () => {
2577
- const buttons = renderedTransactions.map((item) => /* @__PURE__ */ jsx43(TxStatusButton, { transaction: item }, item.txHash));
2578
- xpayTxStatusRoot.render(buttons);
3333
+ const buttons = renderedTransactions.map((item) => /* @__PURE__ */ jsx48(TxStatusButton, { transaction: item }, item.txHash));
3334
+ if (xpayTxStatusRoot === null) {
3335
+ throw new Error("XPay was incorrectly initialised");
3336
+ }
3337
+ xpayTxStatusRoot.render(
3338
+ /* @__PURE__ */ jsx48("div", { className: "xpay-fixed xpay-bottom-5 xpay-right-2 xpay-flex xpay-flex-col xpay-gap-3 xpay-pl-9 xpay-items-end xpay-w-full xpay-z-50", children: buttons })
3339
+ );
2579
3340
  };
2580
3341
 
2581
3342
  // src/components/Skeleton/index.tsx
2582
- import { jsx as jsx44 } from "react/jsx-runtime";
3343
+ import { jsx as jsx49 } from "react/jsx-runtime";
2583
3344
  var Skeleton = ({ width, height }) => {
2584
- return /* @__PURE__ */ jsx44(
3345
+ return /* @__PURE__ */ jsx49(
2585
3346
  "div",
2586
3347
  {
2587
- className: `xpay-bg-current xpay-rounded xpay-animate-pulse ${width} ${height}`
3348
+ className: `xpay-bg-gray-700 xpay-rounded xpay-animate-pulse ${width} ${height}`
2588
3349
  }
2589
3350
  );
2590
3351
  };
@@ -2593,13 +3354,13 @@ var Skeleton = ({ width, height }) => {
2593
3354
  import retry from "async-retry";
2594
3355
 
2595
3356
  // src/services/blockchain.ts
2596
- import { ethers as ethers4 } from "ethers";
3357
+ import { ethers as ethers5 } from "ethers";
2597
3358
  var getCustomTokenData = async (chain, tokenAddress) => {
2598
3359
  const rpcUrl = chain.publicRpcUrls[0];
2599
- const customTokenContract = new ethers4.Contract(
3360
+ const customTokenContract = new ethers5.Contract(
2600
3361
  tokenAddress.toLowerCase(),
2601
3362
  ERC20Abi,
2602
- ethers4.getDefaultProvider(rpcUrl)
3363
+ ethers5.getDefaultProvider(rpcUrl)
2603
3364
  );
2604
3365
  try {
2605
3366
  const query = async (contract, method, args = []) => {
@@ -2638,7 +3399,7 @@ var renderTxStatus = async (txChainId, txHash) => {
2638
3399
  ({ web3Environment, swapSupported }) => web3Environment === "mainnet" /* MAINNET */ && swapSupported
2639
3400
  );
2640
3401
  const messageSentEvent = txReceipt.logs?.find((log) => {
2641
- return log.topics[0] === ethers5.utils.id(MSG_SENT_EVENT_SIG);
3402
+ return log.topics[0] === ethers6.utils.id(MSG_SENT_EVENT_SIG);
2642
3403
  });
2643
3404
  if (!messageSentEvent) {
2644
3405
  throw new Error(
@@ -2646,7 +3407,7 @@ var renderTxStatus = async (txChainId, txHash) => {
2646
3407
  );
2647
3408
  }
2648
3409
  const messageId = messageSentEvent?.topics[1];
2649
- const iface = new ethers5.utils.Interface(MSG_SENT_EVENT_ABI);
3410
+ const iface = new ethers6.utils.Interface(MSG_SENT_EVENT_ABI);
2650
3411
  const decodedMessageSentEvent = iface.parseLog(messageSentEvent);
2651
3412
  if (!decodedMessageSentEvent) {
2652
3413
  throw new Error(
@@ -2696,16 +3457,16 @@ var renderTxStatus = async (txChainId, txHash) => {
2696
3457
  if (!xSwapRouterOnDestinationAddress) {
2697
3458
  throw new Error(`Unknown destination XSwapRouter!`);
2698
3459
  }
2699
- const xSwapRouterOnDestination = new ethers5.Contract(
3460
+ const xSwapRouterOnDestination = new ethers6.Contract(
2700
3461
  xSwapRouterOnDestinationAddress,
2701
3462
  MSG_RECEIVED_EVENT_ABI,
2702
- ethers5.getDefaultProvider(
3463
+ ethers6.getDefaultProvider(
2703
3464
  supportedChains.find((chain) => chain.chainId === dstChainId)?.publicRpcUrls[0]
2704
3465
  )
2705
3466
  );
2706
3467
  const msgReceivedEventFilter = {
2707
3468
  address: xSwapRouterOnDestinationAddress,
2708
- topics: [ethers5.utils.id(MSG_RECEIVED_EVENT_SIG), messageId]
3469
+ topics: [ethers6.utils.id(MSG_RECEIVED_EVENT_SIG), messageId]
2709
3470
  };
2710
3471
  const onSuccess = async () => {
2711
3472
  updateTransactionDoneInRenderedTransactions(txHash);
@@ -2721,6 +3482,14 @@ var renderTxStatus = async (txChainId, txHash) => {
2721
3482
  onSuccess();
2722
3483
  }
2723
3484
  });
3485
+ setTimeout(
3486
+ () => getTxStatus({ transferId: messageId }).then((response) => {
3487
+ if (response.status === "DONE") {
3488
+ onSuccess();
3489
+ }
3490
+ }),
3491
+ 30 * 60 * 1e3
3492
+ );
2724
3493
  xSwapRouterOnDestination.once(msgReceivedEventFilter, () => onSuccess());
2725
3494
  };
2726
3495
  var getTxReceipt = async (txChainId, txHash) => {
@@ -2728,7 +3497,7 @@ var getTxReceipt = async (txChainId, txHash) => {
2728
3497
  const chain = (await getChains()).find(
2729
3498
  (chain2) => chain2.chainId === txChainId
2730
3499
  );
2731
- const provider = new ethers5.providers.JsonRpcProvider(
3500
+ const provider = new ethers6.providers.JsonRpcProvider(
2732
3501
  chain?.publicRpcUrls[0]
2733
3502
  );
2734
3503
  return await retry(async () => {
@@ -2751,7 +3520,9 @@ var openTransactionModal = async ({
2751
3520
  dstChain,
2752
3521
  dstToken,
2753
3522
  customContractCalls = [],
2754
- desc
3523
+ desc,
3524
+ retrunTransactions,
3525
+ dstDisplayToken
2755
3526
  }) => {
2756
3527
  const supportedChains = (await getChains()).filter(
2757
3528
  ({ web3Environment, swapSupported }) => web3Environment === "mainnet" /* MAINNET */ && swapSupported
@@ -2763,9 +3534,13 @@ var openTransactionModal = async ({
2763
3534
  dstTokenAddr: dstToken,
2764
3535
  customContractCalls,
2765
3536
  desc,
2766
- supportedChains
3537
+ supportedChains,
3538
+ retrunTransactions,
3539
+ dstDisplayTokenAddr: dstDisplayToken
2767
3540
  });
2768
- return route.transactions;
3541
+ if (retrunTransactions) {
3542
+ return route.transactions;
3543
+ }
2769
3544
  };
2770
3545
  var validateSwapTxData = (supportedChains, dstChain, dstToken) => {
2771
3546
  const supportedDstChain = supportedChains.find(
@@ -2776,7 +3551,7 @@ var validateSwapTxData = (supportedChains, dstChain, dstToken) => {
2776
3551
  }
2777
3552
  if (!isETHAddressValid(dstToken)) {
2778
3553
  throw new Error(
2779
- `Provided token address ${dstToken} on chain ${dstChain} is not correct`
3554
+ `Provided token address ${dstToken} on chain ${dstChain} is invalid`
2780
3555
  );
2781
3556
  }
2782
3557
  };