@xswap-link/sdk 0.3.3 → 0.3.5

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.
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.3.3";
62
+ var version = "0.3.5";
63
63
 
64
64
  // src/components/WaitingForInit/index.tsx
65
65
  var import_jsx_runtime = require("react/jsx-runtime");
@@ -181,10 +181,11 @@ async function _sendRequest(urlPath, options) {
181
181
  }
182
182
  return response.json();
183
183
  }
184
- async function getRoute(payload) {
184
+ async function getRoute(payload, abortSignal) {
185
185
  return _sendRequest("/route", {
186
186
  method: "POST",
187
- body: JSON.stringify(payload)
187
+ body: JSON.stringify(payload),
188
+ signal: abortSignal
188
189
  });
189
190
  }
190
191
  async function getChains(ecosystem) {
@@ -593,6 +594,7 @@ var MINIMUM_DISPLAYED_TOKEN_AMOUNT = 1e-4;
593
594
  var DEFAULT_SOURCE_CHAIN_ID = "1";
594
595
  var CCIP_EXPLORER = "https://ccip.chain.link/";
595
596
  var TX_RECEIPT_STATUS_LIFETIME = 6e4;
597
+ var DEFAULT_REQUEST_ABORT_MSG = "Request deprecated";
596
598
  var MSG_SENT_EVENT_SIG = "MessageSent(bytes32,uint64,address,bytes,address,uint256,uint256,address,uint256)";
597
599
  var MSG_SENT_EVENT_ABI = [
598
600
  "event MessageSent(bytes32 indexed messageId, uint64 indexed destinationChainSelector, address indexed sender, bytes data, address token, uint256 tokenAmount, uint256 valueForInstantCcipRecieve, address transferedToken, uint256 transferedTokenAmount)"
@@ -604,17 +606,6 @@ var MSG_RECEIVED_EVENT_ABI = [
604
606
 
605
607
  // src/utils/contracts.ts
606
608
  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
- };
618
609
  var getBalances = async (chain, wallet) => {
619
610
  return {
620
611
  ...await getNativeBalance(chain, wallet),
@@ -782,7 +773,7 @@ var getDate = (blockTimestamp) => {
782
773
  };
783
774
 
784
775
  // src/services/integrations/monitoring.ts
785
- var import_ethers7 = require("ethers");
776
+ var import_ethers8 = require("ethers");
786
777
 
787
778
  // src/components/Alert/index.tsx
788
779
  var import_jsx_runtime3 = require("react/jsx-runtime");
@@ -1389,36 +1380,19 @@ var PoweredBy = () => {
1389
1380
 
1390
1381
  // src/components/TxConfigForm/Form.tsx
1391
1382
  var import_react11 = require("react");
1392
- var import_ethers5 = require("ethers");
1383
+ var import_ethers6 = require("ethers");
1393
1384
  var import_wagmi2 = require("wagmi");
1394
1385
 
1395
- // src/hooks/useDebounce.tsx
1396
- var import_react = require("react");
1397
- var useDebounce = (value, delay) => {
1398
- const timeoutRef = (0, import_react.useRef)(null);
1399
- (0, import_react.useEffect)(() => {
1400
- if (timeoutRef.current) clearTimeout(timeoutRef.current);
1401
- timeoutRef.current = setTimeout(() => {
1402
- setValue(value);
1403
- }, delay);
1404
- return () => {
1405
- if (timeoutRef.current) clearTimeout(timeoutRef.current);
1406
- };
1407
- }, [value, delay]);
1408
- const [debouncedValue, setValue] = (0, import_react.useState)(value);
1409
- return debouncedValue;
1410
- };
1411
-
1412
1386
  // src/components/TxConfigForm/History.tsx
1413
- var import_react3 = require("react");
1387
+ var import_react2 = require("react");
1414
1388
  var import_bignumber2 = __toESM(require("bignumber.js"));
1415
1389
 
1416
1390
  // src/components/TxConfigForm/HistoryCard.tsx
1417
- var import_react2 = require("react");
1391
+ var import_react = require("react");
1418
1392
  var import_jsx_runtime30 = require("react/jsx-runtime");
1419
1393
  var HistoryCard = ({ transaction, supportedChains }) => {
1420
1394
  const date = getDate(transaction.timestamp);
1421
- const supportedTokens = (0, import_react2.useMemo)(() => {
1395
+ const supportedTokens = (0, import_react.useMemo)(() => {
1422
1396
  const customTokens = JSON.parse(
1423
1397
  localStorage.getItem("custom-tokens") || "{}"
1424
1398
  );
@@ -1431,7 +1405,7 @@ var HistoryCard = ({ transaction, supportedChains }) => {
1431
1405
  });
1432
1406
  return deepMergeObjects(chainIdToTokenAddressToData, customTokens);
1433
1407
  }, [supportedChains]);
1434
- const findTokenDataByAddressAndChain = (0, import_react2.useCallback)(
1408
+ const findTokenDataByAddressAndChain = (0, import_react.useCallback)(
1435
1409
  (tokenAddress, chainId) => {
1436
1410
  return supportedTokens[chainId]?.[tokenAddress];
1437
1411
  },
@@ -1545,9 +1519,9 @@ var HistoryCard = ({ transaction, supportedChains }) => {
1545
1519
  // src/components/TxConfigForm/History.tsx
1546
1520
  var import_jsx_runtime31 = require("react/jsx-runtime");
1547
1521
  var History = ({ signer, supportedChains }) => {
1548
- const [fetchedHistory, setFetchedHistory] = (0, import_react3.useState)();
1549
- const [historyLoadedOnce, setHistoryLoadedOnce] = (0, import_react3.useState)(false);
1550
- const fetchHistory = (0, import_react3.useCallback)(async () => {
1522
+ const [fetchedHistory, setFetchedHistory] = (0, import_react2.useState)();
1523
+ const [historyLoadedOnce, setHistoryLoadedOnce] = (0, import_react2.useState)(false);
1524
+ const fetchHistory = (0, import_react2.useCallback)(async () => {
1551
1525
  if (signer) {
1552
1526
  const downloadedHistory = await getHistory({ walletAddress: signer });
1553
1527
  const fetchedTransactions = [];
@@ -1607,7 +1581,7 @@ var History = ({ signer, supportedChains }) => {
1607
1581
  }
1608
1582
  }
1609
1583
  }, [signer, getHistory]);
1610
- (0, import_react3.useEffect)(() => {
1584
+ (0, import_react2.useEffect)(() => {
1611
1585
  if (!historyLoadedOnce) fetchHistory();
1612
1586
  const timer = setInterval(() => {
1613
1587
  fetchHistory();
@@ -1664,7 +1638,7 @@ var TopBar = ({
1664
1638
  };
1665
1639
 
1666
1640
  // src/components/TxConfigForm/Settings.tsx
1667
- var import_react4 = require("react");
1641
+ var import_react3 = require("react");
1668
1642
  var import_jsx_runtime33 = require("react/jsx-runtime");
1669
1643
  var Settings = ({
1670
1644
  setSlippage,
@@ -1673,9 +1647,9 @@ var Settings = ({
1673
1647
  expressChecked,
1674
1648
  setExpressChecked
1675
1649
  }) => {
1676
- const [slippageActivePresetIndex, setSlippageActivePresetIndex] = (0, import_react4.useState)(1);
1677
- const [usingSlippageInput, setUsingSlippageInput] = (0, import_react4.useState)(false);
1678
- (0, import_react4.useEffect)(() => {
1650
+ const [slippageActivePresetIndex, setSlippageActivePresetIndex] = (0, import_react3.useState)(1);
1651
+ const [usingSlippageInput, setUsingSlippageInput] = (0, import_react3.useState)(false);
1652
+ (0, import_react3.useEffect)(() => {
1679
1653
  if (!usingSlippageInput) {
1680
1654
  setSlippage(
1681
1655
  SLIPPAGE_PRESETS[slippageActivePresetIndex]?.toString() || "1.5"
@@ -1864,10 +1838,10 @@ var FeesDetails = ({
1864
1838
  };
1865
1839
 
1866
1840
  // src/components/TxConfigForm/Summary.tsx
1867
- var import_react6 = require("react");
1841
+ var import_react5 = require("react");
1868
1842
 
1869
1843
  // src/components/TxConfigForm/UsdPrice.tsx
1870
- var import_react5 = require("react");
1844
+ var import_react4 = require("react");
1871
1845
  var import_jsx_runtime35 = require("react/jsx-runtime");
1872
1846
  var UsdPrice = ({
1873
1847
  prices,
@@ -1875,8 +1849,8 @@ var UsdPrice = ({
1875
1849
  amount = "0",
1876
1850
  loading = false
1877
1851
  }) => {
1878
- const [usdPrice, setUsdPrice] = (0, import_react5.useState)("0.00");
1879
- (0, import_react5.useEffect)(() => {
1852
+ const [usdPrice, setUsdPrice] = (0, import_react4.useState)("0.00");
1853
+ (0, import_react4.useEffect)(() => {
1880
1854
  if (token && prices && prices[token.address]) {
1881
1855
  const newUsdPrice = (Number(amount) * Number(prices[token.address.toLowerCase()])).toFixed(2);
1882
1856
  setUsdPrice(newUsdPrice);
@@ -1905,8 +1879,8 @@ var Summary = ({
1905
1879
  dstToken,
1906
1880
  dstChain
1907
1881
  }) => {
1908
- const [prices, setPrices] = (0, import_react6.useState)();
1909
- const amountReadable = (0, import_react6.useMemo)(
1882
+ const [prices, setPrices] = (0, import_react5.useState)();
1883
+ const amountReadable = (0, import_react5.useMemo)(
1910
1884
  () => weiToHumanReadable({
1911
1885
  amount: route?.estAmountOut || "0",
1912
1886
  decimals: dstToken?.decimals || 18,
@@ -1914,7 +1888,7 @@ var Summary = ({
1914
1888
  }),
1915
1889
  [route, dstToken]
1916
1890
  );
1917
- (0, import_react6.useEffect)(() => {
1891
+ (0, import_react5.useEffect)(() => {
1918
1892
  if (dstChain) {
1919
1893
  getPrices({ chainId: dstChain.chainId, currency: "USD" }).then(
1920
1894
  (prices2) => setPrices(prices2)
@@ -1972,10 +1946,10 @@ var Summary = ({
1972
1946
  };
1973
1947
 
1974
1948
  // src/components/TxConfigForm/SwapPanel.tsx
1975
- var import_react9 = require("react");
1949
+ var import_react8 = require("react");
1976
1950
 
1977
1951
  // src/components/TxConfigForm/TokenPicker.tsx
1978
- var import_react7 = require("react");
1952
+ var import_react6 = require("react");
1979
1953
  var import_react_dom = require("react-dom");
1980
1954
  var import_jsx_runtime38 = require("react/jsx-runtime");
1981
1955
  var TokenPicker = ({
@@ -1986,7 +1960,7 @@ var TokenPicker = ({
1986
1960
  signer,
1987
1961
  balances
1988
1962
  }) => {
1989
- const [searchValue, setSearchValue] = (0, import_react7.useState)("");
1963
+ const [searchValue, setSearchValue] = (0, import_react6.useState)("");
1990
1964
  const onBackdropClick = (e) => {
1991
1965
  e.stopPropagation();
1992
1966
  e.nativeEvent.stopImmediatePropagation();
@@ -1994,7 +1968,7 @@ var TokenPicker = ({
1994
1968
  onCloseClick();
1995
1969
  }
1996
1970
  };
1997
- const filteredTokens = (0, import_react7.useMemo)(() => {
1971
+ const filteredTokens = (0, import_react6.useMemo)(() => {
1998
1972
  const isMatch = (value, searchValue2) => value.toLowerCase().indexOf(searchValue2.toLowerCase()) > -1;
1999
1973
  return tokens?.filter(
2000
1974
  (token) => isMatch(token.symbol, searchValue) || isMatch(token.name, searchValue) || token.address === searchValue.toLowerCase()
@@ -2116,10 +2090,10 @@ var ChainListElement = ({
2116
2090
 
2117
2091
  // src/components/TxConfigForm/BalanceComponent.tsx
2118
2092
  var import_bignumber3 = __toESM(require("bignumber.js"));
2119
- var import_react8 = require("react");
2093
+ var import_react7 = require("react");
2120
2094
  var import_jsx_runtime40 = require("react/jsx-runtime");
2121
2095
  var BalanceComponent = ({ srcToken, balances }) => {
2122
- const balanceText = (0, import_react8.useMemo)(() => {
2096
+ const balanceText = (0, import_react7.useMemo)(() => {
2123
2097
  if (!balances || !srcToken) return "0";
2124
2098
  if (balances[srcToken.address]?.toString() === "0") return "0";
2125
2099
  const fullHumanReadable = weiToHumanReadable({
@@ -2163,10 +2137,10 @@ var SwapPanel = ({
2163
2137
  prices,
2164
2138
  supportedChains
2165
2139
  }) => {
2166
- const [chainListShown, setChainListShown] = (0, import_react9.useState)(false);
2167
- const [tokenListShown, setTokenListShown] = (0, import_react9.useState)(false);
2168
- const listRef = (0, import_react9.useRef)(null);
2169
- const buttonRef = (0, import_react9.useRef)(null);
2140
+ const [chainListShown, setChainListShown] = (0, import_react8.useState)(false);
2141
+ const [tokenListShown, setTokenListShown] = (0, import_react8.useState)(false);
2142
+ const listRef = (0, import_react8.useRef)(null);
2143
+ const buttonRef = (0, import_react8.useRef)(null);
2170
2144
  const handleClickOutside = (event) => {
2171
2145
  if (listRef.current && buttonRef.current) {
2172
2146
  const listElement = listRef.current;
@@ -2185,13 +2159,13 @@ var SwapPanel = ({
2185
2159
  })
2186
2160
  );
2187
2161
  };
2188
- (0, import_react9.useEffect)(() => {
2162
+ (0, import_react8.useEffect)(() => {
2189
2163
  if (chainListShown) {
2190
2164
  document.addEventListener("mousedown", handleClickOutside);
2191
2165
  return () => document.removeEventListener("mousedown", handleClickOutside);
2192
2166
  }
2193
2167
  }, [chainListShown]);
2194
- const chainListOptions = (0, import_react9.useMemo)(
2168
+ const chainListOptions = (0, import_react8.useMemo)(
2195
2169
  () => supportedChains.filter((chain) => chain.chainId !== srcChain?.chainId),
2196
2170
  [supportedChains, srcChain]
2197
2171
  );
@@ -2349,41 +2323,75 @@ var Button = ({ children, onClick, type, disabled }) => {
2349
2323
  // src/components/TxConfigForm/Form.tsx
2350
2324
  var import_actions = require("wagmi/actions");
2351
2325
 
2352
- // src/components/TxConfigForm/ConfirmationAmount.tsx
2353
- var import_react10 = require("react");
2326
+ // src/components/TxConfigForm/ConfirmationView/index.tsx
2327
+ var import_ethers5 = require("ethers");
2328
+
2329
+ // src/components/Spinner/index.tsx
2354
2330
  var import_jsx_runtime45 = require("react/jsx-runtime");
2331
+ var Spinner = ({ width, height }) => {
2332
+ return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { role: "status", children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
2333
+ "svg",
2334
+ {
2335
+ "aria-hidden": "true",
2336
+ 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)]`,
2337
+ viewBox: "0 0 100 101",
2338
+ fill: "none",
2339
+ xmlns: "http://www.w3.org/2000/svg",
2340
+ children: [
2341
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
2342
+ "path",
2343
+ {
2344
+ 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",
2345
+ fill: "currentColor"
2346
+ }
2347
+ ),
2348
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
2349
+ "path",
2350
+ {
2351
+ 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",
2352
+ fill: "currentFill"
2353
+ }
2354
+ )
2355
+ ]
2356
+ }
2357
+ ) });
2358
+ };
2359
+
2360
+ // src/components/TxConfigForm/ConfirmationAmount.tsx
2361
+ var import_react9 = require("react");
2362
+ var import_jsx_runtime46 = require("react/jsx-runtime");
2355
2363
  var ConfirmationAmount = ({
2356
2364
  amount,
2357
2365
  token,
2358
2366
  chain,
2359
2367
  type
2360
2368
  }) => {
2361
- const [prices, setPrices] = (0, import_react10.useState)();
2362
- const amountReadable = (0, import_react10.useMemo)(() => {
2369
+ const [prices, setPrices] = (0, import_react9.useState)();
2370
+ const amountReadable = (0, import_react9.useMemo)(() => {
2363
2371
  return weiToHumanReadable({
2364
2372
  amount: amount || "0",
2365
2373
  decimals: token?.decimals || 18,
2366
2374
  precisionFractionalPlaces: 8
2367
2375
  });
2368
2376
  }, [amount, token]);
2369
- (0, import_react10.useEffect)(() => {
2377
+ (0, import_react9.useEffect)(() => {
2370
2378
  if (chain) {
2371
2379
  getPrices({ chainId: chain.chainId, currency: "USD" }).then(
2372
2380
  (prices2) => setPrices(prices2)
2373
2381
  );
2374
2382
  }
2375
2383
  }, [chain]);
2376
- 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: [
2377
- /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "xpay-flex xpay-flex-col xpay-gap-1", children: [
2378
- /* @__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" }),
2379
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
2384
+ return /* @__PURE__ */ (0, import_jsx_runtime46.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_runtime46.jsxs)("div", { className: "xpay-flex xpay-justify-between", children: [
2385
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "xpay-flex xpay-flex-col xpay-gap-1", children: [
2386
+ /* @__PURE__ */ (0, import_jsx_runtime46.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" }),
2387
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
2380
2388
  "div",
2381
2389
  {
2382
2390
  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"}`,
2383
2391
  children: amountReadable
2384
2392
  }
2385
2393
  ),
2386
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
2394
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
2387
2395
  UsdPrice,
2388
2396
  {
2389
2397
  prices,
@@ -2393,19 +2401,19 @@ var ConfirmationAmount = ({
2393
2401
  }
2394
2402
  )
2395
2403
  ] }),
2396
- /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "xpay-flex xpay-gap-2 xpay-text-sm xpay-justify-center xpay-items-center", children: [
2397
- /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "xpay-flex xpay-flex-col xpay-justify-center xpay-items-end xpay-gap-1", children: [
2398
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { className: "xpay-text-base sm:xpay-text-xl", children: token?.name }),
2399
- /* @__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 }) })
2404
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "xpay-flex xpay-gap-2 xpay-text-sm xpay-justify-center xpay-items-center", children: [
2405
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "xpay-flex xpay-flex-col xpay-justify-center xpay-items-end xpay-gap-1", children: [
2406
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { className: "xpay-text-base sm:xpay-text-xl", children: token?.name }),
2407
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "xpay-flex xpay-justify-center xpay-items-center xpay-gap-1", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { className: "xpay-text-[rgba(255,255,255,0.6)] xpay-text-xs xpay-text-right", children: chain?.displayName }) })
2400
2408
  ] }),
2401
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "xpay-w-10 xpay-h-10", children: token?.image ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
2409
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "xpay-w-10 xpay-h-10", children: token?.image ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
2402
2410
  "img",
2403
2411
  {
2404
2412
  className: "xpay-w-10 xpay-h-10",
2405
2413
  src: token?.image,
2406
2414
  alt: token?.name
2407
2415
  }
2408
- ) : /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
2416
+ ) : /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
2409
2417
  UnknownTokenLogo,
2410
2418
  {
2411
2419
  tokenName: "?",
@@ -2416,42 +2424,227 @@ var ConfirmationAmount = ({
2416
2424
  ] }) });
2417
2425
  };
2418
2426
 
2419
- // src/components/Spinner/index.tsx
2420
- var import_jsx_runtime46 = require("react/jsx-runtime");
2421
- var Spinner = ({ width, height }) => {
2422
- return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { role: "status", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
2423
- "svg",
2427
+ // src/components/TxConfigForm/ConfirmationView/ErrorView.tsx
2428
+ var import_jsx_runtime47 = require("react/jsx-runtime");
2429
+ var ErrorView = ({ txError, onClose }) => {
2430
+ return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { children: [
2431
+ /* @__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)("div", { className: "xpay-cursor-pointer xpay-text-white", onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(CloseIcon, {}) }) }),
2432
+ /* @__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: [
2433
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(ErrorIcon, {}) }),
2434
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "xpay-flex xpay-flex-col", children: [
2435
+ /* @__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!" }) }),
2436
+ /* @__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(txError) }) })
2437
+ ] })
2438
+ ] })
2439
+ ] });
2440
+ };
2441
+
2442
+ // src/components/TxConfigForm/ConfirmationView/SuccessView.tsx
2443
+ var import_react10 = require("react");
2444
+ var import_jsx_runtime48 = require("react/jsx-runtime");
2445
+ var SuccessView = ({
2446
+ onClose,
2447
+ srcChain,
2448
+ dstChain,
2449
+ isExpressDelivery,
2450
+ srcToken,
2451
+ amount,
2452
+ dstDisplayToken,
2453
+ dstToken,
2454
+ route,
2455
+ txSuccessHash,
2456
+ supportedChains
2457
+ }) => {
2458
+ const dstTokenToDisplay = (0, import_react10.useMemo)(() => {
2459
+ return dstDisplayToken ? dstDisplayToken : dstToken;
2460
+ }, [dstDisplayToken, dstToken]);
2461
+ return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { children: [
2462
+ /* @__PURE__ */ (0, import_jsx_runtime48.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_runtime48.jsx)("div", { className: "xpay-cursor-pointer xpay-text-white", onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(CloseIcon, {}) }) }),
2463
+ /* @__PURE__ */ (0, import_jsx_runtime48.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: [
2464
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(SuccessIcon, {}) }),
2465
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "xpay-flex xpay-flex-col", children: [
2466
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { className: "xpay-text-2xl xpay-font-bold xpay-leading-8 xpay-text-center xpay-text-white", children: "Transaction success!" }) }),
2467
+ srcChain?.chainId !== dstChain?.chainId ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("p", { className: "xpay-text-sm xpay-text-center xpay-text-white xpay-opacity-50", children: [
2468
+ "Approximated time of delivery:",
2469
+ " ",
2470
+ isExpressDelivery ? "30 seconds" : "30 minutes"
2471
+ ] }) }) : /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_jsx_runtime48.Fragment, {})
2472
+ ] }),
2473
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "xpay-flex xpay-gap-4 xpay-items-center", children: [
2474
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "xpay-flex xpay-gap-2", children: [
2475
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "xpay-w-10 xpay-h-10", children: srcToken?.image ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
2476
+ "img",
2477
+ {
2478
+ className: "xpay-w-10 xpay-h-10",
2479
+ src: srcToken?.image,
2480
+ alt: srcToken?.name
2481
+ }
2482
+ ) : /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
2483
+ UnknownTokenLogo,
2484
+ {
2485
+ tokenName: "?",
2486
+ className: "xpay-w-10 xpay-h-10"
2487
+ }
2488
+ ) }),
2489
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "xpay-flex xpay-flex-col xpay-items-start", children: [
2490
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "xpay-flex", children: `${amount} ${srcToken?.symbol}` }),
2491
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "xpay-text-sm xpay-text-center xpay-text-white xpay-opacity-50", children: srcChain?.displayName })
2492
+ ] })
2493
+ ] }),
2494
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "xpay-w-3.5 xpay-h-3.5", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ArrowRightIcon, {}) }),
2495
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "xpay-flex xpay-gap-2", children: [
2496
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "xpay-w-10 xpay-h-10", children: dstTokenToDisplay?.image ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
2497
+ "img",
2498
+ {
2499
+ className: "xpay-w-10 xpay-h-10",
2500
+ src: dstTokenToDisplay?.image,
2501
+ alt: dstTokenToDisplay?.name
2502
+ }
2503
+ ) : /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
2504
+ UnknownTokenLogo,
2505
+ {
2506
+ tokenName: "?",
2507
+ className: "xpay-w-10 xpay-h-10"
2508
+ }
2509
+ ) }),
2510
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "xpay-flex xpay-flex-col xpay-items-start", children: [
2511
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "xpay-flex", children: [
2512
+ weiToHumanReadable({
2513
+ amount: route?.estAmountOut || "0",
2514
+ decimals: dstTokenToDisplay?.decimals || 18,
2515
+ precisionFractionalPlaces: 4
2516
+ }),
2517
+ " ",
2518
+ dstTokenToDisplay?.symbol
2519
+ ] }),
2520
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "xpay-text-sm xpay-text-center xpay-text-white xpay-opacity-50", children: dstChain?.displayName })
2521
+ ] })
2522
+ ] })
2523
+ ] }),
2524
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
2525
+ "a",
2526
+ {
2527
+ href: srcChain?.chainId !== dstChain?.chainId ? `${CCIP_EXPLORER}/tx/${txSuccessHash}` : `${supportedChains.find(
2528
+ (chain) => chain.chainId === srcChain?.chainId
2529
+ )?.transactionExplorer}/${txSuccessHash}`,
2530
+ target: "_blank",
2531
+ rel: "noreferrer",
2532
+ className: "xpay-flex xpay-items-center xpay-gap-2 xpay-font-bold xpay-no-underline xpay-cursor-pointer xpay-text-center",
2533
+ "aria-label": "Show the transaction in the chain explorer",
2534
+ children: [
2535
+ /* @__PURE__ */ (0, import_jsx_runtime48.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" }),
2536
+ /* @__PURE__ */ (0, import_jsx_runtime48.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_runtime48.jsx)(ArrowUpRightIcon, {}) })
2537
+ ]
2538
+ }
2539
+ ) })
2540
+ ] })
2541
+ ] });
2542
+ };
2543
+
2544
+ // src/components/TxConfigForm/ConfirmationView/index.tsx
2545
+ var import_jsx_runtime49 = require("react/jsx-runtime");
2546
+ var ConfirmationView = ({
2547
+ txError,
2548
+ onClose,
2549
+ txSuccessHash,
2550
+ srcChain,
2551
+ dstChain,
2552
+ isExpressDelivery,
2553
+ srcToken,
2554
+ amount,
2555
+ dstDisplayToken,
2556
+ dstToken,
2557
+ route,
2558
+ supportedChains,
2559
+ approveTxLoading,
2560
+ approveTxDone,
2561
+ txLoading
2562
+ }) => {
2563
+ return /* @__PURE__ */ (0, import_jsx_runtime49.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: txError ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ErrorView, { txError, onClose }) : txSuccessHash ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
2564
+ SuccessView,
2424
2565
  {
2425
- "aria-hidden": "true",
2426
- 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)]`,
2427
- viewBox: "0 0 100 101",
2428
- fill: "none",
2429
- xmlns: "http://www.w3.org/2000/svg",
2430
- children: [
2431
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
2432
- "path",
2433
- {
2434
- 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",
2435
- fill: "currentColor"
2436
- }
2437
- ),
2438
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
2439
- "path",
2566
+ onClose,
2567
+ isExpressDelivery,
2568
+ amount,
2569
+ supportedChains,
2570
+ txSuccessHash,
2571
+ srcChain,
2572
+ dstChain,
2573
+ srcToken,
2574
+ dstDisplayToken,
2575
+ dstToken,
2576
+ route
2577
+ }
2578
+ ) : (
2579
+ // Tx Confirmation modal
2580
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_jsx_runtime49.Fragment, { children: [
2581
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "xpay-flex xpay-w-full xpay-justify-between xpay-items-center xpay-mx-auto xpay-p-2 xpay-font-light ", children: [
2582
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { className: "xpay-text-white xpay-text-xl", children: "Confirmation" }),
2583
+ /* @__PURE__ */ (0, import_jsx_runtime49.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_runtime49.jsx)(
2584
+ "div",
2440
2585
  {
2441
- 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",
2442
- fill: "currentFill"
2586
+ className: "xpay-cursor-pointer xpay-text-white",
2587
+ onClick: onClose,
2588
+ children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(CloseIcon, {})
2443
2589
  }
2444
- )
2445
- ]
2446
- }
2590
+ ) })
2591
+ ] }),
2592
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "xpay-flex xpay-flex-col xpay-gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
2593
+ ConfirmationAmount,
2594
+ {
2595
+ amount: import_ethers5.ethers.utils.parseUnits(amount, srcToken?.decimals).toString(),
2596
+ chain: srcChain,
2597
+ token: srcToken,
2598
+ type: "src"
2599
+ }
2600
+ ) }),
2601
+ /* @__PURE__ */ (0, import_jsx_runtime49.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_runtime49.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_runtime49.jsx)(ArrowDownIcon, {}) }) }),
2602
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "xpay-flex xpay-flex-col xpay-gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
2603
+ ConfirmationAmount,
2604
+ {
2605
+ amount: route?.estAmountOut || "0",
2606
+ chain: dstChain,
2607
+ token: dstDisplayToken ? dstDisplayToken : dstToken,
2608
+ type: "dst"
2609
+ }
2610
+ ) }),
2611
+ /* @__PURE__ */ (0, import_jsx_runtime49.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: [
2612
+ route?.transactions.approve && /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_jsx_runtime49.Fragment, { children: [
2613
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "xpay-flex xpay-justify-between xpay-items-center", children: [
2614
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "xpay-flex xpay-items-center xpay-gap-2", children: [
2615
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(SignIcon, {}),
2616
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { className: "xpay-opacity-50", children: approveTxLoading ? "Wait for approval confirmation" : "Approve token spending" })
2617
+ ] }),
2618
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "xpay-flex xpay-items-center", children: [
2619
+ approveTxLoading && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Spinner, { width: "5", height: "5" }),
2620
+ approveTxDone && /* @__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, {}) })
2621
+ ] })
2622
+ ] }),
2623
+ /* @__PURE__ */ (0, import_jsx_runtime49.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" })
2624
+ ] }),
2625
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "xpay-flex xpay-justify-between xpay-items-center", children: [
2626
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "xpay-flex xpay-items-center xpay-gap-2", children: [
2627
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(SignIcon, {}),
2628
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { className: "xpay-opacity-50", children: txLoading ? "Wait for transaction confirmation" : "Confirm transaction" })
2629
+ ] }),
2630
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "xpay-flex xpay-items-center", children: txLoading && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Spinner, { width: "5", height: "5" }) })
2631
+ ] })
2632
+ ] })
2633
+ ] })
2447
2634
  ) });
2448
2635
  };
2449
2636
 
2637
+ // src/components/TxConfigForm/ConnectWalletPrompt.tsx
2638
+ var import_jsx_runtime50 = require("react/jsx-runtime");
2639
+ var ConnectWalletPrompt = ({ onClose }) => {
2640
+ return /* @__PURE__ */ (0, import_jsx_runtime50.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: [
2641
+ /* @__PURE__ */ (0, import_jsx_runtime50.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_runtime50.jsx)("div", { className: "xpay-cursor-pointer xpay-text-white", onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(CloseIcon, {}) }) }),
2642
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("p", { className: "xpay-text-xl xpay-font-bold xpay-leading-8 xpay-text-center xpay-text-white", children: "Please connect the wallet first." })
2643
+ ] });
2644
+ };
2645
+
2450
2646
  // src/components/TxConfigForm/Form.tsx
2451
- var import_jsx_runtime47 = (
2452
- // Connect wallet modal
2453
- require("react/jsx-runtime")
2454
- );
2647
+ var import_jsx_runtime51 = require("react/jsx-runtime");
2455
2648
  var Form = ({
2456
2649
  integratorId,
2457
2650
  dstChainId,
@@ -2459,7 +2652,7 @@ var Form = ({
2459
2652
  customContractCalls,
2460
2653
  desc,
2461
2654
  supportedChains,
2462
- retrunTransactions,
2655
+ returnTransactions,
2463
2656
  dstDisplayTokenAddr,
2464
2657
  wagmiConfig,
2465
2658
  onSubmit,
@@ -2490,17 +2683,8 @@ var Form = ({
2490
2683
  const [approveTxLoading, setApproveTxLoading] = (0, import_react11.useState)(false);
2491
2684
  const [approveTxDone, setApproveTxDone] = (0, import_react11.useState)(false);
2492
2685
  const [transactionError, setTransactionError] = (0, import_react11.useState)(null);
2493
- const currentRouteRequestNonce = (0, import_react11.useRef)(0);
2494
- const prevAllowanceValuesRef = (0, import_react11.useRef)({
2495
- srcChainId: srcChain?.chainId,
2496
- srcTokenAddress: srcToken?.address,
2497
- routeTo: import_ethers5.ethers.constants.AddressZero
2498
- });
2499
- const currentAllowanceRequestNonce = (0, import_react11.useRef)(0);
2500
- const [isAllowanceLoading, setIsAllowanceLoading] = (0, import_react11.useState)(false);
2501
- const [srcTokenAllowance, setSrcTokenAllowance] = (0, import_react11.useState)("0");
2686
+ const routeAbortController = (0, import_react11.useRef)(null);
2502
2687
  const { sendTransaction } = (0, import_wagmi2.useSendTransaction)({ config: wagmiConfig });
2503
- const debouncedAmount = useDebounce(amount, 1e3);
2504
2688
  const account = (0, import_wagmi2.useAccount)();
2505
2689
  const { switchChainAsync } = (0, import_wagmi2.useSwitchChain)();
2506
2690
  (0, import_react11.useEffect)(() => {
@@ -2549,7 +2733,7 @@ var Form = ({
2549
2733
  })();
2550
2734
  }, [dstChain]);
2551
2735
  (0, import_react11.useEffect)(() => {
2552
- if (!(integratorId && srcChain && srcToken && dstChain && debouncedAmount && paymentToken && signer && slippage)) {
2736
+ if (!(integratorId && srcChain && srcToken && dstChain && amount && paymentToken && signer && slippage)) {
2553
2737
  return;
2554
2738
  }
2555
2739
  setFormError("");
@@ -2562,84 +2746,52 @@ var Form = ({
2562
2746
  throw new Error(
2563
2747
  `Configuration error: selected token ($${srcToken.symbol} ${srcToken.name}) has unknown decimals param.`
2564
2748
  );
2565
- const nonce = Date.now();
2566
- currentRouteRequestNonce.current = nonce;
2567
- getRoute({
2568
- integratorId,
2569
- fromAmount: import_ethers5.ethers.utils.parseUnits(debouncedAmount, srcToken.decimals).toString(),
2570
- fromAddress: signer || ADDRESSES[srcChain.chainId].FeeCollector,
2571
- fromChain: srcChain.chainId,
2572
- fromToken: srcToken.address,
2573
- toAddress: signer || ADDRESSES[dstChain.chainId].FeeCollector,
2574
- toChain: dstChainId,
2575
- toToken: dstTokenAddr,
2576
- paymentToken: paymentToken.address,
2577
- slippage: Number(slippage),
2578
- expressDelivery: expressChecked,
2579
- customContractCalls
2580
- }).then((response) => {
2581
- if (nonce !== currentRouteRequestNonce.current) {
2582
- return;
2583
- }
2749
+ if (routeAbortController.current) {
2750
+ routeAbortController.current.abort(DEFAULT_REQUEST_ABORT_MSG);
2751
+ }
2752
+ routeAbortController.current = new AbortController();
2753
+ getRoute(
2754
+ {
2755
+ integratorId,
2756
+ fromAmount: import_ethers6.ethers.utils.parseUnits(amount, srcToken.decimals).toString(),
2757
+ fromAddress: signer || ADDRESSES[srcChain.chainId].FeeCollector,
2758
+ fromChain: srcChain.chainId,
2759
+ fromToken: srcToken.address,
2760
+ toAddress: signer || ADDRESSES[dstChain.chainId].FeeCollector,
2761
+ toChain: dstChainId,
2762
+ toToken: dstTokenAddr,
2763
+ paymentToken: paymentToken.address,
2764
+ slippage: Number(slippage),
2765
+ expressDelivery: expressChecked,
2766
+ customContractCalls
2767
+ },
2768
+ routeAbortController.current.signal
2769
+ ).then((response) => {
2584
2770
  setRoute(response);
2585
2771
  setFormError("");
2772
+ setIsGettingRoute(false);
2773
+ routeAbortController.current = null;
2586
2774
  }).catch((err) => {
2587
- setFormError(err.message);
2775
+ if (err !== DEFAULT_REQUEST_ABORT_MSG) {
2776
+ setFormError(err.message);
2777
+ }
2588
2778
  }).finally(() => {
2589
- setIsGettingRoute(false);
2590
2779
  clearTimeout(timeout);
2591
2780
  });
2592
2781
  }, [
2782
+ amount,
2593
2783
  signer,
2594
2784
  srcChain,
2595
2785
  srcToken,
2596
- debouncedAmount,
2597
2786
  paymentToken,
2598
2787
  slippage,
2599
2788
  expressChecked
2600
2789
  ]);
2601
- (0, import_react11.useEffect)(() => {
2602
- (async () => {
2603
- if (!signer || !srcToken?.address || !srcChain?.publicRpcUrls[0] || srcToken?.address === import_ethers5.ethers.constants.AddressZero) {
2604
- return;
2605
- }
2606
- if (route && route.transactions.swap?.to) {
2607
- const {
2608
- srcChainId: prevFromChainId,
2609
- srcTokenAddress: prevFromTokenAddress,
2610
- routeTo: prevRouteTo
2611
- } = prevAllowanceValuesRef.current;
2612
- const hasChanges = srcChain?.chainId !== prevFromChainId || srcToken?.address !== prevFromTokenAddress || route.transactions.swap?.to !== prevRouteTo;
2613
- if (!hasChanges) {
2614
- return;
2615
- }
2616
- prevAllowanceValuesRef.current = {
2617
- srcChainId: srcChain?.chainId,
2618
- srcTokenAddress: srcToken?.address,
2619
- routeTo: route.transactions.swap?.to
2620
- };
2621
- const nonce = Date.now();
2622
- currentAllowanceRequestNonce.current = nonce;
2623
- setIsAllowanceLoading(true);
2624
- const allowanceResponse = await getAllowanceOf(
2625
- srcToken?.address,
2626
- signer,
2627
- route.transactions.swap.to,
2628
- srcChain?.publicRpcUrls[0]
2629
- );
2630
- if (nonce !== currentAllowanceRequestNonce.current) {
2631
- return;
2632
- }
2633
- setSrcTokenAllowance(allowanceResponse);
2634
- setIsAllowanceLoading(false);
2635
- }
2636
- })();
2637
- }, [srcChain, srcToken?.address, signer, setSrcTokenAllowance, route]);
2638
2790
  (0, import_react11.useEffect)(() => {
2639
2791
  if (srcChain) {
2640
2792
  setPaymentToken(
2641
2793
  srcChain.tokens.find(
2642
- (token) => token.address.toLowerCase() === import_ethers5.ethers.constants.AddressZero.toLowerCase()
2794
+ (token) => token.address.toLowerCase() === import_ethers6.ethers.constants.AddressZero.toLowerCase()
2643
2795
  )
2644
2796
  );
2645
2797
  }
@@ -2649,16 +2801,12 @@ var Form = ({
2649
2801
  setFormError("");
2650
2802
  setIsGettingRoute(false);
2651
2803
  setRoute(void 0);
2652
- const nonce = Date.now();
2653
- currentRouteRequestNonce.current = nonce;
2654
2804
  }, [srcToken]);
2655
2805
  (0, import_react11.useEffect)(() => {
2656
2806
  setSrcToken(srcChain?.tokens[0]);
2657
2807
  setAmount("");
2658
2808
  setIsGettingRoute(false);
2659
2809
  setRoute(void 0);
2660
- const nonce = Date.now();
2661
- currentRouteRequestNonce.current = nonce;
2662
2810
  }, [srcChain]);
2663
2811
  (0, import_react11.useEffect)(() => {
2664
2812
  if (srcChain) {
@@ -2675,9 +2823,6 @@ var Form = ({
2675
2823
  (0, import_react11.useEffect)(() => {
2676
2824
  setBackdropClickDisabled(executingTransactions);
2677
2825
  }, [executingTransactions]);
2678
- const isAllowanceOk = (0, import_react11.useMemo)(() => {
2679
- return srcToken?.address === import_ethers5.ethers.constants.AddressZero || Number(srcTokenAllowance) >= Number(amount);
2680
- }, [srcToken, amount, srcTokenAllowance]);
2681
2826
  const triggerTx = (0, import_react11.useCallback)(async () => {
2682
2827
  if (!route) {
2683
2828
  return;
@@ -2685,10 +2830,10 @@ var Form = ({
2685
2830
  setExecutingTransactions(true);
2686
2831
  setBackdropClickDisabled(true);
2687
2832
  setTransactionError(null);
2688
- if (route.transactions.approve && !isAllowanceOk) {
2833
+ if (route.transactions.approve) {
2689
2834
  setApproveTxDone(false);
2690
2835
  const { to, data } = route.transactions.approve;
2691
- await sendTransaction(
2836
+ sendTransaction(
2692
2837
  {
2693
2838
  to,
2694
2839
  data
@@ -2704,7 +2849,7 @@ var Form = ({
2704
2849
  });
2705
2850
  setApproveTxLoading(false);
2706
2851
  setApproveTxDone(true);
2707
- swap(route);
2852
+ await swap(route);
2708
2853
  },
2709
2854
  onError: (error) => {
2710
2855
  setTransactionError(`Approval failed: ${error.message}`);
@@ -2721,17 +2866,15 @@ var Form = ({
2721
2866
  signer,
2722
2867
  srcChain,
2723
2868
  srcToken,
2724
- debouncedAmount,
2725
2869
  paymentToken,
2726
2870
  slippage,
2727
2871
  expressChecked,
2728
- amount,
2729
- srcTokenAllowance
2872
+ amount
2730
2873
  ]);
2731
2874
  const swap = (0, import_react11.useCallback)(
2732
2875
  async (route2) => {
2733
2876
  const { to, value, data } = route2.transactions.swap;
2734
- await sendTransaction(
2877
+ sendTransaction(
2735
2878
  {
2736
2879
  to,
2737
2880
  value: BigInt(value),
@@ -2759,23 +2902,14 @@ var Form = ({
2759
2902
  }
2760
2903
  );
2761
2904
  },
2762
- [
2763
- route,
2764
- signer,
2765
- srcChain,
2766
- srcToken,
2767
- debouncedAmount,
2768
- paymentToken,
2769
- slippage,
2770
- expressChecked
2771
- ]
2905
+ [route, signer, srcChain, srcToken, paymentToken, slippage, expressChecked]
2772
2906
  );
2773
2907
  const handleSubmit = (event) => {
2774
2908
  event.preventDefault();
2775
2909
  if (!route) {
2776
2910
  return;
2777
2911
  }
2778
- if (retrunTransactions) {
2912
+ if (returnTransactions) {
2779
2913
  onSubmit(route);
2780
2914
  return;
2781
2915
  }
@@ -2785,7 +2919,6 @@ var Form = ({
2785
2919
  await switchChainAsync({ chainId: Number(srcChain?.chainId) });
2786
2920
  };
2787
2921
  const swapButton = (0, import_react11.useMemo)(() => {
2788
- let disabled = false;
2789
2922
  if (transactionError) {
2790
2923
  return {
2791
2924
  text: transactionError,
@@ -2799,14 +2932,14 @@ var Form = ({
2799
2932
  text: "Connect wallet",
2800
2933
  fn: () => {
2801
2934
  },
2802
- disabled
2935
+ disabled: false
2803
2936
  };
2804
2937
  }
2805
2938
  if (signer && srcChain && srcChain.chainId !== account.chainId?.toString()) {
2806
2939
  return {
2807
2940
  text: "Switch chain",
2808
2941
  fn: handleSwitchChain,
2809
- disabled
2942
+ disabled: false
2810
2943
  };
2811
2944
  }
2812
2945
  if (!amount) {
@@ -2817,7 +2950,7 @@ var Form = ({
2817
2950
  disabled: true
2818
2951
  };
2819
2952
  }
2820
- if (amount && balances && srcToken && srcToken.decimals && balances[srcToken?.address] !== void 0 && !import_ethers5.ethers.utils.parseUnits(amount, srcToken.decimals).lt(balances[srcToken?.address] || "0")) {
2953
+ if (amount && balances && srcToken && srcToken.decimals && balances[srcToken?.address] !== void 0 && !import_ethers6.ethers.utils.parseUnits(amount, srcToken.decimals).lt(balances[srcToken?.address] || "0")) {
2821
2954
  return {
2822
2955
  text: "Insufficient balance",
2823
2956
  fn: () => {
@@ -2833,231 +2966,54 @@ var Form = ({
2833
2966
  disabled: true
2834
2967
  };
2835
2968
  }
2836
- if (isAllowanceLoading) {
2837
- return {
2838
- text: `Checking allowance`,
2839
- fn: () => {
2840
- },
2841
- disabled: true
2842
- };
2843
- }
2844
2969
  return {
2845
2970
  text: "Submit",
2846
2971
  fn: () => {
2847
2972
  },
2848
- disabled
2973
+ disabled: false
2849
2974
  };
2850
2975
  }, [
2851
2976
  account,
2852
2977
  srcToken,
2853
2978
  srcChain,
2854
- isAllowanceOk,
2855
2979
  amount,
2856
2980
  balances,
2857
2981
  signer,
2858
2982
  transactionError,
2859
- route,
2860
- isAllowanceLoading
2983
+ route
2861
2984
  ]);
2862
2985
  const isExpressDelivery = (0, import_react11.useMemo)(() => {
2863
- let expressDeliveryFee;
2864
- if (!route?.xSwapFees || !route?.xSwapFees.expressDeliveryFee) {
2865
- expressDeliveryFee = safeBigNumberFrom("0");
2866
- } else {
2867
- expressDeliveryFee = safeBigNumberFrom(
2868
- route?.xSwapFees.expressDeliveryFee
2869
- );
2870
- }
2871
- if (expressDeliveryFee.gt("0")) {
2872
- return true;
2873
- }
2874
- return false;
2986
+ const expressDeliveryFee = !route?.xSwapFees || !route?.xSwapFees.expressDeliveryFee ? safeBigNumberFrom("0") : safeBigNumberFrom(route?.xSwapFees.expressDeliveryFee);
2987
+ return expressDeliveryFee.gt("0");
2875
2988
  }, [route]);
2876
- 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: [
2877
- /* @__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)(
2878
- "div",
2879
- {
2880
- className: "xpay-cursor-pointer xpay-text-white",
2881
- onClick: onClose,
2882
- children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(CloseIcon, {})
2883
- }
2884
- ) }),
2885
- " ",
2886
- /* @__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." })
2887
- ] }) : 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 ? (
2888
- // Tx Error modal
2889
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { children: [
2890
- /* @__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)(
2891
- "div",
2892
- {
2893
- className: "xpay-cursor-pointer xpay-text-white",
2894
- onClick: onClose,
2895
- children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(CloseIcon, {})
2896
- }
2897
- ) }),
2898
- /* @__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: [
2899
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(ErrorIcon, {}) }),
2900
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "xpay-flex xpay-flex-col", children: [
2901
- /* @__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!" }) }),
2902
- /* @__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) }) })
2903
- ] })
2904
- ] })
2905
- ] })
2906
- ) : transactionSuccessHash ? (
2907
- // Tx Success modal
2908
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { children: [
2909
- /* @__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)(
2910
- "div",
2911
- {
2912
- className: "xpay-cursor-pointer xpay-text-white",
2913
- onClick: onClose,
2914
- children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(CloseIcon, {})
2915
- }
2916
- ) }),
2917
- /* @__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: [
2918
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(SuccessIcon, {}) }),
2919
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "xpay-flex xpay-flex-col", children: [
2920
- /* @__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!" }) }),
2921
- 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: [
2922
- "Approximated time of delivery:",
2923
- " ",
2924
- isExpressDelivery ? "30 seconds" : "30 minutes"
2925
- ] }) }) : /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_jsx_runtime47.Fragment, {})
2926
- ] }),
2927
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "xpay-flex xpay-gap-4 xpay-items-center", children: [
2928
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "xpay-flex xpay-gap-2", children: [
2929
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "xpay-w-10 xpay-h-10", children: srcToken?.image ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
2930
- "img",
2931
- {
2932
- className: "xpay-w-10 xpay-h-10",
2933
- src: srcToken?.image,
2934
- alt: srcToken?.name
2935
- }
2936
- ) : /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
2937
- UnknownTokenLogo,
2938
- {
2939
- tokenName: "?",
2940
- className: "xpay-w-10 xpay-h-10"
2941
- }
2942
- ) }),
2943
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "xpay-flex xpay-flex-col xpay-items-start", children: [
2944
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "xpay-flex", children: `${debouncedAmount} ${srcToken?.symbol}` }),
2945
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "xpay-text-sm xpay-text-center xpay-text-white xpay-opacity-50", children: srcChain?.displayName })
2946
- ] })
2947
- ] }),
2948
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "xpay-w-3.5 xpay-h-3.5", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(ArrowRightIcon, {}) }),
2949
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "xpay-flex xpay-gap-2", children: [
2950
- /* @__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)(
2951
- "img",
2952
- {
2953
- className: "xpay-w-10 xpay-h-10",
2954
- src: (dstDisplayToken ? dstDisplayToken : dstToken)?.image,
2955
- alt: (dstDisplayToken ? dstDisplayToken : dstToken)?.name
2956
- }
2957
- ) : /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
2958
- UnknownTokenLogo,
2959
- {
2960
- tokenName: "?",
2961
- className: "xpay-w-10 xpay-h-10"
2962
- }
2963
- ) }),
2964
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "xpay-flex xpay-flex-col xpay-items-start", children: [
2965
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "xpay-flex", children: [
2966
- weiToHumanReadable({
2967
- amount: route?.estAmountOut || "0",
2968
- decimals: (dstDisplayToken ? dstDisplayToken : dstToken)?.decimals || 18,
2969
- precisionFractionalPlaces: 4
2970
- }),
2971
- " ",
2972
- (dstDisplayToken ? dstDisplayToken : dstToken)?.symbol
2973
- ] }),
2974
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "xpay-text-sm xpay-text-center xpay-text-white xpay-opacity-50", children: dstChain?.displayName })
2975
- ] })
2976
- ] })
2977
- ] }),
2978
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
2979
- "a",
2980
- {
2981
- href: srcChain?.chainId !== dstChain?.chainId ? `${CCIP_EXPLORER}/tx/${transactionSuccessHash}` : `${supportedChains.find(
2982
- (chain) => chain.chainId === srcChain?.chainId
2983
- )?.transactionExplorer}/${transactionSuccessHash}`,
2984
- target: "_blank",
2985
- rel: "noreferrer",
2986
- className: "xpay-flex xpay-items-center xpay-gap-2 xpay-font-bold xpay-no-underline xpay-cursor-pointer xpay-text-center",
2987
- "aria-label": "Show the transaction in the chain explorer",
2988
- children: [
2989
- /* @__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" }),
2990
- /* @__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, {}) })
2991
- ]
2992
- }
2993
- ) })
2994
- ] })
2995
- ] })
2989
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_jsx_runtime51.Fragment, { children: !signer ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(ConnectWalletPrompt, { onClose }) : executingTransactions ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
2990
+ ConfirmationView,
2991
+ {
2992
+ txError: transactionError,
2993
+ onClose,
2994
+ txSuccessHash: transactionSuccessHash,
2995
+ srcChain,
2996
+ dstChain,
2997
+ isExpressDelivery,
2998
+ srcToken,
2999
+ amount,
3000
+ dstDisplayToken,
3001
+ dstToken,
3002
+ route,
3003
+ supportedChains,
3004
+ approveTxLoading,
3005
+ approveTxDone,
3006
+ txLoading
3007
+ }
2996
3008
  ) : (
2997
- // Tx Confirmation modal
2998
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
2999
- /* @__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: [
3000
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "xpay-text-white xpay-text-xl", children: "Confirmation" }),
3001
- /* @__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)(
3002
- "div",
3003
- {
3004
- className: "xpay-cursor-pointer xpay-text-white",
3005
- onClick: onClose,
3006
- children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(CloseIcon, {})
3007
- }
3008
- ) })
3009
- ] }),
3010
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "xpay-flex xpay-flex-col xpay-gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
3011
- ConfirmationAmount,
3012
- {
3013
- amount: import_ethers5.ethers.utils.parseUnits(debouncedAmount, srcToken?.decimals).toString(),
3014
- chain: srcChain,
3015
- token: srcToken,
3016
- type: "src"
3017
- }
3018
- ) }),
3019
- /* @__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, {}) }) }),
3020
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "xpay-flex xpay-flex-col xpay-gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
3021
- ConfirmationAmount,
3022
- {
3023
- amount: route?.estAmountOut || "0",
3024
- chain: dstChain,
3025
- token: dstDisplayToken ? dstDisplayToken : dstToken,
3026
- type: "dst"
3027
- }
3028
- ) }),
3029
- /* @__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: [
3030
- route?.transactions.approve && !isAllowanceOk && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
3031
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "xpay-flex xpay-justify-between xpay-items-center", children: [
3032
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "xpay-flex xpay-items-center xpay-gap-2", children: [
3033
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(SignIcon, {}),
3034
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "xpay-opacity-50", children: approveTxLoading ? "Wait for approval confirmation" : "Approve token spending" })
3035
- ] }),
3036
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "xpay-flex xpay-items-center", children: [
3037
- approveTxLoading && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Spinner, { width: "5", height: "5" }),
3038
- 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, {}) })
3039
- ] })
3040
- ] }),
3041
- /* @__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" })
3042
- ] }),
3043
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "xpay-flex xpay-justify-between xpay-items-center", children: [
3044
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "xpay-flex xpay-items-center xpay-gap-2", children: [
3045
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(SignIcon, {}),
3046
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "xpay-opacity-50", children: txLoading ? "Wait for transaction confirmation" : "Confirm transaction" })
3047
- ] }),
3048
- /* @__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" }) })
3049
- ] })
3050
- ] })
3051
- ] })
3052
- ) }) : (
3053
3009
  // XPay form
3054
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
3010
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
3055
3011
  "form",
3056
3012
  {
3057
3013
  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",
3058
3014
  onSubmit: handleSubmit,
3059
3015
  children: [
3060
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
3016
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
3061
3017
  TopBar,
3062
3018
  {
3063
3019
  signer,
@@ -3067,7 +3023,7 @@ var Form = ({
3067
3023
  onClose
3068
3024
  }
3069
3025
  ),
3070
- settingsShown && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
3026
+ settingsShown && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
3071
3027
  Settings,
3072
3028
  {
3073
3029
  expressChecked,
@@ -3077,8 +3033,8 @@ var Form = ({
3077
3033
  setSlippage
3078
3034
  }
3079
3035
  ),
3080
- 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: [
3081
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
3036
+ historyTabShown ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(History, { signer, supportedChains }) : /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "xpay-flex xpay-flex-col xpay-gap-2", children: [
3037
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
3082
3038
  SwapPanel,
3083
3039
  {
3084
3040
  amount,
@@ -3093,7 +3049,7 @@ var Form = ({
3093
3049
  setSrcChain
3094
3050
  }
3095
3051
  ),
3096
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
3052
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
3097
3053
  Summary,
3098
3054
  {
3099
3055
  isGettingRoute,
@@ -3102,8 +3058,8 @@ var Form = ({
3102
3058
  dstChain
3103
3059
  }
3104
3060
  ),
3105
- desc && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Description, { description: desc }),
3106
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
3061
+ desc && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Description, { description: desc }),
3062
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
3107
3063
  FeesDetails,
3108
3064
  {
3109
3065
  route,
@@ -3116,8 +3072,8 @@ var Form = ({
3116
3072
  isExpressDelivery
3117
3073
  }
3118
3074
  ),
3119
- formError.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(ErrorField, { error: formError }),
3120
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
3075
+ formError.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(ErrorField, { error: formError }),
3076
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
3121
3077
  Button,
3122
3078
  {
3123
3079
  type: "submit",
@@ -3134,7 +3090,7 @@ var Form = ({
3134
3090
  };
3135
3091
 
3136
3092
  // src/components/TxConfigForm/index.tsx
3137
- var import_jsx_runtime48 = require("react/jsx-runtime");
3093
+ var import_jsx_runtime52 = require("react/jsx-runtime");
3138
3094
  var TxConfigForm = ({
3139
3095
  integratorId,
3140
3096
  dstChainId,
@@ -3142,7 +3098,7 @@ var TxConfigForm = ({
3142
3098
  customContractCalls,
3143
3099
  desc,
3144
3100
  supportedChains,
3145
- retrunTransactions,
3101
+ returnTransactions,
3146
3102
  dstDisplayTokenAddr,
3147
3103
  onSubmit,
3148
3104
  onClose
@@ -3160,13 +3116,13 @@ var TxConfigForm = ({
3160
3116
  () => getWagmiConfig(supportedChains),
3161
3117
  supportedChains
3162
3118
  );
3163
- 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)(
3119
+ return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_wagmi3.WagmiProvider, { config: wagmiConfig, children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_react_query.QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
3164
3120
  "div",
3165
3121
  {
3166
3122
  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",
3167
3123
  onMouseDown: onBackdropClick,
3168
- 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: [
3169
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
3124
+ children: /* @__PURE__ */ (0, import_jsx_runtime52.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: [
3125
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
3170
3126
  Form,
3171
3127
  {
3172
3128
  integratorId,
@@ -3176,14 +3132,14 @@ var TxConfigForm = ({
3176
3132
  desc,
3177
3133
  supportedChains,
3178
3134
  wagmiConfig,
3179
- retrunTransactions: !!retrunTransactions,
3135
+ returnTransactions: !!returnTransactions,
3180
3136
  dstDisplayTokenAddr,
3181
3137
  onSubmit,
3182
3138
  onClose,
3183
3139
  setBackdropClickDisabled: (disabled) => setBackdropClickDisabled(disabled)
3184
3140
  }
3185
3141
  ),
3186
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(PoweredBy, {})
3142
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(PoweredBy, {})
3187
3143
  ] })
3188
3144
  }
3189
3145
  ) }) });
@@ -3195,7 +3151,7 @@ var openTxConfigForm = async ({
3195
3151
  customContractCalls,
3196
3152
  desc,
3197
3153
  supportedChains,
3198
- retrunTransactions,
3154
+ returnTransactions,
3199
3155
  dstDisplayTokenAddr
3200
3156
  }) => {
3201
3157
  try {
@@ -3208,7 +3164,7 @@ var openTxConfigForm = async ({
3208
3164
  throw new Error("XPay was incorrectly initialised");
3209
3165
  }
3210
3166
  xpayRoot.render(
3211
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
3167
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
3212
3168
  TxConfigForm,
3213
3169
  {
3214
3170
  integratorId,
@@ -3217,10 +3173,10 @@ var openTxConfigForm = async ({
3217
3173
  customContractCalls,
3218
3174
  desc,
3219
3175
  supportedChains,
3220
- retrunTransactions,
3176
+ returnTransactions,
3221
3177
  dstDisplayTokenAddr,
3222
3178
  onSubmit: (route) => {
3223
- if (retrunTransactions) {
3179
+ if (returnTransactions) {
3224
3180
  resolve(route);
3225
3181
  }
3226
3182
  if (xpayRoot) {
@@ -3243,7 +3199,7 @@ var openTxConfigForm = async ({
3243
3199
 
3244
3200
  // src/components/TxStatusButton/index.tsx
3245
3201
  var import_react13 = require("react");
3246
- var import_jsx_runtime49 = require("react/jsx-runtime");
3202
+ var import_jsx_runtime53 = require("react/jsx-runtime");
3247
3203
  var TxStatusButton = ({ transaction }) => {
3248
3204
  const {
3249
3205
  srcChain: fromChain,
@@ -3265,20 +3221,20 @@ var TxStatusButton = ({ transaction }) => {
3265
3221
  () => isDone ? "xpay-border xpay-border-solid xpay-border-x_green_dark" : "xpay-border xpay-border-solid xpay-border-x_blue_dark",
3266
3222
  [isDone]
3267
3223
  );
3268
- return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
3224
+ return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
3269
3225
  "div",
3270
3226
  {
3271
3227
  className: "xpay-flex xpay-gap-2",
3272
3228
  onClick: () => setIsWide((x) => !x),
3273
3229
  children: [
3274
- isWide && /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
3230
+ isWide && /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
3275
3231
  "div",
3276
3232
  {
3277
3233
  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}`,
3278
3234
  children: [
3279
- /* @__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: [
3280
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "xpay-flex xpay-items-center xpay-gap-2", children: [
3281
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
3235
+ /* @__PURE__ */ (0, import_jsx_runtime53.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: [
3236
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "xpay-flex xpay-items-center xpay-gap-2", children: [
3237
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
3282
3238
  "img",
3283
3239
  {
3284
3240
  className: "xpay-w-5 xpay-h-5",
@@ -3286,9 +3242,9 @@ var TxStatusButton = ({ transaction }) => {
3286
3242
  alt: "source chain"
3287
3243
  }
3288
3244
  ),
3289
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { children: fromChain }),
3290
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "xpay-w-3.5 xpay-h-3.5", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ArrowRightIcon, {}) }),
3291
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
3245
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { children: fromChain }),
3246
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "xpay-w-3.5 xpay-h-3.5", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ArrowRightIcon, {}) }),
3247
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
3292
3248
  "img",
3293
3249
  {
3294
3250
  className: "xpay-w-5 xpay-h-5",
@@ -3296,23 +3252,23 @@ var TxStatusButton = ({ transaction }) => {
3296
3252
  alt: "to chain"
3297
3253
  }
3298
3254
  ),
3299
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { children: toChain })
3255
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { children: toChain })
3300
3256
  ] }),
3301
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "xpay-flex xpay-items-center xpay-gap-2", children: [
3302
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { children: "Sent" }),
3303
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { children: fromAmount }),
3304
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { children: fromToken }),
3305
- fromTokenImage ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
3257
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "xpay-flex xpay-items-center xpay-gap-2", children: [
3258
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { children: "Sent" }),
3259
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { children: fromAmount }),
3260
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { children: fromToken }),
3261
+ fromTokenImage ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
3306
3262
  "img",
3307
3263
  {
3308
3264
  className: "xpay-w-5 xpay-h-5",
3309
3265
  src: fromTokenImage,
3310
3266
  alt: "source token"
3311
3267
  }
3312
- ) : /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(UnknownTokenLogo, { tokenName: "?" })
3268
+ ) : /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(UnknownTokenLogo, { tokenName: "?" })
3313
3269
  ] })
3314
3270
  ] }),
3315
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
3271
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
3316
3272
  "a",
3317
3273
  {
3318
3274
  href: explorer,
@@ -3320,21 +3276,21 @@ var TxStatusButton = ({ transaction }) => {
3320
3276
  rel: "noreferrer",
3321
3277
  className: "xpay-no-underline xpay-cursor-pointer",
3322
3278
  "aria-label": "Show the transaction in the chain explorer",
3323
- 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, {}) })
3279
+ children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "xpay-w-3.5 xpay-h-3.5", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ArrowUpRightIcon, {}) })
3324
3280
  }
3325
3281
  )
3326
3282
  ]
3327
3283
  }
3328
3284
  ),
3329
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
3285
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
3330
3286
  "div",
3331
3287
  {
3332
3288
  className: `xpay-text-white xpay-rounded-xl xpay-cursor-pointer ${background} ${border}`,
3333
- 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: [
3334
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ArrowLeftIcon, {}),
3335
- /* @__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: [
3336
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "xpay-w-5 xpay-h-5", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(XSwapLogo, {}) }),
3337
- /* @__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" }) })
3289
+ children: /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "xpay-flex xpay-gap-2 xpay-items-center xpay-h-14 xpay-w-20 xpay-justify-center", children: [
3290
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ArrowLeftIcon, {}),
3291
+ /* @__PURE__ */ (0, import_jsx_runtime53.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_runtime53.jsx)("div", { className: "xpay-text-x_green xpay-w-5 xpay-h-5", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(CheckIcon, {}) }) : /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_jsx_runtime53.Fragment, { children: [
3292
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "xpay-w-5 xpay-h-5", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(XSwapLogo, {}) }),
3293
+ /* @__PURE__ */ (0, import_jsx_runtime53.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_runtime53.jsx)(Spinner, { width: "10", height: "10" }) })
3338
3294
  ] }) })
3339
3295
  ] })
3340
3296
  }
@@ -3363,19 +3319,19 @@ var updateTransactionDoneInRenderedTransactions = (txHash) => {
3363
3319
  }
3364
3320
  };
3365
3321
  var renderTxStatusButtons = () => {
3366
- const buttons = renderedTransactions.map((item) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(TxStatusButton, { transaction: item }, item.txHash));
3322
+ const buttons = renderedTransactions.map((item) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(TxStatusButton, { transaction: item }, item.txHash));
3367
3323
  if (xpayTxStatusRoot === null) {
3368
3324
  throw new Error("XPay was incorrectly initialised");
3369
3325
  }
3370
3326
  xpayTxStatusRoot.render(
3371
- /* @__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 })
3327
+ /* @__PURE__ */ (0, import_jsx_runtime53.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 })
3372
3328
  );
3373
3329
  };
3374
3330
 
3375
3331
  // src/components/Skeleton/index.tsx
3376
- var import_jsx_runtime50 = require("react/jsx-runtime");
3332
+ var import_jsx_runtime54 = require("react/jsx-runtime");
3377
3333
  var Skeleton = ({ width, height }) => {
3378
- return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
3334
+ return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
3379
3335
  "div",
3380
3336
  {
3381
3337
  className: `xpay-bg-gray-700 xpay-rounded xpay-animate-pulse ${width} ${height}`
@@ -3387,13 +3343,13 @@ var Skeleton = ({ width, height }) => {
3387
3343
  var import_async_retry = __toESM(require("async-retry"));
3388
3344
 
3389
3345
  // src/services/blockchain.ts
3390
- var import_ethers6 = require("ethers");
3346
+ var import_ethers7 = require("ethers");
3391
3347
  var getCustomTokenData = async (chain, tokenAddress) => {
3392
3348
  const rpcUrl = chain.publicRpcUrls[0];
3393
- const customTokenContract = new import_ethers6.ethers.Contract(
3349
+ const customTokenContract = new import_ethers7.ethers.Contract(
3394
3350
  tokenAddress.toLowerCase(),
3395
3351
  ERC20Abi,
3396
- import_ethers6.ethers.getDefaultProvider(rpcUrl)
3352
+ import_ethers7.ethers.getDefaultProvider(rpcUrl)
3397
3353
  );
3398
3354
  try {
3399
3355
  const query = async (contract, method, args = []) => {
@@ -3432,7 +3388,7 @@ var renderTxStatus = async (txChainId, txHash) => {
3432
3388
  ({ web3Environment, swapSupported }) => web3Environment === "mainnet" /* MAINNET */ && swapSupported
3433
3389
  );
3434
3390
  const messageSentEvent = txReceipt.logs?.find((log) => {
3435
- return log.topics[0] === import_ethers7.ethers.utils.id(MSG_SENT_EVENT_SIG);
3391
+ return log.topics[0] === import_ethers8.ethers.utils.id(MSG_SENT_EVENT_SIG);
3436
3392
  });
3437
3393
  if (!messageSentEvent) {
3438
3394
  throw new Error(
@@ -3440,7 +3396,7 @@ var renderTxStatus = async (txChainId, txHash) => {
3440
3396
  );
3441
3397
  }
3442
3398
  const messageId = messageSentEvent?.topics[1];
3443
- const iface = new import_ethers7.ethers.utils.Interface(MSG_SENT_EVENT_ABI);
3399
+ const iface = new import_ethers8.ethers.utils.Interface(MSG_SENT_EVENT_ABI);
3444
3400
  const decodedMessageSentEvent = iface.parseLog(messageSentEvent);
3445
3401
  if (!decodedMessageSentEvent) {
3446
3402
  throw new Error(
@@ -3490,16 +3446,16 @@ var renderTxStatus = async (txChainId, txHash) => {
3490
3446
  if (!xSwapRouterOnDestinationAddress) {
3491
3447
  throw new Error(`Unknown destination XSwapRouter!`);
3492
3448
  }
3493
- const xSwapRouterOnDestination = new import_ethers7.ethers.Contract(
3449
+ const xSwapRouterOnDestination = new import_ethers8.ethers.Contract(
3494
3450
  xSwapRouterOnDestinationAddress,
3495
3451
  MSG_RECEIVED_EVENT_ABI,
3496
- import_ethers7.ethers.getDefaultProvider(
3452
+ import_ethers8.ethers.getDefaultProvider(
3497
3453
  supportedChains.find((chain) => chain.chainId === dstChainId)?.publicRpcUrls[0]
3498
3454
  )
3499
3455
  );
3500
3456
  const msgReceivedEventFilter = {
3501
3457
  address: xSwapRouterOnDestinationAddress,
3502
- topics: [import_ethers7.ethers.utils.id(MSG_RECEIVED_EVENT_SIG), messageId]
3458
+ topics: [import_ethers8.ethers.utils.id(MSG_RECEIVED_EVENT_SIG), messageId]
3503
3459
  };
3504
3460
  const onSuccess = async () => {
3505
3461
  updateTransactionDoneInRenderedTransactions(txHash);
@@ -3530,7 +3486,7 @@ var getTxReceipt = async (txChainId, txHash) => {
3530
3486
  const chain = (await getChains()).find(
3531
3487
  (chain2) => chain2.chainId === txChainId
3532
3488
  );
3533
- const provider = new import_ethers7.ethers.providers.JsonRpcProvider(
3489
+ const provider = new import_ethers8.ethers.providers.JsonRpcProvider(
3534
3490
  chain?.publicRpcUrls[0]
3535
3491
  );
3536
3492
  return await (0, import_async_retry.default)(async () => {
@@ -3554,7 +3510,7 @@ var openTransactionModal = async ({
3554
3510
  dstToken,
3555
3511
  customContractCalls = [],
3556
3512
  desc,
3557
- retrunTransactions,
3513
+ returnTransactions,
3558
3514
  dstDisplayToken
3559
3515
  }) => {
3560
3516
  const supportedChains = (await getChains()).filter(
@@ -3568,10 +3524,10 @@ var openTransactionModal = async ({
3568
3524
  customContractCalls,
3569
3525
  desc,
3570
3526
  supportedChains,
3571
- retrunTransactions,
3527
+ returnTransactions,
3572
3528
  dstDisplayTokenAddr: dstDisplayToken
3573
3529
  });
3574
- if (retrunTransactions) {
3530
+ if (returnTransactions) {
3575
3531
  return route.transactions;
3576
3532
  }
3577
3533
  };