@multiversx/sdk-dapp-liquidity 1.1.0-alpha.14 → 1.1.0-alpha.15

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/index.js CHANGED
@@ -53,7 +53,7 @@ const reactjs_hooks_validation_useSecondAmountSchema = require("./reactjs/hooks/
53
53
  const reactjs_hooks_validation_useTestHasEnoughFunds = require("./reactjs/hooks/validation/useTestHasEnoughFunds.js");
54
54
  const reactjs_hooks_validation_useTestIsConnected = require("./reactjs/hooks/validation/useTestIsConnected.js");
55
55
  const reactjs_hooks_useAccount = require("./reactjs/hooks/useAccount.js");
56
- const reactjs_hooks_useBalances = require("./useBalances-CPQr6NnQ.js");
56
+ const reactjs_hooks_useBalances = require("./useBalances-Ds5d90Cc.js");
57
57
  const reactjs_hooks_useBridgeFormik = require("./reactjs/hooks/useBridgeFormik.js");
58
58
  const reactjs_hooks_useDebounce = require("./reactjs/hooks/useDebounce.js");
59
59
  const reactjs_hooks_useFetchBridgeData = require("./reactjs/hooks/useFetchBridgeData.js");
package/index.mjs CHANGED
@@ -50,7 +50,7 @@ import { useSecondAmountSchema } from "./reactjs/hooks/validation/useSecondAmoun
50
50
  import { useTestHasEnoughFunds } from "./reactjs/hooks/validation/useTestHasEnoughFunds.mjs";
51
51
  import { useTestIsConnected } from "./reactjs/hooks/validation/useTestIsConnected.mjs";
52
52
  import { useAccount } from "./reactjs/hooks/useAccount.mjs";
53
- import { u } from "./useBalances-DZcebYxR.mjs";
53
+ import { u } from "./useBalances-CvRCOieR.mjs";
54
54
  import { BridgeFormikValuesEnum, useBridgeFormik } from "./reactjs/hooks/useBridgeFormik.mjs";
55
55
  import { useDebounce } from "./reactjs/hooks/useDebounce.mjs";
56
56
  import { useFetchBridgeData } from "./reactjs/hooks/useFetchBridgeData.mjs";
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.0-alpha.14",
31
+ "version": "1.1.0-alpha.15",
32
32
  "main": "index.js",
33
33
  "module": "index.mjs",
34
34
  "types": "index.d.ts",
@@ -44,7 +44,7 @@ const reactjs_components_Connect_MvxAccountDisplay = require("../Connect/MvxAcco
44
44
  const reactjs_components_TokenSelector_TokenSelector = require("../TokenSelector/TokenSelector.js");
45
45
  const viem = require("viem");
46
46
  const actions = require("viem/actions");
47
- const reactjs_hooks_useBalances = require("../../../useBalances-CPQr6NnQ.js");
47
+ const reactjs_hooks_useBalances = require("../../../useBalances-Ds5d90Cc.js");
48
48
  function deepEqual(a, b) {
49
49
  if (a === b)
50
50
  return true;
@@ -220,13 +220,9 @@ const BridgeForm = ({
220
220
  )) ?? (chains == null ? void 0 : chains[0]),
221
221
  [activeChain == null ? void 0 : activeChain.id, chains]
222
222
  );
223
- console.log({
224
- chains,
225
- selectedChainOption
226
- });
227
223
  const defaultReceivingToken = React.useMemo(
228
- () => toOptions.find((x) => x.symbol.toLowerCase().includes("egld")),
229
- [toOptions]
224
+ () => (availableTokens == null ? void 0 : availableTokens[0]) ?? toOptions.find((x) => x.symbol.toLowerCase().includes("usdc")),
225
+ [toOptions, availableTokens]
230
226
  );
231
227
  const hasAmounts = firstAmount !== "" && secondAmount !== "";
232
228
  const fetchRateDebounced = React.useCallback(
@@ -632,6 +628,7 @@ const BridgeForm = ({
632
628
  disabled: isPendingRate,
633
629
  options: fromOptions,
634
630
  areOptionsLoading: isTokensLoading,
631
+ isMvxSelector: false,
635
632
  color: "neutral-850",
636
633
  onChange: onChangeFirstSelect,
637
634
  onBlur: handleBlur,
@@ -41,7 +41,7 @@ import { MvxAccountDisplay } from "../Connect/MvxAccountDisplay.mjs";
41
41
  import { TokenSelector } from "../TokenSelector/TokenSelector.mjs";
42
42
  import { hexToString } from "viem";
43
43
  import { waitForTransactionReceipt as waitForTransactionReceipt$1, getTransaction, call } from "viem/actions";
44
- import { g as getAction } from "../../../useBalances-DZcebYxR.mjs";
44
+ import { g as getAction } from "../../../useBalances-CvRCOieR.mjs";
45
45
  function deepEqual(a, b) {
46
46
  if (a === b)
47
47
  return true;
@@ -217,13 +217,9 @@ const BridgeForm = ({
217
217
  )) ?? (chains == null ? void 0 : chains[0]),
218
218
  [activeChain == null ? void 0 : activeChain.id, chains]
219
219
  );
220
- console.log({
221
- chains,
222
- selectedChainOption
223
- });
224
220
  const defaultReceivingToken = useMemo(
225
- () => toOptions.find((x) => x.symbol.toLowerCase().includes("egld")),
226
- [toOptions]
221
+ () => (availableTokens == null ? void 0 : availableTokens[0]) ?? toOptions.find((x) => x.symbol.toLowerCase().includes("usdc")),
222
+ [toOptions, availableTokens]
227
223
  );
228
224
  const hasAmounts = firstAmount !== "" && secondAmount !== "";
229
225
  const fetchRateDebounced = useCallback(
@@ -629,6 +625,7 @@ const BridgeForm = ({
629
625
  disabled: isPendingRate,
630
626
  options: fromOptions,
631
627
  areOptionsLoading: isTokensLoading,
628
+ isMvxSelector: false,
632
629
  color: "neutral-850",
633
630
  onChange: onChangeFirstSelect,
634
631
  onBlur: handleBlur,
@@ -45,11 +45,7 @@ const TokenSelector = ({
45
45
  (chain) => !constants_index.MVX_CHAIN_IDS.includes(chain.chainId.toString())
46
46
  )) ?? [];
47
47
  }, [data]);
48
- console.log(`TokenSelector - ${name}`, {
49
- chains,
50
- options,
51
- selectedOption
52
- });
48
+ const isVisuallyDisabled = disabled || chains.length < 2;
53
49
  const handleOnClick = () => setShow(true);
54
50
  React.useEffect(() => {
55
51
  onTokenSelectorDisplay == null ? void 0 : onTokenSelectorDisplay(show);
@@ -83,7 +79,7 @@ const TokenSelector = ({
83
79
  },
84
80
  tokens: options,
85
81
  chains,
86
- isMvxSelector: true,
82
+ isMvxSelector,
87
83
  areChainsLoading,
88
84
  selectedToken: selectedOption
89
85
  }
@@ -105,19 +101,19 @@ const TokenSelector = ({
105
101
  "liq-bg-neutral-900/50 liq-outline liq-outline-1 liq-outline-neutral-700/20 hover:enabled:liq-bg-neutral-600/50 hover:enabled:liq-outline-neutral-600": color === "neutral-850"
106
102
  },
107
103
  {
108
- "disabled:!liq-opacity-70": disabled && !omitDisableClass
104
+ "disabled:!liq-opacity-70": isVisuallyDisabled && !omitDisableClass
109
105
  },
110
106
  {
111
- "!liq-cursor-not-allowed !liq-bg-transparent !liq-outline-transparent": disabled
107
+ "!liq-cursor-not-allowed !liq-bg-transparent !liq-outline-transparent": isVisuallyDisabled
112
108
  },
113
109
  className
114
110
  ),
115
111
  onBlur,
116
112
  onClick: handleOnClick,
117
- disabled,
113
+ disabled: isVisuallyDisabled,
118
114
  children: [
119
115
  /* @__PURE__ */ jsxRuntime.jsx(reactjs_components_TokenSelector_components_SelectedOption.SelectedOption, { value: selectedOption }),
120
- !disabled && /* @__PURE__ */ jsxRuntime.jsx(
116
+ !isVisuallyDisabled && /* @__PURE__ */ jsxRuntime.jsx(
121
117
  reactFontawesome.FontAwesomeIcon,
122
118
  {
123
119
  icon: faChevronDown.faChevronDown,
@@ -42,11 +42,7 @@ const TokenSelector = ({
42
42
  (chain) => !MVX_CHAIN_IDS.includes(chain.chainId.toString())
43
43
  )) ?? [];
44
44
  }, [data]);
45
- console.log(`TokenSelector - ${name}`, {
46
- chains,
47
- options,
48
- selectedOption
49
- });
45
+ const isVisuallyDisabled = disabled || chains.length < 2;
50
46
  const handleOnClick = () => setShow(true);
51
47
  useEffect(() => {
52
48
  onTokenSelectorDisplay == null ? void 0 : onTokenSelectorDisplay(show);
@@ -80,7 +76,7 @@ const TokenSelector = ({
80
76
  },
81
77
  tokens: options,
82
78
  chains,
83
- isMvxSelector: true,
79
+ isMvxSelector,
84
80
  areChainsLoading,
85
81
  selectedToken: selectedOption
86
82
  }
@@ -102,19 +98,19 @@ const TokenSelector = ({
102
98
  "liq-bg-neutral-900/50 liq-outline liq-outline-1 liq-outline-neutral-700/20 hover:enabled:liq-bg-neutral-600/50 hover:enabled:liq-outline-neutral-600": color === "neutral-850"
103
99
  },
104
100
  {
105
- "disabled:!liq-opacity-70": disabled && !omitDisableClass
101
+ "disabled:!liq-opacity-70": isVisuallyDisabled && !omitDisableClass
106
102
  },
107
103
  {
108
- "!liq-cursor-not-allowed !liq-bg-transparent !liq-outline-transparent": disabled
104
+ "!liq-cursor-not-allowed !liq-bg-transparent !liq-outline-transparent": isVisuallyDisabled
109
105
  },
110
106
  className
111
107
  ),
112
108
  onBlur,
113
109
  onClick: handleOnClick,
114
- disabled,
110
+ disabled: isVisuallyDisabled,
115
111
  children: [
116
112
  /* @__PURE__ */ jsx(SelectedOption, { value: selectedOption }),
117
- !disabled && /* @__PURE__ */ jsx(
113
+ !isVisuallyDisabled && /* @__PURE__ */ jsx(
118
114
  FontAwesomeIcon,
119
115
  {
120
116
  icon: faChevronDown,
@@ -19,11 +19,6 @@ const TokenItem = ({
19
19
  const { supportedChains: sdkChains } = reactjs_context_useWeb3App.useWeb3App();
20
20
  const { switchNetwork } = react.useAppKitNetwork();
21
21
  const chainId = reactjs_hooks_useGetChainId.useGetChainId();
22
- console.log({
23
- tokenChain,
24
- sdkChains,
25
- chainId
26
- });
27
22
  const activeChain = React.useMemo(() => {
28
23
  return sdkChains == null ? void 0 : sdkChains.find(
29
24
  (chain) => chain.id.toString() === (chainId == null ? void 0 : chainId.toString())
@@ -16,11 +16,6 @@ const TokenItem = ({
16
16
  const { supportedChains: sdkChains } = useWeb3App();
17
17
  const { switchNetwork } = useAppKitNetwork();
18
18
  const chainId = useGetChainId();
19
- console.log({
20
- tokenChain,
21
- sdkChains,
22
- chainId
23
- });
24
19
  const activeChain = useMemo(() => {
25
20
  return sdkChains == null ? void 0 : sdkChains.find(
26
21
  (chain) => chain.id.toString() === (chainId == null ? void 0 : chainId.toString())
@@ -6,7 +6,7 @@ const reactjs_hooks_validation_useSecondAmountSchema = require("./validation/use
6
6
  const reactjs_hooks_validation_useTestHasEnoughFunds = require("./validation/useTestHasEnoughFunds.js");
7
7
  const reactjs_hooks_validation_useTestIsConnected = require("./validation/useTestIsConnected.js");
8
8
  const reactjs_hooks_useAccount = require("./useAccount.js");
9
- const reactjs_hooks_useBalances = require("../../useBalances-CPQr6NnQ.js");
9
+ const reactjs_hooks_useBalances = require("../../useBalances-Ds5d90Cc.js");
10
10
  const reactjs_hooks_useBridgeFormik = require("./useBridgeFormik.js");
11
11
  const reactjs_hooks_useDebounce = require("./useDebounce.js");
12
12
  const reactjs_hooks_useFetchBridgeData = require("./useFetchBridgeData.js");
@@ -3,7 +3,7 @@ import { useSecondAmountSchema } from "./validation/useSecondAmountSchema.mjs";
3
3
  import { useTestHasEnoughFunds } from "./validation/useTestHasEnoughFunds.mjs";
4
4
  import { useTestIsConnected } from "./validation/useTestIsConnected.mjs";
5
5
  import { useAccount } from "./useAccount.mjs";
6
- import { u } from "../../useBalances-DZcebYxR.mjs";
6
+ import { u } from "../../useBalances-CvRCOieR.mjs";
7
7
  import { BridgeFormikValuesEnum, useBridgeFormik } from "./useBridgeFormik.mjs";
8
8
  import { useDebounce } from "./useDebounce.mjs";
9
9
  import { useFetchBridgeData } from "./useFetchBridgeData.mjs";
@@ -13,7 +13,7 @@ require("yup");
13
13
  require("@multiversx/sdk-dapp-utils/out/helpers/parseAmount");
14
14
  require("../../bignumber-B8vjg9qn.js");
15
15
  require("wagmi");
16
- const reactjs_hooks_useBalances = require("../../useBalances-CPQr6NnQ.js");
16
+ const reactjs_hooks_useBalances = require("../../useBalances-Ds5d90Cc.js");
17
17
  require("formik");
18
18
  require("../constants/index.js");
19
19
  require("@reown/appkit-adapter-solana/react");
@@ -10,7 +10,7 @@ import "yup";
10
10
  import "@multiversx/sdk-dapp-utils/out/helpers/parseAmount";
11
11
  import "../../bignumber-CKZkoo0g.mjs";
12
12
  import "wagmi";
13
- import { u } from "../../useBalances-DZcebYxR.mjs";
13
+ import { u } from "../../useBalances-CvRCOieR.mjs";
14
14
  import "formik";
15
15
  import "../constants/index.mjs";
16
16
  import "@reown/appkit-adapter-solana/react";
package/reactjs/index.js CHANGED
@@ -36,7 +36,7 @@ const reactjs_hooks_validation_useSecondAmountSchema = require("./hooks/validati
36
36
  const reactjs_hooks_validation_useTestHasEnoughFunds = require("./hooks/validation/useTestHasEnoughFunds.js");
37
37
  const reactjs_hooks_validation_useTestIsConnected = require("./hooks/validation/useTestIsConnected.js");
38
38
  const reactjs_hooks_useAccount = require("./hooks/useAccount.js");
39
- const reactjs_hooks_useBalances = require("../useBalances-CPQr6NnQ.js");
39
+ const reactjs_hooks_useBalances = require("../useBalances-Ds5d90Cc.js");
40
40
  const reactjs_hooks_useBridgeFormik = require("./hooks/useBridgeFormik.js");
41
41
  const reactjs_hooks_useDebounce = require("./hooks/useDebounce.js");
42
42
  const reactjs_hooks_useFetchBridgeData = require("./hooks/useFetchBridgeData.js");
package/reactjs/index.mjs CHANGED
@@ -33,7 +33,7 @@ import { useSecondAmountSchema } from "./hooks/validation/useSecondAmountSchema.
33
33
  import { useTestHasEnoughFunds } from "./hooks/validation/useTestHasEnoughFunds.mjs";
34
34
  import { useTestIsConnected } from "./hooks/validation/useTestIsConnected.mjs";
35
35
  import { useAccount } from "./hooks/useAccount.mjs";
36
- import { u } from "../useBalances-DZcebYxR.mjs";
36
+ import { u } from "../useBalances-CvRCOieR.mjs";
37
37
  import { BridgeFormikValuesEnum, useBridgeFormik } from "./hooks/useBridgeFormik.mjs";
38
38
  import { useDebounce } from "./hooks/useDebounce.mjs";
39
39
  import { useFetchBridgeData } from "./hooks/useFetchBridgeData.mjs";
@@ -41,10 +41,6 @@ function init(options) {
41
41
  bitcoinTestnet: networks.bitcoinTestnet,
42
42
  ...viemNetworks__namespace
43
43
  };
44
- console.log("supported chains", {
45
- networks: networks$1,
46
- viemNetworks: viemNetworks__namespace
47
- });
48
44
  const acceptedNetworks = Object.values(networks$1).filter(
49
45
  (chain) => options.acceptedChainIDs.includes(chain.id.toString()) && !constants_index.MVX_CHAIN_IDS.includes(chain.id.toString())
50
46
  ).map((network) => network);
@@ -71,12 +67,6 @@ function init(options) {
71
67
  adapters: [wagmiAdapter, solanaAdapter, bitcoinAdapter],
72
68
  networks: [supportedChains[0], ...supportedChains.slice(1)]
73
69
  });
74
- console.log("init", {
75
- config: wagmiAdapter.wagmiConfig,
76
- appKit,
77
- options,
78
- supportedChains
79
- });
80
70
  return {
81
71
  config: wagmiAdapter.wagmiConfig,
82
72
  appKit,
@@ -21,10 +21,6 @@ function init(options) {
21
21
  bitcoinTestnet,
22
22
  ...viemNetworks
23
23
  };
24
- console.log("supported chains", {
25
- networks,
26
- viemNetworks
27
- });
28
24
  const acceptedNetworks = Object.values(networks).filter(
29
25
  (chain) => options.acceptedChainIDs.includes(chain.id.toString()) && !MVX_CHAIN_IDS.includes(chain.id.toString())
30
26
  ).map((network) => network);
@@ -51,12 +47,6 @@ function init(options) {
51
47
  adapters: [wagmiAdapter, solanaAdapter, bitcoinAdapter],
52
48
  networks: [supportedChains[0], ...supportedChains.slice(1)]
53
49
  });
54
- console.log("init", {
55
- config: wagmiAdapter.wagmiConfig,
56
- appKit,
57
- options,
58
- supportedChains
59
- });
60
50
  return {
61
51
  config: wagmiAdapter.wagmiConfig,
62
52
  appKit,
@@ -9,7 +9,7 @@ require("react");
9
9
  require("@multiversx/sdk-dapp-utils/out/helpers/parseAmount");
10
10
  require("../../bignumber-B8vjg9qn.js");
11
11
  require("wagmi");
12
- const reactjs_hooks_useBalances = require("../../useBalances-CPQr6NnQ.js");
12
+ const reactjs_hooks_useBalances = require("../../useBalances-Ds5d90Cc.js");
13
13
  require("formik");
14
14
  require("axios");
15
15
  require("../context/Web3AppProvider.js");
@@ -6,7 +6,7 @@ import "react";
6
6
  import "@multiversx/sdk-dapp-utils/out/helpers/parseAmount";
7
7
  import "../../bignumber-CKZkoo0g.mjs";
8
8
  import "wagmi";
9
- import { u as useBalances } from "../../useBalances-DZcebYxR.mjs";
9
+ import { u as useBalances } from "../../useBalances-CvRCOieR.mjs";
10
10
  import "formik";
11
11
  import "axios";
12
12
  import "../context/Web3AppProvider.mjs";
@@ -180,7 +180,6 @@ const useBalances = () => {
180
180
  const connection = new Connection(rpcUrl);
181
181
  const publicKey = new PublicKey(addr);
182
182
  const balance = await connection.getBalance(publicKey);
183
- console.log(`SOL Balance: ${balance / 1e9} SOL`);
184
183
  return {
185
184
  value: BigInt(balance.toString()),
186
185
  decimals: 9,
@@ -195,7 +194,6 @@ const useBalances = () => {
195
194
  (sum, utxo) => sum + utxo.value,
196
195
  0
197
196
  );
198
- console.log(`BTC Balance: ${balance / 1e8} BTC`);
199
197
  return {
200
198
  value: BigInt(balance.toString()),
201
199
  decimals: 8,
@@ -182,7 +182,6 @@ const useBalances = () => {
182
182
  const connection = new web3_js.Connection(rpcUrl);
183
183
  const publicKey = new web3_js.PublicKey(addr);
184
184
  const balance = await connection.getBalance(publicKey);
185
- console.log(`SOL Balance: ${balance / 1e9} SOL`);
186
185
  return {
187
186
  value: BigInt(balance.toString()),
188
187
  decimals: 9,
@@ -197,7 +196,6 @@ const useBalances = () => {
197
196
  (sum, utxo) => sum + utxo.value,
198
197
  0
199
198
  );
200
- console.log(`BTC Balance: ${balance / 1e8} BTC`);
201
199
  return {
202
200
  value: BigInt(balance.toString()),
203
201
  decimals: 8,