@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.js CHANGED
@@ -59,7 +59,7 @@ var xswap_config_default = {
59
59
  };
60
60
 
61
61
  // package.json
62
- var version = "0.2.6";
62
+ var version = "0.3.0";
63
63
 
64
64
  // src/components/WaitingForInit/index.tsx
65
65
  var import_jsx_runtime = require("react/jsx-runtime");
@@ -86,13 +86,14 @@ var WaitingForInit = () => {
86
86
 
87
87
  // src/config/init.tsx
88
88
  var import_jsx_runtime2 = require("react/jsx-runtime");
89
- var xpayRoot;
90
- var xpayInitIndicatorRoot;
91
- var xpayTxStatusRoot;
92
- var initCompleted = false;
89
+ var xpayRoot = null;
90
+ var xpayInitIndicatorRoot = null;
91
+ var xpayTxStatusRoot = null;
92
+ var xPayInitCompleted = false;
93
+ var isServer = typeof window === "undefined";
93
94
  var initDocument = () => {
94
- if (typeof document === "undefined") {
95
- throw new Error("Can't render XPay components from server side.");
95
+ if (isServer) {
96
+ return;
96
97
  }
97
98
  createXPayInitIndicatorRoot();
98
99
  Promise.all([
@@ -100,19 +101,22 @@ var initDocument = () => {
100
101
  createXPayRoot(),
101
102
  createXPayTxStatusRoot()
102
103
  ]).then(() => {
103
- initCompleted = true;
104
+ xPayInitCompleted = true;
104
105
  });
105
106
  };
106
107
  var waitForInitialization = async () => {
107
- if (!initCompleted) {
108
+ if (!xPayInitCompleted) {
108
109
  displayInitIndicator(true);
109
- while (!initCompleted) {
110
+ while (!xPayInitCompleted) {
110
111
  await new Promise((resolve) => setTimeout(resolve, 10));
111
112
  }
112
113
  displayInitIndicator(false);
113
114
  }
114
115
  };
115
116
  var createStyleElement = async () => {
117
+ if (isServer) {
118
+ return;
119
+ }
116
120
  const css = await fetch(
117
121
  `${xswap_config_default.apiUrl}/sdk/css?${new URLSearchParams({
118
122
  data: JSON.stringify({ version })
@@ -124,6 +128,9 @@ var createStyleElement = async () => {
124
128
  document.body.appendChild(style);
125
129
  };
126
130
  var createXPayRoot = async () => {
131
+ if (isServer) {
132
+ return;
133
+ }
127
134
  const xswapElement = document.createElement("div");
128
135
  xswapElement.setAttribute("id", "xpay-root");
129
136
  xswapElement.setAttribute("class", "xpay");
@@ -131,6 +138,9 @@ var createXPayRoot = async () => {
131
138
  xpayRoot = (0, import_client.createRoot)(xswapElement);
132
139
  };
133
140
  var createXPayTxStatusRoot = async () => {
141
+ if (isServer) {
142
+ return;
143
+ }
134
144
  const txStatusElement = document.createElement("div");
135
145
  txStatusElement.setAttribute("id", "xpay-tx-status");
136
146
  txStatusElement.setAttribute("class", "xpay-tx-status");
@@ -138,13 +148,19 @@ var createXPayTxStatusRoot = async () => {
138
148
  xpayTxStatusRoot = (0, import_client.createRoot)(txStatusElement);
139
149
  };
140
150
  var createXPayInitIndicatorRoot = () => {
151
+ if (isServer) {
152
+ return;
153
+ }
141
154
  const initIndicatorElement = document.createElement("div");
142
155
  initIndicatorElement.setAttribute("id", "xpay-init-indicator");
143
156
  document.body.appendChild(initIndicatorElement);
144
157
  xpayInitIndicatorRoot = (0, import_client.createRoot)(initIndicatorElement);
145
158
  };
146
159
  var displayInitIndicator = (display) => {
147
- display ? xpayInitIndicatorRoot.render(/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(WaitingForInit, {})) : xpayInitIndicatorRoot.render("");
160
+ if (isServer || !xpayInitIndicatorRoot) {
161
+ return;
162
+ }
163
+ display ? xpayInitIndicatorRoot.render(/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(WaitingForInit, {})) : xpayInitIndicatorRoot.render(null);
148
164
  };
149
165
 
150
166
  // src/services/api.ts
@@ -199,7 +215,7 @@ async function getTxStatus(payload) {
199
215
  }
200
216
 
201
217
  // src/services/integrations/customCalls/staking.ts
202
- var import_ethers3 = require("ethers");
218
+ var import_ethers4 = require("ethers");
203
219
 
204
220
  // src/models/Addresses.ts
205
221
  var ContractName = /* @__PURE__ */ ((ContractName2) => {
@@ -571,13 +587,12 @@ var NUMBER_INPUT_REGEX = /^[0-9]*[.,]?[0-9]*$/;
571
587
  var SLIPPAGE_PRESETS = [0.5, 1.5, 3];
572
588
  var DELIVERY_TIME = 30 * 1e3 * 60;
573
589
  var EXPRESS_DELIVERY_TIME = 30 * 1e3;
574
- var EXPRESS_DELIVERY_LIMIT = 1e3;
575
590
  var BALANCES_CHUNK_SIZE = 500;
576
- var ROUTE_TIMEOUT_MS = 5e3;
591
+ var ROUTE_TIMEOUT_MS = 1e4;
577
592
  var MINIMUM_DISPLAYED_TOKEN_AMOUNT = 1e-4;
578
593
  var DEFAULT_SOURCE_CHAIN_ID = "1";
579
594
  var CCIP_EXPLORER = "https://ccip.chain.link/";
580
- var TX_RECEIPT_STATUS_LIFETIME = 1e4;
595
+ var TX_RECEIPT_STATUS_LIFETIME = 6e4;
581
596
  var MSG_SENT_EVENT_SIG = "MessageSent(bytes32,uint64,address,bytes,address,uint256,uint256,address,uint256)";
582
597
  var MSG_SENT_EVENT_ABI = [
583
598
  "event MessageSent(bytes32 indexed messageId, uint64 indexed destinationChainSelector, address indexed sender, bytes data, address token, uint256 tokenAmount, uint256 valueForInstantCcipRecieve, address transferedToken, uint256 transferedTokenAmount)"
@@ -589,6 +604,17 @@ var MSG_RECEIVED_EVENT_ABI = [
589
604
 
590
605
  // src/utils/contracts.ts
591
606
  var IERC20 = new import_ethers.ethers.utils.Interface(ERC20Abi);
607
+ var getAllowanceOf = async (token, wallet, spender, rpcUrl) => {
608
+ const provider = import_ethers.ethers.getDefaultProvider(rpcUrl);
609
+ if (token === import_ethers.ethers.constants.AddressZero) {
610
+ return import_ethers.ethers.constants.MaxUint256.toString();
611
+ }
612
+ const contract = new import_ethers.ethers.Contract(token, ERC20Abi, provider);
613
+ return import_ethers.ethers.utils.formatUnits(
614
+ await contract.allowance(wallet, spender),
615
+ await contract.decimals()
616
+ );
617
+ };
592
618
  var getBalances = async (chain, wallet) => {
593
619
  return {
594
620
  ...await getNativeBalance(chain, wallet),
@@ -675,6 +701,60 @@ var isETHAddressValid = (address) => {
675
701
  return /^0x[a-fA-F0-9]{40}$/.test(address);
676
702
  };
677
703
 
704
+ // src/utils/parseWeb3Error.ts
705
+ var import_ethers3 = require("ethers");
706
+ function parseWeb3Error(error) {
707
+ const errorMessage = typeof error === "string" ? error : error?.message || "An unknown error occurred";
708
+ if (errorMessage.includes("User denied transaction signature") || errorMessage.includes("User rejected the request")) {
709
+ return "Transaction was cancelled.";
710
+ }
711
+ if (errorMessage.includes("insufficient funds")) {
712
+ return "Insufficient funds to complete the transaction.";
713
+ }
714
+ if (errorMessage.includes("gas price too low")) {
715
+ return "Gas price is too low. Please increase the gas price and try again.";
716
+ }
717
+ if (errorMessage.includes("nonce too low")) {
718
+ return "Transaction nonce is too low. Please reset your account in MetaMask and try again.";
719
+ }
720
+ if (errorMessage.includes("execution reverted")) {
721
+ const revertReason = errorMessage.match(/reason: (.+?)(?:, method|$)/)?.[1];
722
+ return revertReason ? `Transaction failed: ${revertReason}` : "Transaction failed during contract execution.";
723
+ }
724
+ if (errorMessage.includes("exceeds block gas limit")) {
725
+ return "Transaction exceeded gas limit. Please try again with a higher gas limit.";
726
+ }
727
+ if (errorMessage.includes("network error") || errorMessage.includes("connection error")) {
728
+ return "Network error. Please check your internet connection and try again.";
729
+ }
730
+ if (errorMessage.includes("MetaMask Tx Signature:")) {
731
+ return "MetaMask error: " + errorMessage.split("MetaMask Tx Signature:")[1].trim();
732
+ }
733
+ if (error.code) {
734
+ switch (error.code) {
735
+ case import_ethers3.ethers.errors.INVALID_ARGUMENT:
736
+ return "Invalid argument provided to the transaction.";
737
+ case import_ethers3.ethers.errors.MISSING_ARGUMENT:
738
+ return "Missing required argument for the transaction.";
739
+ case import_ethers3.ethers.errors.UNEXPECTED_ARGUMENT:
740
+ return "Unexpected argument provided to the transaction.";
741
+ case import_ethers3.ethers.errors.CALL_EXCEPTION:
742
+ return "Contract call failed. The transaction might have been reverted.";
743
+ case import_ethers3.ethers.errors.INSUFFICIENT_FUNDS:
744
+ return "Insufficient funds to complete the transaction.";
745
+ case import_ethers3.ethers.errors.NONCE_EXPIRED:
746
+ return "Transaction nonce has expired. Please try again.";
747
+ case import_ethers3.ethers.errors.REPLACEMENT_UNDERPRICED:
748
+ return "Replacement transaction underpriced. Please increase the gas price.";
749
+ case import_ethers3.ethers.errors.UNPREDICTABLE_GAS_LIMIT:
750
+ return "Unable to estimate gas limit. The transaction might fail.";
751
+ default:
752
+ return "An error occurred: " + error.message;
753
+ }
754
+ }
755
+ return "An error occurred while processing the transaction. Please try again.";
756
+ }
757
+
678
758
  // src/utils/index.ts
679
759
  var import_date_fns = require("date-fns");
680
760
  var deepMergeObjects = (obj1, obj2) => {
@@ -702,7 +782,7 @@ var getDate = (blockTimestamp) => {
702
782
  };
703
783
 
704
784
  // src/services/integrations/monitoring.ts
705
- var import_ethers6 = require("ethers");
785
+ var import_ethers7 = require("ethers");
706
786
 
707
787
  // src/components/Alert/index.tsx
708
788
  var import_jsx_runtime3 = require("react/jsx-runtime");
@@ -1191,20 +1271,122 @@ var XSwapLogo = () => {
1191
1271
  );
1192
1272
  };
1193
1273
 
1194
- // src/components/TxConfigForm/PoweredBy.tsx
1274
+ // src/components/icons/SignIcon.tsx
1195
1275
  var import_jsx_runtime26 = require("react/jsx-runtime");
1276
+ var SignIcon = () => {
1277
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
1278
+ "svg",
1279
+ {
1280
+ width: "24",
1281
+ height: "24",
1282
+ viewBox: "0 0 24 24",
1283
+ fill: "none",
1284
+ xmlns: "http://www.w3.org/2000/svg",
1285
+ children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
1286
+ "path",
1287
+ {
1288
+ 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",
1289
+ fill: "white",
1290
+ fillOpacity: "0.5"
1291
+ }
1292
+ )
1293
+ }
1294
+ );
1295
+ };
1296
+
1297
+ // src/components/icons/SuccessIcon.tsx
1298
+ var import_jsx_runtime27 = require("react/jsx-runtime");
1299
+ var SuccessIcon = () => {
1300
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
1301
+ "svg",
1302
+ {
1303
+ width: "86",
1304
+ height: "85",
1305
+ viewBox: "0 0 86 85",
1306
+ fill: "none",
1307
+ xmlns: "http://www.w3.org/2000/svg",
1308
+ children: [
1309
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
1310
+ "path",
1311
+ {
1312
+ 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",
1313
+ fill: "url(#paint0_linear_1287_1610)"
1314
+ }
1315
+ ),
1316
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
1317
+ "linearGradient",
1318
+ {
1319
+ id: "paint0_linear_1287_1610",
1320
+ x1: "7.58325",
1321
+ y1: "7.08325",
1322
+ x2: "82.2668",
1323
+ y2: "11.4066",
1324
+ gradientUnits: "userSpaceOnUse",
1325
+ children: [
1326
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("stop", { stopColor: "#4CAF50" }),
1327
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("stop", { offset: "1", stopColor: "#2E7D32" })
1328
+ ]
1329
+ }
1330
+ ) })
1331
+ ]
1332
+ }
1333
+ );
1334
+ };
1335
+
1336
+ // src/components/icons/ErrorIcon.tsx
1337
+ var import_jsx_runtime28 = require("react/jsx-runtime");
1338
+ var ErrorIcon = () => {
1339
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
1340
+ "svg",
1341
+ {
1342
+ width: "81",
1343
+ height: "80",
1344
+ viewBox: "0 0 81 80",
1345
+ fill: "none",
1346
+ xmlns: "http://www.w3.org/2000/svg",
1347
+ children: [
1348
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("g", { id: "error_FILL0_wght400_GRAD0_opsz24 1", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
1349
+ "path",
1350
+ {
1351
+ id: "Vector",
1352
+ 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",
1353
+ fill: "url(#paint0_linear_230_166)"
1354
+ }
1355
+ ) }),
1356
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
1357
+ "linearGradient",
1358
+ {
1359
+ id: "paint0_linear_230_166",
1360
+ x1: "7.16675",
1361
+ y1: "6.66675",
1362
+ x2: "77.4571",
1363
+ y2: "10.7358",
1364
+ gradientUnits: "userSpaceOnUse",
1365
+ children: [
1366
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("stop", { stopColor: "#F44336" }),
1367
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("stop", { offset: "1", stopColor: "#C62828" })
1368
+ ]
1369
+ }
1370
+ ) })
1371
+ ]
1372
+ }
1373
+ );
1374
+ };
1375
+
1376
+ // src/components/TxConfigForm/PoweredBy.tsx
1377
+ var import_jsx_runtime29 = require("react/jsx-runtime");
1196
1378
  var PoweredBy = () => {
1197
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "xpay-flex xpay-justify-center xpay-items-center xpay-gap-2 xpay-my-3", children: [
1198
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "xpay-text-x_grey", children: "Powered by" }),
1199
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(XSwapBadgeIcon, {}),
1200
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: "\u2715" }),
1201
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ChainlinkCCIPIcon, {})
1379
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "xpay-flex xpay-justify-center xpay-items-center xpay-gap-2 xpay-my-3", children: [
1380
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "xpay-text-x_grey", children: "Powered by" }),
1381
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(XSwapBadgeIcon, {}),
1382
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { children: "\u2715" }),
1383
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ChainlinkCCIPIcon, {})
1202
1384
  ] });
1203
1385
  };
1204
1386
 
1205
1387
  // src/components/TxConfigForm/Form.tsx
1206
1388
  var import_react11 = require("react");
1207
- var import_ethers4 = require("ethers");
1389
+ var import_ethers5 = require("ethers");
1208
1390
  var import_wagmi2 = require("wagmi");
1209
1391
 
1210
1392
  // src/hooks/useDebounce.tsx
@@ -1230,7 +1412,7 @@ var import_bignumber2 = __toESM(require("bignumber.js"));
1230
1412
 
1231
1413
  // src/components/TxConfigForm/HistoryCard.tsx
1232
1414
  var import_react2 = require("react");
1233
- var import_jsx_runtime27 = require("react/jsx-runtime");
1415
+ var import_jsx_runtime30 = require("react/jsx-runtime");
1234
1416
  var HistoryCard = ({ transaction, supportedChains }) => {
1235
1417
  const date = getDate(transaction.timestamp);
1236
1418
  const supportedTokens = (0, import_react2.useMemo)(() => {
@@ -1276,14 +1458,14 @@ var HistoryCard = ({ transaction, supportedChains }) => {
1276
1458
  const targetChainData = supportedChains.find(
1277
1459
  (chain) => chain.chainId === transaction.targetChainId
1278
1460
  );
1279
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("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: [
1280
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "xpay-flex xpay-w-full xpay-items-center xpay-justify-between", children: [
1281
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "xpay-text-sm sm:xpay-text-base", children: date }),
1282
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "xpay-flex xpay-items-center", children: [
1283
- transaction.status === "IN_PROGRESS" && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "xpay-flex xpay-items-center", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "xpay-text-[rgb(250,200,100)]", children: "In progress" }) }),
1284
- transaction.status === "DONE" && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "xpay-flex xpay-items-center", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "xpay-text-[rgb(100,200,100)]", children: "Done" }) }),
1285
- transaction.status === "REVERTED" && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "xpay-flex xpay-items-center", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "xpay-text-[rgb(255,100,100)]", children: "Reverted" }) }),
1286
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
1461
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("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: [
1462
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "xpay-flex xpay-w-full xpay-items-center xpay-justify-between", children: [
1463
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "xpay-text-sm sm:xpay-text-base", children: date }),
1464
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "xpay-flex xpay-items-center", children: [
1465
+ transaction.status === "IN_PROGRESS" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "xpay-flex xpay-items-center", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "xpay-text-[rgb(250,200,100)]", children: "In progress" }) }),
1466
+ transaction.status === "DONE" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "xpay-flex xpay-items-center", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "xpay-text-[rgb(100,200,100)]", children: "Done" }) }),
1467
+ transaction.status === "REVERTED" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "xpay-flex xpay-items-center", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "xpay-text-[rgb(255,100,100)]", children: "Reverted" }) }),
1468
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
1287
1469
  "a",
1288
1470
  {
1289
1471
  href: `${supportedChains.find(
@@ -1291,17 +1473,17 @@ var HistoryCard = ({ transaction, supportedChains }) => {
1291
1473
  )?.transactionExplorer}/${transaction.hash}`,
1292
1474
  target: "_blank",
1293
1475
  rel: "noreferrer",
1294
- className: "xpay-ml-2 xpay-no-underline",
1476
+ className: "xpay-ml-2 xpay-no-underline visited:xpay-text-white hover:xpay-text-white",
1295
1477
  "aria-label": "Show the transaction in the chain explorer",
1296
- children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "xpay-w-3.5 xpay-h-3.5", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ArrowUpRightIcon, {}) })
1478
+ children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "xpay-w-3.5 xpay-h-3.5", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ArrowUpRightIcon, {}) })
1297
1479
  }
1298
1480
  )
1299
1481
  ] })
1300
1482
  ] }),
1301
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "xpay-flex xpay-justify-between xpay-flex-wrap xpay-gap-2", children: [
1302
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "xpay-flex xpay-items-center", children: [
1303
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "xpay-flex xpay-items-center", children: [
1304
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
1483
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "xpay-flex xpay-justify-between xpay-flex-wrap xpay-gap-2", children: [
1484
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "xpay-flex xpay-items-center", children: [
1485
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "xpay-flex xpay-items-center", children: [
1486
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
1305
1487
  "img",
1306
1488
  {
1307
1489
  src: sourceChainData?.image,
@@ -1309,11 +1491,11 @@ var HistoryCard = ({ transaction, supportedChains }) => {
1309
1491
  className: "xpay-w-5 xpay-h-5 xpay-mr-1"
1310
1492
  }
1311
1493
  ),
1312
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { children: sourceChainData?.displayName })
1494
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { children: sourceChainData?.displayName })
1313
1495
  ] }),
1314
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "xpay-w-3.5 xpay-h-3.5 xpay-my-0 xpay-mx-1.5", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ArrowRightIcon, {}) }),
1315
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "xpay-flex xpay-items-center", children: [
1316
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
1496
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "xpay-w-3.5 xpay-h-3.5 xpay-my-0 xpay-mx-1.5", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ArrowRightIcon, {}) }),
1497
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "xpay-flex xpay-items-center", children: [
1498
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
1317
1499
  "img",
1318
1500
  {
1319
1501
  src: targetChainData?.image,
@@ -1321,35 +1503,35 @@ var HistoryCard = ({ transaction, supportedChains }) => {
1321
1503
  className: "xpay-w-5 xpay-h-5 xpay-mr-1"
1322
1504
  }
1323
1505
  ),
1324
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { children: targetChainData?.displayName })
1506
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { children: targetChainData?.displayName })
1325
1507
  ] })
1326
1508
  ] }),
1327
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "xpay-flex xpay-items-center xpay-mb-2 last:xpay-mb-0", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "xpay-flex xpay-items-center xpay-flex-wrap", children: [
1328
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "xpay-flex xpay-items-center", children: [
1509
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "xpay-flex xpay-items-center xpay-mb-2 last:xpay-mb-0", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "xpay-flex xpay-items-center xpay-flex-wrap", children: [
1510
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "xpay-flex xpay-items-center", children: [
1329
1511
  Number(transferredAmount) < MINIMUM_DISPLAYED_TOKEN_AMOUNT ? `<${MINIMUM_DISPLAYED_TOKEN_AMOUNT}` : transferredAmount,
1330
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "xpay-ml-1", children: tokenData?.symbol }),
1331
- tokenData?.image ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
1512
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "xpay-ml-1", children: tokenData?.symbol }),
1513
+ tokenData?.image ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
1332
1514
  "img",
1333
1515
  {
1334
1516
  src: tokenData?.image,
1335
1517
  alt: tokenData?.name || "",
1336
1518
  className: "xpay-w-5 xpay-h-5 xpay-ml-1"
1337
1519
  }
1338
- ) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("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) })
1520
+ ) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("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) })
1339
1521
  ] }),
1340
- transaction.tokenOutAddress && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
1341
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "xpay-w-3.5 xpay-h-3.5 xpay-my-0 xpay-mx-1.5", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ArrowRightIcon, {}) }),
1342
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "xpay-flex xpay-items-center", children: [
1522
+ transaction.tokenOutAddress && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
1523
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "xpay-w-3.5 xpay-h-3.5 xpay-my-0 xpay-mx-1.5", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ArrowRightIcon, {}) }),
1524
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "xpay-flex xpay-items-center", children: [
1343
1525
  Number(receivedAmount) < 1e-4 ? "<0.0001" : receivedAmount,
1344
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "xpay-ml-1", children: tokenOutData?.symbol }),
1345
- tokenOutData?.image ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
1526
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "xpay-ml-1", children: tokenOutData?.symbol }),
1527
+ tokenOutData?.image ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
1346
1528
  "img",
1347
1529
  {
1348
1530
  src: tokenOutData?.image,
1349
1531
  alt: tokenOutData?.name || "",
1350
1532
  className: "xpay-w-5 xpay-h-5 xpay-ml-1"
1351
1533
  }
1352
- ) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("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) })
1534
+ ) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("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) })
1353
1535
  ] })
1354
1536
  ] })
1355
1537
  ] }) })
@@ -1358,7 +1540,7 @@ var HistoryCard = ({ transaction, supportedChains }) => {
1358
1540
  };
1359
1541
 
1360
1542
  // src/components/TxConfigForm/History.tsx
1361
- var import_jsx_runtime28 = require("react/jsx-runtime");
1543
+ var import_jsx_runtime31 = require("react/jsx-runtime");
1362
1544
  var History = ({ signer, supportedChains }) => {
1363
1545
  const [fetchedHistory, setFetchedHistory] = (0, import_react3.useState)();
1364
1546
  const [historyLoadedOnce, setHistoryLoadedOnce] = (0, import_react3.useState)(false);
@@ -1430,11 +1612,11 @@ var History = ({ signer, supportedChains }) => {
1430
1612
  return () => clearInterval(timer);
1431
1613
  }, [signer, fetchHistory, getHistory, historyLoadedOnce]);
1432
1614
  if (!signer)
1433
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "xpay-flex xpay-items-center xpay-justify-center xpay-w-full xpay-h-[30vh]", children: "Connect a wallet to browse history" });
1434
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "xpay-flex xpay-items-center xpay-justify-center xpay-w-full", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "xpay-w-full xpay-h-96 xpay-overflow-scroll xpay-overflow-x-hidden", children: [
1435
- fetchedHistory?.length === 0 && historyLoadedOnce && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("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..." }),
1436
- !fetchedHistory && !historyLoadedOnce && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "xpay-flex xpay-w-full xpay-h-full xpay-items-center xpay-justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(CircularProgressIcon, {}) }),
1437
- fetchedHistory?.map((transaction, index) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
1615
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "xpay-flex xpay-items-center xpay-justify-center xpay-w-full xpay-h-[30vh]", children: "Connect a wallet to browse history" });
1616
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "xpay-flex xpay-items-center xpay-justify-center xpay-w-full", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "xpay-w-full xpay-h-96 xpay-overflow-scroll xpay-overflow-x-hidden", children: [
1617
+ fetchedHistory?.length === 0 && historyLoadedOnce && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("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..." }),
1618
+ !fetchedHistory && !historyLoadedOnce && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "xpay-flex xpay-w-full xpay-h-full xpay-items-center xpay-justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(CircularProgressIcon, {}) }),
1619
+ fetchedHistory?.map((transaction, index) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
1438
1620
  HistoryCard,
1439
1621
  {
1440
1622
  transaction,
@@ -1446,7 +1628,7 @@ var History = ({ signer, supportedChains }) => {
1446
1628
  };
1447
1629
 
1448
1630
  // src/components/TxConfigForm/TopBar.tsx
1449
- var import_jsx_runtime29 = require("react/jsx-runtime");
1631
+ var import_jsx_runtime32 = require("react/jsx-runtime");
1450
1632
  var TopBar = ({
1451
1633
  signer,
1452
1634
  setSettingsShown,
@@ -1454,33 +1636,33 @@ var TopBar = ({
1454
1636
  historyTabShown,
1455
1637
  onClose
1456
1638
  }) => {
1457
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "xpay-flex xpay-w-full xpay-justify-between xpay-items-center xpay-mx-auto xpay-p-2", children: [
1458
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("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` }),
1459
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "xpay-flex xpay-gap-2 xpay-justify-center xpay-items-center", children: [
1460
- !historyTabShown && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
1639
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "xpay-flex xpay-w-full xpay-justify-between xpay-items-center xpay-mx-auto xpay-p-2", children: [
1640
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("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` }),
1641
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "xpay-flex xpay-gap-2 xpay-justify-center xpay-items-center", children: [
1642
+ !historyTabShown && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
1461
1643
  "div",
1462
1644
  {
1463
1645
  onClick: () => setSettingsShown(true),
1464
1646
  className: "xpay-flex xpay-items-center xpay-text-xs xpay-gap-1 xpay-cursor-pointer",
1465
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("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__ */ (0, import_jsx_runtime29.jsx)(SettingsIcon, {}) })
1647
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("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__ */ (0, import_jsx_runtime32.jsx)(SettingsIcon, {}) })
1466
1648
  }
1467
1649
  ),
1468
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
1650
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
1469
1651
  "div",
1470
1652
  {
1471
1653
  onClick: () => setHistoryTabShown((x) => !x),
1472
1654
  className: "xpay-flex xpay-items-center xpay-text-sm xpay-gap-1 xpay-cursor-pointer",
1473
- children: !historyTabShown ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_jsx_runtime29.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("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__ */ (0, import_jsx_runtime29.jsx)(HistoryIcon, {}) }) }) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { children: "Back" })
1655
+ children: !historyTabShown ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_jsx_runtime32.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("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__ */ (0, import_jsx_runtime32.jsx)(HistoryIcon, {}) }) }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { children: "Back" })
1474
1656
  }
1475
1657
  ),
1476
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "xpay-cursor-pointer xpay-text-white", onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CloseIcon, {}) })
1658
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "xpay-cursor-pointer xpay-text-white", onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(CloseIcon, {}) })
1477
1659
  ] })
1478
1660
  ] });
1479
1661
  };
1480
1662
 
1481
1663
  // src/components/TxConfigForm/Settings.tsx
1482
1664
  var import_react4 = require("react");
1483
- var import_jsx_runtime30 = require("react/jsx-runtime");
1665
+ var import_jsx_runtime33 = require("react/jsx-runtime");
1484
1666
  var Settings = ({
1485
1667
  setSlippage,
1486
1668
  setSettingsShown,
@@ -1497,22 +1679,22 @@ var Settings = ({
1497
1679
  );
1498
1680
  }
1499
1681
  }, [slippageActivePresetIndex, usingSlippageInput]);
1500
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("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__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "xpay-flex xpay-flex-col xpay-gap-4 xpay-justify-between", children: [
1501
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "xpay-flex xpay-justify-between", children: [
1502
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "xpay-text-base", children: "Settings" }),
1503
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
1682
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("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__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "xpay-flex xpay-flex-col xpay-gap-4 xpay-justify-between", children: [
1683
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "xpay-flex xpay-justify-between", children: [
1684
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "xpay-text-base", children: "Settings" }),
1685
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
1504
1686
  "div",
1505
1687
  {
1506
1688
  className: "xpay-cursor-pointer",
1507
1689
  onClick: () => setSettingsShown(false),
1508
- children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(CloseIcon, {})
1690
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(CloseIcon, {})
1509
1691
  }
1510
1692
  )
1511
1693
  ] }),
1512
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { children: [
1513
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "xpay-flex xpay-gap-2 xpay-items-center", children: [
1514
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "xpay-text-sm xpay-text-[rgba(255,255,255,0.6)]", children: "Express delivery" }),
1515
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
1694
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { children: [
1695
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "xpay-flex xpay-gap-2 xpay-items-center", children: [
1696
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "xpay-text-sm xpay-text-[rgba(255,255,255,0.6)]", children: "Express delivery" }),
1697
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
1516
1698
  "span",
1517
1699
  {
1518
1700
  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",
@@ -1520,8 +1702,8 @@ var Settings = ({
1520
1702
  setExpressChecked((x) => !x);
1521
1703
  },
1522
1704
  children: [
1523
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "xpay-h-full, xpay-w-full xpay-rounded-lg xpay-bg-[rgba(255,255,255,0.3)]" }),
1524
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
1705
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "xpay-h-full, xpay-w-full xpay-rounded-lg xpay-bg-[rgba(255,255,255,0.3)]" }),
1706
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
1525
1707
  "span",
1526
1708
  {
1527
1709
  className: `xpay-transition-all xpay-w-5 xpay-h-5 xpay-rounded-full xpay-absolute xpay-translate-y-[-4px]
@@ -1532,15 +1714,15 @@ var Settings = ({
1532
1714
  }
1533
1715
  ) })
1534
1716
  ] }),
1535
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "xpay-flex xpay-gap-4", children: [
1536
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "xpay-min-w-[26px] xpay-min-h-[26px] xpay-text-[#ffa726]", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(InfoIcon, {}) }),
1537
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("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." })
1717
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "xpay-flex xpay-gap-4", children: [
1718
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "xpay-min-w-[26px] xpay-min-h-[26px] xpay-text-[#ffa726]", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(InfoIcon, {}) }),
1719
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("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." })
1538
1720
  ] })
1539
1721
  ] }),
1540
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "xpay-flex xpay-flex-col xpay-gap-2", children: [
1541
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "xpay-text-[rgba(255,255,255,0.6)] xpay-text-sm", children: "Slippage" }),
1542
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "xpay-flex xpay-gap-2", children: [
1543
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("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__ */ (0, import_jsx_runtime30.jsx)(
1722
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "xpay-flex xpay-flex-col xpay-gap-2", children: [
1723
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "xpay-text-[rgba(255,255,255,0.6)] xpay-text-sm", children: "Slippage" }),
1724
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "xpay-flex xpay-gap-2", children: [
1725
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("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__ */ (0, import_jsx_runtime33.jsx)(
1544
1726
  "div",
1545
1727
  {
1546
1728
  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]" : ""}`,
@@ -1552,8 +1734,8 @@ var Settings = ({
1552
1734
  },
1553
1735
  index
1554
1736
  )) }),
1555
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("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: [
1556
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
1737
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("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: [
1738
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
1557
1739
  "input",
1558
1740
  {
1559
1741
  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",
@@ -1572,16 +1754,16 @@ var Settings = ({
1572
1754
  }
1573
1755
  }
1574
1756
  ),
1575
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(PercentageIcon, {})
1757
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(PercentageIcon, {})
1576
1758
  ] })
1577
1759
  ] }),
1578
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "xpay-flex xpay-gap-4", children: [
1579
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "xpay-min-w-[26px] xpay-min-h-[26px] xpay-text-[#ffa726]", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(InfoIcon, {}) }),
1580
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "xpay-text-xs xpay-text-left", children: [
1760
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "xpay-flex xpay-gap-4", children: [
1761
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "xpay-min-w-[26px] xpay-min-h-[26px] xpay-text-[#ffa726]", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(InfoIcon, {}) }),
1762
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "xpay-text-xs xpay-text-left", children: [
1581
1763
  "Slippage is the price variation you are willing to accept in the event that the price of the trade changes while it is processing.",
1582
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("br", {}),
1764
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("br", {}),
1583
1765
  " ",
1584
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("br", {}),
1766
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("br", {}),
1585
1767
  "If the trade fails due to too-low slippage, you will receive USDC on the destination chain."
1586
1768
  ] })
1587
1769
  ] })
@@ -1590,28 +1772,23 @@ var Settings = ({
1590
1772
  };
1591
1773
 
1592
1774
  // src/components/TxConfigForm/FeesDetails.tsx
1593
- var import_react5 = require("react");
1594
- var import_jsx_runtime31 = require("react/jsx-runtime");
1775
+ var import_jsx_runtime34 = require("react/jsx-runtime");
1595
1776
  var FeesDetails = ({
1596
1777
  isGettingRoute,
1597
1778
  route,
1598
1779
  paymentToken,
1599
1780
  dstToken,
1600
- expressChecked,
1601
- exceedsExpressDeliveryLimit,
1602
1781
  slippage,
1603
1782
  feesDetailsShown,
1783
+ isExpressDelivery,
1604
1784
  setFeesDetailsShown
1605
1785
  }) => {
1606
- const isExpressDeliveryPossible = (0, import_react5.useMemo)(() => {
1607
- return expressChecked && !exceedsExpressDeliveryLimit;
1608
- }, [expressChecked, exceedsExpressDeliveryLimit]);
1609
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("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: [
1610
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "xpay-flex xpay-w-full xpay-items-center xpay-justify-between xpay-text-xs sm:xpay-text-sm", children: [
1611
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "xpay-flex xpay-items-center xpay-gap-1 xpay-font-medium xpay-text-white xpay-opacity-60", children: [
1612
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(CoinsIcon, {}),
1613
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "xpay-mr-1", children: "Fees:" }),
1614
- isGettingRoute ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Skeleton, { width: "xpay-w-20", height: "xpay-h-4" }) : ` ${weiToHumanReadable({
1786
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("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: [
1787
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "xpay-flex xpay-w-full xpay-items-center xpay-justify-between xpay-text-xs sm:xpay-text-sm", children: [
1788
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "xpay-flex xpay-items-center xpay-gap-1 xpay-font-medium xpay-text-white xpay-opacity-60", children: [
1789
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CoinsIcon, {}),
1790
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "xpay-mr-1", children: "Fees:" }),
1791
+ isGettingRoute ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Skeleton, { width: "xpay-w-20", height: "xpay-h-4" }) : ` ${weiToHumanReadable({
1615
1792
  amount: safeBigNumberFrom(
1616
1793
  route?.xSwapFees.xSwapFee.nativeFee || "0"
1617
1794
  ).add(safeBigNumberFrom(route?.xSwapFees.ccipFee || "0")).add(
@@ -1621,54 +1798,54 @@ var FeesDetails = ({
1621
1798
  precisionFractionalPlaces: 5
1622
1799
  })} ${paymentToken?.symbol}`
1623
1800
  ] }),
1624
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "xpay-flex xpay-gap-1 xpay-items-center", children: [
1625
- route?.xSwapFees.expressDeliveryFee && !isGettingRoute && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
1801
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "xpay-flex xpay-gap-1 xpay-items-center", children: [
1802
+ route?.xSwapFees.expressDeliveryFee && !isGettingRoute && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
1626
1803
  "div",
1627
1804
  {
1628
- className: `xpay-flex xpay-gap-1 xpay-items-center xpay-font-medium ${isExpressDeliveryPossible ? "xpay-text-x_green" : "xpay-text-white xpay-opacity-60"}`,
1805
+ className: `xpay-flex xpay-gap-1 xpay-items-center xpay-font-medium ${isExpressDelivery ? "xpay-text-x_green" : "xpay-text-white xpay-opacity-60"}`,
1629
1806
  children: [
1630
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(TimerIcon, {}),
1631
- isExpressDeliveryPossible ? "Fast ~ 30sec " : "Normal ~ 30min"
1807
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(TimerIcon, {}),
1808
+ isExpressDelivery ? "Fast ~ 30sec " : "Normal ~ 30min"
1632
1809
  ]
1633
1810
  }
1634
1811
  ),
1635
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
1812
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
1636
1813
  "div",
1637
1814
  {
1638
1815
  onClick: () => setFeesDetailsShown((x) => !x),
1639
1816
  className: "xpay-font-medium xpay-text-white xpay-opacity-60 xpay-cursor-pointer xpay-flex xpay-items-center xpay-w-[15px] xpay-h-[9px]",
1640
- children: feesDetailsShown ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ChevronUpIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ChevronDownIcon, {})
1817
+ children: feesDetailsShown ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChevronUpIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChevronDownIcon, {})
1641
1818
  }
1642
1819
  )
1643
1820
  ] })
1644
1821
  ] }),
1645
- feesDetailsShown && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "xpay-flex xpay-w-full xpay-items-center xpay-justify-between xpay-gap-2", children: [
1646
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "xpay-flex xpay-flex-col xpay-text-[10px] xpay-gap-1", children: [
1647
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "xpay-flex xpay-justify-between xpay-font-medium xpay-text-white xpay-opacity-60 xpay-gap-1", children: [
1648
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { children: "CCIP Fee:" }),
1649
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "xpay-whitespace-nowrap", children: ` ${weiToHumanReadable({
1822
+ feesDetailsShown && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "xpay-flex xpay-w-full xpay-items-center xpay-justify-between xpay-gap-2", children: [
1823
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "xpay-flex xpay-flex-col xpay-text-[10px] xpay-gap-1", children: [
1824
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "xpay-flex xpay-justify-between xpay-font-medium xpay-text-white xpay-opacity-60 xpay-gap-1", children: [
1825
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { children: "CCIP Fee:" }),
1826
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "xpay-whitespace-nowrap", children: ` ${weiToHumanReadable({
1650
1827
  amount: route?.xSwapFees.ccipFee || "0",
1651
1828
  decimals: 18,
1652
1829
  precisionFractionalPlaces: 5
1653
1830
  })} ${paymentToken?.symbol}` })
1654
1831
  ] }),
1655
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "xpay-flex xpay-justify-between xpay-font-medium xpay-text-white xpay-opacity-60 xpay-gap-1", children: [
1656
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { children: "Native Fee:" }),
1657
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "xpay-whitespace-nowrap", children: ` ${weiToHumanReadable({
1832
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "xpay-flex xpay-justify-between xpay-font-medium xpay-text-white xpay-opacity-60 xpay-gap-1", children: [
1833
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { children: "Native Fee:" }),
1834
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "xpay-whitespace-nowrap", children: ` ${weiToHumanReadable({
1658
1835
  amount: route?.xSwapFees.xSwapFee.nativeFee || "0",
1659
1836
  decimals: 18,
1660
1837
  precisionFractionalPlaces: 5
1661
1838
  })} ${paymentToken?.symbol}` })
1662
1839
  ] })
1663
1840
  ] }),
1664
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "xpay-flex xpay-flex-col xpay-text-[10px] xpay-gap-1", children: [
1665
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "xpay-flex xpay-justify-between xpay-font-medium xpay-text-white xpay-opacity-60 xpay-gap-1", children: [
1666
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { children: "Slippage:" }),
1667
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "xpay-whitespace-nowrap", children: `${slippage}%` })
1841
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "xpay-flex xpay-flex-col xpay-text-[10px] xpay-gap-1", children: [
1842
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "xpay-flex xpay-justify-between xpay-font-medium xpay-text-white xpay-opacity-60 xpay-gap-1", children: [
1843
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { children: "Slippage:" }),
1844
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "xpay-whitespace-nowrap", children: `${slippage}%` })
1668
1845
  ] }),
1669
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "xpay-flex xpay-justify-between xpay-font-medium xpay-text-white xpay-opacity-60 xpay-gap-1", children: [
1670
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { children: "Min amount out:" }),
1671
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "xpay-whitespace-nowrap", children: [
1846
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "xpay-flex xpay-justify-between xpay-font-medium xpay-text-white xpay-opacity-60 xpay-gap-1", children: [
1847
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { children: "Min amount out:" }),
1848
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "xpay-whitespace-nowrap", children: [
1672
1849
  weiToHumanReadable({
1673
1850
  amount: route?.minAmountOut || "0",
1674
1851
  decimals: dstToken?.decimals || 18,
@@ -1684,38 +1861,31 @@ var FeesDetails = ({
1684
1861
  };
1685
1862
 
1686
1863
  // src/components/TxConfigForm/Summary.tsx
1687
- var import_react7 = require("react");
1864
+ var import_react6 = require("react");
1688
1865
 
1689
1866
  // src/components/TxConfigForm/UsdPrice.tsx
1690
- var import_react6 = require("react");
1691
- var import_jsx_runtime32 = require("react/jsx-runtime");
1867
+ var import_react5 = require("react");
1868
+ var import_jsx_runtime35 = require("react/jsx-runtime");
1692
1869
  var UsdPrice = ({
1693
1870
  prices,
1694
1871
  token,
1695
1872
  amount = "0",
1696
- loading = false,
1697
- type,
1698
- setExceedsExpressDeliveryLimit
1873
+ loading = false
1699
1874
  }) => {
1700
- const [usdPrice, setUsdPrice] = (0, import_react6.useState)("0.00");
1701
- (0, import_react6.useEffect)(() => {
1875
+ const [usdPrice, setUsdPrice] = (0, import_react5.useState)("0.00");
1876
+ (0, import_react5.useEffect)(() => {
1702
1877
  if (token && prices && prices[token.address]) {
1703
- const newUsdPrice = (Number(amount) * Number(prices[token.address])).toFixed(2);
1704
- if (type === "src" && setExceedsExpressDeliveryLimit) {
1705
- setExceedsExpressDeliveryLimit(
1706
- Number(newUsdPrice) > EXPRESS_DELIVERY_LIMIT
1707
- );
1708
- }
1878
+ const newUsdPrice = (Number(amount) * Number(prices[token.address.toLowerCase()])).toFixed(2);
1709
1879
  setUsdPrice(newUsdPrice);
1710
1880
  }
1711
1881
  }, [token, prices, amount]);
1712
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "xpay-opacity-60 xpay-py-4", children: loading ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Skeleton, { width: "xpay-w-12", height: "xpay-h-4" }) : token ? prices && prices[token.address] ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { children: `$${usdPrice}` }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Alert, { desc: "Unknown price" }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_jsx_runtime32.Fragment, { children: "$0.00" }) });
1882
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "xpay-opacity-60", children: loading ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Skeleton, { width: "xpay-w-12", height: "xpay-h-4" }) : token ? prices && prices[token.address] ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { children: `$${usdPrice}` }) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Alert, { desc: "Unknown price" }) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_jsx_runtime35.Fragment, { children: "$0.00" }) });
1713
1883
  };
1714
1884
 
1715
1885
  // src/components/UnknownTokenLogo/UnknownTokenLogo.tsx
1716
- var import_jsx_runtime33 = require("react/jsx-runtime");
1886
+ var import_jsx_runtime36 = require("react/jsx-runtime");
1717
1887
  var UnknownTokenLogo = ({ tokenName, className }) => {
1718
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
1888
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
1719
1889
  "div",
1720
1890
  {
1721
1891
  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}`,
@@ -1725,87 +1895,86 @@ var UnknownTokenLogo = ({ tokenName, className }) => {
1725
1895
  };
1726
1896
 
1727
1897
  // src/components/TxConfigForm/Summary.tsx
1728
- var import_jsx_runtime34 = require("react/jsx-runtime");
1898
+ var import_jsx_runtime37 = require("react/jsx-runtime");
1729
1899
  var Summary = ({
1730
1900
  isGettingRoute,
1731
1901
  route,
1732
1902
  dstToken,
1733
1903
  dstChain
1734
1904
  }) => {
1735
- const [prices, setPrices] = (0, import_react7.useState)();
1736
- const amountReadable = (0, import_react7.useMemo)(
1905
+ const [prices, setPrices] = (0, import_react6.useState)();
1906
+ const amountReadable = (0, import_react6.useMemo)(
1737
1907
  () => weiToHumanReadable({
1738
1908
  amount: route?.estAmountOut || "0",
1739
1909
  decimals: dstToken?.decimals || 18,
1740
- precisionFractionalPlaces: 5
1910
+ precisionFractionalPlaces: 8
1741
1911
  }),
1742
1912
  [route, dstToken]
1743
1913
  );
1744
- (0, import_react7.useEffect)(() => {
1914
+ (0, import_react6.useEffect)(() => {
1745
1915
  if (dstChain) {
1746
1916
  getPrices({ chainId: dstChain.chainId, currency: "USD" }).then(
1747
1917
  (prices2) => setPrices(prices2)
1748
1918
  );
1749
1919
  }
1750
1920
  }, [dstChain]);
1751
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("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: [
1752
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "xpay-flex xpay-justify-between", children: [
1753
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "xpay-flex xpay-flex-col xpay-gap-1", children: [
1754
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { className: "xpay-text-[rgba(255,255,255,0.6)] xpay-text-sm", children: "You receive" }),
1755
- isGettingRoute ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
1921
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("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: [
1922
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "xpay-flex xpay-justify-between", children: [
1923
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "xpay-flex xpay-flex-col xpay-gap-1", children: [
1924
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "xpay-text-[rgba(255,255,255,0.6)] xpay-text-sm", children: "You receive" }),
1925
+ isGettingRoute ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
1756
1926
  Skeleton,
1757
1927
  {
1758
1928
  width: "xpay-w-[100px]",
1759
1929
  height: "xpay-h-[36px]",
1760
1930
  other: "sm:xpay-w-[190px]"
1761
1931
  }
1762
- ) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "xpay-flex xpay-gap-2 xpay-items-center xpay-text-white xpay-text-xl sm:xpay-text-3xl", children: amountReadable })
1932
+ ) : /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "xpay-flex xpay-gap-2 xpay-items-center xpay-text-white xpay-text-xl sm:xpay-text-3xl", children: amountReadable })
1763
1933
  ] }),
1764
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "xpay-flex xpay-flex-col xpay-items-end xpay-gap-1 xpay-text-sm", children: [
1765
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "xpay-flex xpay-justify-center xpay-items-center xpay-gap-1", children: [
1766
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "xpay-w-5 xpay-h-5", children: dstToken?.image ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
1934
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "xpay-flex xpay-flex-col xpay-items-end xpay-gap-1 xpay-text-sm", children: [
1935
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "xpay-flex xpay-justify-center xpay-items-center xpay-gap-1", children: [
1936
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "xpay-w-5 xpay-h-5", children: dstToken?.image ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
1767
1937
  "img",
1768
1938
  {
1769
1939
  className: "xpay-w-5 xpay-h-5",
1770
1940
  src: dstToken?.image,
1771
1941
  alt: dstToken?.name
1772
1942
  }
1773
- ) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(UnknownTokenLogo, { tokenName: "?" }) }),
1774
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { className: "xpay-text-base sm:xpay-text-xl", children: dstToken?.name })
1943
+ ) : /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(UnknownTokenLogo, { tokenName: "?" }) }),
1944
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "xpay-text-base sm:xpay-text-xl", children: dstToken?.name })
1775
1945
  ] }),
1776
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "xpay-flex xpay-justify-center xpay-items-center xpay-gap-1", children: [
1777
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("p", { className: "xpay-text-[rgba(255,255,255,0.6)] xpay-text-right", children: [
1946
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "xpay-flex xpay-justify-center xpay-items-center xpay-gap-1", children: [
1947
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("p", { className: "xpay-text-[rgba(255,255,255,0.6)] xpay-text-right", children: [
1778
1948
  "on",
1779
1949
  " "
1780
1950
  ] }),
1781
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "xpay-flex xpay-items-center xpay-gap-1 xpay-text-white", children: [
1782
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "xpay-w-4 xpay-h-4", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("img", { src: dstChain?.image, alt: dstChain?.name }) }),
1783
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { children: dstChain?.displayName })
1951
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "xpay-flex xpay-items-center xpay-gap-1 xpay-text-white", children: [
1952
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "xpay-w-4 xpay-h-4", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("img", { src: dstChain?.image, alt: dstChain?.name }) }),
1953
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { children: dstChain?.displayName })
1784
1954
  ] })
1785
1955
  ] })
1786
1956
  ] })
1787
1957
  ] }),
1788
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
1958
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "xpay-pt-2", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
1789
1959
  UsdPrice,
1790
1960
  {
1791
1961
  prices,
1792
1962
  token: dstToken,
1793
1963
  amount: amountReadable,
1794
- loading: isGettingRoute,
1795
- type: "dst"
1964
+ loading: isGettingRoute
1796
1965
  }
1797
- ),
1798
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("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__ */ (0, import_jsx_runtime34.jsx)("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__ */ (0, import_jsx_runtime34.jsx)(ArrowDownIcon, {}) }) })
1966
+ ) }),
1967
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("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__ */ (0, import_jsx_runtime37.jsx)("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__ */ (0, import_jsx_runtime37.jsx)(ArrowDownIcon, {}) }) })
1799
1968
  ] });
1800
1969
  };
1801
1970
 
1802
1971
  // src/components/TxConfigForm/SwapPanel.tsx
1803
- var import_react10 = require("react");
1972
+ var import_react9 = require("react");
1804
1973
 
1805
1974
  // src/components/TxConfigForm/TokenPicker.tsx
1806
- var import_react8 = require("react");
1975
+ var import_react7 = require("react");
1807
1976
  var import_react_dom = require("react-dom");
1808
- var import_jsx_runtime35 = require("react/jsx-runtime");
1977
+ var import_jsx_runtime38 = require("react/jsx-runtime");
1809
1978
  var TokenPicker = ({
1810
1979
  onCloseClick,
1811
1980
  tokens,
@@ -1814,7 +1983,7 @@ var TokenPicker = ({
1814
1983
  signer,
1815
1984
  balances
1816
1985
  }) => {
1817
- const [searchValue, setSearchValue] = (0, import_react8.useState)("");
1986
+ const [searchValue, setSearchValue] = (0, import_react7.useState)("");
1818
1987
  const onBackdropClick = (e) => {
1819
1988
  e.stopPropagation();
1820
1989
  e.nativeEvent.stopImmediatePropagation();
@@ -1822,7 +1991,7 @@ var TokenPicker = ({
1822
1991
  onCloseClick();
1823
1992
  }
1824
1993
  };
1825
- const filteredTokens = (0, import_react8.useMemo)(() => {
1994
+ const filteredTokens = (0, import_react7.useMemo)(() => {
1826
1995
  const isMatch = (value, searchValue2) => value.toLowerCase().indexOf(searchValue2.toLowerCase()) > -1;
1827
1996
  return tokens?.filter(
1828
1997
  (token) => isMatch(token.symbol, searchValue) || isMatch(token.name, searchValue) || token.address === searchValue.toLowerCase()
@@ -1832,24 +2001,24 @@ var TokenPicker = ({
1832
2001
  }, [searchValue, tokens]);
1833
2002
  const xpayRoot2 = document.querySelector("#xpay-root");
1834
2003
  return xpayRoot2 ? (0, import_react_dom.createPortal)(
1835
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
2004
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
1836
2005
  "div",
1837
2006
  {
1838
2007
  onClick: onBackdropClick,
1839
2008
  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",
1840
- children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("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: [
1841
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
2009
+ children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("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: [
2010
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
1842
2011
  "div",
1843
2012
  {
1844
2013
  onClick: onCloseClick,
1845
2014
  className: "xpay-absolute xpay-top-4 xpay-right-4 xpay-cursor-pointer",
1846
- children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(CloseIcon, {})
2015
+ children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(CloseIcon, {})
1847
2016
  }
1848
2017
  ),
1849
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { className: "xpay-text-base xpay-mb-4", children: "Pick a token" }),
1850
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("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: [
1851
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "xpay-w-6 xpay-h-6", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(SearchIcon, {}) }),
1852
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
2018
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "xpay-text-base xpay-mb-4", children: "Pick a token" }),
2019
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("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: [
2020
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "xpay-w-6 xpay-h-6", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(SearchIcon, {}) }),
2021
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
1853
2022
  "input",
1854
2023
  {
1855
2024
  placeholder: "Search name or paste address",
@@ -1859,7 +2028,7 @@ var TokenPicker = ({
1859
2028
  }
1860
2029
  )
1861
2030
  ] }),
1862
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("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__ */ (0, import_jsx_runtime35.jsxs)(
2031
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("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__ */ (0, import_jsx_runtime38.jsxs)(
1863
2032
  "div",
1864
2033
  {
1865
2034
  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)]" : ""}`,
@@ -1868,7 +2037,7 @@ var TokenPicker = ({
1868
2037
  onCloseClick();
1869
2038
  },
1870
2039
  children: [
1871
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
2040
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
1872
2041
  "img",
1873
2042
  {
1874
2043
  src: token.image,
@@ -1876,13 +2045,13 @@ var TokenPicker = ({
1876
2045
  className: "xpay-w-5"
1877
2046
  }
1878
2047
  ),
1879
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "xpay-text-sm", children: token.symbol })
2048
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "xpay-text-sm", children: token.symbol })
1880
2049
  ]
1881
2050
  },
1882
2051
  token.address
1883
2052
  )) }),
1884
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("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)]" }),
1885
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("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__ */ (0, import_jsx_runtime35.jsxs)(
2053
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("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)]" }),
2054
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("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__ */ (0, import_jsx_runtime38.jsxs)(
1886
2055
  "div",
1887
2056
  {
1888
2057
  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)]" : ""}`,
@@ -1891,22 +2060,22 @@ var TokenPicker = ({
1891
2060
  onCloseClick();
1892
2061
  },
1893
2062
  children: [
1894
- token.image ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("img", { src: token.image, alt: token.name }) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("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) }),
1895
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "xpay-flex xpay-justify-between xpay-items-center xpay-gap-1 xpay-overflow-hidden xpay-grow", children: [
1896
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "xpay-flex xpay-flex-col xpay-leading-[16px]", children: [
1897
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "xpay-overflow-hidden xpay-whitespace-nowrap xpay-text-ellipsis xpay-text-[15px]", children: token.name }),
1898
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "xpay-text-[#888] xpay-text-[11px]", children: token.symbol })
2063
+ token.image ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("img", { src: token.image, alt: token.name }) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("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) }),
2064
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "xpay-flex xpay-justify-between xpay-items-center xpay-gap-1 xpay-overflow-hidden xpay-grow", children: [
2065
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "xpay-flex xpay-flex-col xpay-leading-[16px]", children: [
2066
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "xpay-overflow-hidden xpay-whitespace-nowrap xpay-text-ellipsis xpay-text-[15px]", children: token.name }),
2067
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "xpay-text-[#888] xpay-text-[11px]", children: token.symbol })
1899
2068
  ] }),
1900
- signer && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_jsx_runtime35.Fragment, { children: balances && balances[token.address] && token.decimals ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "xpay-text-xs", children: weiToHumanReadable({
2069
+ signer && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_jsx_runtime38.Fragment, { children: balances && balances[token.address] && token.decimals ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "xpay-text-xs", children: weiToHumanReadable({
1901
2070
  amount: balances[token.address]?.toString() || "0",
1902
2071
  decimals: token.decimals,
1903
2072
  precisionFractionalPlaces: 4
1904
- }) }) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Skeleton, { width: "xpay-w-12", height: "xpay-h-3" }) })
2073
+ }) }) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Skeleton, { width: "xpay-w-12", height: "xpay-h-3" }) })
1905
2074
  ] })
1906
2075
  ]
1907
2076
  },
1908
2077
  `${index}_${token.address}`
1909
- )) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "xpay-mt-4 xpay-flex xpay-justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { className: "xpay-text-sm xpay-text-white", children: "No tokens found." }) }) })
2078
+ )) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "xpay-mt-4 xpay-flex xpay-justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "xpay-text-sm xpay-text-white", children: "No tokens found." }) }) })
1910
2079
  ] })
1911
2080
  }
1912
2081
  ),
@@ -1915,7 +2084,7 @@ var TokenPicker = ({
1915
2084
  };
1916
2085
 
1917
2086
  // src/components/TxConfigForm/ChainListElement.tsx
1918
- var import_jsx_runtime36 = require("react/jsx-runtime");
2087
+ var import_jsx_runtime39 = require("react/jsx-runtime");
1919
2088
  var ChainListElement = ({
1920
2089
  chain,
1921
2090
  setSrcChain,
@@ -1923,8 +2092,8 @@ var ChainListElement = ({
1923
2092
  index,
1924
2093
  length
1925
2094
  }) => {
1926
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { children: [
1927
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
2095
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { children: [
2096
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
1928
2097
  "li",
1929
2098
  {
1930
2099
  className: "xpay-bg-transparent xpay-border-none xpay-flex xpay-gap-1 xpay-items-center xpay-cursor-pointer xpay-py-2 xpay-w-full",
@@ -1933,21 +2102,21 @@ var ChainListElement = ({
1933
2102
  setChainListShown(false);
1934
2103
  },
1935
2104
  children: [
1936
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("img", { width: 12, height: 12, src: chain.image, alt: chain.displayName }),
2105
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("img", { width: 12, height: 12, src: chain.image, alt: chain.displayName }),
1937
2106
  chain.displayName
1938
2107
  ]
1939
2108
  }
1940
2109
  ),
1941
- index !== length - 1 && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "xpay-h-px xpay-mx-2 xpay-bg-[rgba(255,255,255,0.15)]" })
2110
+ index !== length - 1 && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "xpay-h-px xpay-mx-2 xpay-bg-[rgba(255,255,255,0.15)]" })
1942
2111
  ] }, `${chain.ecosystem}-${chain.chainId}`);
1943
2112
  };
1944
2113
 
1945
2114
  // src/components/TxConfigForm/BalanceComponent.tsx
1946
- var import_react9 = require("react");
2115
+ var import_react8 = require("react");
1947
2116
  var import_bignumber3 = __toESM(require("bignumber.js"));
1948
- var import_jsx_runtime37 = require("react/jsx-runtime");
2117
+ var import_jsx_runtime40 = require("react/jsx-runtime");
1949
2118
  var BalanceComponent = ({ srcToken, balances }) => {
1950
- const balanceText = (0, import_react9.useMemo)(() => {
2119
+ const balanceText = (0, import_react8.useMemo)(() => {
1951
2120
  if (!balances || !srcToken) return "0";
1952
2121
  if (balances[srcToken.address]?.toString() === "0") return "0";
1953
2122
  const fullHumanReadable = weiToHumanReadable({
@@ -1965,7 +2134,7 @@ var BalanceComponent = ({ srcToken, balances }) => {
1965
2134
  precisionFractionalPlaces: 5
1966
2135
  });
1967
2136
  }, [srcToken, balances]);
1968
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
2137
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
1969
2138
  "Balance:",
1970
2139
  " ",
1971
2140
  srcToken && balances ? weiToHumanReadable({
@@ -1973,12 +2142,12 @@ var BalanceComponent = ({ srcToken, balances }) => {
1973
2142
  decimals: srcToken.decimals,
1974
2143
  precisionFractionalPlaces: 4
1975
2144
  }) : 0,
1976
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("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" })
2145
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("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" })
1977
2146
  ] });
1978
2147
  };
1979
2148
 
1980
2149
  // src/components/TxConfigForm/SwapPanel.tsx
1981
- var import_jsx_runtime38 = require("react/jsx-runtime");
2150
+ var import_jsx_runtime41 = require("react/jsx-runtime");
1982
2151
  var SwapPanel = ({
1983
2152
  amount,
1984
2153
  setAmount,
@@ -1989,13 +2158,12 @@ var SwapPanel = ({
1989
2158
  signer,
1990
2159
  balances,
1991
2160
  prices,
1992
- supportedChains,
1993
- setExceedsExpressDeliveryLimit
2161
+ supportedChains
1994
2162
  }) => {
1995
- const [chainListShown, setChainListShown] = (0, import_react10.useState)(false);
1996
- const [tokenListShown, setTokenListShown] = (0, import_react10.useState)(false);
1997
- const listRef = (0, import_react10.useRef)(null);
1998
- const buttonRef = (0, import_react10.useRef)(null);
2163
+ const [chainListShown, setChainListShown] = (0, import_react9.useState)(false);
2164
+ const [tokenListShown, setTokenListShown] = (0, import_react9.useState)(false);
2165
+ const listRef = (0, import_react9.useRef)(null);
2166
+ const buttonRef = (0, import_react9.useRef)(null);
1999
2167
  const handleClickOutside = (event) => {
2000
2168
  if (listRef.current && buttonRef.current) {
2001
2169
  const listElement = listRef.current;
@@ -2014,21 +2182,21 @@ var SwapPanel = ({
2014
2182
  })
2015
2183
  );
2016
2184
  };
2017
- (0, import_react10.useEffect)(() => {
2185
+ (0, import_react9.useEffect)(() => {
2018
2186
  if (chainListShown) {
2019
2187
  document.addEventListener("mousedown", handleClickOutside);
2020
2188
  return () => document.removeEventListener("mousedown", handleClickOutside);
2021
2189
  }
2022
2190
  }, [chainListShown]);
2023
- const chainListOptions = (0, import_react10.useMemo)(
2191
+ const chainListOptions = (0, import_react9.useMemo)(
2024
2192
  () => supportedChains.filter((chain) => chain.chainId !== srcChain?.chainId),
2025
2193
  [supportedChains, srcChain]
2026
2194
  );
2027
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "xpay-flex xpay-justify-between xpay-global-border xpay-rounded-lg xpay-bg-[rgba(15,15,15,1)] xpay-p-4", children: [
2028
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "xpay-flex xpay-flex-col xpay-justify-between xpay-gap-2 xpay-overflow-hidden xpay-w-1/2", children: [
2029
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "xpay-flex xpay-flex-col xpay-gap-1", children: [
2030
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "xpay-text-white xpay-opacity-60 xpay-text-xs sm:xpay-text-sm xpay-font-medium", children: "You pay" }),
2031
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
2195
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "xpay-flex xpay-justify-between xpay-global-border xpay-rounded-lg xpay-bg-[rgba(15,15,15,1)] xpay-p-4", children: [
2196
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "xpay-flex xpay-flex-col xpay-justify-between xpay-gap-2 xpay-overflow-hidden xpay-w-1/2", children: [
2197
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "xpay-flex xpay-flex-col xpay-gap-1", children: [
2198
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("p", { className: "xpay-text-white xpay-opacity-60 xpay-text-xs sm:xpay-text-sm xpay-font-medium", children: "You pay" }),
2199
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
2032
2200
  "input",
2033
2201
  {
2034
2202
  className: "xpay-p-0 xpay-border-none xpay-outline-none xpay-bg-transparent xpay-text-2xl xpay-overflow-ellipsis",
@@ -2047,20 +2215,18 @@ var SwapPanel = ({
2047
2215
  }
2048
2216
  )
2049
2217
  ] }),
2050
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "xpay-flex xpay-items-center xpay-text-sm xpay-text-[rgba(255,255,255,0.6)]", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
2218
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "xpay-flex xpay-items-center xpay-text-sm xpay-text-[rgba(255,255,255,0.6)]", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
2051
2219
  UsdPrice,
2052
2220
  {
2053
2221
  prices,
2054
2222
  token: srcToken,
2055
2223
  amount,
2056
- loading: false,
2057
- type: "src",
2058
- setExceedsExpressDeliveryLimit
2224
+ loading: false
2059
2225
  }
2060
2226
  ) })
2061
2227
  ] }),
2062
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "xpay-flex xpay-flex-col xpay-relative xpay-items-end xpay-gap-2.5 xpay-w-1/2 xpay-text-xs", children: [
2063
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
2228
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "xpay-flex xpay-flex-col xpay-relative xpay-items-end xpay-gap-2.5 xpay-w-1/2 xpay-text-xs", children: [
2229
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
2064
2230
  "div",
2065
2231
  {
2066
2232
  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",
@@ -2068,7 +2234,7 @@ var SwapPanel = ({
2068
2234
  setTokenListShown((state) => !state);
2069
2235
  },
2070
2236
  children: [
2071
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
2237
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
2072
2238
  "img",
2073
2239
  {
2074
2240
  height: 16,
@@ -2077,12 +2243,12 @@ var SwapPanel = ({
2077
2243
  alt: srcToken?.name
2078
2244
  }
2079
2245
  ),
2080
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { children: srcToken?.symbol }),
2081
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(DownArrowIcon, {})
2246
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { children: srcToken?.symbol }),
2247
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(DownArrowIcon, {})
2082
2248
  ]
2083
2249
  }
2084
2250
  ),
2085
- tokenListShown && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
2251
+ tokenListShown && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
2086
2252
  TokenPicker,
2087
2253
  {
2088
2254
  onCloseClick: () => setTokenListShown(false),
@@ -2093,22 +2259,22 @@ var SwapPanel = ({
2093
2259
  balances
2094
2260
  }
2095
2261
  ),
2096
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
2262
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
2097
2263
  "div",
2098
2264
  {
2099
2265
  onClick: handleMaxClick,
2100
2266
  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",
2101
- children: signer && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(BalanceComponent, { balances, srcToken })
2267
+ children: signer && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(BalanceComponent, { balances, srcToken })
2102
2268
  }
2103
2269
  ),
2104
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
2270
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
2105
2271
  "div",
2106
2272
  {
2107
2273
  ref: buttonRef,
2108
2274
  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",
2109
2275
  onClick: () => setChainListShown((prev) => !prev),
2110
2276
  children: [
2111
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
2277
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
2112
2278
  "img",
2113
2279
  {
2114
2280
  width: "16",
@@ -2117,17 +2283,17 @@ var SwapPanel = ({
2117
2283
  alt: srcChain?.name
2118
2284
  }
2119
2285
  ),
2120
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { children: srcChain?.displayName }),
2121
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(DownArrowIcon, {})
2286
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { children: srcChain?.displayName }),
2287
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(DownArrowIcon, {})
2122
2288
  ]
2123
2289
  }
2124
2290
  ),
2125
- chainListShown && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
2291
+ chainListShown && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
2126
2292
  "ul",
2127
2293
  {
2128
2294
  ref: listRef,
2129
2295
  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",
2130
- children: chainListOptions.map((chain, index) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
2296
+ children: chainListOptions.map((chain, index) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
2131
2297
  ChainListElement,
2132
2298
  {
2133
2299
  index,
@@ -2135,7 +2301,8 @@ var SwapPanel = ({
2135
2301
  setSrcChain,
2136
2302
  setChainListShown,
2137
2303
  chain
2138
- }
2304
+ },
2305
+ chain.chainId
2139
2306
  ))
2140
2307
  }
2141
2308
  )
@@ -2144,9 +2311,9 @@ var SwapPanel = ({
2144
2311
  };
2145
2312
 
2146
2313
  // src/components/TxConfigForm/ErrorField.tsx
2147
- var import_jsx_runtime39 = require("react/jsx-runtime");
2314
+ var import_jsx_runtime42 = require("react/jsx-runtime");
2148
2315
  var ErrorField = ({ error }) => {
2149
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
2316
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
2150
2317
  "div",
2151
2318
  {
2152
2319
  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"}`,
@@ -2156,15 +2323,15 @@ var ErrorField = ({ error }) => {
2156
2323
  };
2157
2324
 
2158
2325
  // src/components/TxConfigForm/Description.tsx
2159
- var import_jsx_runtime40 = require("react/jsx-runtime");
2326
+ var import_jsx_runtime43 = require("react/jsx-runtime");
2160
2327
  var Description = ({ description }) => {
2161
- return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "xpay-flex xpay-flex-col xpay-items-start xpay-rounded-lg xpay-px-4 xpay-py-2", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "xpay-w-full xpay-flex xpay-gap-4 xpay-items-start xpay-justify-between xpay-text-xl", children: description }) });
2328
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("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__ */ (0, import_jsx_runtime43.jsx)("div", { className: "xpay-flex xpay-w-full xpay-items-center xpay-justify-between xpay-text-xs sm:xpay-text-sm", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "xpay-flex xpay-items-center xpay-gap-1 xpay-font-medium xpay-text-white xpay-opacity-60", children: description }) }) });
2162
2329
  };
2163
2330
 
2164
2331
  // src/components/TxConfigForm/Button.tsx
2165
- var import_jsx_runtime41 = require("react/jsx-runtime");
2332
+ var import_jsx_runtime44 = require("react/jsx-runtime");
2166
2333
  var Button = ({ children, onClick, type, disabled }) => {
2167
- return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
2334
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
2168
2335
  "button",
2169
2336
  {
2170
2337
  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",
@@ -2177,7 +2344,111 @@ var Button = ({ children, onClick, type, disabled }) => {
2177
2344
  };
2178
2345
 
2179
2346
  // src/components/TxConfigForm/Form.tsx
2180
- var import_jsx_runtime42 = require("react/jsx-runtime");
2347
+ var import_actions = require("wagmi/actions");
2348
+
2349
+ // src/components/TxConfigForm/ConfirmationAmount.tsx
2350
+ var import_react10 = require("react");
2351
+ var import_jsx_runtime45 = require("react/jsx-runtime");
2352
+ var ConfirmationAmount = ({
2353
+ amount,
2354
+ token,
2355
+ chain,
2356
+ type
2357
+ }) => {
2358
+ const [prices, setPrices] = (0, import_react10.useState)();
2359
+ const amountReadable = (0, import_react10.useMemo)(() => {
2360
+ return weiToHumanReadable({
2361
+ amount: amount || "0",
2362
+ decimals: token?.decimals || 18,
2363
+ precisionFractionalPlaces: 8
2364
+ });
2365
+ }, [amount, token]);
2366
+ (0, import_react10.useEffect)(() => {
2367
+ if (chain) {
2368
+ getPrices({ chainId: chain.chainId, currency: "USD" }).then(
2369
+ (prices2) => setPrices(prices2)
2370
+ );
2371
+ }
2372
+ }, [chain]);
2373
+ return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("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__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "xpay-flex xpay-justify-between", children: [
2374
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "xpay-flex xpay-flex-col xpay-gap-1", children: [
2375
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("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" }),
2376
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
2377
+ "div",
2378
+ {
2379
+ 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"}`,
2380
+ children: amountReadable
2381
+ }
2382
+ ),
2383
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
2384
+ UsdPrice,
2385
+ {
2386
+ prices,
2387
+ token,
2388
+ amount: amountReadable,
2389
+ loading: false
2390
+ }
2391
+ )
2392
+ ] }),
2393
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "xpay-flex xpay-gap-2 xpay-text-sm xpay-justify-center xpay-items-center", children: [
2394
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "xpay-flex xpay-flex-col xpay-justify-center xpay-items-end xpay-gap-1", children: [
2395
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { className: "xpay-text-base sm:xpay-text-xl", children: token?.name }),
2396
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "xpay-flex xpay-justify-center xpay-items-center xpay-gap-1", children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { className: "xpay-text-[rgba(255,255,255,0.6)] xpay-text-xs xpay-text-right", children: chain?.displayName }) })
2397
+ ] }),
2398
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "xpay-w-10 xpay-h-10", children: token?.image ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
2399
+ "img",
2400
+ {
2401
+ className: "xpay-w-10 xpay-h-10",
2402
+ src: token?.image,
2403
+ alt: token?.name
2404
+ }
2405
+ ) : /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
2406
+ UnknownTokenLogo,
2407
+ {
2408
+ tokenName: "?",
2409
+ className: "xpay-w-10 xpay-h-10"
2410
+ }
2411
+ ) })
2412
+ ] })
2413
+ ] }) });
2414
+ };
2415
+
2416
+ // src/components/Spinner/index.tsx
2417
+ var import_jsx_runtime46 = require("react/jsx-runtime");
2418
+ var Spinner = ({ width, height }) => {
2419
+ return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { role: "status", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
2420
+ "svg",
2421
+ {
2422
+ "aria-hidden": "true",
2423
+ 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)]`,
2424
+ viewBox: "0 0 100 101",
2425
+ fill: "none",
2426
+ xmlns: "http://www.w3.org/2000/svg",
2427
+ children: [
2428
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
2429
+ "path",
2430
+ {
2431
+ 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",
2432
+ fill: "currentColor"
2433
+ }
2434
+ ),
2435
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
2436
+ "path",
2437
+ {
2438
+ 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",
2439
+ fill: "currentFill"
2440
+ }
2441
+ )
2442
+ ]
2443
+ }
2444
+ ) });
2445
+ };
2446
+
2447
+ // src/components/TxConfigForm/Form.tsx
2448
+ var import_jsx_runtime47 = (
2449
+ // Connect wallet modal
2450
+ require("react/jsx-runtime")
2451
+ );
2181
2452
  var Form = ({
2182
2453
  integratorId,
2183
2454
  dstChainId,
@@ -2185,12 +2456,17 @@ var Form = ({
2185
2456
  customContractCalls,
2186
2457
  desc,
2187
2458
  supportedChains,
2459
+ retrunTransactions,
2460
+ dstDisplayTokenAddr,
2461
+ wagmiConfig,
2188
2462
  onSubmit,
2189
- onClose
2463
+ onClose,
2464
+ setBackdropClickDisabled
2190
2465
  }) => {
2191
2466
  const [signer, setSigner] = (0, import_react11.useState)();
2192
2467
  const [dstChain, setDstChain] = (0, import_react11.useState)();
2193
2468
  const [dstToken, setDstToken] = (0, import_react11.useState)();
2469
+ const [dstDisplayToken, setDstDisplayToken] = (0, import_react11.useState)();
2194
2470
  const [srcChain, setSrcChain] = (0, import_react11.useState)();
2195
2471
  const [srcToken, setSrcToken] = (0, import_react11.useState)();
2196
2472
  const [amount, setAmount] = (0, import_react11.useState)("");
@@ -2205,7 +2481,22 @@ var Form = ({
2205
2481
  const [formError, setFormError] = (0, import_react11.useState)("");
2206
2482
  const [slippage, setSlippage] = (0, import_react11.useState)("1.5");
2207
2483
  const [feesDetailsShown, setFeesDetailsShown] = (0, import_react11.useState)(false);
2208
- const [exceedsExpressDeliveryLimit, setExceedsExpressDeliveryLimit] = (0, import_react11.useState)(false);
2484
+ const [executingTransactions, setExecutingTransactions] = (0, import_react11.useState)(false);
2485
+ const [transactionSuccessHash, setTransactionSuccessHash] = (0, import_react11.useState)();
2486
+ const [txLoading, setTxLoading] = (0, import_react11.useState)(false);
2487
+ const [approveTxLoading, setApproveTxLoading] = (0, import_react11.useState)(false);
2488
+ const [approveTxDone, setApproveTxDone] = (0, import_react11.useState)(false);
2489
+ const [transactionError, setTransactionError] = (0, import_react11.useState)(null);
2490
+ const currentRouteRequestNonce = (0, import_react11.useRef)(0);
2491
+ const prevAllowanceValuesRef = (0, import_react11.useRef)({
2492
+ srcChainId: srcChain?.chainId,
2493
+ srcTokenAddress: srcToken?.address,
2494
+ routeTo: import_ethers5.ethers.constants.AddressZero
2495
+ });
2496
+ const currentAllowanceRequestNonce = (0, import_react11.useRef)(0);
2497
+ const [isAllowanceLoading, setIsAllowanceLoading] = (0, import_react11.useState)(false);
2498
+ const [srcTokenAllowance, setSrcTokenAllowance] = (0, import_react11.useState)("0");
2499
+ const { sendTransaction } = (0, import_wagmi2.useSendTransaction)({ config: wagmiConfig });
2209
2500
  const debouncedAmount = useDebounce(amount, 1e3);
2210
2501
  const account = (0, import_wagmi2.useAccount)();
2211
2502
  const { switchChainAsync } = (0, import_wagmi2.useSwitchChain)();
@@ -2240,43 +2531,61 @@ var Form = ({
2240
2531
  );
2241
2532
  }
2242
2533
  setDstToken(dstTokenResult);
2534
+ if (dstDisplayTokenAddr) {
2535
+ let dstDisplayTokenResult = dstChain?.tokens.find(
2536
+ (token) => token.address.toLowerCase() === dstDisplayTokenAddr.toLowerCase()
2537
+ );
2538
+ if (!dstDisplayTokenResult) {
2539
+ dstDisplayTokenResult = await getCustomTokenData(
2540
+ dstChain,
2541
+ dstDisplayTokenAddr.toLowerCase()
2542
+ );
2543
+ }
2544
+ setDstDisplayToken(dstDisplayTokenResult);
2545
+ }
2243
2546
  })();
2244
2547
  }, [dstChain]);
2245
2548
  (0, import_react11.useEffect)(() => {
2246
- if (integratorId && srcChain && srcToken && dstChain && debouncedAmount && paymentToken && slippage) {
2247
- setFormError("");
2248
- const timeout = setTimeout(() => {
2249
- setFormError("Getting Route is taking longer than usually");
2250
- }, ROUTE_TIMEOUT_MS);
2251
- setIsGettingRoute(true);
2252
- setFeesDetailsShown(false);
2253
- if (!srcToken.decimals)
2254
- throw new Error(
2255
- `Configuration error: selected token ($${srcToken.symbol} ${srcToken.name}) has unknown decimals param.`
2256
- );
2257
- getRoute({
2258
- integratorId,
2259
- fromAmount: import_ethers4.ethers.utils.parseUnits(debouncedAmount, srcToken.decimals).toString(),
2260
- fromAddress: signer || ADDRESSES[srcChain.chainId].FeeCollector,
2261
- fromChain: srcChain.chainId,
2262
- fromToken: srcToken.address,
2263
- toAddress: signer || ADDRESSES[dstChain.chainId].FeeCollector,
2264
- toChain: dstChainId,
2265
- toToken: dstTokenAddr,
2266
- paymentToken: paymentToken.address,
2267
- slippage: Number(slippage),
2268
- expressDelivery: expressChecked && !exceedsExpressDeliveryLimit,
2269
- customContractCalls
2270
- }).then((response) => {
2271
- setRoute(response);
2272
- setFormError("");
2273
- }).catch((err) => {
2274
- setFormError(err.message);
2275
- }).finally(() => {
2276
- setIsGettingRoute(false);
2277
- clearTimeout(timeout);
2278
- });
2549
+ if (!(integratorId && srcChain && srcToken && dstChain && debouncedAmount && paymentToken && signer && slippage)) {
2550
+ return;
2279
2551
  }
2552
+ setFormError("");
2553
+ const timeout = setTimeout(() => {
2554
+ setFormError("Getting Route is taking longer than usually");
2555
+ }, ROUTE_TIMEOUT_MS);
2556
+ setIsGettingRoute(true);
2557
+ setFeesDetailsShown(false);
2558
+ if (!srcToken.decimals)
2559
+ throw new Error(
2560
+ `Configuration error: selected token ($${srcToken.symbol} ${srcToken.name}) has unknown decimals param.`
2561
+ );
2562
+ const nonce = Date.now();
2563
+ currentRouteRequestNonce.current = nonce;
2564
+ getRoute({
2565
+ integratorId,
2566
+ fromAmount: import_ethers5.ethers.utils.parseUnits(debouncedAmount, srcToken.decimals).toString(),
2567
+ fromAddress: signer || ADDRESSES[srcChain.chainId].FeeCollector,
2568
+ fromChain: srcChain.chainId,
2569
+ fromToken: srcToken.address,
2570
+ toAddress: signer || ADDRESSES[dstChain.chainId].FeeCollector,
2571
+ toChain: dstChainId,
2572
+ toToken: dstTokenAddr,
2573
+ paymentToken: paymentToken.address,
2574
+ slippage: Number(slippage),
2575
+ expressDelivery: expressChecked,
2576
+ customContractCalls
2577
+ }).then((response) => {
2578
+ if (nonce !== currentRouteRequestNonce.current) {
2579
+ return;
2580
+ }
2581
+ setRoute(response);
2582
+ setFormError("");
2583
+ }).catch((err) => {
2584
+ setFormError(err.message);
2585
+ }).finally(() => {
2586
+ setIsGettingRoute(false);
2587
+ clearTimeout(timeout);
2588
+ });
2280
2589
  }, [
2281
2590
  signer,
2282
2591
  srcChain,
@@ -2286,11 +2595,48 @@ var Form = ({
2286
2595
  slippage,
2287
2596
  expressChecked
2288
2597
  ]);
2598
+ (0, import_react11.useEffect)(() => {
2599
+ (async () => {
2600
+ if (!signer || !srcToken?.address || !srcChain?.publicRpcUrls[0] || srcToken?.address === import_ethers5.ethers.constants.AddressZero) {
2601
+ return;
2602
+ }
2603
+ if (route && route.transactions.swap?.to) {
2604
+ const {
2605
+ srcChainId: prevFromChainId,
2606
+ srcTokenAddress: prevFromTokenAddress,
2607
+ routeTo: prevRouteTo
2608
+ } = prevAllowanceValuesRef.current;
2609
+ const hasChanges = srcChain?.chainId !== prevFromChainId || srcToken?.address !== prevFromTokenAddress || route.transactions.swap?.to !== prevRouteTo;
2610
+ if (!hasChanges) {
2611
+ return;
2612
+ }
2613
+ prevAllowanceValuesRef.current = {
2614
+ srcChainId: srcChain?.chainId,
2615
+ srcTokenAddress: srcToken?.address,
2616
+ routeTo: route.transactions.swap?.to
2617
+ };
2618
+ const nonce = Date.now();
2619
+ currentAllowanceRequestNonce.current = nonce;
2620
+ setIsAllowanceLoading(true);
2621
+ const allowanceResponse = await getAllowanceOf(
2622
+ srcToken?.address,
2623
+ signer,
2624
+ route.transactions.swap.to,
2625
+ srcChain?.publicRpcUrls[0]
2626
+ );
2627
+ if (nonce !== currentAllowanceRequestNonce.current) {
2628
+ return;
2629
+ }
2630
+ setSrcTokenAllowance(allowanceResponse);
2631
+ setIsAllowanceLoading(false);
2632
+ }
2633
+ })();
2634
+ }, [srcChain, srcToken?.address, signer, setSrcTokenAllowance, route]);
2289
2635
  (0, import_react11.useEffect)(() => {
2290
2636
  if (srcChain) {
2291
2637
  setPaymentToken(
2292
2638
  srcChain.tokens.find(
2293
- (token) => token.address.toLowerCase() === import_ethers4.ethers.constants.AddressZero.toLowerCase()
2639
+ (token) => token.address.toLowerCase() === import_ethers5.ethers.constants.AddressZero.toLowerCase()
2294
2640
  )
2295
2641
  );
2296
2642
  }
@@ -2298,9 +2644,18 @@ var Form = ({
2298
2644
  (0, import_react11.useEffect)(() => {
2299
2645
  setAmount("");
2300
2646
  setFormError("");
2647
+ setIsGettingRoute(false);
2648
+ setRoute(void 0);
2649
+ const nonce = Date.now();
2650
+ currentRouteRequestNonce.current = nonce;
2301
2651
  }, [srcToken]);
2302
2652
  (0, import_react11.useEffect)(() => {
2303
2653
  setSrcToken(srcChain?.tokens[0]);
2654
+ setAmount("");
2655
+ setIsGettingRoute(false);
2656
+ setRoute(void 0);
2657
+ const nonce = Date.now();
2658
+ currentRouteRequestNonce.current = nonce;
2304
2659
  }, [srcChain]);
2305
2660
  (0, import_react11.useEffect)(() => {
2306
2661
  if (srcChain) {
@@ -2314,97 +2669,469 @@ var Form = ({
2314
2669
  getBalances(srcChain, signer).then((balances2) => setBalances(balances2));
2315
2670
  }
2316
2671
  }, [srcChain, signer]);
2672
+ (0, import_react11.useEffect)(() => {
2673
+ setBackdropClickDisabled(executingTransactions);
2674
+ }, [executingTransactions]);
2675
+ const isAllowanceOk = (0, import_react11.useMemo)(() => {
2676
+ return srcToken?.address === import_ethers5.ethers.constants.AddressZero || Number(srcTokenAllowance) >= Number(amount);
2677
+ }, [srcToken, amount, srcTokenAllowance]);
2678
+ const triggerTx = (0, import_react11.useCallback)(async () => {
2679
+ if (!route) {
2680
+ return;
2681
+ }
2682
+ setExecutingTransactions(true);
2683
+ setBackdropClickDisabled(true);
2684
+ setTransactionError(null);
2685
+ if (route.transactions.approve && !isAllowanceOk) {
2686
+ setApproveTxDone(false);
2687
+ const { to, data } = route.transactions.approve;
2688
+ await sendTransaction(
2689
+ {
2690
+ to,
2691
+ data
2692
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2693
+ },
2694
+ {
2695
+ onSuccess: async (hash) => {
2696
+ setApproveTxLoading(true);
2697
+ const chainId = (0, import_actions.getChainId)(wagmiConfig);
2698
+ await (0, import_actions.waitForTransactionReceipt)(wagmiConfig, {
2699
+ chainId,
2700
+ hash
2701
+ });
2702
+ setApproveTxLoading(false);
2703
+ setApproveTxDone(true);
2704
+ swap(route);
2705
+ },
2706
+ onError: (error) => {
2707
+ setTransactionError(`Approval failed: ${error.message}`);
2708
+ setApproveTxLoading(false);
2709
+ setBackdropClickDisabled(false);
2710
+ }
2711
+ }
2712
+ );
2713
+ } else {
2714
+ await swap(route);
2715
+ }
2716
+ }, [
2717
+ route,
2718
+ signer,
2719
+ srcChain,
2720
+ srcToken,
2721
+ debouncedAmount,
2722
+ paymentToken,
2723
+ slippage,
2724
+ expressChecked,
2725
+ amount,
2726
+ srcTokenAllowance
2727
+ ]);
2728
+ const swap = (0, import_react11.useCallback)(
2729
+ async (route2) => {
2730
+ const { to, value, data } = route2.transactions.swap;
2731
+ await sendTransaction(
2732
+ {
2733
+ to,
2734
+ value: BigInt(value),
2735
+ data
2736
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2737
+ },
2738
+ {
2739
+ onSuccess: async (hash) => {
2740
+ setTxLoading(true);
2741
+ const chainId = (0, import_actions.getChainId)(wagmiConfig);
2742
+ await (0, import_actions.waitForTransactionReceipt)(wagmiConfig, {
2743
+ chainId,
2744
+ hash
2745
+ });
2746
+ setTxLoading(false);
2747
+ if (srcChain?.chainId !== dstChain?.chainId) {
2748
+ renderTxStatus(chainId.toString(), hash);
2749
+ }
2750
+ setTransactionSuccessHash(hash);
2751
+ },
2752
+ onError: (error) => {
2753
+ setBackdropClickDisabled(false);
2754
+ setTransactionError(`Transaction failed: ${error.message}`);
2755
+ }
2756
+ }
2757
+ );
2758
+ },
2759
+ [
2760
+ route,
2761
+ signer,
2762
+ srcChain,
2763
+ srcToken,
2764
+ debouncedAmount,
2765
+ paymentToken,
2766
+ slippage,
2767
+ expressChecked
2768
+ ]
2769
+ );
2317
2770
  const handleSubmit = (event) => {
2318
2771
  event.preventDefault();
2319
- if (route) onSubmit(route);
2772
+ if (!route) {
2773
+ return;
2774
+ }
2775
+ if (retrunTransactions) {
2776
+ onSubmit(route);
2777
+ return;
2778
+ }
2779
+ triggerTx();
2320
2780
  };
2321
2781
  const handleSwitchChain = async () => {
2322
2782
  await switchChainAsync({ chainId: Number(srcChain?.chainId) });
2323
2783
  };
2324
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
2325
- "form",
2326
- {
2327
- 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",
2328
- onSubmit: handleSubmit,
2329
- children: [
2330
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
2331
- TopBar,
2784
+ const swapButton = (0, import_react11.useMemo)(() => {
2785
+ let disabled = false;
2786
+ if (transactionError) {
2787
+ return {
2788
+ text: transactionError,
2789
+ fn: () => {
2790
+ },
2791
+ disabled: true
2792
+ };
2793
+ }
2794
+ if (!signer) {
2795
+ return {
2796
+ text: "Connect wallet",
2797
+ fn: () => {
2798
+ },
2799
+ disabled
2800
+ };
2801
+ }
2802
+ if (signer && srcChain && srcChain.chainId !== account.chainId?.toString()) {
2803
+ return {
2804
+ text: "Switch chain",
2805
+ fn: handleSwitchChain,
2806
+ disabled
2807
+ };
2808
+ }
2809
+ if (!amount) {
2810
+ return {
2811
+ text: `Enter token amount`,
2812
+ fn: () => {
2813
+ },
2814
+ disabled: true
2815
+ };
2816
+ }
2817
+ if (amount && balances && srcToken && srcToken.decimals && balances[srcToken?.address] !== void 0 && !import_ethers5.ethers.utils.parseUnits(amount, srcToken.decimals).lt(balances[srcToken?.address] || "0")) {
2818
+ return {
2819
+ text: "Insufficient balance",
2820
+ fn: () => {
2821
+ },
2822
+ disabled: true
2823
+ };
2824
+ }
2825
+ if (!route) {
2826
+ return {
2827
+ text: `Loading route`,
2828
+ fn: () => {
2829
+ },
2830
+ disabled: true
2831
+ };
2832
+ }
2833
+ if (isAllowanceLoading) {
2834
+ return {
2835
+ text: `Checking allowance`,
2836
+ fn: () => {
2837
+ },
2838
+ disabled: true
2839
+ };
2840
+ }
2841
+ return {
2842
+ text: "Submit",
2843
+ fn: () => {
2844
+ },
2845
+ disabled
2846
+ };
2847
+ }, [
2848
+ account,
2849
+ srcToken,
2850
+ srcChain,
2851
+ isAllowanceOk,
2852
+ amount,
2853
+ balances,
2854
+ signer,
2855
+ transactionError,
2856
+ route,
2857
+ isAllowanceLoading
2858
+ ]);
2859
+ const isExpressDelivery = (0, import_react11.useMemo)(() => {
2860
+ let expressDeliveryFee;
2861
+ if (!route?.xSwapFees || !route?.xSwapFees.expressDeliveryFee) {
2862
+ expressDeliveryFee = safeBigNumberFrom("0");
2863
+ } else {
2864
+ expressDeliveryFee = safeBigNumberFrom(
2865
+ route?.xSwapFees.expressDeliveryFee
2866
+ );
2867
+ }
2868
+ if (expressDeliveryFee.gt("0")) {
2869
+ return true;
2870
+ }
2871
+ return false;
2872
+ }, [route]);
2873
+ return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_jsx_runtime47.Fragment, { children: !signer ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("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: [
2874
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "xpay-flex xpay-w-full xpay-justify-end xpay-items-center xpay-mx-auto xpay-p-2", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
2875
+ "div",
2876
+ {
2877
+ className: "xpay-cursor-pointer xpay-text-white",
2878
+ onClick: onClose,
2879
+ children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(CloseIcon, {})
2880
+ }
2881
+ ) }),
2882
+ " ",
2883
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "xpay-text-xl xpay-font-bold xpay-leading-8 xpay-text-center xpay-text-white", children: "Please connect the wallet first." })
2884
+ ] }) : executingTransactions ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("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 ? (
2885
+ // Tx Error modal
2886
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { children: [
2887
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "xpay-flex xpay-w-full xpay-justify-end xpay-items-center xpay-mx-auto xpay-p-2", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
2888
+ "div",
2889
+ {
2890
+ className: "xpay-cursor-pointer xpay-text-white",
2891
+ onClick: onClose,
2892
+ children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(CloseIcon, {})
2893
+ }
2894
+ ) }),
2895
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("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: [
2896
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(ErrorIcon, {}) }),
2897
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "xpay-flex xpay-flex-col", children: [
2898
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "xpay-text-2xl xpay-font-bold xpay-leading-8 xpay-text-center xpay-text-white", children: "Transaction error!" }) }),
2899
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "xpay-text-sm xpay-text-center xpay-text-white xpay-opacity-50", children: parseWeb3Error(transactionError) }) })
2900
+ ] })
2901
+ ] })
2902
+ ] })
2903
+ ) : transactionSuccessHash ? (
2904
+ // Tx Success modal
2905
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { children: [
2906
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "xpay-flex xpay-w-full xpay-justify-end xpay-items-center xpay-mx-auto xpay-p-2", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
2907
+ "div",
2908
+ {
2909
+ className: "xpay-cursor-pointer xpay-text-white",
2910
+ onClick: onClose,
2911
+ children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(CloseIcon, {})
2912
+ }
2913
+ ) }),
2914
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("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: [
2915
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(SuccessIcon, {}) }),
2916
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "xpay-flex xpay-flex-col", children: [
2917
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "xpay-text-2xl xpay-font-bold xpay-leading-8 xpay-text-center xpay-text-white", children: "Transaction success!" }) }),
2918
+ srcChain?.chainId !== dstChain?.chainId ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("p", { className: "xpay-text-sm xpay-text-center xpay-text-white xpay-opacity-50", children: [
2919
+ "Approximated time of delivery:",
2920
+ " ",
2921
+ isExpressDelivery ? "30 seconds" : "30 minutes"
2922
+ ] }) }) : /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_jsx_runtime47.Fragment, {})
2923
+ ] }),
2924
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "xpay-flex xpay-gap-4 xpay-items-center", children: [
2925
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "xpay-flex xpay-gap-2", children: [
2926
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "xpay-w-10 xpay-h-10", children: srcToken?.image ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
2927
+ "img",
2928
+ {
2929
+ className: "xpay-w-10 xpay-h-10",
2930
+ src: srcToken?.image,
2931
+ alt: srcToken?.name
2932
+ }
2933
+ ) : /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
2934
+ UnknownTokenLogo,
2935
+ {
2936
+ tokenName: "?",
2937
+ className: "xpay-w-10 xpay-h-10"
2938
+ }
2939
+ ) }),
2940
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "xpay-flex xpay-flex-col xpay-items-start", children: [
2941
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "xpay-flex", children: `${debouncedAmount} ${srcToken?.symbol}` }),
2942
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "xpay-text-sm xpay-text-center xpay-text-white xpay-opacity-50", children: srcChain?.displayName })
2943
+ ] })
2944
+ ] }),
2945
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "xpay-w-3.5 xpay-h-3.5", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(ArrowRightIcon, {}) }),
2946
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "xpay-flex xpay-gap-2", children: [
2947
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "xpay-w-10 xpay-h-10", children: (dstDisplayToken ? dstDisplayToken : dstToken)?.image ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
2948
+ "img",
2949
+ {
2950
+ className: "xpay-w-10 xpay-h-10",
2951
+ src: (dstDisplayToken ? dstDisplayToken : dstToken)?.image,
2952
+ alt: (dstDisplayToken ? dstDisplayToken : dstToken)?.name
2953
+ }
2954
+ ) : /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
2955
+ UnknownTokenLogo,
2956
+ {
2957
+ tokenName: "?",
2958
+ className: "xpay-w-10 xpay-h-10"
2959
+ }
2960
+ ) }),
2961
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "xpay-flex xpay-flex-col xpay-items-start", children: [
2962
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "xpay-flex", children: [
2963
+ weiToHumanReadable({
2964
+ amount: route?.estAmountOut || "0",
2965
+ decimals: (dstDisplayToken ? dstDisplayToken : dstToken)?.decimals || 18,
2966
+ precisionFractionalPlaces: 4
2967
+ }),
2968
+ " ",
2969
+ (dstDisplayToken ? dstDisplayToken : dstToken)?.symbol
2970
+ ] }),
2971
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "xpay-text-sm xpay-text-center xpay-text-white xpay-opacity-50", children: dstChain?.displayName })
2972
+ ] })
2973
+ ] })
2974
+ ] }),
2975
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
2976
+ "a",
2332
2977
  {
2333
- signer,
2334
- historyTabShown,
2335
- setHistoryTabShown,
2336
- setSettingsShown,
2337
- onClose
2978
+ href: srcChain?.chainId !== dstChain?.chainId ? `${CCIP_EXPLORER}/tx/${transactionSuccessHash}` : `${supportedChains.find(
2979
+ (chain) => chain.chainId === srcChain?.chainId
2980
+ )?.transactionExplorer}/${transactionSuccessHash}`,
2981
+ target: "_blank",
2982
+ rel: "noreferrer",
2983
+ className: "xpay-flex xpay-items-center xpay-gap-2 xpay-font-bold xpay-no-underline xpay-cursor-pointer xpay-text-center",
2984
+ "aria-label": "Show the transaction in the chain explorer",
2985
+ children: [
2986
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("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" }),
2987
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "xpay-w-3.5 xpay-h-3.5 xpay-bg-gradient-to-r xpay-text-x_blue_dark", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(ArrowUpRightIcon, {}) })
2988
+ ]
2338
2989
  }
2339
- ),
2340
- settingsShown && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
2341
- Settings,
2990
+ ) })
2991
+ ] })
2992
+ ] })
2993
+ ) : (
2994
+ // Tx Confirmation modal
2995
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
2996
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "xpay-flex xpay-w-full xpay-justify-between xpay-items-center xpay-mx-auto xpay-p-2 xpay-font-light ", children: [
2997
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "xpay-text-white xpay-text-xl", children: "Confirmation" }),
2998
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "xpay-flex xpay-w-full xpay-justify-end xpay-items-center xpay-mx-auto xpay-p-2", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
2999
+ "div",
2342
3000
  {
2343
- expressChecked,
2344
- setExpressChecked,
2345
- setSettingsShown,
2346
- slippage,
2347
- setSlippage
3001
+ className: "xpay-cursor-pointer xpay-text-white",
3002
+ onClick: onClose,
3003
+ children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(CloseIcon, {})
2348
3004
  }
2349
- ),
2350
- historyTabShown ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(History, { signer, supportedChains }) : /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "xpay-flex xpay-flex-col xpay-gap-2", children: [
2351
- desc && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Description, { description: desc }),
2352
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
2353
- SwapPanel,
3005
+ ) })
3006
+ ] }),
3007
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "xpay-flex xpay-flex-col xpay-gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
3008
+ ConfirmationAmount,
3009
+ {
3010
+ amount: import_ethers5.ethers.utils.parseUnits(debouncedAmount, srcToken?.decimals).toString(),
3011
+ chain: srcChain,
3012
+ token: srcToken,
3013
+ type: "src"
3014
+ }
3015
+ ) }),
3016
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "xpay-flex xpay-justify-center xpay-globalBorder xpay-rounded-xl xpay-p-[5px] xpay--mt-7 xpay--mb-6 ", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("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__ */ (0, import_jsx_runtime47.jsx)(ArrowDownIcon, {}) }) }),
3017
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "xpay-flex xpay-flex-col xpay-gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
3018
+ ConfirmationAmount,
3019
+ {
3020
+ amount: route?.estAmountOut || "0",
3021
+ chain: dstChain,
3022
+ token: dstDisplayToken ? dstDisplayToken : dstToken,
3023
+ type: "dst"
3024
+ }
3025
+ ) }),
3026
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("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: [
3027
+ route?.transactions.approve && !isAllowanceOk && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
3028
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "xpay-flex xpay-justify-between xpay-items-center", children: [
3029
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "xpay-flex xpay-items-center xpay-gap-2", children: [
3030
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(SignIcon, {}),
3031
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "xpay-opacity-50", children: approveTxLoading ? "Wait for approval confirmation" : "Approve token spending" })
3032
+ ] }),
3033
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "xpay-flex xpay-items-center", children: [
3034
+ approveTxLoading && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Spinner, { width: "5", height: "5" }),
3035
+ approveTxDone && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "xpay-text-x_green xpay-w-5 xpay-h-5", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(CheckIcon, {}) })
3036
+ ] })
3037
+ ] }),
3038
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "xpay-w-px xpay-h-6 xpay-mt-1 xpay-mb-1 xpay-ml-2.5 xpay-bg-white xpay-opacity-50" })
3039
+ ] }),
3040
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "xpay-flex xpay-justify-between xpay-items-center", children: [
3041
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "xpay-flex xpay-items-center xpay-gap-2", children: [
3042
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(SignIcon, {}),
3043
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "xpay-opacity-50", children: txLoading ? "Wait for transaction confirmation" : "Confirm transaction" })
3044
+ ] }),
3045
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "xpay-flex xpay-items-center", children: txLoading && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Spinner, { width: "5", height: "5" }) })
3046
+ ] })
3047
+ ] })
3048
+ ] })
3049
+ ) }) : (
3050
+ // XPay form
3051
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
3052
+ "form",
3053
+ {
3054
+ 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",
3055
+ onSubmit: handleSubmit,
3056
+ children: [
3057
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
3058
+ TopBar,
2354
3059
  {
2355
- amount,
2356
- setAmount,
2357
- srcToken,
2358
- setSrcToken,
2359
- srcChain,
2360
3060
  signer,
2361
- balances,
2362
- prices,
2363
- supportedChains,
2364
- setSrcChain,
2365
- setExceedsExpressDeliveryLimit
3061
+ historyTabShown,
3062
+ setHistoryTabShown,
3063
+ setSettingsShown,
3064
+ onClose
2366
3065
  }
2367
3066
  ),
2368
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
2369
- Summary,
3067
+ settingsShown && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
3068
+ Settings,
2370
3069
  {
2371
- isGettingRoute,
2372
- route,
2373
- dstToken,
2374
- dstChain
2375
- }
2376
- ),
2377
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
2378
- FeesDetails,
2379
- {
2380
- route,
2381
- isGettingRoute,
2382
- paymentToken,
2383
- dstToken,
2384
3070
  expressChecked,
2385
- exceedsExpressDeliveryLimit,
3071
+ setExpressChecked,
3072
+ setSettingsShown,
2386
3073
  slippage,
2387
- feesDetailsShown,
2388
- setFeesDetailsShown
3074
+ setSlippage
2389
3075
  }
2390
3076
  ),
2391
- formError.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ErrorField, { error: formError }),
2392
- signer && srcChain && srcChain.chainId !== account.chainId?.toString() ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Button, { type: "button", onClick: handleSwitchChain, children: "Switch chain" }) : /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
2393
- Button,
2394
- {
2395
- type: "submit",
2396
- disabled: !signer || !route || isGettingRoute,
2397
- children: "Submit"
2398
- }
2399
- )
2400
- ] })
2401
- ]
2402
- }
2403
- );
3077
+ historyTabShown ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(History, { signer, supportedChains }) : /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "xpay-flex xpay-flex-col xpay-gap-2", children: [
3078
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
3079
+ SwapPanel,
3080
+ {
3081
+ amount,
3082
+ setAmount,
3083
+ srcToken,
3084
+ setSrcToken,
3085
+ srcChain,
3086
+ signer,
3087
+ balances,
3088
+ prices,
3089
+ supportedChains,
3090
+ setSrcChain
3091
+ }
3092
+ ),
3093
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
3094
+ Summary,
3095
+ {
3096
+ isGettingRoute,
3097
+ route,
3098
+ dstToken: dstDisplayToken ? dstDisplayToken : dstToken,
3099
+ dstChain
3100
+ }
3101
+ ),
3102
+ desc && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Description, { description: desc }),
3103
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
3104
+ FeesDetails,
3105
+ {
3106
+ route,
3107
+ isGettingRoute,
3108
+ paymentToken,
3109
+ dstToken,
3110
+ slippage,
3111
+ feesDetailsShown,
3112
+ setFeesDetailsShown,
3113
+ isExpressDelivery
3114
+ }
3115
+ ),
3116
+ formError.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(ErrorField, { error: formError }),
3117
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
3118
+ Button,
3119
+ {
3120
+ type: "submit",
3121
+ disabled: swapButton.disabled,
3122
+ onClick: swapButton.fn,
3123
+ children: swapButton.text
3124
+ }
3125
+ )
3126
+ ] })
3127
+ ]
3128
+ }
3129
+ )
3130
+ ) });
2404
3131
  };
2405
3132
 
2406
3133
  // src/components/TxConfigForm/index.tsx
2407
- var import_jsx_runtime43 = require("react/jsx-runtime");
3134
+ var import_jsx_runtime48 = require("react/jsx-runtime");
2408
3135
  var TxConfigForm = ({
2409
3136
  integratorId,
2410
3137
  dstChainId,
@@ -2412,13 +3139,16 @@ var TxConfigForm = ({
2412
3139
  customContractCalls,
2413
3140
  desc,
2414
3141
  supportedChains,
3142
+ retrunTransactions,
3143
+ dstDisplayTokenAddr,
2415
3144
  onSubmit,
2416
3145
  onClose
2417
3146
  }) => {
3147
+ const [backdropClickDisabled, setBackdropClickDisabled] = (0, import_react12.useState)(false);
2418
3148
  const onBackdropClick = (e) => {
2419
3149
  e.stopPropagation();
2420
3150
  e.nativeEvent.stopImmediatePropagation();
2421
- if (e.target === e.currentTarget) {
3151
+ if (e.target === e.currentTarget && !backdropClickDisabled) {
2422
3152
  onClose();
2423
3153
  }
2424
3154
  };
@@ -2427,13 +3157,13 @@ var TxConfigForm = ({
2427
3157
  () => getWagmiConfig(supportedChains),
2428
3158
  supportedChains
2429
3159
  );
2430
- return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_wagmi3.WagmiProvider, { config: wagmiConfig, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_react_query.QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
3160
+ return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_wagmi3.WagmiProvider, { config: wagmiConfig, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react_query.QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
2431
3161
  "div",
2432
3162
  {
2433
3163
  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",
2434
- onClick: onBackdropClick,
2435
- children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("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: [
2436
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
3164
+ onMouseDown: onBackdropClick,
3165
+ children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("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: [
3166
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
2437
3167
  Form,
2438
3168
  {
2439
3169
  integratorId,
@@ -2442,11 +3172,15 @@ var TxConfigForm = ({
2442
3172
  customContractCalls,
2443
3173
  desc,
2444
3174
  supportedChains,
3175
+ wagmiConfig,
3176
+ retrunTransactions: !!retrunTransactions,
3177
+ dstDisplayTokenAddr,
2445
3178
  onSubmit,
2446
- onClose
3179
+ onClose,
3180
+ setBackdropClickDisabled: (disabled) => setBackdropClickDisabled(disabled)
2447
3181
  }
2448
3182
  ),
2449
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(PoweredBy, {})
3183
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(PoweredBy, {})
2450
3184
  ] })
2451
3185
  }
2452
3186
  ) }) });
@@ -2457,13 +3191,21 @@ var openTxConfigForm = async ({
2457
3191
  dstTokenAddr,
2458
3192
  customContractCalls,
2459
3193
  desc,
2460
- supportedChains
3194
+ supportedChains,
3195
+ retrunTransactions,
3196
+ dstDisplayTokenAddr
2461
3197
  }) => {
2462
3198
  try {
3199
+ if (xpayRoot === null) {
3200
+ throw new Error("XPay was incorrectly initialised");
3201
+ }
2463
3202
  return await new Promise(async (resolve) => {
2464
3203
  await waitForInitialization();
3204
+ if (xpayRoot === null) {
3205
+ throw new Error("XPay was incorrectly initialised");
3206
+ }
2465
3207
  xpayRoot.render(
2466
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
3208
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
2467
3209
  TxConfigForm,
2468
3210
  {
2469
3211
  integratorId,
@@ -2472,12 +3214,20 @@ var openTxConfigForm = async ({
2472
3214
  customContractCalls,
2473
3215
  desc,
2474
3216
  supportedChains,
3217
+ retrunTransactions,
3218
+ dstDisplayTokenAddr,
2475
3219
  onSubmit: (route) => {
2476
- resolve(route);
2477
- xpayRoot.render("");
3220
+ if (retrunTransactions) {
3221
+ resolve(route);
3222
+ }
3223
+ if (xpayRoot) {
3224
+ xpayRoot.render("");
3225
+ }
2478
3226
  },
2479
3227
  onClose: () => {
2480
- xpayRoot.render("");
3228
+ if (xpayRoot) {
3229
+ xpayRoot.render("");
3230
+ }
2481
3231
  }
2482
3232
  }
2483
3233
  )
@@ -2490,7 +3240,7 @@ var openTxConfigForm = async ({
2490
3240
 
2491
3241
  // src/components/TxStatusButton/index.tsx
2492
3242
  var import_react13 = require("react");
2493
- var import_jsx_runtime44 = require("react/jsx-runtime");
3243
+ var import_jsx_runtime49 = require("react/jsx-runtime");
2494
3244
  var TxStatusButton = ({ transaction }) => {
2495
3245
  const {
2496
3246
  srcChain: fromChain,
@@ -2512,20 +3262,20 @@ var TxStatusButton = ({ transaction }) => {
2512
3262
  () => isDone ? "xpay-border xpay-border-solid xpay-border-x_green_dark" : "xpay-border xpay-border-solid xpay-border-x_blue_dark",
2513
3263
  [isDone]
2514
3264
  );
2515
- return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
3265
+ return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
2516
3266
  "div",
2517
3267
  {
2518
3268
  className: "xpay-flex xpay-gap-2",
2519
3269
  onClick: () => setIsWide((x) => !x),
2520
3270
  children: [
2521
- isWide && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
3271
+ isWide && /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
2522
3272
  "div",
2523
3273
  {
2524
3274
  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}`,
2525
3275
  children: [
2526
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("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: [
2527
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "xpay-flex xpay-items-center xpay-gap-2", children: [
2528
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
3276
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("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: [
3277
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "xpay-flex xpay-items-center xpay-gap-2", children: [
3278
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
2529
3279
  "img",
2530
3280
  {
2531
3281
  className: "xpay-w-5 xpay-h-5",
@@ -2533,9 +3283,9 @@ var TxStatusButton = ({ transaction }) => {
2533
3283
  alt: "source chain"
2534
3284
  }
2535
3285
  ),
2536
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { children: fromChain }),
2537
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "xpay-w-3.5 xpay-h-3.5", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ArrowRightIcon, {}) }),
2538
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
3286
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { children: fromChain }),
3287
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "xpay-w-3.5 xpay-h-3.5", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ArrowRightIcon, {}) }),
3288
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
2539
3289
  "img",
2540
3290
  {
2541
3291
  className: "xpay-w-5 xpay-h-5",
@@ -2543,23 +3293,23 @@ var TxStatusButton = ({ transaction }) => {
2543
3293
  alt: "to chain"
2544
3294
  }
2545
3295
  ),
2546
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { children: toChain })
3296
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { children: toChain })
2547
3297
  ] }),
2548
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "xpay-flex xpay-items-center xpay-gap-2", children: [
2549
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { children: "Sent" }),
2550
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { children: fromAmount }),
2551
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { children: fromToken }),
2552
- fromTokenImage ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
3298
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "xpay-flex xpay-items-center xpay-gap-2", children: [
3299
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { children: "Sent" }),
3300
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { children: fromAmount }),
3301
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { children: fromToken }),
3302
+ fromTokenImage ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
2553
3303
  "img",
2554
3304
  {
2555
3305
  className: "xpay-w-5 xpay-h-5",
2556
3306
  src: fromTokenImage,
2557
3307
  alt: "source token"
2558
3308
  }
2559
- ) : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(UnknownTokenLogo, { tokenName: "?" })
3309
+ ) : /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(UnknownTokenLogo, { tokenName: "?" })
2560
3310
  ] })
2561
3311
  ] }),
2562
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
3312
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
2563
3313
  "a",
2564
3314
  {
2565
3315
  href: explorer,
@@ -2567,21 +3317,21 @@ var TxStatusButton = ({ transaction }) => {
2567
3317
  rel: "noreferrer",
2568
3318
  className: "xpay-no-underline xpay-cursor-pointer",
2569
3319
  "aria-label": "Show the transaction in the chain explorer",
2570
- children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "xpay-w-3.5 xpay-h-3.5", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ArrowUpRightIcon, {}) })
3320
+ children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "xpay-w-3.5 xpay-h-3.5", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ArrowUpRightIcon, {}) })
2571
3321
  }
2572
3322
  )
2573
3323
  ]
2574
3324
  }
2575
3325
  ),
2576
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
3326
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
2577
3327
  "div",
2578
3328
  {
2579
3329
  className: `xpay-text-white xpay-rounded-xl xpay-cursor-pointer ${background} ${border}`,
2580
- children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "xpay-flex xpay-gap-2 xpay-items-center xpay-h-14 xpay-w-20 xpay-justify-center", children: [
2581
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ArrowLeftIcon, {}),
2582
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "xpay-relative xpay-flex xpay-items-center xpay-justify-center xpay-w-9 xpay-h-9", children: isDone ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "xpay-text-x_green xpay-w-5 xpay-h-5", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(CheckIcon, {}) }) : /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
2583
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "xpay-w-5 xpay-h-5", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(XSwapLogo, {}) }),
2584
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("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__ */ (0, import_jsx_runtime44.jsx)(CircularProgressIcon, {}) })
3330
+ children: /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "xpay-flex xpay-gap-2 xpay-items-center xpay-h-14 xpay-w-20 xpay-justify-center", children: [
3331
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ArrowLeftIcon, {}),
3332
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "xpay-relative xpay-flex xpay-items-center xpay-justify-center xpay-w-9 xpay-h-9", children: isDone ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "xpay-text-x_green xpay-w-5 xpay-h-5", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(CheckIcon, {}) }) : /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_jsx_runtime49.Fragment, { children: [
3333
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "xpay-w-5 xpay-h-5", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(XSwapLogo, {}) }),
3334
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("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__ */ (0, import_jsx_runtime49.jsx)(Spinner, { width: "10", height: "10" }) })
2585
3335
  ] }) })
2586
3336
  ] })
2587
3337
  }
@@ -2610,17 +3360,22 @@ var updateTransactionDoneInRenderedTransactions = (txHash) => {
2610
3360
  }
2611
3361
  };
2612
3362
  var renderTxStatusButtons = () => {
2613
- const buttons = renderedTransactions.map((item) => /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(TxStatusButton, { transaction: item }, item.txHash));
2614
- xpayTxStatusRoot.render(buttons);
3363
+ const buttons = renderedTransactions.map((item) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(TxStatusButton, { transaction: item }, item.txHash));
3364
+ if (xpayTxStatusRoot === null) {
3365
+ throw new Error("XPay was incorrectly initialised");
3366
+ }
3367
+ xpayTxStatusRoot.render(
3368
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("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 })
3369
+ );
2615
3370
  };
2616
3371
 
2617
3372
  // src/components/Skeleton/index.tsx
2618
- var import_jsx_runtime45 = require("react/jsx-runtime");
3373
+ var import_jsx_runtime50 = require("react/jsx-runtime");
2619
3374
  var Skeleton = ({ width, height }) => {
2620
- return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
3375
+ return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
2621
3376
  "div",
2622
3377
  {
2623
- className: `xpay-bg-current xpay-rounded xpay-animate-pulse ${width} ${height}`
3378
+ className: `xpay-bg-gray-700 xpay-rounded xpay-animate-pulse ${width} ${height}`
2624
3379
  }
2625
3380
  );
2626
3381
  };
@@ -2629,13 +3384,13 @@ var Skeleton = ({ width, height }) => {
2629
3384
  var import_async_retry = __toESM(require("async-retry"));
2630
3385
 
2631
3386
  // src/services/blockchain.ts
2632
- var import_ethers5 = require("ethers");
3387
+ var import_ethers6 = require("ethers");
2633
3388
  var getCustomTokenData = async (chain, tokenAddress) => {
2634
3389
  const rpcUrl = chain.publicRpcUrls[0];
2635
- const customTokenContract = new import_ethers5.ethers.Contract(
3390
+ const customTokenContract = new import_ethers6.ethers.Contract(
2636
3391
  tokenAddress.toLowerCase(),
2637
3392
  ERC20Abi,
2638
- import_ethers5.ethers.getDefaultProvider(rpcUrl)
3393
+ import_ethers6.ethers.getDefaultProvider(rpcUrl)
2639
3394
  );
2640
3395
  try {
2641
3396
  const query = async (contract, method, args = []) => {
@@ -2674,7 +3429,7 @@ var renderTxStatus = async (txChainId, txHash) => {
2674
3429
  ({ web3Environment, swapSupported }) => web3Environment === "mainnet" /* MAINNET */ && swapSupported
2675
3430
  );
2676
3431
  const messageSentEvent = txReceipt.logs?.find((log) => {
2677
- return log.topics[0] === import_ethers6.ethers.utils.id(MSG_SENT_EVENT_SIG);
3432
+ return log.topics[0] === import_ethers7.ethers.utils.id(MSG_SENT_EVENT_SIG);
2678
3433
  });
2679
3434
  if (!messageSentEvent) {
2680
3435
  throw new Error(
@@ -2682,7 +3437,7 @@ var renderTxStatus = async (txChainId, txHash) => {
2682
3437
  );
2683
3438
  }
2684
3439
  const messageId = messageSentEvent?.topics[1];
2685
- const iface = new import_ethers6.ethers.utils.Interface(MSG_SENT_EVENT_ABI);
3440
+ const iface = new import_ethers7.ethers.utils.Interface(MSG_SENT_EVENT_ABI);
2686
3441
  const decodedMessageSentEvent = iface.parseLog(messageSentEvent);
2687
3442
  if (!decodedMessageSentEvent) {
2688
3443
  throw new Error(
@@ -2732,16 +3487,16 @@ var renderTxStatus = async (txChainId, txHash) => {
2732
3487
  if (!xSwapRouterOnDestinationAddress) {
2733
3488
  throw new Error(`Unknown destination XSwapRouter!`);
2734
3489
  }
2735
- const xSwapRouterOnDestination = new import_ethers6.ethers.Contract(
3490
+ const xSwapRouterOnDestination = new import_ethers7.ethers.Contract(
2736
3491
  xSwapRouterOnDestinationAddress,
2737
3492
  MSG_RECEIVED_EVENT_ABI,
2738
- import_ethers6.ethers.getDefaultProvider(
3493
+ import_ethers7.ethers.getDefaultProvider(
2739
3494
  supportedChains.find((chain) => chain.chainId === dstChainId)?.publicRpcUrls[0]
2740
3495
  )
2741
3496
  );
2742
3497
  const msgReceivedEventFilter = {
2743
3498
  address: xSwapRouterOnDestinationAddress,
2744
- topics: [import_ethers6.ethers.utils.id(MSG_RECEIVED_EVENT_SIG), messageId]
3499
+ topics: [import_ethers7.ethers.utils.id(MSG_RECEIVED_EVENT_SIG), messageId]
2745
3500
  };
2746
3501
  const onSuccess = async () => {
2747
3502
  updateTransactionDoneInRenderedTransactions(txHash);
@@ -2757,6 +3512,14 @@ var renderTxStatus = async (txChainId, txHash) => {
2757
3512
  onSuccess();
2758
3513
  }
2759
3514
  });
3515
+ setTimeout(
3516
+ () => getTxStatus({ transferId: messageId }).then((response) => {
3517
+ if (response.status === "DONE") {
3518
+ onSuccess();
3519
+ }
3520
+ }),
3521
+ 30 * 60 * 1e3
3522
+ );
2760
3523
  xSwapRouterOnDestination.once(msgReceivedEventFilter, () => onSuccess());
2761
3524
  };
2762
3525
  var getTxReceipt = async (txChainId, txHash) => {
@@ -2764,7 +3527,7 @@ var getTxReceipt = async (txChainId, txHash) => {
2764
3527
  const chain = (await getChains()).find(
2765
3528
  (chain2) => chain2.chainId === txChainId
2766
3529
  );
2767
- const provider = new import_ethers6.ethers.providers.JsonRpcProvider(
3530
+ const provider = new import_ethers7.ethers.providers.JsonRpcProvider(
2768
3531
  chain?.publicRpcUrls[0]
2769
3532
  );
2770
3533
  return await (0, import_async_retry.default)(async () => {
@@ -2787,7 +3550,9 @@ var openTransactionModal = async ({
2787
3550
  dstChain,
2788
3551
  dstToken,
2789
3552
  customContractCalls = [],
2790
- desc
3553
+ desc,
3554
+ retrunTransactions,
3555
+ dstDisplayToken
2791
3556
  }) => {
2792
3557
  const supportedChains = (await getChains()).filter(
2793
3558
  ({ web3Environment, swapSupported }) => web3Environment === "mainnet" /* MAINNET */ && swapSupported
@@ -2799,9 +3564,13 @@ var openTransactionModal = async ({
2799
3564
  dstTokenAddr: dstToken,
2800
3565
  customContractCalls,
2801
3566
  desc,
2802
- supportedChains
3567
+ supportedChains,
3568
+ retrunTransactions,
3569
+ dstDisplayTokenAddr: dstDisplayToken
2803
3570
  });
2804
- return route.transactions;
3571
+ if (retrunTransactions) {
3572
+ return route.transactions;
3573
+ }
2805
3574
  };
2806
3575
  var validateSwapTxData = (supportedChains, dstChain, dstToken) => {
2807
3576
  const supportedDstChain = supportedChains.find(
@@ -2812,7 +3581,7 @@ var validateSwapTxData = (supportedChains, dstChain, dstToken) => {
2812
3581
  }
2813
3582
  if (!isETHAddressValid(dstToken)) {
2814
3583
  throw new Error(
2815
- `Provided token address ${dstToken} on chain ${dstChain} is not correct`
3584
+ `Provided token address ${dstToken} on chain ${dstChain} is invalid`
2816
3585
  );
2817
3586
  }
2818
3587
  };