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