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