@xswap-link/sdk 0.2.1 → 0.2.3

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.mjs CHANGED
@@ -5,82 +5,8 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
5
5
  throw Error('Dynamic require of "' + x + '" is not supported');
6
6
  });
7
7
 
8
- // src/components/Alert/index.tsx
9
- import { jsxs } from "react/jsx-runtime";
10
- var Alert = ({ desc }) => {
11
- return /* @__PURE__ */ jsxs("div", { className: "border border-solid border-x_alert rounded-3xl text-x_alert_light text-xs py-0.5 px-2", children: [
12
- "\u26A0\uFE0F ",
13
- desc
14
- ] });
15
- };
16
-
17
- // src/components/TxConfigForm/index.tsx
18
- import { useMemo as useMemo7 } from "react";
8
+ // src/config/init.ts
19
9
  import { createRoot } from "react-dom/client";
20
- import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
21
- import { WagmiProvider } from "wagmi";
22
-
23
- // src/config/wagmiConfig.ts
24
- import { createConfig, http } from "wagmi";
25
- import { injected, metaMask, walletConnect, safe } from "wagmi/connectors";
26
- import * as WagmiChains from "viem/chains";
27
- import { mainnet } from "viem/chains";
28
- var getWagmiConfig = (supportedChains) => {
29
- const chains = mapChains(supportedChains);
30
- const transports = mapTransports(chains);
31
- return createConfig({
32
- chains,
33
- transports,
34
- connectors: [
35
- injected(),
36
- metaMask(),
37
- safe(),
38
- walletConnect({ projectId: "c392898b45ac587a280b5eb33e92aeb0" })
39
- ]
40
- });
41
- };
42
- var mapChains = (supportedChains) => {
43
- const result = [mainnet];
44
- result.push(
45
- ...Object.values(WagmiChains).filter(
46
- (chain) => chain.id !== mainnet.id && supportedChains.some(({ chainId }) => chainId === chain.id.toString())
47
- )
48
- );
49
- return result;
50
- };
51
- var mapTransports = (chains) => {
52
- const transports = {};
53
- chains.forEach((chain) => {
54
- transports[chain.id] = http();
55
- });
56
- return transports;
57
- };
58
-
59
- // src/components/icons/CloseIcon.tsx
60
- import { jsx } from "react/jsx-runtime";
61
- var CloseIcon = () => {
62
- return /* @__PURE__ */ jsx(
63
- "svg",
64
- {
65
- height: "18",
66
- width: "18",
67
- xmlns: "http://www.w3.org/2000/svg",
68
- viewBox: "0 0 10.312 8.319",
69
- children: /* @__PURE__ */ jsx(
70
- "path",
71
- {
72
- fill: "white",
73
- d: "M6.073 4.078 10.151 0H9.093A1.87 1.87 0 0 0 7.77.548L5.157 3.162 2.543.548A1.87 1.87 0 0 0 1.22 0H.161L4.24 4.078 0 8.318h1.058a1.87 1.87 0 0 0 1.322-.547l2.777-2.777 2.776 2.777a1.869 1.869 0 0 0 1.322.548h1.058Z"
74
- }
75
- )
76
- }
77
- );
78
- };
79
-
80
- // src/components/TxConfigForm/Form.tsx
81
- import { useEffect as useEffect7, useState as useState8 } from "react";
82
- import { ethers as ethers4 } from "ethers";
83
- import { useAccount, useSwitchChain } from "wagmi";
84
10
 
85
11
  // xswap.config.ts
86
12
  var xSwapConfig = {
@@ -96,6 +22,76 @@ var xswap_config_default = {
96
22
  ...xSwapConfigLocal
97
23
  };
98
24
 
25
+ // package.json
26
+ var version = "0.2.3";
27
+
28
+ // src/config/init.ts
29
+ var xswapRoot;
30
+ var txStatusRoot;
31
+ var initDocument = () => {
32
+ if (typeof document === "undefined") {
33
+ throw new Error("Can't render XPay components from server side.");
34
+ }
35
+ const cssRequestParams = new URLSearchParams({
36
+ data: JSON.stringify({ version })
37
+ });
38
+ fetch(`${xswap_config_default.apiUrl}/sdk/css?${cssRequestParams}`).then(
39
+ async (css) => {
40
+ const style = document.createElement("style");
41
+ style.textContent = await css.text();
42
+ document.body.appendChild(style);
43
+ }
44
+ );
45
+ const xswapElement = document.createElement("div");
46
+ xswapElement.setAttribute("id", "xswap-modal");
47
+ document.body.appendChild(xswapElement);
48
+ xswapRoot = createRoot(xswapElement);
49
+ const txStatusElement = document.createElement("div");
50
+ txStatusElement.setAttribute("id", "xswap-tx-status");
51
+ txStatusElement.setAttribute("class", "xswap-tx-status");
52
+ document.body.appendChild(txStatusElement);
53
+ txStatusRoot = createRoot(txStatusElement);
54
+ };
55
+
56
+ // src/models/Addresses.ts
57
+ var ContractName = /* @__PURE__ */ ((ContractName2) => {
58
+ ContractName2["BatchQuery"] = "BatchQuery";
59
+ ContractName2["FeeCollector"] = "FeeCollector";
60
+ ContractName2["XSwapRouter"] = "XSwapRouter";
61
+ return ContractName2;
62
+ })(ContractName || {});
63
+
64
+ // src/models/Ecosystem.ts
65
+ var Ecosystem = /* @__PURE__ */ ((Ecosystem2) => {
66
+ Ecosystem2["EVM"] = "evm";
67
+ return Ecosystem2;
68
+ })(Ecosystem || {});
69
+
70
+ // src/models/Environment.ts
71
+ var Environment = /* @__PURE__ */ ((Environment2) => {
72
+ Environment2["PROD"] = "production";
73
+ Environment2["DEV"] = "develop";
74
+ Environment2["LOCAL"] = "local";
75
+ return Environment2;
76
+ })(Environment || {});
77
+
78
+ // src/models/Web3Environment.ts
79
+ var Web3Environment = /* @__PURE__ */ ((Web3Environment2) => {
80
+ Web3Environment2["DEVNET"] = "devnet";
81
+ Web3Environment2["TESTNET"] = "testnet";
82
+ Web3Environment2["MAINNET"] = "mainnet";
83
+ return Web3Environment2;
84
+ })(Web3Environment || {});
85
+
86
+ // src/models/XSwapCallType.ts
87
+ var XSwapCallType = /* @__PURE__ */ ((XSwapCallType2) => {
88
+ XSwapCallType2[XSwapCallType2["DEFAULT"] = 0] = "DEFAULT";
89
+ XSwapCallType2[XSwapCallType2["FULL_TOKEN_BALANCE"] = 1] = "FULL_TOKEN_BALANCE";
90
+ XSwapCallType2[XSwapCallType2["FULL_NATIVE_BALANCE"] = 2] = "FULL_NATIVE_BALANCE";
91
+ XSwapCallType2[XSwapCallType2["COLLECT_TOKEN_BALANCE"] = 3] = "COLLECT_TOKEN_BALANCE";
92
+ return XSwapCallType2;
93
+ })(XSwapCallType || {});
94
+
99
95
  // src/services/api.ts
100
96
  async function _sendRequest(urlPath, options) {
101
97
  const response = await fetch(`${xswap_config_default.apiUrl}${urlPath}`, {
@@ -124,26 +120,6 @@ async function getChains(ecosystem) {
124
120
  return _sendRequest(`/chains?data=${JSON.stringify({ ecosystem })}
125
121
  `);
126
122
  }
127
- async function getChainData(chainId, ecosystem) {
128
- return _sendRequest(
129
- `/chains?data=${JSON.stringify({
130
- chainId,
131
- ecosystem
132
- })}`
133
- );
134
- }
135
- async function getTokens(chainId, address, ecosystem) {
136
- return _sendRequest(
137
- `/tokens?data=${JSON.stringify({
138
- chainId,
139
- address,
140
- ecosystem
141
- })}`
142
- );
143
- }
144
- async function getBridgeTokens() {
145
- return _sendRequest(`/bridgeTokens`);
146
- }
147
123
  async function getHistory(payload) {
148
124
  return await _sendRequest(
149
125
  `/history?${new URLSearchParams({
@@ -162,45 +138,6 @@ async function getPrices(payload) {
162
138
  // src/services/integrations/customCalls/staking.ts
163
139
  import { ethers as ethers2 } from "ethers";
164
140
 
165
- // src/models/Addresses.ts
166
- var ContractName = /* @__PURE__ */ ((ContractName2) => {
167
- ContractName2["BatchQuery"] = "BatchQuery";
168
- ContractName2["FeeCollector"] = "FeeCollector";
169
- ContractName2["XSwapRouter"] = "XSwapRouter";
170
- return ContractName2;
171
- })(ContractName || {});
172
-
173
- // src/models/Ecosystem.ts
174
- var Ecosystem = /* @__PURE__ */ ((Ecosystem2) => {
175
- Ecosystem2["EVM"] = "evm";
176
- return Ecosystem2;
177
- })(Ecosystem || {});
178
-
179
- // src/models/Environment.ts
180
- var Environment = /* @__PURE__ */ ((Environment2) => {
181
- Environment2["PROD"] = "production";
182
- Environment2["DEV"] = "develop";
183
- Environment2["LOCAL"] = "local";
184
- return Environment2;
185
- })(Environment || {});
186
-
187
- // src/models/Web3Environment.ts
188
- var Web3Environment = /* @__PURE__ */ ((Web3Environment2) => {
189
- Web3Environment2["DEVNET"] = "devnet";
190
- Web3Environment2["TESTNET"] = "testnet";
191
- Web3Environment2["MAINNET"] = "mainnet";
192
- return Web3Environment2;
193
- })(Web3Environment || {});
194
-
195
- // src/models/XSwapCallType.ts
196
- var XSwapCallType = /* @__PURE__ */ ((XSwapCallType2) => {
197
- XSwapCallType2[XSwapCallType2["DEFAULT"] = 0] = "DEFAULT";
198
- XSwapCallType2[XSwapCallType2["FULL_TOKEN_BALANCE"] = 1] = "FULL_TOKEN_BALANCE";
199
- XSwapCallType2[XSwapCallType2["FULL_NATIVE_BALANCE"] = 2] = "FULL_NATIVE_BALANCE";
200
- XSwapCallType2[XSwapCallType2["COLLECT_TOKEN_BALANCE"] = 3] = "COLLECT_TOKEN_BALANCE";
201
- return XSwapCallType2;
202
- })(XSwapCallType || {});
203
-
204
141
  // src/utils/contracts.ts
205
142
  import { ethers } from "ethers";
206
143
 
@@ -227,16 +164,6 @@ var weiToHumanReadable = ({
227
164
  }
228
165
  return res;
229
166
  };
230
- var generateRandomBigNumber = (length) => {
231
- return BigNumber.from(utils.randomBytes(length));
232
- };
233
- var generateUniqueRandomBigNumber = (length, existingValues) => {
234
- let result;
235
- while (result === void 0 || existingValues.includes(result)) {
236
- result = generateRandomBigNumber(length);
237
- }
238
- return result;
239
- };
240
167
 
241
168
  // src/contracts/abi/BatchQuery.json
242
169
  var BatchQuery_default = [
@@ -583,17 +510,6 @@ var MSG_RECEIVED_EVENT_ABI = [
583
510
 
584
511
  // src/utils/contracts.ts
585
512
  var IERC20 = new ethers.utils.Interface(ERC20Abi);
586
- var getBalanceOf = async (wallet, token, rpcUrl) => {
587
- const provider = ethers.getDefaultProvider(rpcUrl);
588
- if (token === ethers.constants.AddressZero) {
589
- return ethers.utils.formatEther(await provider.getBalance(wallet));
590
- }
591
- const contract = new ethers.Contract(token, ERC20Abi, provider);
592
- return ethers.utils.formatUnits(
593
- await contract.balanceOf(wallet),
594
- await contract.decimals()
595
- );
596
- };
597
513
  var getBalances = async (chain, wallet) => {
598
514
  return {
599
515
  ...await getNativeBalance(chain, wallet),
@@ -644,35 +560,6 @@ var getErc20Balances = async (chain, wallet) => {
644
560
  });
645
561
  return balances;
646
562
  };
647
- var generateApproveTxData = (tokenAddress, spender, amount) => {
648
- return tokenAddress !== ethers.constants.AddressZero ? {
649
- to: tokenAddress,
650
- value: safeBigNumberFrom("0"),
651
- data: IERC20.encodeFunctionData("approve", [spender, amount])
652
- } : void 0;
653
- };
654
- var findPlaceholderIndex = (abi, funName, funParams, placeholderValue) => {
655
- if (funParams.flat(Infinity).filter((param) => param === placeholderValue).length !== 1) {
656
- throw new Error("Random placeholder value must be provided and unique.");
657
- }
658
- const iface = new ethers.utils.Interface(abi);
659
- const functionFragment = iface.getFunction(funName);
660
- if (!functionFragment) {
661
- throw new Error(`Can't find function "${funName}" in provided ABI.`);
662
- }
663
- const encodedFunData = iface.encodeFunctionData(functionFragment, funParams);
664
- const paramData = encodedFunData.slice(10);
665
- const chunks = [];
666
- for (let i = 0; i < paramData.length; i += 64) {
667
- chunks.push(paramData.slice(i, i + 64));
668
- }
669
- const searchValue = placeholderValue.toHexString().slice(2).padStart(64, "0");
670
- const result = chunks.findIndex((chunk) => chunk === searchValue);
671
- if (result === -1) {
672
- throw new Error("Randomized parameter not found in the encoded data.");
673
- }
674
- return result;
675
- };
676
563
 
677
564
  // src/utils/strings.ts
678
565
  var shortAddress = (address) => {
@@ -684,19 +571,6 @@ var shortAddress = (address) => {
684
571
 
685
572
  // src/utils/index.ts
686
573
  import { format } from "date-fns";
687
- var replaceNull = (values, newValue) => {
688
- const modifiedValues = [...values];
689
- for (let i = 0; i < modifiedValues.length; i++) {
690
- if (Array.isArray(modifiedValues[i])) {
691
- modifiedValues[i] = replaceNull(modifiedValues[i], newValue);
692
- } else {
693
- if (modifiedValues[i] === null) {
694
- modifiedValues[i] = newValue;
695
- }
696
- }
697
- }
698
- return modifiedValues;
699
- };
700
574
  var deepMergeObjects = (obj1, obj2) => {
701
575
  for (const key in obj2) {
702
576
  if (obj2.hasOwnProperty(key)) {
@@ -721,229 +595,79 @@ var getDate = (blockTimestamp) => {
721
595
  return format(date, "d MMM yyyy HH:mm:ss");
722
596
  };
723
597
 
724
- // src/services/integrations/customCalls/staking.ts
725
- var generateStakingCalls = ({
726
- token,
727
- staking,
728
- stakingAbi,
729
- stakingFunName,
730
- stakingFunParams
731
- }) => {
732
- const flatStakingFunParams = stakingFunParams.flat(Infinity);
733
- if (flatStakingFunParams.filter((param) => param === null).length !== 1) {
734
- throw new Error(
735
- "Exactly 1 'null' value should be provided in 'funParams' in order to override token balance"
736
- );
737
- }
738
- const randomBigNumber = generateUniqueRandomBigNumber(
739
- 32,
740
- flatStakingFunParams
741
- );
742
- const modifiedStakingFunParams = replaceNull(
743
- stakingFunParams,
744
- randomBigNumber
745
- );
746
- const approveFunParams = [staking, randomBigNumber];
747
- const stakingApproveCall = {
748
- callType: 1 /* FULL_TOKEN_BALANCE */,
749
- target: token,
750
- callData: IERC20.encodeFunctionData("approve", approveFunParams),
751
- payload: ethers2.utils.defaultAbiCoder.encode(
752
- ["address", "uint256"],
753
- [
754
- token,
755
- findPlaceholderIndex(
756
- JSON.stringify(ERC20Abi),
757
- "approve",
758
- approveFunParams,
759
- randomBigNumber
760
- )
761
- ]
762
- ),
763
- value: "0"
764
- };
765
- const stakingCall = {
766
- callType: 1 /* FULL_TOKEN_BALANCE */,
767
- target: staking,
768
- callData: new ethers2.utils.Interface(stakingAbi).encodeFunctionData(
769
- stakingFunName,
770
- modifiedStakingFunParams
771
- ),
772
- payload: ethers2.utils.defaultAbiCoder.encode(
773
- ["address", "uint256"],
774
- [
775
- token,
776
- findPlaceholderIndex(
777
- stakingAbi,
778
- stakingFunName,
779
- modifiedStakingFunParams,
780
- randomBigNumber
781
- )
782
- ]
783
- ),
784
- value: "0"
785
- };
786
- return [stakingApproveCall, stakingCall];
787
- };
788
-
789
598
  // src/services/integrations/monitoring.ts
790
- import { ethers as ethers3 } from "ethers";
791
- import retry from "async-retry";
792
- var monitorTransactionStatus = async (txChainId, txHash) => {
793
- const txReceipt = await getTxReceipt(txChainId, txHash);
794
- const supportedChains = (await getChains()).filter(
795
- ({ web3Environment, swapSupported }) => web3Environment === "mainnet" /* MAINNET */ && swapSupported
796
- );
797
- const messageSentEvent = txReceipt.logs?.find((log) => {
798
- return log.topics[0] === ethers3.utils.id(MSG_SENT_EVENT_SIG);
799
- });
800
- if (!messageSentEvent) {
801
- throw new Error(
802
- `No transaction event found for chain ${txChainId} tx ${txHash}`
803
- );
804
- }
805
- const messageId = messageSentEvent?.topics[1];
806
- const iface = new ethers3.utils.Interface(MSG_SENT_EVENT_ABI);
807
- const decodedMessageSentEvent = iface.parseLog(messageSentEvent);
808
- if (!decodedMessageSentEvent) {
809
- throw new Error(
810
- `No transaction event arguments found for chain ${txChainId} tx ${txHash}`
811
- );
812
- }
813
- const srcChain = supportedChains.find(
814
- (chain) => chain.chainId === txChainId.toString()
815
- );
816
- const srcToken = srcChain?.tokens.find(
817
- (token) => token.address === decodedMessageSentEvent.args?.token.toString()
818
- );
819
- const dstChain = supportedChains.find(
820
- (chain) => chain.ccipChainId === decodedMessageSentEvent.args?.destinationChainSelector?.toString()
821
- );
822
- const dstChainId = dstChain?.chainId;
823
- if (!dstChainId) {
824
- throw new Error(`Unknown destination chain!`);
825
- }
826
- const transaction = {
827
- txHash,
828
- fromChain: srcChain?.displayName,
829
- fromChainImage: srcChain?.image,
830
- toChain: dstChain.displayName,
831
- toChainImage: dstChain.image,
832
- fromToken: srcToken?.symbol,
833
- fromTokenImage: srcToken?.image,
834
- fromAmount: weiToHumanReadable({
835
- amount: decodedMessageSentEvent.args?.tokenAmount.toString(),
836
- decimals: srcToken?.decimals || 18,
837
- precisionFractionalPlaces: 4
838
- }),
839
- isDone: false,
840
- explorer: `${CCIP_EXPLORER}/tx/${txHash}`
841
- };
842
- addTransactionToRenderedTransactions(transaction);
843
- renderTxHistoryButtons();
844
- const xSwapRouterOnDestinationAddress = ADDRESSES[dstChainId]?.XSwapRouter;
845
- if (!xSwapRouterOnDestinationAddress) {
846
- throw new Error(`Unknown destination XSwapRouter!`);
847
- }
848
- const xSwapRouterOnDestination = new ethers3.Contract(
849
- xSwapRouterOnDestinationAddress,
850
- MSG_RECEIVED_EVENT_ABI,
851
- ethers3.getDefaultProvider(
852
- supportedChains.find((chain) => chain.chainId === dstChainId)?.publicRpcUrls[0]
853
- )
854
- );
855
- const msgReceivedEventFilter = {
856
- address: xSwapRouterOnDestinationAddress,
857
- topics: [ethers3.utils.id(MSG_RECEIVED_EVENT_SIG), messageId]
858
- };
859
- const onSuccess = async () => {
860
- updateTransactionDoneInRenderedTransactions(txHash);
861
- renderTxHistoryButtons();
862
- await new Promise(
863
- (resolve) => setTimeout(() => resolve(true), TX_RECEIPT_STATUS_LIFETIME)
864
- );
865
- removeTransactionFromRenderedTransactions(txHash);
866
- renderTxHistoryButtons();
867
- };
868
- xSwapRouterOnDestination.once(msgReceivedEventFilter, () => onSuccess());
869
- };
870
- var getTxReceipt = async (txChainId, txHash) => {
871
- try {
872
- const chain = (await getChains()).find(
873
- (chain2) => chain2.chainId === txChainId
874
- );
875
- const provider = new ethers3.providers.JsonRpcProvider(
876
- chain?.publicRpcUrls[0]
877
- );
878
- return await retry(async () => {
879
- const txReceipt = await provider.getTransactionReceipt(txHash);
880
- if (!txReceipt) {
881
- throw new Error(`Couldn't fetch tx receipt`);
882
- }
883
- return txReceipt;
884
- });
885
- } catch (e) {
886
- throw new Error(
887
- `Couldn't fetch tx ${txHash} receipt on chain ${txChainId}`
888
- );
889
- }
599
+ import { ethers as ethers4 } from "ethers";
600
+
601
+ // src/components/Alert/index.tsx
602
+ import { jsxs } from "react/jsx-runtime";
603
+ var Alert = ({ desc }) => {
604
+ return /* @__PURE__ */ jsxs("div", { className: "border border-solid border-x_alert rounded-3xl text-x_alert_light text-xs py-0.5 px-2", children: [
605
+ "\u26A0\uFE0F ",
606
+ desc
607
+ ] });
890
608
  };
891
609
 
892
- // src/services/integrations/transactions.ts
893
- var getSwapTx = async ({
894
- dstChain,
895
- dstToken,
896
- customContractCalls = [],
897
- desc
898
- }) => {
899
- const supportedChains = (await getChains()).filter(
900
- ({ web3Environment, swapSupported }) => web3Environment === "mainnet" /* MAINNET */ && swapSupported
901
- );
902
- validateSwapTxData(supportedChains, dstChain, dstToken);
903
- const route = await openTxConfigForm({
904
- dstChainId: dstChain,
905
- dstTokenAddr: dstToken,
906
- customContractCalls,
907
- desc,
908
- supportedChains
610
+ // src/components/TxConfigForm/index.tsx
611
+ import { useMemo as useMemo7 } from "react";
612
+ import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
613
+ import { WagmiProvider } from "wagmi";
614
+
615
+ // src/config/wagmiConfig.ts
616
+ import { createConfig, http } from "wagmi";
617
+ import { injected, metaMask, walletConnect, safe } from "wagmi/connectors";
618
+ import * as WagmiChains from "viem/chains";
619
+ import { mainnet } from "viem/chains";
620
+ var getWagmiConfig = (supportedChains) => {
621
+ const chains = mapChains(supportedChains);
622
+ const transports = mapTransports(chains);
623
+ return createConfig({
624
+ chains,
625
+ transports,
626
+ connectors: [
627
+ injected(),
628
+ metaMask(),
629
+ safe(),
630
+ walletConnect({ projectId: "c392898b45ac587a280b5eb33e92aeb0" })
631
+ ]
909
632
  });
910
- return route.transactions;
911
633
  };
912
- var validateSwapTxData = (supportedChains, dstChain, dstToken) => {
913
- const supportedDstChain = supportedChains.find(
914
- ({ chainId }) => chainId === dstChain
634
+ var mapChains = (supportedChains) => {
635
+ const result = [mainnet];
636
+ result.push(
637
+ ...Object.values(WagmiChains).filter(
638
+ (chain) => chain.id !== mainnet.id && supportedChains.some(({ chainId }) => chainId === chain.id.toString())
639
+ )
915
640
  );
916
- if (!supportedDstChain) {
917
- throw new Error(`Provided chain '${dstChain}' is not supported`);
918
- }
919
- if (!supportedDstChain.tokens.some(({ address }) => address === dstToken)) {
920
- throw new Error(`Provided token '${dstToken}' is not supported`);
921
- }
641
+ return result;
922
642
  };
923
-
924
- // src/hooks/useDebounce.tsx
925
- import { useEffect, useRef, useState } from "react";
926
- var useDebounce = (value, delay) => {
927
- const timeoutRef = useRef(null);
928
- useEffect(() => {
929
- if (timeoutRef.current) clearTimeout(timeoutRef.current);
930
- timeoutRef.current = setTimeout(() => {
931
- setValue(value);
932
- }, delay);
933
- return () => {
934
- if (timeoutRef.current) clearTimeout(timeoutRef.current);
935
- };
936
- }, [value, delay]);
937
- const [debouncedValue, setValue] = useState(value);
938
- return debouncedValue;
643
+ var mapTransports = (chains) => {
644
+ const transports = {};
645
+ chains.forEach((chain) => {
646
+ transports[chain.id] = http();
647
+ });
648
+ return transports;
939
649
  };
940
650
 
941
- // src/components/TxConfigForm/History.tsx
942
- import { useCallback as useCallback2, useEffect as useEffect2, useState as useState2 } from "react";
943
- import BigNumberJS2 from "bignumber.js";
944
-
945
- // src/components/TxConfigForm/HistoryCard.tsx
946
- import { useCallback, useMemo } from "react";
651
+ // src/components/icons/CloseIcon.tsx
652
+ import { jsx } from "react/jsx-runtime";
653
+ var CloseIcon = () => {
654
+ return /* @__PURE__ */ jsx(
655
+ "svg",
656
+ {
657
+ height: "18",
658
+ width: "18",
659
+ xmlns: "http://www.w3.org/2000/svg",
660
+ viewBox: "0 0 10.312 8.319",
661
+ children: /* @__PURE__ */ jsx(
662
+ "path",
663
+ {
664
+ fill: "white",
665
+ d: "M6.073 4.078 10.151 0H9.093A1.87 1.87 0 0 0 7.77.548L5.157 3.162 2.543.548A1.87 1.87 0 0 0 1.22 0H.161L4.24 4.078 0 8.318h1.058a1.87 1.87 0 0 0 1.322-.547l2.777-2.777 2.776 2.777a1.869 1.869 0 0 0 1.322.548h1.058Z"
666
+ }
667
+ )
668
+ }
669
+ );
670
+ };
947
671
 
948
672
  // src/components/icons/ArrowRightIcon.tsx
949
673
  import { jsx as jsx2 } from "react/jsx-runtime";
@@ -1361,8 +1085,46 @@ var XSwapLogo = () => {
1361
1085
  );
1362
1086
  };
1363
1087
 
1088
+ // src/components/TxConfigForm/PoweredBy.tsx
1089
+ import { jsx as jsx23, jsxs as jsxs6 } from "react/jsx-runtime";
1090
+ var PoweredBy = () => {
1091
+ return /* @__PURE__ */ jsxs6("div", { className: "flex justify-center items-center gap-2 my-3", children: [
1092
+ /* @__PURE__ */ jsx23("span", { className: "text-x_grey", children: "Powered by" }),
1093
+ /* @__PURE__ */ jsx23(XSwapBadgeIcon, {}),
1094
+ /* @__PURE__ */ jsx23("span", { children: "\u2715" }),
1095
+ /* @__PURE__ */ jsx23(ChainlinkCCIPIcon, {})
1096
+ ] });
1097
+ };
1098
+
1099
+ // src/components/TxConfigForm/Form.tsx
1100
+ import { useEffect as useEffect7, useState as useState8 } from "react";
1101
+ import { ethers as ethers3 } from "ethers";
1102
+ import { useAccount, useSwitchChain } from "wagmi";
1103
+
1104
+ // src/hooks/useDebounce.tsx
1105
+ import { useEffect, useRef, useState } from "react";
1106
+ var useDebounce = (value, delay) => {
1107
+ const timeoutRef = useRef(null);
1108
+ useEffect(() => {
1109
+ if (timeoutRef.current) clearTimeout(timeoutRef.current);
1110
+ timeoutRef.current = setTimeout(() => {
1111
+ setValue(value);
1112
+ }, delay);
1113
+ return () => {
1114
+ if (timeoutRef.current) clearTimeout(timeoutRef.current);
1115
+ };
1116
+ }, [value, delay]);
1117
+ const [debouncedValue, setValue] = useState(value);
1118
+ return debouncedValue;
1119
+ };
1120
+
1121
+ // src/components/TxConfigForm/History.tsx
1122
+ import { useCallback as useCallback2, useEffect as useEffect2, useState as useState2 } from "react";
1123
+ import BigNumberJS2 from "bignumber.js";
1124
+
1364
1125
  // src/components/TxConfigForm/HistoryCard.tsx
1365
- import { Fragment, jsx as jsx23, jsxs as jsxs6 } from "react/jsx-runtime";
1126
+ import { useCallback, useMemo } from "react";
1127
+ import { Fragment, jsx as jsx24, jsxs as jsxs7 } from "react/jsx-runtime";
1366
1128
  var HistoryCard = ({ transaction, supportedChains }) => {
1367
1129
  const date = getDate(transaction.timestamp);
1368
1130
  const supportedTokens = useMemo(() => {
@@ -1408,14 +1170,14 @@ var HistoryCard = ({ transaction, supportedChains }) => {
1408
1170
  const targetChainData = supportedChains.find(
1409
1171
  (chain) => chain.chainId === transaction.targetChainId
1410
1172
  );
1411
- return /* @__PURE__ */ jsxs6("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: [
1412
- /* @__PURE__ */ jsxs6("div", { className: "flex w-full items-center justify-between", children: [
1413
- /* @__PURE__ */ jsx23("div", { className: "text-sm sm:text-base", children: date }),
1414
- /* @__PURE__ */ jsxs6("div", { className: "flex items-center", children: [
1415
- transaction.status === "IN_PROGRESS" && /* @__PURE__ */ jsx23("div", { className: "flex items-center", children: /* @__PURE__ */ jsx23("div", { className: "text-[rgb(250,200,100)]", children: "In progress" }) }),
1416
- transaction.status === "DONE" && /* @__PURE__ */ jsx23("div", { className: "flex items-center", children: /* @__PURE__ */ jsx23("div", { className: "text-[rgb(100,200,100)]", children: "Done" }) }),
1417
- transaction.status === "REVERTED" && /* @__PURE__ */ jsx23("div", { className: "flex items-center", children: /* @__PURE__ */ jsx23("div", { className: "text-[rgb(255,100,100)]", children: "Reverted" }) }),
1418
- /* @__PURE__ */ jsx23(
1173
+ return /* @__PURE__ */ jsxs7("div", { className: "flex flex-col globalBorder rounded-xl bg-[rgb(15,15,15)] text-white text-xs sm:text-sm p-4 gap-3 mb-2", children: [
1174
+ /* @__PURE__ */ jsxs7("div", { className: "flex w-full items-center justify-between", children: [
1175
+ /* @__PURE__ */ jsx24("div", { className: "text-sm sm:text-base", children: date }),
1176
+ /* @__PURE__ */ jsxs7("div", { className: "flex items-center", children: [
1177
+ transaction.status === "IN_PROGRESS" && /* @__PURE__ */ jsx24("div", { className: "flex items-center", children: /* @__PURE__ */ jsx24("div", { className: "text-[rgb(250,200,100)]", children: "In progress" }) }),
1178
+ transaction.status === "DONE" && /* @__PURE__ */ jsx24("div", { className: "flex items-center", children: /* @__PURE__ */ jsx24("div", { className: "text-[rgb(100,200,100)]", children: "Done" }) }),
1179
+ transaction.status === "REVERTED" && /* @__PURE__ */ jsx24("div", { className: "flex items-center", children: /* @__PURE__ */ jsx24("div", { className: "text-[rgb(255,100,100)]", children: "Reverted" }) }),
1180
+ /* @__PURE__ */ jsx24(
1419
1181
  "a",
1420
1182
  {
1421
1183
  href: `${supportedChains.find(
@@ -1425,15 +1187,15 @@ var HistoryCard = ({ transaction, supportedChains }) => {
1425
1187
  rel: "noreferrer",
1426
1188
  className: "ml-2 no-underline",
1427
1189
  "aria-label": "Show the transaction in the chain explorer",
1428
- children: /* @__PURE__ */ jsx23("div", { className: "w-3.5 h-3.5", children: /* @__PURE__ */ jsx23(ArrowUpRightIcon, {}) })
1190
+ children: /* @__PURE__ */ jsx24("div", { className: "w-3.5 h-3.5", children: /* @__PURE__ */ jsx24(ArrowUpRightIcon, {}) })
1429
1191
  }
1430
1192
  )
1431
1193
  ] })
1432
1194
  ] }),
1433
- /* @__PURE__ */ jsxs6("div", { className: "flex justify-between flex-wrap gap-2", children: [
1434
- /* @__PURE__ */ jsxs6("div", { className: "flex items-center", children: [
1435
- /* @__PURE__ */ jsxs6("div", { className: "flex items-center", children: [
1436
- /* @__PURE__ */ jsx23(
1195
+ /* @__PURE__ */ jsxs7("div", { className: "flex justify-between flex-wrap gap-2", children: [
1196
+ /* @__PURE__ */ jsxs7("div", { className: "flex items-center", children: [
1197
+ /* @__PURE__ */ jsxs7("div", { className: "flex items-center", children: [
1198
+ /* @__PURE__ */ jsx24(
1437
1199
  "img",
1438
1200
  {
1439
1201
  src: sourceChainData?.image,
@@ -1441,11 +1203,11 @@ var HistoryCard = ({ transaction, supportedChains }) => {
1441
1203
  className: "w-5 h-5 mr-1"
1442
1204
  }
1443
1205
  ),
1444
- /* @__PURE__ */ jsx23("div", { children: sourceChainData?.displayName })
1206
+ /* @__PURE__ */ jsx24("div", { children: sourceChainData?.displayName })
1445
1207
  ] }),
1446
- /* @__PURE__ */ jsx23("div", { className: "w-3.5 h-3.5 my-0 mx-1.5", children: /* @__PURE__ */ jsx23(ArrowRightIcon, {}) }),
1447
- /* @__PURE__ */ jsxs6("div", { className: "flex items-center", children: [
1448
- /* @__PURE__ */ jsx23(
1208
+ /* @__PURE__ */ jsx24("div", { className: "w-3.5 h-3.5 my-0 mx-1.5", children: /* @__PURE__ */ jsx24(ArrowRightIcon, {}) }),
1209
+ /* @__PURE__ */ jsxs7("div", { className: "flex items-center", children: [
1210
+ /* @__PURE__ */ jsx24(
1449
1211
  "img",
1450
1212
  {
1451
1213
  src: targetChainData?.image,
@@ -1453,35 +1215,35 @@ var HistoryCard = ({ transaction, supportedChains }) => {
1453
1215
  className: "w-5 h-5 mr-1"
1454
1216
  }
1455
1217
  ),
1456
- /* @__PURE__ */ jsx23("div", { children: targetChainData?.displayName })
1218
+ /* @__PURE__ */ jsx24("div", { children: targetChainData?.displayName })
1457
1219
  ] })
1458
1220
  ] }),
1459
- /* @__PURE__ */ jsx23("div", { className: "flex items-center mb-2 last:mb-0", children: /* @__PURE__ */ jsxs6("div", { className: "flex items-center flex-wrap", children: [
1460
- /* @__PURE__ */ jsxs6("div", { className: "flex items-center", children: [
1221
+ /* @__PURE__ */ jsx24("div", { className: "flex items-center mb-2 last:mb-0", children: /* @__PURE__ */ jsxs7("div", { className: "flex items-center flex-wrap", children: [
1222
+ /* @__PURE__ */ jsxs7("div", { className: "flex items-center", children: [
1461
1223
  Number(transferredAmount) < MINIMUM_DISPLAYED_TOKEN_AMOUNT ? `<${MINIMUM_DISPLAYED_TOKEN_AMOUNT}` : transferredAmount,
1462
- /* @__PURE__ */ jsx23("div", { className: "ml-1", children: tokenData?.symbol }),
1463
- tokenData?.image ? /* @__PURE__ */ jsx23(
1224
+ /* @__PURE__ */ jsx24("div", { className: "ml-1", children: tokenData?.symbol }),
1225
+ tokenData?.image ? /* @__PURE__ */ jsx24(
1464
1226
  "img",
1465
1227
  {
1466
1228
  src: tokenData?.image,
1467
1229
  alt: tokenData?.name || "",
1468
1230
  className: "w-5 h-5 ml-1"
1469
1231
  }
1470
- ) : /* @__PURE__ */ jsx23("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) })
1232
+ ) : /* @__PURE__ */ jsx24("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) })
1471
1233
  ] }),
1472
- transaction.tokenOutAddress && /* @__PURE__ */ jsxs6(Fragment, { children: [
1473
- /* @__PURE__ */ jsx23("div", { className: "w-3.5 h-3.5 my-0 mx-1.5", children: /* @__PURE__ */ jsx23(ArrowRightIcon, {}) }),
1474
- /* @__PURE__ */ jsxs6("div", { className: "flex items-center", children: [
1234
+ transaction.tokenOutAddress && /* @__PURE__ */ jsxs7(Fragment, { children: [
1235
+ /* @__PURE__ */ jsx24("div", { className: "w-3.5 h-3.5 my-0 mx-1.5", children: /* @__PURE__ */ jsx24(ArrowRightIcon, {}) }),
1236
+ /* @__PURE__ */ jsxs7("div", { className: "flex items-center", children: [
1475
1237
  Number(receivedAmount) < 1e-4 ? "<0.0001" : receivedAmount,
1476
- /* @__PURE__ */ jsx23("div", { className: "ml-1", children: tokenOutData?.symbol }),
1477
- tokenOutData?.image ? /* @__PURE__ */ jsx23(
1238
+ /* @__PURE__ */ jsx24("div", { className: "ml-1", children: tokenOutData?.symbol }),
1239
+ tokenOutData?.image ? /* @__PURE__ */ jsx24(
1478
1240
  "img",
1479
1241
  {
1480
1242
  src: tokenOutData?.image,
1481
1243
  alt: tokenOutData?.name || "",
1482
1244
  className: "w-5 h-5 ml-1"
1483
1245
  }
1484
- ) : /* @__PURE__ */ jsx23("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) })
1246
+ ) : /* @__PURE__ */ jsx24("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) })
1485
1247
  ] })
1486
1248
  ] })
1487
1249
  ] }) })
@@ -1490,7 +1252,7 @@ var HistoryCard = ({ transaction, supportedChains }) => {
1490
1252
  };
1491
1253
 
1492
1254
  // src/components/TxConfigForm/History.tsx
1493
- import { jsx as jsx24, jsxs as jsxs7 } from "react/jsx-runtime";
1255
+ import { jsx as jsx25, jsxs as jsxs8 } from "react/jsx-runtime";
1494
1256
  var History = ({ signer, supportedChains }) => {
1495
1257
  const [fetchedHistory, setFetchedHistory] = useState2();
1496
1258
  const [historyLoadedOnce, setHistoryLoadedOnce] = useState2(false);
@@ -1542,11 +1304,11 @@ var History = ({ signer, supportedChains }) => {
1542
1304
  return () => clearInterval(timer);
1543
1305
  }, [signer, fetchHistory, getHistory, historyLoadedOnce]);
1544
1306
  if (!signer)
1545
- return /* @__PURE__ */ jsx24("div", { className: "flex items-center justify-center w-full h-[30vh]", children: "Connect a wallet to browse history" });
1546
- return /* @__PURE__ */ jsx24("div", { className: "flex items-center justify-center w-full", children: /* @__PURE__ */ jsxs7("div", { className: "w-full h-96 overflow-scroll overflow-x-hidden", children: [
1547
- fetchedHistory?.length === 0 && historyLoadedOnce && /* @__PURE__ */ jsx24("div", { className: "w-full text-center py-4 px-0 text-[rgb(158,158,158)]", children: "Your history is empty..." }),
1548
- !fetchedHistory && !historyLoadedOnce && /* @__PURE__ */ jsx24("div", { className: "flex w-full h-full items-center justify-center", children: /* @__PURE__ */ jsx24(CircularProgressIcon, {}) }),
1549
- fetchedHistory?.map((transaction, index) => /* @__PURE__ */ jsx24(
1307
+ return /* @__PURE__ */ jsx25("div", { className: "flex items-center justify-center w-full h-[30vh]", children: "Connect a wallet to browse history" });
1308
+ return /* @__PURE__ */ jsx25("div", { className: "flex items-center justify-center w-full", children: /* @__PURE__ */ jsxs8("div", { className: "w-full h-96 overflow-scroll overflow-x-hidden", children: [
1309
+ fetchedHistory?.length === 0 && historyLoadedOnce && /* @__PURE__ */ jsx25("div", { className: "w-full text-center py-4 px-0 text-[rgb(158,158,158)]", children: "Your history is empty..." }),
1310
+ !fetchedHistory && !historyLoadedOnce && /* @__PURE__ */ jsx25("div", { className: "flex w-full h-full items-center justify-center", children: /* @__PURE__ */ jsx25(CircularProgressIcon, {}) }),
1311
+ fetchedHistory?.map((transaction, index) => /* @__PURE__ */ jsx25(
1550
1312
  HistoryCard,
1551
1313
  {
1552
1314
  transaction,
@@ -1558,30 +1320,30 @@ var History = ({ signer, supportedChains }) => {
1558
1320
  };
1559
1321
 
1560
1322
  // src/components/TxConfigForm/TopBar.tsx
1561
- import { Fragment as Fragment2, jsx as jsx25, jsxs as jsxs8 } from "react/jsx-runtime";
1323
+ import { Fragment as Fragment2, jsx as jsx26, jsxs as jsxs9 } from "react/jsx-runtime";
1562
1324
  var TopBar = ({
1563
1325
  signer,
1564
1326
  setSettingsShown,
1565
1327
  setHistoryTabShown,
1566
1328
  historyTabShown
1567
1329
  }) => {
1568
- return /* @__PURE__ */ jsxs8("div", { className: "flex w-full justify-between items-center mx-auto sm:pl-4 pr-8 pt-2", children: [
1569
- /* @__PURE__ */ jsx25("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` }),
1570
- /* @__PURE__ */ jsxs8("div", { className: "flex gap-2", children: [
1571
- !historyTabShown && /* @__PURE__ */ jsx25(
1330
+ return /* @__PURE__ */ jsxs9("div", { className: "flex w-full justify-between items-center mx-auto sm:pl-4 pr-8 pt-2", children: [
1331
+ /* @__PURE__ */ jsx26("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` }),
1332
+ /* @__PURE__ */ jsxs9("div", { className: "flex gap-2", children: [
1333
+ !historyTabShown && /* @__PURE__ */ jsx26(
1572
1334
  "div",
1573
1335
  {
1574
1336
  onClick: () => setSettingsShown(true),
1575
1337
  className: "flex items-center text-xs gap-1 cursor-pointer",
1576
- children: /* @__PURE__ */ jsx25("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__ */ jsx25(SettingsIcon, {}) })
1338
+ children: /* @__PURE__ */ jsx26("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__ */ jsx26(SettingsIcon, {}) })
1577
1339
  }
1578
1340
  ),
1579
- /* @__PURE__ */ jsx25(
1341
+ /* @__PURE__ */ jsx26(
1580
1342
  "div",
1581
1343
  {
1582
1344
  onClick: () => setHistoryTabShown((x) => !x),
1583
1345
  className: "flex items-center text-sm gap-1 cursor-pointer",
1584
- children: !historyTabShown ? /* @__PURE__ */ jsx25(Fragment2, { children: /* @__PURE__ */ jsx25("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__ */ jsx25(HistoryIcon, {}) }) }) : /* @__PURE__ */ jsx25("div", { children: "Back" })
1346
+ children: !historyTabShown ? /* @__PURE__ */ jsx26(Fragment2, { children: /* @__PURE__ */ jsx26("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__ */ jsx26(HistoryIcon, {}) }) }) : /* @__PURE__ */ jsx26("div", { children: "Back" })
1585
1347
  }
1586
1348
  )
1587
1349
  ] })
@@ -1590,7 +1352,7 @@ var TopBar = ({
1590
1352
 
1591
1353
  // src/components/TxConfigForm/Settings.tsx
1592
1354
  import { useState as useState3, useEffect as useEffect3 } from "react";
1593
- import { jsx as jsx26, jsxs as jsxs9 } from "react/jsx-runtime";
1355
+ import { jsx as jsx27, jsxs as jsxs10 } from "react/jsx-runtime";
1594
1356
  var Settings = ({
1595
1357
  setSlippage,
1596
1358
  setSettingsShown,
@@ -1607,22 +1369,22 @@ var Settings = ({
1607
1369
  );
1608
1370
  }
1609
1371
  }, [slippageActivePresetIndex, usingSlippageInput]);
1610
- return /* @__PURE__ */ jsx26("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__ */ jsxs9("div", { className: "flex flex-col gap-4 justify-between", children: [
1611
- /* @__PURE__ */ jsxs9("div", { className: "flex justify-between", children: [
1612
- /* @__PURE__ */ jsx26("div", { className: "text-base", children: "Settings" }),
1613
- /* @__PURE__ */ jsx26(
1372
+ return /* @__PURE__ */ jsx27("div", { className: "absolute w-[310px] right-0 top-[46px] z-10 bg-black border border-solid border-[rgba(54,129,198,1)] p-4 rounded-xl", children: /* @__PURE__ */ jsxs10("div", { className: "flex flex-col gap-4 justify-between", children: [
1373
+ /* @__PURE__ */ jsxs10("div", { className: "flex justify-between", children: [
1374
+ /* @__PURE__ */ jsx27("div", { className: "text-base", children: "Settings" }),
1375
+ /* @__PURE__ */ jsx27(
1614
1376
  "div",
1615
1377
  {
1616
1378
  className: "cursor-pointer",
1617
1379
  onClick: () => setSettingsShown(false),
1618
- children: /* @__PURE__ */ jsx26(CloseIcon, {})
1380
+ children: /* @__PURE__ */ jsx27(CloseIcon, {})
1619
1381
  }
1620
1382
  )
1621
1383
  ] }),
1622
- /* @__PURE__ */ jsxs9("div", { children: [
1623
- /* @__PURE__ */ jsxs9("div", { className: "flex gap-2 items-center", children: [
1624
- /* @__PURE__ */ jsx26("div", { className: "text-sm text-[rgba(255,255,255,0.6)]", children: "Express delivery" }),
1625
- /* @__PURE__ */ jsx26("div", { children: /* @__PURE__ */ jsxs9(
1384
+ /* @__PURE__ */ jsxs10("div", { children: [
1385
+ /* @__PURE__ */ jsxs10("div", { className: "flex gap-2 items-center", children: [
1386
+ /* @__PURE__ */ jsx27("div", { className: "text-sm text-[rgba(255,255,255,0.6)]", children: "Express delivery" }),
1387
+ /* @__PURE__ */ jsx27("div", { children: /* @__PURE__ */ jsxs10(
1626
1388
  "span",
1627
1389
  {
1628
1390
  className: "inline-flex w-14 h-9 p-3 relative align-middle box-border overflow-hidden cursor-pointer",
@@ -1630,8 +1392,8 @@ var Settings = ({
1630
1392
  setExpressChecked((x) => !x);
1631
1393
  },
1632
1394
  children: [
1633
- /* @__PURE__ */ jsx26("span", { className: "h-full, w-full rounded-lg bg-[rgba(255,255,255,0.3)]" }),
1634
- /* @__PURE__ */ jsx26(
1395
+ /* @__PURE__ */ jsx27("span", { className: "h-full, w-full rounded-lg bg-[rgba(255,255,255,0.3)]" }),
1396
+ /* @__PURE__ */ jsx27(
1635
1397
  "span",
1636
1398
  {
1637
1399
  className: `transition-all w-5 h-5 rounded-full absolute translate-y-[-4px]
@@ -1642,15 +1404,15 @@ var Settings = ({
1642
1404
  }
1643
1405
  ) })
1644
1406
  ] }),
1645
- /* @__PURE__ */ jsxs9("div", { className: "flex gap-4", children: [
1646
- /* @__PURE__ */ jsx26("div", { className: "min-w-[26px] min-h-[26px] text-[#ffa726]", children: /* @__PURE__ */ jsx26(InfoIcon, {}) }),
1647
- /* @__PURE__ */ jsx26("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." })
1407
+ /* @__PURE__ */ jsxs10("div", { className: "flex gap-4", children: [
1408
+ /* @__PURE__ */ jsx27("div", { className: "min-w-[26px] min-h-[26px] text-[#ffa726]", children: /* @__PURE__ */ jsx27(InfoIcon, {}) }),
1409
+ /* @__PURE__ */ jsx27("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." })
1648
1410
  ] })
1649
1411
  ] }),
1650
- /* @__PURE__ */ jsxs9("div", { className: "flex flex-col gap-2 ", children: [
1651
- /* @__PURE__ */ jsx26("div", { className: " text-[rgba(255,255,255,0.6)] text-sm", children: "Slippage" }),
1652
- /* @__PURE__ */ jsxs9("div", { className: "flex gap-2", children: [
1653
- /* @__PURE__ */ jsx26("div", { className: "flex items-center bg-[rgba(15,15,15,1)] p-1 globalBorder rounded-xl", children: SLIPPAGE_PRESETS.map((preset, index) => /* @__PURE__ */ jsx26(
1412
+ /* @__PURE__ */ jsxs10("div", { className: "flex flex-col gap-2 ", children: [
1413
+ /* @__PURE__ */ jsx27("div", { className: " text-[rgba(255,255,255,0.6)] text-sm", children: "Slippage" }),
1414
+ /* @__PURE__ */ jsxs10("div", { className: "flex gap-2", children: [
1415
+ /* @__PURE__ */ jsx27("div", { className: "flex items-center bg-[rgba(15,15,15,1)] p-1 globalBorder rounded-xl", children: SLIPPAGE_PRESETS.map((preset, index) => /* @__PURE__ */ jsx27(
1654
1416
  "div",
1655
1417
  {
1656
1418
  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]" : ""}`,
@@ -1662,8 +1424,8 @@ var Settings = ({
1662
1424
  },
1663
1425
  index
1664
1426
  )) }),
1665
- /* @__PURE__ */ jsxs9("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: [
1666
- /* @__PURE__ */ jsx26(
1427
+ /* @__PURE__ */ jsxs10("div", { className: "bg-[rgba(39,39,39,1)] p-2 border border-solid border-[rgba(82,82,82,1)] rounded-xl text-white flex items-center", children: [
1428
+ /* @__PURE__ */ jsx27(
1667
1429
  "input",
1668
1430
  {
1669
1431
  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",
@@ -1682,16 +1444,16 @@ var Settings = ({
1682
1444
  }
1683
1445
  }
1684
1446
  ),
1685
- /* @__PURE__ */ jsx26(PercentageIcon, {})
1447
+ /* @__PURE__ */ jsx27(PercentageIcon, {})
1686
1448
  ] })
1687
1449
  ] }),
1688
- /* @__PURE__ */ jsxs9("div", { className: "flex gap-4", children: [
1689
- /* @__PURE__ */ jsx26("div", { className: "min-w-[26px] min-h-[26px] text-[#ffa726]", children: /* @__PURE__ */ jsx26(InfoIcon, {}) }),
1690
- /* @__PURE__ */ jsxs9("div", { className: "text-xs text-left", children: [
1450
+ /* @__PURE__ */ jsxs10("div", { className: "flex gap-4", children: [
1451
+ /* @__PURE__ */ jsx27("div", { className: "min-w-[26px] min-h-[26px] text-[#ffa726]", children: /* @__PURE__ */ jsx27(InfoIcon, {}) }),
1452
+ /* @__PURE__ */ jsxs10("div", { className: "text-xs text-left", children: [
1691
1453
  "Slippage is the price variation you are willing to accept in the event that the price of the trade changes while it is processing.",
1692
- /* @__PURE__ */ jsx26("br", {}),
1454
+ /* @__PURE__ */ jsx27("br", {}),
1693
1455
  " ",
1694
- /* @__PURE__ */ jsx26("br", {}),
1456
+ /* @__PURE__ */ jsx27("br", {}),
1695
1457
  "If the trade fails due to too-low slippage, you will receive USDC on the destination chain."
1696
1458
  ] })
1697
1459
  ] })
@@ -1700,7 +1462,7 @@ var Settings = ({
1700
1462
  };
1701
1463
 
1702
1464
  // src/components/TxConfigForm/FeesDetails.tsx
1703
- import { jsx as jsx27, jsxs as jsxs10 } from "react/jsx-runtime";
1465
+ import { jsx as jsx28, jsxs as jsxs11 } from "react/jsx-runtime";
1704
1466
  var FeesDetails = ({
1705
1467
  isGettingRoute,
1706
1468
  route,
@@ -1711,12 +1473,12 @@ var FeesDetails = ({
1711
1473
  feesDetailsShown,
1712
1474
  setFeesDetailsShown
1713
1475
  }) => {
1714
- return /* @__PURE__ */ jsxs10("div", { className: "flex flex-col gap-3 globalBorder rounded-lg bg-[rgba(15,15,15,1)] p-4 mb-1", children: [
1715
- /* @__PURE__ */ jsxs10("div", { className: "flex w-full items-center justify-between text-xs sm:text-sm ", children: [
1716
- /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-1 font-medium text-white opacity-60", children: [
1717
- /* @__PURE__ */ jsx27(CoinsIcon, {}),
1718
- /* @__PURE__ */ jsx27("div", { className: "mr-1", children: "Fees:" }),
1719
- isGettingRoute ? /* @__PURE__ */ jsx27("div", { className: "bg-current rounded animate-pulse w-20 h-4" }) : ` ${weiToHumanReadable({
1476
+ return /* @__PURE__ */ jsxs11("div", { className: "flex flex-col gap-3 globalBorder rounded-lg bg-[rgba(15,15,15,1)] p-4 mb-1", children: [
1477
+ /* @__PURE__ */ jsxs11("div", { className: "flex w-full items-center justify-between text-xs sm:text-sm ", children: [
1478
+ /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-1 font-medium text-white opacity-60", children: [
1479
+ /* @__PURE__ */ jsx28(CoinsIcon, {}),
1480
+ /* @__PURE__ */ jsx28("div", { className: "mr-1", children: "Fees:" }),
1481
+ isGettingRoute ? /* @__PURE__ */ jsx28("div", { className: "bg-current rounded animate-pulse w-20 h-4" }) : ` ${weiToHumanReadable({
1720
1482
  amount: safeBigNumberFrom(
1721
1483
  route?.xSwapFees.xSwapFee.nativeFee || "0"
1722
1484
  ).add(safeBigNumberFrom(route?.xSwapFees.ccipFee || "0")).add(
@@ -1726,30 +1488,30 @@ var FeesDetails = ({
1726
1488
  precisionFractionalPlaces: 5
1727
1489
  })} ${paymentToken?.symbol}`
1728
1490
  ] }),
1729
- /* @__PURE__ */ jsxs10("div", { className: "flex gap-1 items-center", children: [
1730
- /* @__PURE__ */ jsxs10(
1491
+ /* @__PURE__ */ jsxs11("div", { className: "flex gap-1 items-center", children: [
1492
+ /* @__PURE__ */ jsxs11(
1731
1493
  "div",
1732
1494
  {
1733
1495
  className: `flex gap-1 items-center font-medium ${expressChecked ? "text-x_green" : "text-white opacity-60"}`,
1734
1496
  children: [
1735
- /* @__PURE__ */ jsx27(TimerIcon, {}),
1497
+ /* @__PURE__ */ jsx28(TimerIcon, {}),
1736
1498
  expressChecked ? "Fast ~ 30sec " : "Normal ~ 30min"
1737
1499
  ]
1738
1500
  }
1739
1501
  ),
1740
- /* @__PURE__ */ jsx27(
1502
+ /* @__PURE__ */ jsx28(
1741
1503
  "div",
1742
1504
  {
1743
1505
  onClick: () => setFeesDetailsShown((x) => !x),
1744
1506
  className: "font-medium text-white opacity-60 cursor-pointer flex items-center w-[15px] h-[9px]",
1745
- children: feesDetailsShown ? /* @__PURE__ */ jsx27(ChevronUpIcon, {}) : /* @__PURE__ */ jsx27(ChevronDownIcon, {})
1507
+ children: feesDetailsShown ? /* @__PURE__ */ jsx28(ChevronUpIcon, {}) : /* @__PURE__ */ jsx28(ChevronDownIcon, {})
1746
1508
  }
1747
1509
  )
1748
1510
  ] })
1749
1511
  ] }),
1750
- feesDetailsShown && /* @__PURE__ */ jsxs10("div", { className: "flex w-full items-center justify-between ", children: [
1751
- /* @__PURE__ */ jsxs10("div", { className: "flex flex-col text-[10px] gap-1", children: [
1752
- /* @__PURE__ */ jsxs10("div", { className: "font-medium text-white opacity-60", children: [
1512
+ feesDetailsShown && /* @__PURE__ */ jsxs11("div", { className: "flex w-full items-center justify-between ", children: [
1513
+ /* @__PURE__ */ jsxs11("div", { className: "flex flex-col text-[10px] gap-1", children: [
1514
+ /* @__PURE__ */ jsxs11("div", { className: "font-medium text-white opacity-60", children: [
1753
1515
  "CCIP Fee:",
1754
1516
  ` ${weiToHumanReadable({
1755
1517
  amount: route?.xSwapFees.ccipFee || "0",
@@ -1757,7 +1519,7 @@ var FeesDetails = ({
1757
1519
  precisionFractionalPlaces: 5
1758
1520
  })} ${paymentToken?.symbol}`
1759
1521
  ] }),
1760
- /* @__PURE__ */ jsxs10("div", { className: "font-medium text-white opacity-60", children: [
1522
+ /* @__PURE__ */ jsxs11("div", { className: "font-medium text-white opacity-60", children: [
1761
1523
  "Native Fee:",
1762
1524
  ` ${weiToHumanReadable({
1763
1525
  amount: route?.xSwapFees.xSwapFee.nativeFee || "0",
@@ -1766,12 +1528,12 @@ var FeesDetails = ({
1766
1528
  })} ${paymentToken?.symbol}`
1767
1529
  ] })
1768
1530
  ] }),
1769
- /* @__PURE__ */ jsxs10("div", { className: "flex flex-col text-[10px] gap-1", children: [
1770
- /* @__PURE__ */ jsxs10("div", { className: "font-medium text-white opacity-60", children: [
1531
+ /* @__PURE__ */ jsxs11("div", { className: "flex flex-col text-[10px] gap-1", children: [
1532
+ /* @__PURE__ */ jsxs11("div", { className: "font-medium text-white opacity-60", children: [
1771
1533
  "Slippage: ",
1772
1534
  `${slippage}%`
1773
1535
  ] }),
1774
- /* @__PURE__ */ jsxs10("div", { className: "font-medium text-white opacity-60", children: [
1536
+ /* @__PURE__ */ jsxs11("div", { className: "font-medium text-white opacity-60", children: [
1775
1537
  "Min amount out:",
1776
1538
  " ",
1777
1539
  weiToHumanReadable({
@@ -1792,7 +1554,7 @@ import { useEffect as useEffect5, useMemo as useMemo3, useState as useState5 } f
1792
1554
 
1793
1555
  // src/components/TxConfigForm/UsdPrice.tsx
1794
1556
  import { useEffect as useEffect4, useState as useState4 } from "react";
1795
- import { Fragment as Fragment3, jsx as jsx28 } from "react/jsx-runtime";
1557
+ import { Fragment as Fragment3, jsx as jsx29 } from "react/jsx-runtime";
1796
1558
  var UsdPrice = ({
1797
1559
  prices,
1798
1560
  token,
@@ -1805,11 +1567,11 @@ var UsdPrice = ({
1805
1567
  setUsdPrice((Number(amount) * Number(prices[token.address])).toFixed(2));
1806
1568
  }
1807
1569
  }, [token, prices, amount]);
1808
- return /* @__PURE__ */ jsx28("div", { className: "opacity-60 py-4", children: loading ? /* @__PURE__ */ jsx28(Skeleton, { width: "w-12", height: "h-4" }) : token ? prices && prices[token.address] ? /* @__PURE__ */ jsx28("div", { children: `$${usdPrice}` }) : /* @__PURE__ */ jsx28(Alert, { desc: "Unknown price" }) : /* @__PURE__ */ jsx28(Fragment3, { children: "$0.00" }) });
1570
+ return /* @__PURE__ */ jsx29("div", { className: "opacity-60 py-4", children: loading ? /* @__PURE__ */ jsx29(Skeleton, { width: "w-12", height: "h-4" }) : token ? prices && prices[token.address] ? /* @__PURE__ */ jsx29("div", { children: `$${usdPrice}` }) : /* @__PURE__ */ jsx29(Alert, { desc: "Unknown price" }) : /* @__PURE__ */ jsx29(Fragment3, { children: "$0.00" }) });
1809
1571
  };
1810
1572
 
1811
1573
  // src/components/TxConfigForm/Summary.tsx
1812
- import { jsx as jsx29, jsxs as jsxs11 } from "react/jsx-runtime";
1574
+ import { jsx as jsx30, jsxs as jsxs12 } from "react/jsx-runtime";
1813
1575
  var Summary = ({
1814
1576
  isGettingRoute,
1815
1577
  route,
@@ -1832,32 +1594,32 @@ var Summary = ({
1832
1594
  );
1833
1595
  }
1834
1596
  }, [dstChain]);
1835
- return /* @__PURE__ */ jsxs11("div", { className: "flex flex-col globalBorder rounded-lg bg-[rgba(15,15,15,1)] p-4 relative", children: [
1836
- /* @__PURE__ */ jsxs11("div", { className: "flex justify-between", children: [
1837
- /* @__PURE__ */ jsxs11("div", { className: "flex flex-col gap-1", children: [
1838
- /* @__PURE__ */ jsx29("p", { className: "text-[rgba(255,255,255,0.6)] text-sm", children: "You receive" }),
1839
- isGettingRoute ? /* @__PURE__ */ jsx29(
1597
+ return /* @__PURE__ */ jsxs12("div", { className: "flex flex-col globalBorder rounded-lg bg-[rgba(15,15,15,1)] p-4 relative", children: [
1598
+ /* @__PURE__ */ jsxs12("div", { className: "flex justify-between", children: [
1599
+ /* @__PURE__ */ jsxs12("div", { className: "flex flex-col gap-1", children: [
1600
+ /* @__PURE__ */ jsx30("p", { className: "text-[rgba(255,255,255,0.6)] text-sm", children: "You receive" }),
1601
+ isGettingRoute ? /* @__PURE__ */ jsx30(
1840
1602
  Skeleton,
1841
1603
  {
1842
1604
  width: "w-[100px]",
1843
1605
  height: "h-[36px]",
1844
1606
  other: "sm:w-[190px]"
1845
1607
  }
1846
- ) : /* @__PURE__ */ jsxs11("div", { className: "flex gap-2 items-center text-white text-xl sm:text-3xl", children: [
1608
+ ) : /* @__PURE__ */ jsxs12("div", { className: "flex gap-2 items-center text-white text-xl sm:text-3xl", children: [
1847
1609
  amountReadable,
1848
- /* @__PURE__ */ jsx29("div", { className: "w-4 sm:w-6 h-4 sm:h-6", children: /* @__PURE__ */ jsx29("img", { src: dstToken?.image, alt: dstToken?.name }) }),
1849
- /* @__PURE__ */ jsx29("p", { className: "text-base sm:text-xl", children: dstToken?.symbol })
1610
+ /* @__PURE__ */ jsx30("div", { className: "w-4 sm:w-6 h-4 sm:h-6", children: /* @__PURE__ */ jsx30("img", { src: dstToken?.image, alt: dstToken?.name }) }),
1611
+ /* @__PURE__ */ jsx30("p", { className: "text-base sm:text-xl", children: dstToken?.symbol })
1850
1612
  ] })
1851
1613
  ] }),
1852
- /* @__PURE__ */ jsxs11("div", { className: "flex flex-col gap-1 text-sm", children: [
1853
- /* @__PURE__ */ jsx29("p", { className: "text-[rgba(255,255,255,0.6)] text-right", children: "on chain:" }),
1854
- /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-1 text-white", children: [
1855
- /* @__PURE__ */ jsx29("div", { className: "w-4 h-4", children: /* @__PURE__ */ jsx29("img", { src: dstChain?.image, alt: dstChain?.name }) }),
1856
- /* @__PURE__ */ jsx29("div", { children: dstChain?.displayName })
1614
+ /* @__PURE__ */ jsxs12("div", { className: "flex flex-col gap-1 text-sm", children: [
1615
+ /* @__PURE__ */ jsx30("p", { className: "text-[rgba(255,255,255,0.6)] text-right", children: "on chain:" }),
1616
+ /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1 text-white", children: [
1617
+ /* @__PURE__ */ jsx30("div", { className: "w-4 h-4", children: /* @__PURE__ */ jsx30("img", { src: dstChain?.image, alt: dstChain?.name }) }),
1618
+ /* @__PURE__ */ jsx30("div", { children: dstChain?.displayName })
1857
1619
  ] })
1858
1620
  ] })
1859
1621
  ] }),
1860
- /* @__PURE__ */ jsx29(
1622
+ /* @__PURE__ */ jsx30(
1861
1623
  UsdPrice,
1862
1624
  {
1863
1625
  prices,
@@ -1866,7 +1628,7 @@ var Summary = ({
1866
1628
  loading: isGettingRoute
1867
1629
  }
1868
1630
  ),
1869
- /* @__PURE__ */ jsx29("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__ */ jsx29("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__ */ jsx29(ArrowDownIcon, {}) }) })
1631
+ /* @__PURE__ */ jsx30("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__ */ jsx30("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__ */ jsx30(ArrowDownIcon, {}) }) })
1870
1632
  ] });
1871
1633
  };
1872
1634
 
@@ -1876,7 +1638,7 @@ import { useState as useState7, useEffect as useEffect6, useRef as useRef2, useM
1876
1638
  // src/components/TxConfigForm/TokenPicker.tsx
1877
1639
  import { useState as useState6, useMemo as useMemo4 } from "react";
1878
1640
  import { createPortal } from "react-dom";
1879
- import { Fragment as Fragment4, jsx as jsx30, jsxs as jsxs12 } from "react/jsx-runtime";
1641
+ import { Fragment as Fragment4, jsx as jsx31, jsxs as jsxs13 } from "react/jsx-runtime";
1880
1642
  var TokenPicker = ({
1881
1643
  onCloseClick,
1882
1644
  tokens,
@@ -1903,24 +1665,24 @@ var TokenPicker = ({
1903
1665
  );
1904
1666
  }, [searchValue, tokens]);
1905
1667
  return modalRoot ? createPortal(
1906
- /* @__PURE__ */ jsx30(
1668
+ /* @__PURE__ */ jsx31(
1907
1669
  "div",
1908
1670
  {
1909
1671
  onClick: onBackdropClick,
1910
1672
  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",
1911
- children: /* @__PURE__ */ jsxs12("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: [
1912
- /* @__PURE__ */ jsx30(
1673
+ children: /* @__PURE__ */ jsxs13("div", { className: "relative bg-black rounded-3xl p-6 max-h-[70%] flex flex-col text-base text-white w-[452px] h-[70%] border border-solid border-[rgba(255,255,255,0.2)]", children: [
1674
+ /* @__PURE__ */ jsx31(
1913
1675
  "div",
1914
1676
  {
1915
1677
  onClick: onCloseClick,
1916
1678
  className: "absolute top-4 right-4 cursor-pointer",
1917
- children: /* @__PURE__ */ jsx30(CloseIcon, {})
1679
+ children: /* @__PURE__ */ jsx31(CloseIcon, {})
1918
1680
  }
1919
1681
  ),
1920
- /* @__PURE__ */ jsx30("p", { className: "text-base mb-4", children: "Pick a token" }),
1921
- /* @__PURE__ */ jsxs12("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: [
1922
- /* @__PURE__ */ jsx30("div", { className: "w-6 h-6", children: /* @__PURE__ */ jsx30(SearchIcon, {}) }),
1923
- /* @__PURE__ */ jsx30(
1682
+ /* @__PURE__ */ jsx31("p", { className: "text-base mb-4", children: "Pick a token" }),
1683
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-center border border-solid border-[rgba(255,255,255,0.1)] rounded-lg py-0 px-3 gap-2 bg-[rgba(15,15,15,1)]", children: [
1684
+ /* @__PURE__ */ jsx31("div", { className: "w-6 h-6", children: /* @__PURE__ */ jsx31(SearchIcon, {}) }),
1685
+ /* @__PURE__ */ jsx31(
1924
1686
  "input",
1925
1687
  {
1926
1688
  placeholder: "Search name or paste address",
@@ -1930,7 +1692,7 @@ var TokenPicker = ({
1930
1692
  }
1931
1693
  )
1932
1694
  ] }),
1933
- /* @__PURE__ */ jsx30("div", { className: "my-4 mx-0 flex flex-wrap gap-3", children: tokens?.filter((token) => token?.quickPick).map((token) => /* @__PURE__ */ jsxs12(
1695
+ /* @__PURE__ */ jsx31("div", { className: "my-4 mx-0 flex flex-wrap gap-3", children: tokens?.filter((token) => token?.quickPick).map((token) => /* @__PURE__ */ jsxs13(
1934
1696
  "div",
1935
1697
  {
1936
1698
  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)]" : ""}`,
@@ -1939,14 +1701,14 @@ var TokenPicker = ({
1939
1701
  onCloseClick();
1940
1702
  },
1941
1703
  children: [
1942
- /* @__PURE__ */ jsx30("img", { src: token.image, alt: token.name, className: "w-5" }),
1943
- /* @__PURE__ */ jsx30("div", { className: "text-sm", children: token.symbol })
1704
+ /* @__PURE__ */ jsx31("img", { src: token.image, alt: token.name, className: "w-5" }),
1705
+ /* @__PURE__ */ jsx31("div", { className: "text-sm", children: token.symbol })
1944
1706
  ]
1945
1707
  },
1946
1708
  token.address
1947
1709
  )) }),
1948
- /* @__PURE__ */ jsx30("div", { className: "h-[2px] my-0 mx-[-24px] w-[100%+48px] px-12 bg-[rgba(255,255,255,0.1)]" }),
1949
- /* @__PURE__ */ jsx30("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__ */ jsxs12(
1710
+ /* @__PURE__ */ jsx31("div", { className: "h-[2px] my-0 mx-[-24px] w-[100%+48px] px-12 bg-[rgba(255,255,255,0.1)]" }),
1711
+ /* @__PURE__ */ jsx31("div", { className: "overflow-y-scroll h-full mx-[-24px] w-[100%+48px] flex flex-col", children: filteredTokens && filteredTokens.length > 0 ? filteredTokens.map((token, index) => /* @__PURE__ */ jsxs13(
1950
1712
  "div",
1951
1713
  {
1952
1714
  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)]" : ""}`,
@@ -1955,29 +1717,29 @@ var TokenPicker = ({
1955
1717
  onCloseClick();
1956
1718
  },
1957
1719
  children: [
1958
- token.image ? /* @__PURE__ */ jsx30(
1720
+ token.image ? /* @__PURE__ */ jsx31(
1959
1721
  "img",
1960
1722
  {
1961
1723
  src: token.image,
1962
1724
  alt: token.name,
1963
1725
  className: "token-picker__all__logo"
1964
1726
  }
1965
- ) : /* @__PURE__ */ jsx30("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) }),
1966
- /* @__PURE__ */ jsxs12("div", { className: "flex justify-between items-center gap-1 overflow-hidden grow", children: [
1967
- /* @__PURE__ */ jsxs12("div", { className: "flex flex-col leading-[16px]", children: [
1968
- /* @__PURE__ */ jsx30("div", { className: "overflow-hidden whitespace-nowrap text-ellipsis text-[15px]", children: token.name }),
1969
- /* @__PURE__ */ jsx30("div", { className: "text-[#888] text-[11px]", children: token.symbol })
1727
+ ) : /* @__PURE__ */ jsx31("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) }),
1728
+ /* @__PURE__ */ jsxs13("div", { className: "flex justify-between items-center gap-1 overflow-hidden grow", children: [
1729
+ /* @__PURE__ */ jsxs13("div", { className: "flex flex-col leading-[16px]", children: [
1730
+ /* @__PURE__ */ jsx31("div", { className: "overflow-hidden whitespace-nowrap text-ellipsis text-[15px]", children: token.name }),
1731
+ /* @__PURE__ */ jsx31("div", { className: "text-[#888] text-[11px]", children: token.symbol })
1970
1732
  ] }),
1971
- signer && /* @__PURE__ */ jsx30(Fragment4, { children: balances && balances[token.address] && token.decimals ? /* @__PURE__ */ jsx30("div", { className: "text-xs", children: weiToHumanReadable({
1733
+ signer && /* @__PURE__ */ jsx31(Fragment4, { children: balances && balances[token.address] && token.decimals ? /* @__PURE__ */ jsx31("div", { className: "text-xs", children: weiToHumanReadable({
1972
1734
  amount: balances[token.address]?.toString() || "0",
1973
1735
  decimals: token.decimals,
1974
1736
  precisionFractionalPlaces: 4
1975
- }) }) : /* @__PURE__ */ jsx30(Skeleton, { width: "w-12", height: "h-3" }) })
1737
+ }) }) : /* @__PURE__ */ jsx31(Skeleton, { width: "w-12", height: "h-3" }) })
1976
1738
  ] })
1977
1739
  ]
1978
1740
  },
1979
1741
  `${index}_${token.address}`
1980
- )) : /* @__PURE__ */ jsx30("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ jsx30("p", { className: "text-sm text-white", children: "No tokens found." }) }) })
1742
+ )) : /* @__PURE__ */ jsx31("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ jsx31("p", { className: "text-sm text-white", children: "No tokens found." }) }) })
1981
1743
  ] })
1982
1744
  }
1983
1745
  ),
@@ -1986,7 +1748,7 @@ var TokenPicker = ({
1986
1748
  };
1987
1749
 
1988
1750
  // src/components/TxConfigForm/ChainListElement.tsx
1989
- import { jsx as jsx31, jsxs as jsxs13 } from "react/jsx-runtime";
1751
+ import { jsx as jsx32, jsxs as jsxs14 } from "react/jsx-runtime";
1990
1752
  var ChainListElement = ({
1991
1753
  chain,
1992
1754
  setSrcChain,
@@ -1994,8 +1756,8 @@ var ChainListElement = ({
1994
1756
  index,
1995
1757
  length
1996
1758
  }) => {
1997
- return /* @__PURE__ */ jsxs13("div", { children: [
1998
- /* @__PURE__ */ jsxs13(
1759
+ return /* @__PURE__ */ jsxs14("div", { children: [
1760
+ /* @__PURE__ */ jsxs14(
1999
1761
  "li",
2000
1762
  {
2001
1763
  className: "bg-transparent border-none flex gap-1 items-center cursor-pointer py-2 w-full",
@@ -2004,19 +1766,19 @@ var ChainListElement = ({
2004
1766
  setChainListShown(false);
2005
1767
  },
2006
1768
  children: [
2007
- /* @__PURE__ */ jsx31("img", { width: 12, height: 12, src: chain.image, alt: chain.displayName }),
1769
+ /* @__PURE__ */ jsx32("img", { width: 12, height: 12, src: chain.image, alt: chain.displayName }),
2008
1770
  chain.displayName
2009
1771
  ]
2010
1772
  }
2011
1773
  ),
2012
- index !== length - 1 && /* @__PURE__ */ jsx31("div", { className: "h-px mx-2 bg-[rgba(255,255,255,0.15)]" })
1774
+ index !== length - 1 && /* @__PURE__ */ jsx32("div", { className: "h-px mx-2 bg-[rgba(255,255,255,0.15)]" })
2013
1775
  ] }, `${chain.ecosystem}-${chain.chainId}`);
2014
1776
  };
2015
1777
 
2016
1778
  // src/components/TxConfigForm/BalanceComponent.tsx
2017
1779
  import { useMemo as useMemo5 } from "react";
2018
1780
  import BigNumber3 from "bignumber.js";
2019
- import { Fragment as Fragment5, jsx as jsx32, jsxs as jsxs14 } from "react/jsx-runtime";
1781
+ import { Fragment as Fragment5, jsx as jsx33, jsxs as jsxs15 } from "react/jsx-runtime";
2020
1782
  var BalanceComponent = ({ srcToken, balances }) => {
2021
1783
  const balanceText = useMemo5(() => {
2022
1784
  if (!balances || !srcToken) return "0";
@@ -2036,7 +1798,7 @@ var BalanceComponent = ({ srcToken, balances }) => {
2036
1798
  precisionFractionalPlaces: 5
2037
1799
  });
2038
1800
  }, [srcToken, balances]);
2039
- return /* @__PURE__ */ jsxs14(Fragment5, { children: [
1801
+ return /* @__PURE__ */ jsxs15(Fragment5, { children: [
2040
1802
  "Balance:",
2041
1803
  " ",
2042
1804
  srcToken && balances ? weiToHumanReadable({
@@ -2044,12 +1806,12 @@ var BalanceComponent = ({ srcToken, balances }) => {
2044
1806
  decimals: srcToken.decimals,
2045
1807
  precisionFractionalPlaces: 4
2046
1808
  }) : 0,
2047
- /* @__PURE__ */ jsx32("span", { className: "bg-gradient-to-r from-x_blue_light to-x_blue_dark bg-clip-text text-transparent", children: "Max" })
1809
+ /* @__PURE__ */ jsx33("span", { className: "bg-gradient-to-r from-x_blue_light to-x_blue_dark bg-clip-text text-transparent", children: "Max" })
2048
1810
  ] });
2049
1811
  };
2050
1812
 
2051
1813
  // src/components/TxConfigForm/SwapPanel.tsx
2052
- import { jsx as jsx33, jsxs as jsxs15 } from "react/jsx-runtime";
1814
+ import { jsx as jsx34, jsxs as jsxs16 } from "react/jsx-runtime";
2053
1815
  var SwapPanel = ({
2054
1816
  amount,
2055
1817
  setAmount,
@@ -2094,11 +1856,11 @@ var SwapPanel = ({
2094
1856
  () => supportedChains.filter((chain) => chain.chainId !== srcChain?.chainId),
2095
1857
  [supportedChains, srcChain]
2096
1858
  );
2097
- return /* @__PURE__ */ jsxs15("div", { className: "flex justify-between globalBorder rounded-lg bg-[rgba(15,15,15,1)] p-4", children: [
2098
- /* @__PURE__ */ jsxs15("div", { className: "flex flex-col justify-between gap-2 overflow-hidden w-1/2", children: [
2099
- /* @__PURE__ */ jsxs15("div", { className: "flex flex-col gap-1", children: [
2100
- /* @__PURE__ */ jsx33("p", { className: "text-white opacity-60 text-xs sm:text-sm font-medium", children: "You pay" }),
2101
- /* @__PURE__ */ jsx33(
1859
+ return /* @__PURE__ */ jsxs16("div", { className: "flex justify-between globalBorder rounded-lg bg-[rgba(15,15,15,1)] p-4", children: [
1860
+ /* @__PURE__ */ jsxs16("div", { className: "flex flex-col justify-between gap-2 overflow-hidden w-1/2", children: [
1861
+ /* @__PURE__ */ jsxs16("div", { className: "flex flex-col gap-1", children: [
1862
+ /* @__PURE__ */ jsx34("p", { className: "text-white opacity-60 text-xs sm:text-sm font-medium", children: "You pay" }),
1863
+ /* @__PURE__ */ jsx34(
2102
1864
  "input",
2103
1865
  {
2104
1866
  className: "p-0 border-none outline-none bg-transparent text-2xl overflow-ellipsis",
@@ -2117,7 +1879,7 @@ var SwapPanel = ({
2117
1879
  }
2118
1880
  )
2119
1881
  ] }),
2120
- /* @__PURE__ */ jsx33("div", { className: "flex items-center text-sm text-[rgba(255,255,255,0.6)]", children: /* @__PURE__ */ jsx33(
1882
+ /* @__PURE__ */ jsx34("div", { className: "flex items-center text-sm text-[rgba(255,255,255,0.6)]", children: /* @__PURE__ */ jsx34(
2121
1883
  UsdPrice,
2122
1884
  {
2123
1885
  prices,
@@ -2127,8 +1889,8 @@ var SwapPanel = ({
2127
1889
  }
2128
1890
  ) })
2129
1891
  ] }),
2130
- /* @__PURE__ */ jsxs15("div", { className: "flex flex-col relative items-end gap-2.5 w-1/2 text-xs", children: [
2131
- /* @__PURE__ */ jsxs15(
1892
+ /* @__PURE__ */ jsxs16("div", { className: "flex flex-col relative items-end gap-2.5 w-1/2 text-xs", children: [
1893
+ /* @__PURE__ */ jsxs16(
2132
1894
  "div",
2133
1895
  {
2134
1896
  className: "flex gap-2 items-center p-2 max-w-full cursor-pointer bg-black text-white globalBorder rounded-3xl whitespace-nowrap",
@@ -2136,7 +1898,7 @@ var SwapPanel = ({
2136
1898
  setTokenListShown((state) => !state);
2137
1899
  },
2138
1900
  children: [
2139
- /* @__PURE__ */ jsx33(
1901
+ /* @__PURE__ */ jsx34(
2140
1902
  "img",
2141
1903
  {
2142
1904
  height: 16,
@@ -2145,12 +1907,12 @@ var SwapPanel = ({
2145
1907
  alt: srcToken?.name
2146
1908
  }
2147
1909
  ),
2148
- /* @__PURE__ */ jsx33("div", { children: srcToken?.symbol }),
2149
- /* @__PURE__ */ jsx33(DownArrowIcon, {})
1910
+ /* @__PURE__ */ jsx34("div", { children: srcToken?.symbol }),
1911
+ /* @__PURE__ */ jsx34(DownArrowIcon, {})
2150
1912
  ]
2151
1913
  }
2152
1914
  ),
2153
- tokenListShown && /* @__PURE__ */ jsx33(
1915
+ tokenListShown && /* @__PURE__ */ jsx34(
2154
1916
  TokenPicker,
2155
1917
  {
2156
1918
  onCloseClick: () => setTokenListShown(false),
@@ -2161,22 +1923,22 @@ var SwapPanel = ({
2161
1923
  balances
2162
1924
  }
2163
1925
  ),
2164
- /* @__PURE__ */ jsx33(
1926
+ /* @__PURE__ */ jsx34(
2165
1927
  "div",
2166
1928
  {
2167
1929
  onClick: handleMaxClick,
2168
1930
  className: "flex gap-1 items-center font-medium text-white opacity-60 py-0.5 cursor-pointer",
2169
- children: signer && /* @__PURE__ */ jsx33(BalanceComponent, { balances, srcToken })
1931
+ children: signer && /* @__PURE__ */ jsx34(BalanceComponent, { balances, srcToken })
2170
1932
  }
2171
1933
  ),
2172
- /* @__PURE__ */ jsxs15(
1934
+ /* @__PURE__ */ jsxs16(
2173
1935
  "div",
2174
1936
  {
2175
1937
  ref: buttonRef,
2176
1938
  className: "bg-black globalBorder rounded-2xl whitespace-nowrap flex items-center p-2 cursor-pointer gap-2",
2177
1939
  onClick: () => setChainListShown((prev) => !prev),
2178
1940
  children: [
2179
- /* @__PURE__ */ jsx33(
1941
+ /* @__PURE__ */ jsx34(
2180
1942
  "img",
2181
1943
  {
2182
1944
  width: "16",
@@ -2185,17 +1947,17 @@ var SwapPanel = ({
2185
1947
  alt: srcChain?.name
2186
1948
  }
2187
1949
  ),
2188
- /* @__PURE__ */ jsx33("div", { children: srcChain?.displayName }),
2189
- /* @__PURE__ */ jsx33(DownArrowIcon, {})
1950
+ /* @__PURE__ */ jsx34("div", { children: srcChain?.displayName }),
1951
+ /* @__PURE__ */ jsx34(DownArrowIcon, {})
2190
1952
  ]
2191
1953
  }
2192
1954
  ),
2193
- chainListShown && /* @__PURE__ */ jsx33(
1955
+ chainListShown && /* @__PURE__ */ jsx34(
2194
1956
  "ul",
2195
1957
  {
2196
1958
  ref: listRef,
2197
1959
  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",
2198
- children: chainListOptions.map((chain, index) => /* @__PURE__ */ jsx33(
1960
+ children: chainListOptions.map((chain, index) => /* @__PURE__ */ jsx34(
2199
1961
  ChainListElement,
2200
1962
  {
2201
1963
  index,
@@ -2212,9 +1974,9 @@ var SwapPanel = ({
2212
1974
  };
2213
1975
 
2214
1976
  // src/components/TxConfigForm/ErrorField.tsx
2215
- import { jsx as jsx34 } from "react/jsx-runtime";
1977
+ import { jsx as jsx35 } from "react/jsx-runtime";
2216
1978
  var ErrorField = ({ error }) => {
2217
- return /* @__PURE__ */ jsx34(
1979
+ return /* @__PURE__ */ jsx35(
2218
1980
  "div",
2219
1981
  {
2220
1982
  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"}`,
@@ -2224,15 +1986,15 @@ var ErrorField = ({ error }) => {
2224
1986
  };
2225
1987
 
2226
1988
  // src/components/TxConfigForm/Description.tsx
2227
- import { jsx as jsx35 } from "react/jsx-runtime";
1989
+ import { jsx as jsx36 } from "react/jsx-runtime";
2228
1990
  var Description = ({ description }) => {
2229
- return /* @__PURE__ */ jsx35("div", { className: "flex flex-col items-start rounded-lg px-4 py-2", children: /* @__PURE__ */ jsx35("div", { className: "w-full flex gap-4 items-start justify-between text-xl", children: description }) });
1991
+ return /* @__PURE__ */ jsx36("div", { className: "flex flex-col items-start rounded-lg px-4 py-2", children: /* @__PURE__ */ jsx36("div", { className: "w-full flex gap-4 items-start justify-between text-xl", children: description }) });
2230
1992
  };
2231
1993
 
2232
1994
  // src/components/TxConfigForm/Button.tsx
2233
- import { jsx as jsx36 } from "react/jsx-runtime";
1995
+ import { jsx as jsx37 } from "react/jsx-runtime";
2234
1996
  var Button = ({ children, onClick, type, disabled }) => {
2235
- return /* @__PURE__ */ jsx36(
1997
+ return /* @__PURE__ */ jsx37(
2236
1998
  "button",
2237
1999
  {
2238
2000
  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",
@@ -2245,7 +2007,7 @@ var Button = ({ children, onClick, type, disabled }) => {
2245
2007
  };
2246
2008
 
2247
2009
  // src/components/TxConfigForm/Form.tsx
2248
- import { jsx as jsx37, jsxs as jsxs16 } from "react/jsx-runtime";
2010
+ import { jsx as jsx38, jsxs as jsxs17 } from "react/jsx-runtime";
2249
2011
  var Form = ({
2250
2012
  dstChainId,
2251
2013
  dstTokenAddr,
@@ -2310,7 +2072,7 @@ var Form = ({
2310
2072
  `Configuration error: selected token ($${srcToken.symbol} ${srcToken.name}) has unknown decimals param.`
2311
2073
  );
2312
2074
  getRoute({
2313
- fromAmount: ethers4.utils.parseUnits(debouncedAmount, srcToken.decimals).toString(),
2075
+ fromAmount: ethers3.utils.parseUnits(debouncedAmount, srcToken.decimals).toString(),
2314
2076
  fromAddress: signer || ADDRESSES[srcChain.chainId].FeeCollector,
2315
2077
  fromChain: srcChain.chainId,
2316
2078
  fromToken: srcToken.address,
@@ -2344,7 +2106,7 @@ var Form = ({
2344
2106
  if (srcChain) {
2345
2107
  setPaymentToken(
2346
2108
  srcChain.tokens.find(
2347
- (token) => token.address.toLowerCase() === ethers4.constants.AddressZero.toLowerCase()
2109
+ (token) => token.address.toLowerCase() === ethers3.constants.AddressZero.toLowerCase()
2348
2110
  )
2349
2111
  );
2350
2112
  }
@@ -2375,13 +2137,13 @@ var Form = ({
2375
2137
  const handleSwitchChain = async () => {
2376
2138
  await switchChainAsync({ chainId: Number(srcChain?.chainId) });
2377
2139
  };
2378
- return /* @__PURE__ */ jsxs16(
2140
+ return /* @__PURE__ */ jsxs17(
2379
2141
  "form",
2380
2142
  {
2381
2143
  className: "flex flex-col gap-2 z-10 my-0 mx-auto p-4 rounded-3xl overflow-hidden font-light w-x_mobile sm:w-x_desktop",
2382
2144
  onSubmit: handleSubmit,
2383
2145
  children: [
2384
- /* @__PURE__ */ jsx37(
2146
+ /* @__PURE__ */ jsx38(
2385
2147
  TopBar,
2386
2148
  {
2387
2149
  signer,
@@ -2390,7 +2152,7 @@ var Form = ({
2390
2152
  setSettingsShown
2391
2153
  }
2392
2154
  ),
2393
- settingsShown && /* @__PURE__ */ jsx37(
2155
+ settingsShown && /* @__PURE__ */ jsx38(
2394
2156
  Settings,
2395
2157
  {
2396
2158
  expressChecked,
@@ -2400,9 +2162,9 @@ var Form = ({
2400
2162
  setSlippage
2401
2163
  }
2402
2164
  ),
2403
- historyTabShown ? /* @__PURE__ */ jsx37(History, { signer, supportedChains }) : /* @__PURE__ */ jsxs16("div", { className: "flex flex-col gap-2", children: [
2404
- desc && /* @__PURE__ */ jsx37(Description, { description: desc }),
2405
- /* @__PURE__ */ jsx37(
2165
+ historyTabShown ? /* @__PURE__ */ jsx38(History, { signer, supportedChains }) : /* @__PURE__ */ jsxs17("div", { className: "flex flex-col gap-2", children: [
2166
+ desc && /* @__PURE__ */ jsx38(Description, { description: desc }),
2167
+ /* @__PURE__ */ jsx38(
2406
2168
  SwapPanel,
2407
2169
  {
2408
2170
  amount,
@@ -2417,7 +2179,7 @@ var Form = ({
2417
2179
  setSrcChain
2418
2180
  }
2419
2181
  ),
2420
- /* @__PURE__ */ jsx37(
2182
+ /* @__PURE__ */ jsx38(
2421
2183
  Summary,
2422
2184
  {
2423
2185
  isGettingRoute,
@@ -2426,7 +2188,7 @@ var Form = ({
2426
2188
  dstChain
2427
2189
  }
2428
2190
  ),
2429
- /* @__PURE__ */ jsx37(
2191
+ /* @__PURE__ */ jsx38(
2430
2192
  FeesDetails,
2431
2193
  {
2432
2194
  route,
@@ -2439,8 +2201,8 @@ var Form = ({
2439
2201
  setFeesDetailsShown
2440
2202
  }
2441
2203
  ),
2442
- formError.length > 0 && /* @__PURE__ */ jsx37(ErrorField, { error: formError }),
2443
- signer && srcChain && srcChain.chainId !== account.chainId?.toString() ? /* @__PURE__ */ jsx37(Button, { type: "button", onClick: handleSwitchChain, children: "Switch chain" }) : /* @__PURE__ */ jsx37(
2204
+ formError.length > 0 && /* @__PURE__ */ jsx38(ErrorField, { error: formError }),
2205
+ signer && srcChain && srcChain.chainId !== account.chainId?.toString() ? /* @__PURE__ */ jsx38(Button, { type: "button", onClick: handleSwitchChain, children: "Switch chain" }) : /* @__PURE__ */ jsx38(
2444
2206
  Button,
2445
2207
  {
2446
2208
  type: "submit",
@@ -2454,11 +2216,8 @@ var Form = ({
2454
2216
  );
2455
2217
  };
2456
2218
 
2457
- // package.json
2458
- var version = "0.2.1";
2459
-
2460
2219
  // src/components/TxConfigForm/index.tsx
2461
- import { jsx as jsx38, jsxs as jsxs17 } from "react/jsx-runtime";
2220
+ import { jsx as jsx39, jsxs as jsxs18 } from "react/jsx-runtime";
2462
2221
  var TxConfigForm = ({
2463
2222
  dstChainId,
2464
2223
  dstTokenAddr,
@@ -2480,13 +2239,13 @@ var TxConfigForm = ({
2480
2239
  () => getWagmiConfig(supportedChains),
2481
2240
  supportedChains
2482
2241
  );
2483
- return /* @__PURE__ */ jsx38(WagmiProvider, { config: wagmiConfig, children: /* @__PURE__ */ jsx38(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx38(
2242
+ return /* @__PURE__ */ jsx39(WagmiProvider, { config: wagmiConfig, children: /* @__PURE__ */ jsx39(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx39(
2484
2243
  "div",
2485
2244
  {
2486
2245
  className: "top-0 left-0 right-0 bottom-0 bg-[rgba(0,0,0,0.8)] fixed flex items-center justify-center z-10",
2487
2246
  onClick: onBackdropClick,
2488
- children: /* @__PURE__ */ jsxs17("div", { className: "relative bg-black rounded-3xl w-lg overflow-auto text-white border-2 border-solid border-[rgba(255,255,255,0.1)]", children: [
2489
- /* @__PURE__ */ jsx38(
2247
+ children: /* @__PURE__ */ jsxs18("div", { className: "relative bg-black rounded-3xl w-lg overflow-auto text-white border-2 border-solid border-[rgba(255,255,255,0.1)]", children: [
2248
+ /* @__PURE__ */ jsx39(
2490
2249
  Form,
2491
2250
  {
2492
2251
  dstChainId,
@@ -2497,20 +2256,15 @@ var TxConfigForm = ({
2497
2256
  onSubmit
2498
2257
  }
2499
2258
  ),
2500
- /* @__PURE__ */ jsx38(
2259
+ /* @__PURE__ */ jsx39(
2501
2260
  "div",
2502
2261
  {
2503
2262
  className: "absolute top-7 right-4 cursor-pointer text-white",
2504
2263
  onClick: onClose,
2505
- children: /* @__PURE__ */ jsx38(CloseIcon, {})
2264
+ children: /* @__PURE__ */ jsx39(CloseIcon, {})
2506
2265
  }
2507
2266
  ),
2508
- /* @__PURE__ */ jsxs17("div", { className: "swappage__poweredby", children: [
2509
- /* @__PURE__ */ jsx38("span", { children: "Powered by" }),
2510
- /* @__PURE__ */ jsx38(XSwapBadgeIcon, {}),
2511
- /* @__PURE__ */ jsx38("span", { children: "\u2715" }),
2512
- /* @__PURE__ */ jsx38(ChainlinkCCIPIcon, {})
2513
- ] })
2267
+ /* @__PURE__ */ jsx39(PoweredBy, {})
2514
2268
  ] })
2515
2269
  }
2516
2270
  ) }) });
@@ -2525,7 +2279,7 @@ var openTxConfigForm = async ({
2525
2279
  try {
2526
2280
  return await new Promise((resolve) => {
2527
2281
  xswapRoot.render(
2528
- /* @__PURE__ */ jsx38(
2282
+ /* @__PURE__ */ jsx39(
2529
2283
  TxConfigForm,
2530
2284
  {
2531
2285
  dstChainId,
@@ -2548,24 +2302,11 @@ var openTxConfigForm = async ({
2548
2302
  throw new Error(`XSwap component error, ${err}`);
2549
2303
  }
2550
2304
  };
2551
- var xswapRoot;
2552
- if (typeof document !== "undefined") {
2553
- const xswapStyleElement = document.createElement("link");
2554
- xswapStyleElement.rel = "stylesheet";
2555
- xswapStyleElement.type = "text/css";
2556
- xswapStyleElement.href = `${xswap_config_default.apiUrl}/sdk/css?data={"version": "${version}"}`;
2557
- document.head.appendChild(xswapStyleElement);
2558
- const xswapModalElement = document.createElement("div");
2559
- xswapModalElement.setAttribute("id", "xswap-modal");
2560
- document.body.appendChild(xswapModalElement);
2561
- xswapRoot = createRoot(xswapModalElement);
2562
- }
2563
2305
 
2564
- // src/components/TxHistoryButton/index.tsx
2306
+ // src/components/TxStatusButton/index.tsx
2565
2307
  import { useMemo as useMemo8, useState as useState9 } from "react";
2566
- import { createRoot as createRoot2 } from "react-dom/client";
2567
- import { Fragment as Fragment6, jsx as jsx39, jsxs as jsxs18 } from "react/jsx-runtime";
2568
- var TxHistoryButton = ({ transaction }) => {
2308
+ import { Fragment as Fragment6, jsx as jsx40, jsxs as jsxs19 } from "react/jsx-runtime";
2309
+ var TxStatusButton = ({ transaction }) => {
2569
2310
  const {
2570
2311
  fromChain,
2571
2312
  fromChainImage,
@@ -2587,15 +2328,15 @@ var TxHistoryButton = ({ transaction }) => {
2587
2328
  () => isDone ? "border border-solid border-x_green_dark" : "border border-solid border-x_blue_dark",
2588
2329
  [isDone]
2589
2330
  );
2590
- return /* @__PURE__ */ jsxs18("div", { className: "flex gap-2", onClick: () => setIsWide((x) => !x), children: [
2591
- isWide && /* @__PURE__ */ jsxs18(
2331
+ return /* @__PURE__ */ jsxs19("div", { className: "flex gap-2", onClick: () => setIsWide((x) => !x), children: [
2332
+ isWide && /* @__PURE__ */ jsxs19(
2592
2333
  "div",
2593
2334
  {
2594
2335
  className: `flex items-center min-w-60 sm:w-[520px] text-white h-14 px-4 text-sm gap-3 rounded-xl ${background} ${border}`,
2595
2336
  children: [
2596
- /* @__PURE__ */ jsxs18("div", { className: "flex justify-between flex-col gap-2 sm:gap-5 sm:flex-row w-full", children: [
2597
- /* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-2", children: [
2598
- /* @__PURE__ */ jsx39(
2337
+ /* @__PURE__ */ jsxs19("div", { className: "flex justify-between flex-col gap-2 sm:gap-5 sm:flex-row w-full", children: [
2338
+ /* @__PURE__ */ jsxs19("div", { className: "flex items-center gap-2", children: [
2339
+ /* @__PURE__ */ jsx40(
2599
2340
  "img",
2600
2341
  {
2601
2342
  className: "w-5 h-5",
@@ -2603,16 +2344,16 @@ var TxHistoryButton = ({ transaction }) => {
2603
2344
  alt: "source chain"
2604
2345
  }
2605
2346
  ),
2606
- /* @__PURE__ */ jsx39("div", { children: fromChain }),
2607
- /* @__PURE__ */ jsx39("div", { className: "w-3.5 h-3.5", children: /* @__PURE__ */ jsx39(ArrowRightIcon, {}) }),
2608
- /* @__PURE__ */ jsx39("img", { className: "w-5 h-5", src: toChainImage, alt: "to chain" }),
2609
- /* @__PURE__ */ jsx39("div", { children: toChain })
2347
+ /* @__PURE__ */ jsx40("div", { children: fromChain }),
2348
+ /* @__PURE__ */ jsx40("div", { className: "w-3.5 h-3.5", children: /* @__PURE__ */ jsx40(ArrowRightIcon, {}) }),
2349
+ /* @__PURE__ */ jsx40("img", { className: "w-5 h-5", src: toChainImage, alt: "to chain" }),
2350
+ /* @__PURE__ */ jsx40("div", { children: toChain })
2610
2351
  ] }),
2611
- /* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-2", children: [
2612
- /* @__PURE__ */ jsx39("div", { children: "Sent" }),
2613
- /* @__PURE__ */ jsx39("div", { children: fromAmount }),
2614
- /* @__PURE__ */ jsx39("div", { children: fromToken }),
2615
- /* @__PURE__ */ jsx39(
2352
+ /* @__PURE__ */ jsxs19("div", { className: "flex items-center gap-2", children: [
2353
+ /* @__PURE__ */ jsx40("div", { children: "Sent" }),
2354
+ /* @__PURE__ */ jsx40("div", { children: fromAmount }),
2355
+ /* @__PURE__ */ jsx40("div", { children: fromToken }),
2356
+ /* @__PURE__ */ jsx40(
2616
2357
  "img",
2617
2358
  {
2618
2359
  className: "w-5 h-5",
@@ -2622,7 +2363,7 @@ var TxHistoryButton = ({ transaction }) => {
2622
2363
  )
2623
2364
  ] })
2624
2365
  ] }),
2625
- /* @__PURE__ */ jsx39(
2366
+ /* @__PURE__ */ jsx40(
2626
2367
  "a",
2627
2368
  {
2628
2369
  href: explorer,
@@ -2630,21 +2371,21 @@ var TxHistoryButton = ({ transaction }) => {
2630
2371
  rel: "noreferrer",
2631
2372
  className: "no-underline cursor-pointer",
2632
2373
  "aria-label": "Show the transaction in the chain explorer",
2633
- children: /* @__PURE__ */ jsx39("div", { className: "w-3.5 h-3.5", children: /* @__PURE__ */ jsx39(ArrowUpRightIcon, {}) })
2374
+ children: /* @__PURE__ */ jsx40("div", { className: "w-3.5 h-3.5", children: /* @__PURE__ */ jsx40(ArrowUpRightIcon, {}) })
2634
2375
  }
2635
2376
  )
2636
2377
  ]
2637
2378
  }
2638
2379
  ),
2639
- /* @__PURE__ */ jsx39(
2380
+ /* @__PURE__ */ jsx40(
2640
2381
  "div",
2641
2382
  {
2642
2383
  className: `text-white rounded-xl cursor-pointer ${background} ${border}`,
2643
- children: /* @__PURE__ */ jsxs18("div", { className: "flex gap-2 items-center h-14 w-20 justify-center", children: [
2644
- /* @__PURE__ */ jsx39(ArrowLeftIcon, {}),
2645
- /* @__PURE__ */ jsx39("div", { className: "relative flex items-center justify-center w-9 h-9", children: isDone ? /* @__PURE__ */ jsx39("div", { className: "text-x_green w-5 h-5", children: /* @__PURE__ */ jsx39(CheckIcon, {}) }) : /* @__PURE__ */ jsxs18(Fragment6, { children: [
2646
- /* @__PURE__ */ jsx39("div", { className: "w-5 h-5", children: /* @__PURE__ */ jsx39(XSwapLogo, {}) }),
2647
- /* @__PURE__ */ jsx39("div", { className: "absolute flex items-center justify-center top-0 left-0 right-0 bottom-0 text-white", children: /* @__PURE__ */ jsx39(CircularProgressIcon, {}) })
2384
+ children: /* @__PURE__ */ jsxs19("div", { className: "flex gap-2 items-center h-14 w-20 justify-center", children: [
2385
+ /* @__PURE__ */ jsx40(ArrowLeftIcon, {}),
2386
+ /* @__PURE__ */ jsx40("div", { className: "relative flex items-center justify-center w-9 h-9", children: isDone ? /* @__PURE__ */ jsx40("div", { className: "text-x_green w-5 h-5", children: /* @__PURE__ */ jsx40(CheckIcon, {}) }) : /* @__PURE__ */ jsxs19(Fragment6, { children: [
2387
+ /* @__PURE__ */ jsx40("div", { className: "w-5 h-5", children: /* @__PURE__ */ jsx40(XSwapLogo, {}) }),
2388
+ /* @__PURE__ */ jsx40("div", { className: "absolute flex items-center justify-center top-0 left-0 right-0 bottom-0 text-white", children: /* @__PURE__ */ jsx40(CircularProgressIcon, {}) })
2648
2389
  ] }) })
2649
2390
  ] })
2650
2391
  }
@@ -2670,78 +2411,159 @@ var updateTransactionDoneInRenderedTransactions = (txHash) => {
2670
2411
  transaction.isDone = true;
2671
2412
  }
2672
2413
  };
2673
- var historyElement = document.createElement("div");
2674
- historyElement.setAttribute("id", "xswap-history");
2675
- historyElement.setAttribute(
2676
- "class",
2677
- "absolute bottom-5 right-2 flex flex-col gap-3 pl-9 items-end w-full z-50"
2678
- );
2679
- document.body.appendChild(historyElement);
2680
- var txHistoryButtonRoot = createRoot2(historyElement);
2681
- var renderTxHistoryButtons = () => {
2682
- const buttons = renderedTransactions.map((item) => /* @__PURE__ */ jsx39(TxHistoryButton, { transaction: item }, item.txHash));
2683
- txHistoryButtonRoot.render(buttons);
2414
+ var renderTxStatusButtons = () => {
2415
+ const buttons = renderedTransactions.map((item) => /* @__PURE__ */ jsx40(TxStatusButton, { transaction: item }, item.txHash));
2416
+ txStatusRoot.render(buttons);
2684
2417
  };
2685
2418
 
2686
2419
  // src/components/Skeleton/index.tsx
2687
- import { jsx as jsx40 } from "react/jsx-runtime";
2420
+ import { jsx as jsx41 } from "react/jsx-runtime";
2688
2421
  var Skeleton = ({ width, height }) => {
2689
- return /* @__PURE__ */ jsx40("div", { className: `bg-current rounded animate-pulse ${width} ${height}` });
2422
+ return /* @__PURE__ */ jsx41("div", { className: `bg-current rounded animate-pulse ${width} ${height}` });
2423
+ };
2424
+
2425
+ // src/services/integrations/monitoring.ts
2426
+ import retry from "async-retry";
2427
+ var monitorTransactionStatus = async (txChainId, txHash) => {
2428
+ const txReceipt = await getTxReceipt(txChainId, txHash);
2429
+ const supportedChains = (await getChains()).filter(
2430
+ ({ web3Environment, swapSupported }) => web3Environment === "mainnet" /* MAINNET */ && swapSupported
2431
+ );
2432
+ const messageSentEvent = txReceipt.logs?.find((log) => {
2433
+ return log.topics[0] === ethers4.utils.id(MSG_SENT_EVENT_SIG);
2434
+ });
2435
+ if (!messageSentEvent) {
2436
+ throw new Error(
2437
+ `No transaction event found for chain ${txChainId} tx ${txHash}`
2438
+ );
2439
+ }
2440
+ const messageId = messageSentEvent?.topics[1];
2441
+ const iface = new ethers4.utils.Interface(MSG_SENT_EVENT_ABI);
2442
+ const decodedMessageSentEvent = iface.parseLog(messageSentEvent);
2443
+ if (!decodedMessageSentEvent) {
2444
+ throw new Error(
2445
+ `No transaction event arguments found for chain ${txChainId} tx ${txHash}`
2446
+ );
2447
+ }
2448
+ const srcChain = supportedChains.find(
2449
+ (chain) => chain.chainId === txChainId.toString()
2450
+ );
2451
+ const srcToken = srcChain?.tokens.find(
2452
+ (token) => token.address === decodedMessageSentEvent.args?.token.toString()
2453
+ );
2454
+ const dstChain = supportedChains.find(
2455
+ (chain) => chain.ccipChainId === decodedMessageSentEvent.args?.destinationChainSelector?.toString()
2456
+ );
2457
+ const dstChainId = dstChain?.chainId;
2458
+ if (!dstChainId) {
2459
+ throw new Error(`Unknown destination chain!`);
2460
+ }
2461
+ const transaction = {
2462
+ txHash,
2463
+ fromChain: srcChain?.displayName,
2464
+ fromChainImage: srcChain?.image,
2465
+ toChain: dstChain.displayName,
2466
+ toChainImage: dstChain.image,
2467
+ fromToken: srcToken?.symbol,
2468
+ fromTokenImage: srcToken?.image,
2469
+ fromAmount: weiToHumanReadable({
2470
+ amount: decodedMessageSentEvent.args?.tokenAmount.toString(),
2471
+ decimals: srcToken?.decimals || 18,
2472
+ precisionFractionalPlaces: 4
2473
+ }),
2474
+ isDone: false,
2475
+ explorer: `${CCIP_EXPLORER}/tx/${txHash}`
2476
+ };
2477
+ addTransactionToRenderedTransactions(transaction);
2478
+ renderTxStatusButtons();
2479
+ const xSwapRouterOnDestinationAddress = ADDRESSES[dstChainId]?.XSwapRouter;
2480
+ if (!xSwapRouterOnDestinationAddress) {
2481
+ throw new Error(`Unknown destination XSwapRouter!`);
2482
+ }
2483
+ const xSwapRouterOnDestination = new ethers4.Contract(
2484
+ xSwapRouterOnDestinationAddress,
2485
+ MSG_RECEIVED_EVENT_ABI,
2486
+ ethers4.getDefaultProvider(
2487
+ supportedChains.find((chain) => chain.chainId === dstChainId)?.publicRpcUrls[0]
2488
+ )
2489
+ );
2490
+ const msgReceivedEventFilter = {
2491
+ address: xSwapRouterOnDestinationAddress,
2492
+ topics: [ethers4.utils.id(MSG_RECEIVED_EVENT_SIG), messageId]
2493
+ };
2494
+ const onSuccess = async () => {
2495
+ updateTransactionDoneInRenderedTransactions(txHash);
2496
+ renderTxStatusButtons();
2497
+ await new Promise(
2498
+ (resolve) => setTimeout(() => resolve(true), TX_RECEIPT_STATUS_LIFETIME)
2499
+ );
2500
+ removeTransactionFromRenderedTransactions(txHash);
2501
+ renderTxStatusButtons();
2502
+ };
2503
+ xSwapRouterOnDestination.once(msgReceivedEventFilter, () => onSuccess());
2504
+ };
2505
+ var getTxReceipt = async (txChainId, txHash) => {
2506
+ try {
2507
+ const chain = (await getChains()).find(
2508
+ (chain2) => chain2.chainId === txChainId
2509
+ );
2510
+ const provider = new ethers4.providers.JsonRpcProvider(
2511
+ chain?.publicRpcUrls[0]
2512
+ );
2513
+ return await retry(async () => {
2514
+ const txReceipt = await provider.getTransactionReceipt(txHash);
2515
+ if (!txReceipt) {
2516
+ throw new Error(`Couldn't fetch tx receipt`);
2517
+ }
2518
+ return txReceipt;
2519
+ });
2520
+ } catch (e) {
2521
+ throw new Error(
2522
+ `Couldn't fetch tx ${txHash} receipt on chain ${txChainId}`
2523
+ );
2524
+ }
2525
+ };
2526
+
2527
+ // src/services/integrations/transactions.ts
2528
+ var getSwapTx = async ({
2529
+ dstChain,
2530
+ dstToken,
2531
+ customContractCalls = [],
2532
+ desc
2533
+ }) => {
2534
+ const supportedChains = (await getChains()).filter(
2535
+ ({ web3Environment, swapSupported }) => web3Environment === "mainnet" /* MAINNET */ && swapSupported
2536
+ );
2537
+ validateSwapTxData(supportedChains, dstChain, dstToken);
2538
+ const route = await openTxConfigForm({
2539
+ dstChainId: dstChain,
2540
+ dstTokenAddr: dstToken,
2541
+ customContractCalls,
2542
+ desc,
2543
+ supportedChains
2544
+ });
2545
+ return route.transactions;
2546
+ };
2547
+ var validateSwapTxData = (supportedChains, dstChain, dstToken) => {
2548
+ const supportedDstChain = supportedChains.find(
2549
+ ({ chainId }) => chainId === dstChain
2550
+ );
2551
+ if (!supportedDstChain) {
2552
+ throw new Error(`Provided chain '${dstChain}' is not supported`);
2553
+ }
2554
+ if (!supportedDstChain.tokens.some(({ address }) => address === dstToken)) {
2555
+ throw new Error(`Provided token '${dstToken}' is not supported`);
2556
+ }
2690
2557
  };
2558
+
2559
+ // src/index.ts
2560
+ initDocument();
2691
2561
  export {
2692
- ADDRESSES,
2693
- Alert,
2694
- BALANCES_CHUNK_SIZE,
2695
- BatchQueryAbi,
2696
- CCIP_EXPLORER,
2697
2562
  ContractName,
2698
- DEFAULT_ECOSYSTEM,
2699
- DEFAULT_SOURCE_CHAIN_ID,
2700
- DELIVERY_TIME,
2701
- ERC20Abi,
2702
- EXPRESS_DELIVERY_TIME,
2703
2563
  Ecosystem,
2704
2564
  Environment,
2705
- IERC20,
2706
- MINIMUM_DISPLAYED_TOKEN_AMOUNT,
2707
- MSG_RECEIVED_EVENT_ABI,
2708
- MSG_RECEIVED_EVENT_SIG,
2709
- MSG_SENT_EVENT_ABI,
2710
- MSG_SENT_EVENT_SIG,
2711
- NUMBER_INPUT_REGEX,
2712
- ROUTE_TIMEOUT_MS,
2713
- SLIPPAGE_PRESETS,
2714
- Skeleton,
2715
- TX_RECEIPT_STATUS_LIFETIME,
2716
- TxHistoryButton,
2717
2565
  Web3Environment,
2718
2566
  XSwapCallType,
2719
- addTransactionToRenderedTransactions,
2720
- chunkArray,
2721
- deepMergeObjects,
2722
- findPlaceholderIndex,
2723
- generateApproveTxData,
2724
- generateRandomBigNumber,
2725
- generateStakingCalls,
2726
- generateUniqueRandomBigNumber,
2727
- getBalanceOf,
2728
- getBalances,
2729
- getBridgeTokens,
2730
- getChainData,
2731
- getChains,
2732
- getDate,
2733
- getHistory,
2734
- getPrices,
2735
- getRoute,
2736
2567
  getSwapTx,
2737
- getTokens,
2738
- monitorTransactionStatus,
2739
- openTxConfigForm,
2740
- removeTransactionFromRenderedTransactions,
2741
- renderTxHistoryButtons,
2742
- replaceNull,
2743
- safeBigNumberFrom,
2744
- shortAddress,
2745
- updateTransactionDoneInRenderedTransactions,
2746
- weiToHumanReadable
2568
+ monitorTransactionStatus
2747
2569
  };