@multiversx/sdk-dapp-liquidity 1.1.5 → 1.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/package.json +1 -1
  2. package/reactjs/components/AccountAddress/AccountAddress.js +8 -1
  3. package/reactjs/components/AccountAddress/AccountAddress.mjs +8 -1
  4. package/reactjs/components/BridgeForm/Deposit.js +1 -0
  5. package/reactjs/components/BridgeForm/Deposit.mjs +1 -0
  6. package/reactjs/components/BridgeForm/Transfer.js +2 -0
  7. package/reactjs/components/BridgeForm/Transfer.mjs +2 -0
  8. package/reactjs/components/Connect/BridgeAccountDisplay.js +16 -2
  9. package/reactjs/components/Connect/BridgeAccountDisplay.mjs +16 -2
  10. package/reactjs/components/Connect/BridgeConnectButton.js +20 -12
  11. package/reactjs/components/Connect/BridgeConnectButton.mjs +20 -12
  12. package/reactjs/components/Connect/CustomConnectButton.d.ts +2 -1
  13. package/reactjs/components/Connect/CustomConnectButton.js +3 -1
  14. package/reactjs/components/Connect/CustomConnectButton.mjs +3 -1
  15. package/reactjs/components/Connect/MvxAccountDisplay.js +10 -1
  16. package/reactjs/components/Connect/MvxAccountDisplay.mjs +10 -1
  17. package/reactjs/components/Connect/MvxConnectButton.js +1 -0
  18. package/reactjs/components/Connect/MvxConnectButton.mjs +1 -0
  19. package/reactjs/components/Connect/SwitchChainButton.js +1 -0
  20. package/reactjs/components/Connect/SwitchChainButton.mjs +1 -0
  21. package/reactjs/components/CopyButton/CopyButton.d.ts +2 -1
  22. package/reactjs/components/CopyButton/CopyButton.js +6 -1
  23. package/reactjs/components/CopyButton/CopyButton.mjs +6 -1
  24. package/reactjs/components/ToggleDirection/ToggleDirection.js +14 -6
  25. package/reactjs/components/ToggleDirection/ToggleDirection.mjs +14 -6
  26. package/reactjs/components/TokenSelector/TokenSelector.js +1 -0
  27. package/reactjs/components/TokenSelector/TokenSelector.mjs +1 -0
  28. package/reactjs/components/TokenSelector/components/TokenItem.js +2 -0
  29. package/reactjs/components/TokenSelector/components/TokenItem.mjs +2 -0
  30. package/reactjs/components/TrimAddress/TrimAddress.d.ts +2 -1
  31. package/reactjs/components/TrimAddress/TrimAddress.js +2 -0
  32. package/reactjs/components/TrimAddress/TrimAddress.mjs +2 -0
  33. package/reactjs/hooks/useBridgeFormik.d.ts +2 -1
  34. package/reactjs/hooks/useBridgeFormik.js +3 -2
  35. package/reactjs/hooks/useBridgeFormik.mjs +3 -2
  36. package/reactjs/hooks/validation/useAmountSchema.d.ts +3 -1
  37. package/reactjs/hooks/validation/useAmountSchema.js +4 -2
  38. package/reactjs/hooks/validation/useAmountSchema.mjs +4 -2
  39. package/reactjs/hooks/validation/useTestIsConnected.d.ts +3 -1
  40. package/reactjs/hooks/validation/useTestIsConnected.js +10 -3
  41. package/reactjs/hooks/validation/useTestIsConnected.mjs +10 -3
package/package.json CHANGED
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "homepage": "https://github.com/multiversx/mx-sdk-dapp-liquidity#readme",
30
30
  "license": "MIT",
31
- "version": "1.1.5",
31
+ "version": "1.1.7",
32
32
  "main": "index.js",
33
33
  "module": "index.mjs",
34
34
  "types": "index.d.ts",
@@ -18,7 +18,14 @@ const AccountAddress = ({
18
18
  "liq-flex liq-min-w-0 liq-flex-grow liq-overflow-hidden liq-leading-none liq-max-w-[10rem]",
19
19
  className
20
20
  ),
21
- children: heroTag && showTag ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "liq-truncate liq-text-left liq-text-neutral-100 uppercase", children: heroTag }) : /* @__PURE__ */ jsxRuntime.jsx(reactjs_components_TrimAddress_TrimAddress.TrimAddress, { address })
21
+ children: heroTag && showTag ? /* @__PURE__ */ jsxRuntime.jsx(
22
+ "div",
23
+ {
24
+ className: "liq-truncate liq-text-left liq-text-neutral-100 uppercase",
25
+ "data-testid": "mx-address",
26
+ children: heroTag
27
+ }
28
+ ) : /* @__PURE__ */ jsxRuntime.jsx(reactjs_components_TrimAddress_TrimAddress.TrimAddress, { address, "data-testid": "mx-address" })
22
29
  }
23
30
  );
24
31
  };
@@ -15,7 +15,14 @@ const AccountAddress = ({
15
15
  "liq-flex liq-min-w-0 liq-flex-grow liq-overflow-hidden liq-leading-none liq-max-w-[10rem]",
16
16
  className
17
17
  ),
18
- children: heroTag && showTag ? /* @__PURE__ */ jsx("div", { className: "liq-truncate liq-text-left liq-text-neutral-100 uppercase", children: heroTag }) : /* @__PURE__ */ jsx(TrimAddress, { address })
18
+ children: heroTag && showTag ? /* @__PURE__ */ jsx(
19
+ "div",
20
+ {
21
+ className: "liq-truncate liq-text-left liq-text-neutral-100 uppercase",
22
+ "data-testid": "mx-address",
23
+ children: heroTag
24
+ }
25
+ ) : /* @__PURE__ */ jsx(TrimAddress, { address, "data-testid": "mx-address" })
19
26
  }
20
27
  );
21
28
  };
@@ -369,6 +369,7 @@ const Deposit = ({
369
369
  handleSubmit,
370
370
  resetSwapForm
371
371
  } = reactjs_hooks_useBridgeFormik.useBridgeFormik({
372
+ isMvxConnected: Boolean(mvxAddress),
372
373
  rate,
373
374
  sender: account.address ?? "",
374
375
  receiver: mvxAddress ?? "",
@@ -366,6 +366,7 @@ const Deposit = ({
366
366
  handleSubmit,
367
367
  resetSwapForm
368
368
  } = useBridgeFormik({
369
+ isMvxConnected: Boolean(mvxAddress),
369
370
  rate,
370
371
  sender: account.address ?? "",
371
372
  receiver: mvxAddress ?? "",
@@ -274,6 +274,7 @@ const Transfer = ({
274
274
  handleSubmit,
275
275
  resetSwapForm
276
276
  } = reactjs_hooks_useBridgeFormik.useBridgeFormik({
277
+ isMvxConnected: Boolean(mvxAddress),
277
278
  rate,
278
279
  sender: mvxAddress ?? "",
279
280
  receiver: account.address ?? "",
@@ -514,6 +515,7 @@ const Transfer = ({
514
515
  mvxAddress && isAuthenticated && /* @__PURE__ */ jsxRuntime.jsxs(
515
516
  reactjs_components_base_MxButton_MxButton.MxButton,
516
517
  {
518
+ "data-testid": "submit-button",
517
519
  type: "submit",
518
520
  variant: "neutral-850",
519
521
  className: "liq-w-full disabled:liq-bg-neutral-850/50 liq-py-3 hover:enabled:liq-bg-primary !liq-text-primary-200",
@@ -271,6 +271,7 @@ const Transfer = ({
271
271
  handleSubmit,
272
272
  resetSwapForm
273
273
  } = useBridgeFormik({
274
+ isMvxConnected: Boolean(mvxAddress),
274
275
  rate,
275
276
  sender: mvxAddress ?? "",
276
277
  receiver: account.address ?? "",
@@ -511,6 +512,7 @@ const Transfer = ({
511
512
  mvxAddress && isAuthenticated && /* @__PURE__ */ jsxs(
512
513
  MxButton,
513
514
  {
515
+ "data-testid": "submit-button",
514
516
  type: "submit",
515
517
  variant: "neutral-850",
516
518
  className: "liq-w-full disabled:liq-bg-neutral-850/50 liq-py-3 hover:enabled:liq-bg-primary !liq-text-primary-200",
@@ -50,16 +50,30 @@ const BridgeAccountDisplay = ({
50
50
  target: "_blank",
51
51
  showExternalIcon: false,
52
52
  className: "!liq-relative",
53
- children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "liq-flex liq-min-w-0 liq-flex-grow liq-overflow-hidden liq-leading-none liq-max-w-[10rem]", children: /* @__PURE__ */ jsxRuntime.jsx(reactjs_components_TrimAddress_TrimAddress.TrimAddress, { address: account.address }) })
53
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "liq-flex liq-min-w-0 liq-flex-grow liq-overflow-hidden liq-leading-none liq-max-w-[10rem]", children: /* @__PURE__ */ jsxRuntime.jsx(
54
+ reactjs_components_TrimAddress_TrimAddress.TrimAddress,
55
+ {
56
+ address: account.address,
57
+ "data-testid": "evm-address"
58
+ }
59
+ ) })
54
60
  }
55
61
  ),
56
- /* @__PURE__ */ jsxRuntime.jsx(reactjs_components_CopyButton_CopyButton.CopyButton, { text: account.address, className: "liq-text-sm" })
62
+ /* @__PURE__ */ jsxRuntime.jsx(
63
+ reactjs_components_CopyButton_CopyButton.CopyButton,
64
+ {
65
+ text: account.address,
66
+ className: "liq-text-sm",
67
+ "data-testid": "evm-copy-button"
68
+ }
69
+ )
57
70
  ] }) }),
58
71
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "liq-ml-auto liq-mr-0 liq-flex liq-items-center liq-gap-1", children: /* @__PURE__ */ jsxRuntime.jsx(
59
72
  "button",
60
73
  {
61
74
  className: "focus-primary liq-flex liq-items-center liq-gap-1 liq-rounded-xl liq-px-0 liq-py-2 liq-text-sm liq-font-semibold liq-text-neutral-400 liq-transition-colors liq-duration-200 hover:enabled:liq-text-white disabled:liq-opacity-50",
62
75
  onClick: handleDisconnect,
76
+ "data-testid": "evm-disconnect-button",
63
77
  children: /* @__PURE__ */ jsxRuntime.jsx(reactFontawesome.FontAwesomeIcon, { icon: faPowerOff.faPowerOff })
64
78
  }
65
79
  ) })
@@ -47,16 +47,30 @@ const BridgeAccountDisplay = ({
47
47
  target: "_blank",
48
48
  showExternalIcon: false,
49
49
  className: "!liq-relative",
50
- children: /* @__PURE__ */ jsx("div", { className: "liq-flex liq-min-w-0 liq-flex-grow liq-overflow-hidden liq-leading-none liq-max-w-[10rem]", children: /* @__PURE__ */ jsx(TrimAddress, { address: account.address }) })
50
+ children: /* @__PURE__ */ jsx("div", { className: "liq-flex liq-min-w-0 liq-flex-grow liq-overflow-hidden liq-leading-none liq-max-w-[10rem]", children: /* @__PURE__ */ jsx(
51
+ TrimAddress,
52
+ {
53
+ address: account.address,
54
+ "data-testid": "evm-address"
55
+ }
56
+ ) })
51
57
  }
52
58
  ),
53
- /* @__PURE__ */ jsx(CopyButton, { text: account.address, className: "liq-text-sm" })
59
+ /* @__PURE__ */ jsx(
60
+ CopyButton,
61
+ {
62
+ text: account.address,
63
+ className: "liq-text-sm",
64
+ "data-testid": "evm-copy-button"
65
+ }
66
+ )
54
67
  ] }) }),
55
68
  /* @__PURE__ */ jsx("div", { className: "liq-ml-auto liq-mr-0 liq-flex liq-items-center liq-gap-1", children: /* @__PURE__ */ jsx(
56
69
  "button",
57
70
  {
58
71
  className: "focus-primary liq-flex liq-items-center liq-gap-1 liq-rounded-xl liq-px-0 liq-py-2 liq-text-sm liq-font-semibold liq-text-neutral-400 liq-transition-colors liq-duration-200 hover:enabled:liq-text-white disabled:liq-opacity-50",
59
72
  onClick: handleDisconnect,
73
+ "data-testid": "evm-disconnect-button",
60
74
  children: /* @__PURE__ */ jsx(FontAwesomeIcon, { icon: faPowerOff })
61
75
  }
62
76
  ) })
@@ -11,17 +11,25 @@ const BridgeConnectButton = ({
11
11
  className
12
12
  }) => {
13
13
  const account = reactjs_hooks_useAccount.useAccount();
14
- return /* @__PURE__ */ jsxRuntime.jsx(reactjs_components_Connect_CustomConnectButton.CustomConnectButton, { className, disabled, children: account.isConnected ? null : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "liq-flex liq-items-center liq-justify-center liq-gap-1", children: [
15
- !account.isConnected && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "liq-ml-2 liq-flex liq-items-center liq-gap-1", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "liq-text-primary-200", children: account.isConnecting ? "Connecting..." : "Connect" }) }),
16
- activeChain && /* @__PURE__ */ jsxRuntime.jsx(
17
- "img",
18
- {
19
- src: activeChain.pngUrl,
20
- alt: "",
21
- className: "liq-z-10 liq-flex liq-h-[1.5rem] liq-w-[1.5rem] liq-p-1"
22
- }
23
- ),
24
- (activeChain == null ? void 0 : activeChain.networkName) && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "liq-inline liq-truncate", children: helpers_getDisplayName.getDisplayName(activeChain) })
25
- ] }) });
14
+ return /* @__PURE__ */ jsxRuntime.jsx(
15
+ reactjs_components_Connect_CustomConnectButton.CustomConnectButton,
16
+ {
17
+ className,
18
+ disabled,
19
+ "data-testid": "evm-network-connect-button",
20
+ children: account.isConnected ? null : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "liq-flex liq-items-center liq-justify-center liq-gap-1", children: [
21
+ !account.isConnected && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "liq-ml-2 liq-flex liq-items-center liq-gap-1", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "liq-text-primary-200", children: account.isConnecting ? "Connecting..." : "Connect" }) }),
22
+ activeChain && /* @__PURE__ */ jsxRuntime.jsx(
23
+ "img",
24
+ {
25
+ src: activeChain.pngUrl,
26
+ alt: "",
27
+ className: "liq-z-10 liq-flex liq-h-[1.5rem] liq-w-[1.5rem] liq-p-1"
28
+ }
29
+ ),
30
+ (activeChain == null ? void 0 : activeChain.networkName) && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "liq-inline liq-truncate", children: helpers_getDisplayName.getDisplayName(activeChain) })
31
+ ] })
32
+ }
33
+ );
26
34
  };
27
35
  exports.BridgeConnectButton = BridgeConnectButton;
@@ -8,18 +8,26 @@ const BridgeConnectButton = ({
8
8
  className
9
9
  }) => {
10
10
  const account = useAccount();
11
- return /* @__PURE__ */ jsx(CustomConnectButton, { className, disabled, children: account.isConnected ? null : /* @__PURE__ */ jsxs("div", { className: "liq-flex liq-items-center liq-justify-center liq-gap-1", children: [
12
- !account.isConnected && /* @__PURE__ */ jsx("div", { className: "liq-ml-2 liq-flex liq-items-center liq-gap-1", children: /* @__PURE__ */ jsx("span", { className: "liq-text-primary-200", children: account.isConnecting ? "Connecting..." : "Connect" }) }),
13
- activeChain && /* @__PURE__ */ jsx(
14
- "img",
15
- {
16
- src: activeChain.pngUrl,
17
- alt: "",
18
- className: "liq-z-10 liq-flex liq-h-[1.5rem] liq-w-[1.5rem] liq-p-1"
19
- }
20
- ),
21
- (activeChain == null ? void 0 : activeChain.networkName) && /* @__PURE__ */ jsx("span", { className: "liq-inline liq-truncate", children: getDisplayName(activeChain) })
22
- ] }) });
11
+ return /* @__PURE__ */ jsx(
12
+ CustomConnectButton,
13
+ {
14
+ className,
15
+ disabled,
16
+ "data-testid": "evm-network-connect-button",
17
+ children: account.isConnected ? null : /* @__PURE__ */ jsxs("div", { className: "liq-flex liq-items-center liq-justify-center liq-gap-1", children: [
18
+ !account.isConnected && /* @__PURE__ */ jsx("div", { className: "liq-ml-2 liq-flex liq-items-center liq-gap-1", children: /* @__PURE__ */ jsx("span", { className: "liq-text-primary-200", children: account.isConnecting ? "Connecting..." : "Connect" }) }),
19
+ activeChain && /* @__PURE__ */ jsx(
20
+ "img",
21
+ {
22
+ src: activeChain.pngUrl,
23
+ alt: "",
24
+ className: "liq-z-10 liq-flex liq-h-[1.5rem] liq-w-[1.5rem] liq-p-1"
25
+ }
26
+ ),
27
+ (activeChain == null ? void 0 : activeChain.networkName) && /* @__PURE__ */ jsx("span", { className: "liq-inline liq-truncate", children: getDisplayName(activeChain) })
28
+ ] })
29
+ }
30
+ );
23
31
  };
24
32
  export {
25
33
  BridgeConnectButton
@@ -1,7 +1,8 @@
1
1
  import { ReactNode } from 'react';
2
2
 
3
- export declare const CustomConnectButton: ({ disabled, className, children }: {
3
+ export declare const CustomConnectButton: ({ disabled, className, children, "data-testid": dataTestId }: {
4
4
  disabled?: boolean;
5
5
  className?: string;
6
6
  children?: ReactNode;
7
+ "data-testid"?: string;
7
8
  }) => import("react/jsx-runtime").JSX.Element;
@@ -7,7 +7,8 @@ const wagmi = require("wagmi");
7
7
  const CustomConnectButton = ({
8
8
  disabled,
9
9
  className,
10
- children
10
+ children,
11
+ "data-testid": dataTestId
11
12
  }) => {
12
13
  const { open } = react.useAppKit();
13
14
  const { isConnected, isConnecting } = wagmi.useAccount();
@@ -27,6 +28,7 @@ const CustomConnectButton = ({
27
28
  return /* @__PURE__ */ jsxRuntime.jsx(
28
29
  "button",
29
30
  {
31
+ "data-testid": dataTestId,
30
32
  onClick: () => open({
31
33
  view: "Connect"
32
34
  }),
@@ -4,7 +4,8 @@ import { useAccount, useDisconnect } from "wagmi";
4
4
  const CustomConnectButton = ({
5
5
  disabled,
6
6
  className,
7
- children
7
+ children,
8
+ "data-testid": dataTestId
8
9
  }) => {
9
10
  const { open } = useAppKit();
10
11
  const { isConnected, isConnecting } = useAccount();
@@ -24,6 +25,7 @@ const CustomConnectButton = ({
24
25
  return /* @__PURE__ */ jsx(
25
26
  "button",
26
27
  {
28
+ "data-testid": dataTestId,
27
29
  onClick: () => open({
28
30
  view: "Connect"
29
31
  }),
@@ -46,13 +46,21 @@ const MvxAccountDisplay = ({
46
46
  )
47
47
  }
48
48
  ),
49
- /* @__PURE__ */ jsxRuntime.jsx(reactjs_components_CopyButton_CopyButton.CopyButton, { text: accountAddress, className: "liq-text-sm" })
49
+ /* @__PURE__ */ jsxRuntime.jsx(
50
+ reactjs_components_CopyButton_CopyButton.CopyButton,
51
+ {
52
+ text: accountAddress,
53
+ className: "liq-text-sm",
54
+ "data-testid": "mx-copy-button"
55
+ }
56
+ )
50
57
  ] }) }),
51
58
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "liq-ml-auto liq-mr-0 liq-flex liq-items-center liq-gap-1", children: /* @__PURE__ */ jsxRuntime.jsx(
52
59
  "button",
53
60
  {
54
61
  className: "focus-primary liq-flex liq-items-center liq-gap-1 liq-rounded-xl liq-px-0 liq-py-2 liq-text-sm liq-font-semibold liq-text-neutral-400 liq-transition-colors liq-duration-200 hover:enabled:liq-text-white disabled:liq-opacity-50",
55
62
  onClick: handleDisconnect,
63
+ "data-testid": "mx-disconnect-button",
56
64
  children: /* @__PURE__ */ jsxRuntime.jsx(reactFontawesome.FontAwesomeIcon, { icon: faPowerOff.faPowerOff })
57
65
  }
58
66
  ) })
@@ -63,6 +71,7 @@ const MvxAccountDisplay = ({
63
71
  type: "button",
64
72
  className: "liq-rounded-lg liq-font-semibold liq-transition-colors liq-duration-200 disabled:liq-opacity-50 liq-bg-neutral-750 liq-text-primary-200 hover:enabled:liq-bg-primary liq-px-2",
65
73
  onClick: handleConnect,
74
+ "data-testid": "mx-connect-button",
66
75
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "liq-flex liq-justify-center liq-gap-2", children: [
67
76
  /* @__PURE__ */ jsxRuntime.jsx("div", { children: "Connect " }),
68
77
  /* @__PURE__ */ jsxRuntime.jsx("img", { src: chainIcon, alt: "", className: "liq-w-4" }),
@@ -43,13 +43,21 @@ const MvxAccountDisplay = ({
43
43
  )
44
44
  }
45
45
  ),
46
- /* @__PURE__ */ jsx(CopyButton, { text: accountAddress, className: "liq-text-sm" })
46
+ /* @__PURE__ */ jsx(
47
+ CopyButton,
48
+ {
49
+ text: accountAddress,
50
+ className: "liq-text-sm",
51
+ "data-testid": "mx-copy-button"
52
+ }
53
+ )
47
54
  ] }) }),
48
55
  /* @__PURE__ */ jsx("div", { className: "liq-ml-auto liq-mr-0 liq-flex liq-items-center liq-gap-1", children: /* @__PURE__ */ jsx(
49
56
  "button",
50
57
  {
51
58
  className: "focus-primary liq-flex liq-items-center liq-gap-1 liq-rounded-xl liq-px-0 liq-py-2 liq-text-sm liq-font-semibold liq-text-neutral-400 liq-transition-colors liq-duration-200 hover:enabled:liq-text-white disabled:liq-opacity-50",
52
59
  onClick: handleDisconnect,
60
+ "data-testid": "mx-disconnect-button",
53
61
  children: /* @__PURE__ */ jsx(FontAwesomeIcon, { icon: faPowerOff })
54
62
  }
55
63
  ) })
@@ -60,6 +68,7 @@ const MvxAccountDisplay = ({
60
68
  type: "button",
61
69
  className: "liq-rounded-lg liq-font-semibold liq-transition-colors liq-duration-200 disabled:liq-opacity-50 liq-bg-neutral-750 liq-text-primary-200 hover:enabled:liq-bg-primary liq-px-2",
62
70
  onClick: handleConnect,
71
+ "data-testid": "mx-connect-button",
63
72
  children: /* @__PURE__ */ jsxs("div", { className: "liq-flex liq-justify-center liq-gap-2", children: [
64
73
  /* @__PURE__ */ jsx("div", { children: "Connect " }),
65
74
  /* @__PURE__ */ jsx("img", { src: chainIcon, alt: "", className: "liq-w-4" }),
@@ -17,6 +17,7 @@ const MvxConnectButton = ({
17
17
  return /* @__PURE__ */ jsxRuntime.jsx(
18
18
  reactjs_components_base_MxButton_MxButton.MxButton,
19
19
  {
20
+ "data-testid": "mx-network-connect-button",
20
21
  type: "button",
21
22
  variant: "neutral-850",
22
23
  className: reactjs_utils_mxClsx.mxClsx(
@@ -14,6 +14,7 @@ const MvxConnectButton = ({
14
14
  return /* @__PURE__ */ jsx(
15
15
  MxButton,
16
16
  {
17
+ "data-testid": "mx-network-connect-button",
17
18
  type: "button",
18
19
  variant: "neutral-850",
19
20
  className: mxClsx(
@@ -22,6 +22,7 @@ const SwitchChainButton = ({
22
22
  },
23
23
  className: `${baseStyle} ${className}`,
24
24
  disabled,
25
+ "data-tesid": "evm-connect-button",
25
26
  children
26
27
  }
27
28
  );
@@ -19,6 +19,7 @@ const SwitchChainButton = ({
19
19
  },
20
20
  className: `${baseStyle} ${className}`,
21
21
  disabled,
22
+ "data-tesid": "evm-connect-button",
22
23
  children
23
24
  }
24
25
  );
@@ -1,6 +1,7 @@
1
1
  interface CopyButtonType {
2
2
  text: string;
3
3
  className?: string;
4
+ 'data-testid'?: string;
4
5
  }
5
- export declare const CopyButton: ({ text, className }: CopyButtonType) => import("react/jsx-runtime").JSX.Element;
6
+ export declare const CopyButton: ({ text, className, "data-testid": dataTestId }: CopyButtonType) => import("react/jsx-runtime").JSX.Element;
6
7
  export {};
@@ -8,7 +8,11 @@ const reactFontawesome = require("@fortawesome/react-fontawesome");
8
8
  const React = require("react");
9
9
  const reactjs_components_CopyButton_utils_copyToClipboard = require("./utils/copyToClipboard.js");
10
10
  const reactjs_components_base_MxButton_MxButton = require("../base/MxButton/MxButton.js");
11
- const CopyButton = ({ text, className = "" }) => {
11
+ const CopyButton = ({
12
+ text,
13
+ className = "",
14
+ "data-testid": dataTestId
15
+ }) => {
12
16
  const [copyResult, setCopyResut] = React.useState({
13
17
  default: true,
14
18
  success: false
@@ -35,6 +39,7 @@ const CopyButton = ({ text, className = "" }) => {
35
39
  className,
36
40
  variant: "link-neutral-500",
37
41
  onClick: handleOnClick,
42
+ "data-testid": dataTestId,
38
43
  children: copyResult.default || !copyResult.success ? /* @__PURE__ */ jsxRuntime.jsx(reactFontawesome.FontAwesomeIcon, { icon: faCopy.faCopy }) : /* @__PURE__ */ jsxRuntime.jsx(reactFontawesome.FontAwesomeIcon, { icon: faCheck.faCheck })
39
44
  }
40
45
  );
@@ -5,7 +5,11 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
5
5
  import React from "react";
6
6
  import { copyTextToClipboard } from "./utils/copyToClipboard.mjs";
7
7
  import { MxButton } from "../base/MxButton/MxButton.mjs";
8
- const CopyButton = ({ text, className = "" }) => {
8
+ const CopyButton = ({
9
+ text,
10
+ className = "",
11
+ "data-testid": dataTestId
12
+ }) => {
9
13
  const [copyResult, setCopyResut] = React.useState({
10
14
  default: true,
11
15
  success: false
@@ -32,6 +36,7 @@ const CopyButton = ({ text, className = "" }) => {
32
36
  className,
33
37
  variant: "link-neutral-500",
34
38
  onClick: handleOnClick,
39
+ "data-testid": dataTestId,
35
40
  children: copyResult.default || !copyResult.success ? /* @__PURE__ */ jsx(FontAwesomeIcon, { icon: faCopy }) : /* @__PURE__ */ jsx(FontAwesomeIcon, { icon: faCheck })
36
41
  }
37
42
  );
@@ -11,13 +11,21 @@ const ToggleDirection = ({
11
11
  e.stopPropagation();
12
12
  onChangeDirection();
13
13
  };
14
- return /* @__PURE__ */ jsxRuntime.jsx("button", { className: "liq-inline-block", onClick: handleChangeDirection, children: /* @__PURE__ */ jsxRuntime.jsx(
15
- "img",
14
+ return /* @__PURE__ */ jsxRuntime.jsx(
15
+ "button",
16
16
  {
17
- src: HugImage,
18
- alt: "",
19
- className: "liq-h-6 liq-w-6 liq-text-neutral-100 liq-mx-auto liq-my-2"
17
+ className: "liq-inline-block",
18
+ onClick: handleChangeDirection,
19
+ "data-testid": "toggle-button",
20
+ children: /* @__PURE__ */ jsxRuntime.jsx(
21
+ "img",
22
+ {
23
+ src: HugImage,
24
+ alt: "",
25
+ className: "liq-h-6 liq-w-6 liq-text-neutral-100 liq-mx-auto liq-my-2"
26
+ }
27
+ )
20
28
  }
21
- ) });
29
+ );
22
30
  };
23
31
  exports.ToggleDirection = ToggleDirection;
@@ -8,14 +8,22 @@ const ToggleDirection = ({
8
8
  e.stopPropagation();
9
9
  onChangeDirection();
10
10
  };
11
- return /* @__PURE__ */ jsx("button", { className: "liq-inline-block", onClick: handleChangeDirection, children: /* @__PURE__ */ jsx(
12
- "img",
11
+ return /* @__PURE__ */ jsx(
12
+ "button",
13
13
  {
14
- src: HugImage,
15
- alt: "",
16
- className: "liq-h-6 liq-w-6 liq-text-neutral-100 liq-mx-auto liq-my-2"
14
+ className: "liq-inline-block",
15
+ onClick: handleChangeDirection,
16
+ "data-testid": "toggle-button",
17
+ children: /* @__PURE__ */ jsx(
18
+ "img",
19
+ {
20
+ src: HugImage,
21
+ alt: "",
22
+ className: "liq-h-6 liq-w-6 liq-text-neutral-100 liq-mx-auto liq-my-2"
23
+ }
24
+ )
17
25
  }
18
- ) });
26
+ );
19
27
  };
20
28
  export {
21
29
  ToggleDirection
@@ -149,6 +149,7 @@ const TokenSelector = ({
149
149
  /* @__PURE__ */ jsxRuntime.jsx(
150
150
  reactjs_components_DisplayAmount_DisplayAmount.DisplayAmount,
151
151
  {
152
+ "data-testid": `${name}-balance`,
152
153
  decimals: selectedOption == null ? void 0 : selectedOption.decimals,
153
154
  amount: (selectedOption == null ? void 0 : selectedOption.balance) ?? "0",
154
155
  className: "liq-font-medium liq-text-neutral-100"
@@ -146,6 +146,7 @@ const TokenSelector = ({
146
146
  /* @__PURE__ */ jsx(
147
147
  DisplayAmount,
148
148
  {
149
+ "data-testid": `${name}-balance`,
149
150
  decimals: selectedOption == null ? void 0 : selectedOption.decimals,
150
151
  amount: (selectedOption == null ? void 0 : selectedOption.balance) ?? "0",
151
152
  className: "liq-font-medium liq-text-neutral-100"
@@ -13,6 +13,7 @@ const TokenItem = ({
13
13
  onClick,
14
14
  selected
15
15
  }) => {
16
+ var _a, _b;
16
17
  const { tokenChain, chainIcon } = reactjs_hooks_useResolveTokenChain.useResolveTokenChain({
17
18
  token
18
19
  });
@@ -36,6 +37,7 @@ const TokenItem = ({
36
37
  return /* @__PURE__ */ jsxRuntime.jsx(
37
38
  "div",
38
39
  {
40
+ "data-testid": `token-item-${(_b = (_a = token.symbol) == null ? void 0 : _a.toLowerCase) == null ? void 0 : _b.call(_a)}`,
39
41
  className: `token-item ${selected ? "liq-selected" : ""} liq-flex liq-cursor-pointer liq-items-center liq-justify-between liq-rounded-lg liq-p-2 hover:liq-bg-neutral-700 liq-bg-neutral-850`,
40
42
  onClick: () => {
41
43
  handleSwitchChain();
@@ -10,6 +10,7 @@ const TokenItem = ({
10
10
  onClick,
11
11
  selected
12
12
  }) => {
13
+ var _a, _b;
13
14
  const { tokenChain, chainIcon } = useResolveTokenChain({
14
15
  token
15
16
  });
@@ -33,6 +34,7 @@ const TokenItem = ({
33
34
  return /* @__PURE__ */ jsx(
34
35
  "div",
35
36
  {
37
+ "data-testid": `token-item-${(_b = (_a = token.symbol) == null ? void 0 : _a.toLowerCase) == null ? void 0 : _b.call(_a)}`,
36
38
  className: `token-item ${selected ? "liq-selected" : ""} liq-flex liq-cursor-pointer liq-items-center liq-justify-between liq-rounded-lg liq-p-2 hover:liq-bg-neutral-700 liq-bg-neutral-850`,
37
39
  onClick: () => {
38
40
  handleSwitchChain();
@@ -3,6 +3,7 @@ interface WalletTruncateProps {
3
3
  startLength?: number;
4
4
  endLength?: number;
5
5
  className?: string;
6
+ 'data-testid'?: string;
6
7
  }
7
- export declare const TrimAddress: ({ address, startLength, endLength, className }: WalletTruncateProps) => import("react/jsx-runtime").JSX.Element | null;
8
+ export declare const TrimAddress: ({ "data-testid": dataTestId, address, startLength, endLength, className }: WalletTruncateProps) => import("react/jsx-runtime").JSX.Element | null;
8
9
  export {};
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
4
  const jsxRuntime = require("react/jsx-runtime");
5
5
  const TrimAddress = ({
6
+ "data-testid": dataTestId,
6
7
  address,
7
8
  startLength = 4,
8
9
  endLength = 5,
@@ -14,6 +15,7 @@ const TrimAddress = ({
14
15
  return /* @__PURE__ */ jsxRuntime.jsxs(
15
16
  "div",
16
17
  {
18
+ "data-testid": dataTestId,
17
19
  className: `liq-truncate liq-text-left liq-text-neutral-100 uppercase liq-flex liq-gap-1 ${className}`,
18
20
  children: [
19
21
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: address.slice(0, startLength) }),
@@ -1,5 +1,6 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
2
  const TrimAddress = ({
3
+ "data-testid": dataTestId,
3
4
  address,
4
5
  startLength = 4,
5
6
  endLength = 5,
@@ -11,6 +12,7 @@ const TrimAddress = ({
11
12
  return /* @__PURE__ */ jsxs(
12
13
  "div",
13
14
  {
15
+ "data-testid": dataTestId,
14
16
  className: `liq-truncate liq-text-left liq-text-neutral-100 uppercase liq-flex liq-gap-1 ${className}`,
15
17
  children: [
16
18
  /* @__PURE__ */ jsx("span", { children: address.slice(0, startLength) }),
@@ -19,7 +19,7 @@ export interface TradeFormikValuesType {
19
19
  fromChainId?: string;
20
20
  toChainId?: string;
21
21
  }
22
- export declare const useBridgeFormik: ({ sender, receiver, firstToken, firstAmount, secondToken, secondAmount, fromChainId, toChainId, setForceRefetchRate, rate, onSubmit }: {
22
+ export declare const useBridgeFormik: ({ sender, receiver, firstToken, firstAmount, secondToken, secondAmount, fromChainId, toChainId, setForceRefetchRate, rate, onSubmit, isMvxConnected }: {
23
23
  sender: string;
24
24
  receiver: string;
25
25
  firstAmount?: string;
@@ -28,6 +28,7 @@ export declare const useBridgeFormik: ({ sender, receiver, firstToken, firstAmou
28
28
  toChainId?: string;
29
29
  firstToken?: TokenType;
30
30
  secondToken?: TokenType;
31
+ isMvxConnected: boolean;
31
32
  setForceRefetchRate?: (value: (previous: number) => number) => void;
32
33
  rate?: RateRequestResponse;
33
34
  onSubmit: ({ transactions, provider }: {
@@ -30,7 +30,8 @@ const useBridgeFormik = ({
30
30
  toChainId,
31
31
  setForceRefetchRate,
32
32
  rate,
33
- onSubmit
33
+ onSubmit,
34
+ isMvxConnected
34
35
  }) => {
35
36
  const pendingSigningRef = React.useRef();
36
37
  const { nativeAuthToken } = reactjs_context_useWeb3App.useWeb3App();
@@ -93,7 +94,7 @@ const useBridgeFormik = ({
93
94
  [
94
95
  "firstAmount"
95
96
  /* firstAmount */
96
- ]: reactjs_hooks_validation_useAmountSchema.useAmountSchema(),
97
+ ]: reactjs_hooks_validation_useAmountSchema.useAmountSchema({ isMvxConnected }),
97
98
  [
98
99
  "firstToken"
99
100
  /* firstToken */
@@ -27,7 +27,8 @@ const useBridgeFormik = ({
27
27
  toChainId,
28
28
  setForceRefetchRate,
29
29
  rate,
30
- onSubmit
30
+ onSubmit,
31
+ isMvxConnected
31
32
  }) => {
32
33
  const pendingSigningRef = useRef();
33
34
  const { nativeAuthToken } = useWeb3App();
@@ -90,7 +91,7 @@ const useBridgeFormik = ({
90
91
  [
91
92
  "firstAmount"
92
93
  /* firstAmount */
93
- ]: useAmountSchema(),
94
+ ]: useAmountSchema({ isMvxConnected }),
94
95
  [
95
96
  "firstToken"
96
97
  /* firstToken */
@@ -1,2 +1,4 @@
1
1
  import * as yup from 'yup';
2
- export declare const useAmountSchema: () => yup.StringSchema<string, yup.AnyObject, undefined, "">;
2
+ export declare const useAmountSchema: ({ isMvxConnected }: {
3
+ isMvxConnected: boolean;
4
+ }) => yup.StringSchema<string, yup.AnyObject, undefined, "">;
@@ -21,9 +21,11 @@ function _interopNamespaceDefault(e) {
21
21
  return Object.freeze(n);
22
22
  }
23
23
  const yup__namespace = /* @__PURE__ */ _interopNamespaceDefault(yup);
24
- const useAmountSchema = () => {
24
+ const useAmountSchema = ({
25
+ isMvxConnected
26
+ }) => {
25
27
  const testHasEnoughFunds = reactjs_hooks_validation_useTestHasEnoughFunds.useTestHasEnoughFunds();
26
- const testIsConnected = reactjs_hooks_validation_useTestIsConnected.useTestIsConnected();
28
+ const testIsConnected = reactjs_hooks_validation_useTestIsConnected.useTestIsConnected({ isMvxConnected });
27
29
  const testStartDot = (value) => !(value == null ? void 0 : value.startsWith("."));
28
30
  const testEndDot = (value) => !(value == null ? void 0 : value.endsWith("."));
29
31
  return yup__namespace.string().required("Amount is a required field").test("account", testIsConnected).test("startDot", "Amount must not start with dot", testStartDot).test("endDot", "Amount must not end with dot", testEndDot).test("funds", testHasEnoughFunds);
@@ -1,9 +1,11 @@
1
1
  import * as yup from "yup";
2
2
  import { useTestHasEnoughFunds } from "./useTestHasEnoughFunds.mjs";
3
3
  import { useTestIsConnected } from "./useTestIsConnected.mjs";
4
- const useAmountSchema = () => {
4
+ const useAmountSchema = ({
5
+ isMvxConnected
6
+ }) => {
5
7
  const testHasEnoughFunds = useTestHasEnoughFunds();
6
- const testIsConnected = useTestIsConnected();
8
+ const testIsConnected = useTestIsConnected({ isMvxConnected });
7
9
  const testStartDot = (value) => !(value == null ? void 0 : value.startsWith("."));
8
10
  const testEndDot = (value) => !(value == null ? void 0 : value.endsWith("."));
9
11
  return yup.string().required("Amount is a required field").test("account", testIsConnected).test("startDot", "Amount must not start with dot", testStartDot).test("endDot", "Amount must not end with dot", testEndDot).test("funds", testHasEnoughFunds);
@@ -1,3 +1,5 @@
1
1
  import { TestContext } from 'yup';
2
2
 
3
- export declare const useTestIsConnected: () => <T extends string | undefined>(_value: T, context: TestContext) => true | import('yup').ValidationError;
3
+ export declare const useTestIsConnected: ({ isMvxConnected }: {
4
+ isMvxConnected: boolean;
5
+ }) => <T extends string | undefined>(_value: T, context: TestContext) => true | import('yup').ValidationError;
@@ -2,12 +2,19 @@
2
2
  "use strict";
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
4
  const React = require("react");
5
+ const helpers_getMvxChainId = require("../../../helpers/getMvxChainId.js");
5
6
  const reactjs_hooks_useAccount = require("../useAccount.js");
6
- const useTestIsConnected = () => {
7
+ const useTestIsConnected = ({
8
+ isMvxConnected
9
+ }) => {
7
10
  const { address } = reactjs_hooks_useAccount.useAccount();
8
11
  return React.useCallback(
9
12
  (_value, context) => {
10
- if (Boolean(address)) {
13
+ const firstToken = context.parent.firstToken;
14
+ const mvxChainId = helpers_getMvxChainId.getMvxChainId();
15
+ const isFromMvxChain = (firstToken == null ? void 0 : firstToken.chainId) === mvxChainId;
16
+ const isConnected = isFromMvxChain ? isMvxConnected : Boolean(address);
17
+ if (isConnected) {
11
18
  return true;
12
19
  }
13
20
  return context.createError({
@@ -15,7 +22,7 @@ const useTestIsConnected = () => {
15
22
  path: context.path
16
23
  });
17
24
  },
18
- [address]
25
+ [address, isMvxConnected]
19
26
  );
20
27
  };
21
28
  exports.useTestIsConnected = useTestIsConnected;
@@ -1,10 +1,17 @@
1
1
  import { useCallback } from "react";
2
+ import { getMvxChainId } from "../../../helpers/getMvxChainId.mjs";
2
3
  import { useAccount } from "../useAccount.mjs";
3
- const useTestIsConnected = () => {
4
+ const useTestIsConnected = ({
5
+ isMvxConnected
6
+ }) => {
4
7
  const { address } = useAccount();
5
8
  return useCallback(
6
9
  (_value, context) => {
7
- if (Boolean(address)) {
10
+ const firstToken = context.parent.firstToken;
11
+ const mvxChainId = getMvxChainId();
12
+ const isFromMvxChain = (firstToken == null ? void 0 : firstToken.chainId) === mvxChainId;
13
+ const isConnected = isFromMvxChain ? isMvxConnected : Boolean(address);
14
+ if (isConnected) {
8
15
  return true;
9
16
  }
10
17
  return context.createError({
@@ -12,7 +19,7 @@ const useTestIsConnected = () => {
12
19
  path: context.path
13
20
  });
14
21
  },
15
- [address]
22
+ [address, isMvxConnected]
16
23
  );
17
24
  };
18
25
  export {