@multiversx/sdk-dapp-liquidity 1.0.7 → 1.0.9

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
@@ -178,6 +178,7 @@ Object.defineProperty(exports, "useWaitForTransactionReceipt", {
178
178
  enumerable: true,
179
179
  get: () => wagmi.useWaitForTransactionReceipt
180
180
  });
181
+ exports.ALL_NETWORK_ID = reactjs_constants_chains.ALL_NETWORK_ID;
181
182
  exports.chainIdentifier = reactjs_constants_chains.chainIdentifier;
182
183
  exports.useAppKit = index.useAppKit;
183
184
  exports.useAppKitEvents = index.useAppKitEvents;
package/index.mjs CHANGED
@@ -80,10 +80,11 @@ import { roundAmount } from "./reactjs/utils/roundAmount.mjs";
80
80
  import { testNumber } from "./reactjs/utils/testNumber.mjs";
81
81
  import { u as u2 } from "./react-B9sQBOh0.mjs";
82
82
  import { useWaitForTransactionReceipt } from "wagmi";
83
- import { chainIdentifier } from "./reactjs/constants/chains.mjs";
83
+ import { ALL_NETWORK_ID, chainIdentifier } from "./reactjs/constants/chains.mjs";
84
84
  import { u as u3, a, e, b, c, d } from "./index-BXwpbIDQ.mjs";
85
85
  import { u as u4, b as b2, a as a2 } from "./react-CSQpf1zk.mjs";
86
86
  export {
87
+ ALL_NETWORK_ID,
87
88
  AccountAddress,
88
89
  AmountCard,
89
90
  AmountInput,
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.0.7",
31
+ "version": "1.0.9",
32
32
  "main": "index.js",
33
33
  "module": "index.mjs",
34
34
  "types": "index.d.ts",
@@ -30,31 +30,42 @@ const AmountInput = ({
30
30
  }
31
31
  };
32
32
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "liq-flex liq-w-full liq-flex-col liq-justify-between", children: [
33
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "liq-flex liq-text-base liq-max-w-none liq-w-full liq-bg-transparent liq-relative", children: /* @__PURE__ */ jsxRuntime.jsx(
34
- reactNumberFormat.NumericFormat,
33
+ /* @__PURE__ */ jsxRuntime.jsx(
34
+ "div",
35
35
  {
36
- name: inputName,
37
- value: inputValue,
38
- placeholder: "0",
39
- allowLeadingZeros: true,
40
- thousandSeparator: ",",
41
- allowNegative: false,
42
- disabled,
43
36
  className: reactjs_utils_mxClsx.mxClsx(
44
- "liq-text-3xl liq-leading-9 liq-min-h-12 liq-py-0 liq-w-full liq-h-full liq-border-none liq-font-medium liq-px-0 liq-outline-0 liq-bg-transparent",
37
+ "liq-flex liq-text-base liq-max-w-none liq-w-full liq-bg-transparent liq-relative",
45
38
  {
46
- "liq-disabled liq-animate-pulse": disabled && !omitDisableClass
47
- },
48
- className
39
+ "liq-disabled liq-animate-loader": disabled
40
+ }
49
41
  ),
50
- onChange: handleAmountChange,
51
- onValueChange: async ({ value }) => {
52
- onInputDebounceChange == null ? void 0 : onInputDebounceChange(value);
53
- },
54
- onBlur,
55
- onKeyDown: (e) => checkKeyDown(e)
42
+ children: /* @__PURE__ */ jsxRuntime.jsx(
43
+ reactNumberFormat.NumericFormat,
44
+ {
45
+ name: inputName,
46
+ value: inputValue,
47
+ placeholder: "0",
48
+ allowLeadingZeros: true,
49
+ thousandSeparator: ",",
50
+ allowNegative: false,
51
+ disabled,
52
+ className: reactjs_utils_mxClsx.mxClsx(
53
+ "liq-text-3xl liq-leading-9 liq-min-h-12 liq-py-0 liq-w-full liq-h-full liq-border-none liq-font-medium liq-px-0 liq-outline-0 liq-bg-transparent",
54
+ {
55
+ "liq-disabled liq-animate-pulse": disabled && !omitDisableClass
56
+ },
57
+ className
58
+ ),
59
+ onChange: handleAmountChange,
60
+ onValueChange: async ({ value }) => {
61
+ onInputDebounceChange == null ? void 0 : onInputDebounceChange(value);
62
+ },
63
+ onBlur,
64
+ onKeyDown: (e) => checkKeyDown(e)
65
+ }
66
+ )
56
67
  }
57
- ) }),
68
+ ),
58
69
  amountError && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "liq-flex liq-min-h-[2rem] liq-items-end", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "liq-text-danger liq-text-xs", children: amountError }) })
59
70
  ] });
60
71
  };
@@ -27,31 +27,42 @@ const AmountInput = ({
27
27
  }
28
28
  };
29
29
  return /* @__PURE__ */ jsxs("div", { className: "liq-flex liq-w-full liq-flex-col liq-justify-between", children: [
30
- /* @__PURE__ */ jsx("div", { className: "liq-flex liq-text-base liq-max-w-none liq-w-full liq-bg-transparent liq-relative", children: /* @__PURE__ */ jsx(
31
- NumericFormat,
30
+ /* @__PURE__ */ jsx(
31
+ "div",
32
32
  {
33
- name: inputName,
34
- value: inputValue,
35
- placeholder: "0",
36
- allowLeadingZeros: true,
37
- thousandSeparator: ",",
38
- allowNegative: false,
39
- disabled,
40
33
  className: mxClsx(
41
- "liq-text-3xl liq-leading-9 liq-min-h-12 liq-py-0 liq-w-full liq-h-full liq-border-none liq-font-medium liq-px-0 liq-outline-0 liq-bg-transparent",
34
+ "liq-flex liq-text-base liq-max-w-none liq-w-full liq-bg-transparent liq-relative",
42
35
  {
43
- "liq-disabled liq-animate-pulse": disabled && !omitDisableClass
44
- },
45
- className
36
+ "liq-disabled liq-animate-loader": disabled
37
+ }
46
38
  ),
47
- onChange: handleAmountChange,
48
- onValueChange: async ({ value }) => {
49
- onInputDebounceChange == null ? void 0 : onInputDebounceChange(value);
50
- },
51
- onBlur,
52
- onKeyDown: (e) => checkKeyDown(e)
39
+ children: /* @__PURE__ */ jsx(
40
+ NumericFormat,
41
+ {
42
+ name: inputName,
43
+ value: inputValue,
44
+ placeholder: "0",
45
+ allowLeadingZeros: true,
46
+ thousandSeparator: ",",
47
+ allowNegative: false,
48
+ disabled,
49
+ className: mxClsx(
50
+ "liq-text-3xl liq-leading-9 liq-min-h-12 liq-py-0 liq-w-full liq-h-full liq-border-none liq-font-medium liq-px-0 liq-outline-0 liq-bg-transparent",
51
+ {
52
+ "liq-disabled liq-animate-pulse": disabled && !omitDisableClass
53
+ },
54
+ className
55
+ ),
56
+ onChange: handleAmountChange,
57
+ onValueChange: async ({ value }) => {
58
+ onInputDebounceChange == null ? void 0 : onInputDebounceChange(value);
59
+ },
60
+ onBlur,
61
+ onKeyDown: (e) => checkKeyDown(e)
62
+ }
63
+ )
53
64
  }
54
- ) }),
65
+ ),
55
66
  amountError && /* @__PURE__ */ jsx("div", { className: "liq-flex liq-min-h-[2rem] liq-items-end", children: /* @__PURE__ */ jsx("div", { className: "liq-text-danger liq-text-xs", children: amountError }) })
56
67
  ] });
57
68
  };
@@ -205,6 +205,9 @@ const BridgeForm = ({
205
205
  )) ?? (chains == null ? void 0 : chains[0]),
206
206
  [activeChain == null ? void 0 : activeChain.id, chains]
207
207
  );
208
+ const defaultReceivingToken = toOptions.find(
209
+ (x) => x.name.toLowerCase().includes("usdc")
210
+ );
208
211
  const hasAmounts = firstAmount !== "" && secondAmount !== "";
209
212
  const fetchRateDebounced = require$$0.useCallback(
210
213
  debounce(async (amount) => {
@@ -292,7 +295,7 @@ const BridgeForm = ({
292
295
  }
293
296
  setFirstToken(() => option);
294
297
  updateUrlParams({ firstTokenId: option == null ? void 0 : option.address });
295
- const secondOption = toOptions.find((x) => x.name === (option == null ? void 0 : option.name));
298
+ const secondOption = toOptions.find((x) => x.name === (option == null ? void 0 : option.name)) ?? defaultReceivingToken;
296
299
  if (!secondOption) {
297
300
  return;
298
301
  }
@@ -333,7 +336,7 @@ const BridgeForm = ({
333
336
  );
334
337
  const secondOption = (toOptions == null ? void 0 : toOptions.find(
335
338
  ({ address }) => address === ((firstOption == null ? void 0 : firstOption.name) ?? (initialTokens == null ? void 0 : initialTokens.secondTokenId))
336
- )) ?? toOptions.find((x) => x.name === (firstOption == null ? void 0 : firstOption.name));
339
+ )) ?? toOptions.find((x) => x.name === (firstOption == null ? void 0 : firstOption.name)) ?? defaultReceivingToken;
337
340
  const hasOptionsSelected = Boolean(firstToken) && Boolean(secondToken) && ((_a2 = firstToken == null ? void 0 : firstToken.address) == null ? void 0 : _a2.toLowerCase()) === ((_b2 = firstOption == null ? void 0 : firstOption.address) == null ? void 0 : _b2.toLowerCase()) && ((_c2 = secondToken == null ? void 0 : secondToken.address) == null ? void 0 : _c2.toLowerCase()) === ((_d2 = secondOption == null ? void 0 : secondOption.address) == null ? void 0 : _d2.toLowerCase());
338
341
  if (hasOptionsSelected) {
339
342
  return;
@@ -456,8 +459,18 @@ const BridgeForm = ({
456
459
  fetchRateDebounced(firstAmount);
457
460
  }, [firstAmount, fetchRateDebounced]);
458
461
  require$$0.useEffect(() => {
459
- return setSecondAmount((rate == null ? void 0 : rate.amountOut) ?? "");
460
- }, [rate]);
462
+ if (!(rate == null ? void 0 : rate.amountOut)) {
463
+ return;
464
+ }
465
+ formik.setFieldValue(reactjs_hooks_useBridgeFormik.BridgeFormikValuesEnum.secondAmount, rate.amountOut);
466
+ setSecondAmount(rate.amountOut);
467
+ }, [rate == null ? void 0 : rate.amountOut]);
468
+ require$$0.useEffect(() => {
469
+ if (rateValidationError) {
470
+ formik.setFieldValue(reactjs_hooks_useBridgeFormik.BridgeFormikValuesEnum.secondAmount, "0");
471
+ setSecondAmount("0");
472
+ }
473
+ }, [rateValidationError]);
461
474
  require$$0.useEffect(setInitialSelectedTokens, [isTokensLoading, chainId]);
462
475
  require$$0.useEffect(() => {
463
476
  const selectedTokenOption = evmTokensWithBalances == null ? void 0 : evmTokensWithBalances.find(
@@ -588,7 +601,7 @@ const BridgeForm = ({
588
601
  inputName: "secondAmount",
589
602
  inputValue: formik.values.secondAmount ?? "",
590
603
  amountError: secondAmount !== "" ? fromChainError ?? secondAmountError : void 0,
591
- disabled: false,
604
+ disabled: isPendingRate,
592
605
  onInputDebounceChange: handleOnChangeSecondAmount,
593
606
  onInputChange: handleChange,
594
607
  onBlur: handleBlur
@@ -202,6 +202,9 @@ const BridgeForm = ({
202
202
  )) ?? (chains == null ? void 0 : chains[0]),
203
203
  [activeChain == null ? void 0 : activeChain.id, chains]
204
204
  );
205
+ const defaultReceivingToken = toOptions.find(
206
+ (x) => x.name.toLowerCase().includes("usdc")
207
+ );
205
208
  const hasAmounts = firstAmount !== "" && secondAmount !== "";
206
209
  const fetchRateDebounced = useCallback(
207
210
  debounce(async (amount) => {
@@ -289,7 +292,7 @@ const BridgeForm = ({
289
292
  }
290
293
  setFirstToken(() => option);
291
294
  updateUrlParams({ firstTokenId: option == null ? void 0 : option.address });
292
- const secondOption = toOptions.find((x) => x.name === (option == null ? void 0 : option.name));
295
+ const secondOption = toOptions.find((x) => x.name === (option == null ? void 0 : option.name)) ?? defaultReceivingToken;
293
296
  if (!secondOption) {
294
297
  return;
295
298
  }
@@ -330,7 +333,7 @@ const BridgeForm = ({
330
333
  );
331
334
  const secondOption = (toOptions == null ? void 0 : toOptions.find(
332
335
  ({ address }) => address === ((firstOption == null ? void 0 : firstOption.name) ?? (initialTokens == null ? void 0 : initialTokens.secondTokenId))
333
- )) ?? toOptions.find((x) => x.name === (firstOption == null ? void 0 : firstOption.name));
336
+ )) ?? toOptions.find((x) => x.name === (firstOption == null ? void 0 : firstOption.name)) ?? defaultReceivingToken;
334
337
  const hasOptionsSelected = Boolean(firstToken) && Boolean(secondToken) && ((_a2 = firstToken == null ? void 0 : firstToken.address) == null ? void 0 : _a2.toLowerCase()) === ((_b2 = firstOption == null ? void 0 : firstOption.address) == null ? void 0 : _b2.toLowerCase()) && ((_c2 = secondToken == null ? void 0 : secondToken.address) == null ? void 0 : _c2.toLowerCase()) === ((_d2 = secondOption == null ? void 0 : secondOption.address) == null ? void 0 : _d2.toLowerCase());
335
338
  if (hasOptionsSelected) {
336
339
  return;
@@ -453,8 +456,18 @@ const BridgeForm = ({
453
456
  fetchRateDebounced(firstAmount);
454
457
  }, [firstAmount, fetchRateDebounced]);
455
458
  useEffect(() => {
456
- return setSecondAmount((rate == null ? void 0 : rate.amountOut) ?? "");
457
- }, [rate]);
459
+ if (!(rate == null ? void 0 : rate.amountOut)) {
460
+ return;
461
+ }
462
+ formik.setFieldValue(BridgeFormikValuesEnum.secondAmount, rate.amountOut);
463
+ setSecondAmount(rate.amountOut);
464
+ }, [rate == null ? void 0 : rate.amountOut]);
465
+ useEffect(() => {
466
+ if (rateValidationError) {
467
+ formik.setFieldValue(BridgeFormikValuesEnum.secondAmount, "0");
468
+ setSecondAmount("0");
469
+ }
470
+ }, [rateValidationError]);
458
471
  useEffect(setInitialSelectedTokens, [isTokensLoading, chainId]);
459
472
  useEffect(() => {
460
473
  const selectedTokenOption = evmTokensWithBalances == null ? void 0 : evmTokensWithBalances.find(
@@ -585,7 +598,7 @@ const BridgeForm = ({
585
598
  inputName: "secondAmount",
586
599
  inputValue: formik.values.secondAmount ?? "",
587
600
  amountError: secondAmount !== "" ? fromChainError ?? secondAmountError : void 0,
588
- disabled: false,
601
+ disabled: isPendingRate,
589
602
  onInputDebounceChange: handleOnChangeSecondAmount,
590
603
  onInputChange: handleChange,
591
604
  onBlur: handleBlur
@@ -7,6 +7,8 @@ const Select = require("react-select");
7
7
  const reactjs_components_TokenSelector_components_ChainSelect_components_FormatChainOptionLabel = require("./components/FormatChainOptionLabel.js");
8
8
  const reactjs_components_TokenSelector_components_ChainSelect_components_IndicatorSeparator = require("./components/IndicatorSeparator.js");
9
9
  const reactjs_components_TokenSelector_components_ChainSelect_components_SelectedChainOption = require("./components/SelectedChainOption.js");
10
+ require("../../../../constants/index.js");
11
+ const reactjs_constants_chains = require("../../../../constants/chains.js");
10
12
  const ChainSelect = ({
11
13
  isLoading,
12
14
  selectedChainId,
@@ -26,9 +28,9 @@ const ChainSelect = ({
26
28
  }));
27
29
  options.unshift({
28
30
  label: "All",
29
- value: "0",
31
+ value: reactjs_constants_chains.ALL_NETWORK_ID,
30
32
  chain: {
31
- id: "0",
33
+ id: reactjs_constants_chains.ALL_NETWORK_ID,
32
34
  name: "all",
33
35
  networkName: "All",
34
36
  svgUrl: "https://cdn.multiversx.com/liquidity-sdk/all-networks.svg"
@@ -4,6 +4,8 @@ import Select from "react-select";
4
4
  import { FormatChainOptionLabel } from "./components/FormatChainOptionLabel.mjs";
5
5
  import { IndicatorSeparator } from "./components/IndicatorSeparator.mjs";
6
6
  import { SelectedChainOption } from "./components/SelectedChainOption.mjs";
7
+ import "../../../../constants/index.mjs";
8
+ import { ALL_NETWORK_ID } from "../../../../constants/chains.mjs";
7
9
  const ChainSelect = ({
8
10
  isLoading,
9
11
  selectedChainId,
@@ -23,9 +25,9 @@ const ChainSelect = ({
23
25
  }));
24
26
  options.unshift({
25
27
  label: "All",
26
- value: "0",
28
+ value: ALL_NETWORK_ID,
27
29
  chain: {
28
- id: "0",
30
+ id: ALL_NETWORK_ID,
29
31
  name: "all",
30
32
  networkName: "All",
31
33
  svgUrl: "https://cdn.multiversx.com/liquidity-sdk/all-networks.svg"
@@ -5,8 +5,10 @@ const jsxRuntime = require("react/jsx-runtime");
5
5
  const require$$0 = require("react");
6
6
  const reactjs_components_TokenSelector_components_ChainSelect_ChainSelect = require("./ChainSelect/ChainSelect.js");
7
7
  const reactjs_components_TokenSelector_components_TokenList = require("./TokenList.js");
8
+ require("../../../constants/index.js");
8
9
  const reactjs_hooks_useGetChainId = require("../../../hooks/useGetChainId.js");
9
10
  const reactjs_components_base_MxSearch_MxSearch = require("../../base/MxSearch/MxSearch.js");
11
+ const reactjs_constants_chains = require("../../../constants/chains.js");
10
12
  const SelectContent = ({
11
13
  onSelect,
12
14
  tokens = [],
@@ -19,7 +21,7 @@ const SelectContent = ({
19
21
  const searchPatternRef = require$$0.useRef("");
20
22
  const activeChainId = reactjs_hooks_useGetChainId.useGetChainId();
21
23
  const [selectedChainId, setSelectedChainId] = require$$0.useState(
22
- (activeChainId == null ? void 0 : activeChainId.toString()) ?? "0"
24
+ (activeChainId == null ? void 0 : activeChainId.toString()) ?? reactjs_constants_chains.ALL_NETWORK_ID
23
25
  );
24
26
  const filteredTokensText = require$$0.useMemo(() => {
25
27
  const selectedChain = chains.find(
@@ -36,7 +38,7 @@ const SelectContent = ({
36
38
  };
37
39
  const handleSearch = (pattern) => {
38
40
  searchPatternRef.current = pattern;
39
- if (selectedChainId === "0") {
41
+ if (selectedChainId === reactjs_constants_chains.ALL_NETWORK_ID) {
40
42
  const filtered2 = tokens.filter(
41
43
  (token) => token.symbol.toLowerCase().includes(pattern.toLowerCase())
42
44
  );
@@ -2,8 +2,10 @@ import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { useState, useRef, useMemo, useEffect } from "react";
3
3
  import { ChainSelect } from "./ChainSelect/ChainSelect.mjs";
4
4
  import { TokenList } from "./TokenList.mjs";
5
+ import "../../../constants/index.mjs";
5
6
  import { useGetChainId } from "../../../hooks/useGetChainId.mjs";
6
7
  import { MxSearch } from "../../base/MxSearch/MxSearch.mjs";
8
+ import { ALL_NETWORK_ID } from "../../../constants/chains.mjs";
7
9
  const SelectContent = ({
8
10
  onSelect,
9
11
  tokens = [],
@@ -16,7 +18,7 @@ const SelectContent = ({
16
18
  const searchPatternRef = useRef("");
17
19
  const activeChainId = useGetChainId();
18
20
  const [selectedChainId, setSelectedChainId] = useState(
19
- (activeChainId == null ? void 0 : activeChainId.toString()) ?? "0"
21
+ (activeChainId == null ? void 0 : activeChainId.toString()) ?? ALL_NETWORK_ID
20
22
  );
21
23
  const filteredTokensText = useMemo(() => {
22
24
  const selectedChain = chains.find(
@@ -33,7 +35,7 @@ const SelectContent = ({
33
35
  };
34
36
  const handleSearch = (pattern) => {
35
37
  searchPatternRef.current = pattern;
36
- if (selectedChainId === "0") {
38
+ if (selectedChainId === ALL_NETWORK_ID) {
37
39
  const filtered2 = tokens.filter(
38
40
  (token) => token.symbol.toLowerCase().includes(pattern.toLowerCase())
39
41
  );
@@ -32,4 +32,5 @@ export declare const chainIdentifier: {
32
32
  msx: string;
33
33
  MultiversX: string;
34
34
  };
35
+ export declare const ALL_NETWORK_ID = "-1";
35
36
  export {};
@@ -35,4 +35,6 @@ const chainIdentifier = {
35
35
  ...base,
36
36
  default: _default.DefaultIcon
37
37
  };
38
+ const ALL_NETWORK_ID = "-1";
39
+ exports.ALL_NETWORK_ID = ALL_NETWORK_ID;
38
40
  exports.chainIdentifier = chainIdentifier;
@@ -32,6 +32,8 @@ const chainIdentifier = {
32
32
  ...base,
33
33
  default: DefaultIcon
34
34
  };
35
+ const ALL_NETWORK_ID = "-1";
35
36
  export {
37
+ ALL_NETWORK_ID,
36
38
  chainIdentifier
37
39
  };
@@ -7,6 +7,7 @@ const safeWindow = (
7
7
  typeof window !== "undefined" ? window : {}
8
8
  );
9
9
  const safeDocument = typeof document !== "undefined" ? safeWindow.document : {};
10
+ exports.ALL_NETWORK_ID = reactjs_constants_chains.ALL_NETWORK_ID;
10
11
  exports.chainIdentifier = reactjs_constants_chains.chainIdentifier;
11
12
  exports.safeDocument = safeDocument;
12
13
  exports.safeWindow = safeWindow;
@@ -1,10 +1,11 @@
1
- import { chainIdentifier } from "./chains.mjs";
1
+ import { ALL_NETWORK_ID, chainIdentifier } from "./chains.mjs";
2
2
  const safeWindow = (
3
3
  // eslint-disable-next-line no-undef
4
4
  typeof window !== "undefined" ? window : {}
5
5
  );
6
6
  const safeDocument = typeof document !== "undefined" ? safeWindow.document : {};
7
7
  export {
8
+ ALL_NETWORK_ID,
8
9
  chainIdentifier,
9
10
  safeDocument,
10
11
  safeWindow
@@ -133,8 +133,8 @@ const useBridgeFormik = ({
133
133
  setFieldValue("secondAmount", 0, true);
134
134
  return;
135
135
  }
136
- if (lastChangedField === "firstAmount" && values.firstAmount && values.firstAmount !== "") {
137
- const calculatedSecondAmount = parseFloat(values.firstAmount) - Number((rate == null ? void 0 : rate.fee) ?? "0");
136
+ if (lastChangedField === "firstAmount" && values.firstAmount && values.firstAmount !== "" && (rate == null ? void 0 : rate.fee) && rate.fee !== "0") {
137
+ const calculatedSecondAmount = parseFloat(values.firstAmount) - Number(rate.fee);
138
138
  setFieldValue(
139
139
  "secondAmount",
140
140
  calculatedSecondAmount > 0 ? calculatedSecondAmount : "0"
@@ -146,8 +146,8 @@ const useBridgeFormik = ({
146
146
  setFieldValue("firstAmount", 0, true);
147
147
  return;
148
148
  }
149
- if (lastChangedField === "secondAmount" && values.secondAmount && values.secondAmount !== "") {
150
- const calculatedFirstAmount = parseFloat(values.secondAmount) + Number((rate == null ? void 0 : rate.fee) ?? "0");
149
+ if (lastChangedField === "secondAmount" && values.secondAmount && values.secondAmount !== "" && (rate == null ? void 0 : rate.fee) && rate.fee !== "0") {
150
+ const calculatedFirstAmount = parseFloat(values.secondAmount) + Number(rate.fee);
151
151
  setFieldValue("firstAmount", calculatedFirstAmount);
152
152
  }
153
153
  }, [values.secondAmount, rate == null ? void 0 : rate.fee, lastChangedField, touched.secondAmount]);
@@ -130,8 +130,8 @@ const useBridgeFormik = ({
130
130
  setFieldValue("secondAmount", 0, true);
131
131
  return;
132
132
  }
133
- if (lastChangedField === "firstAmount" && values.firstAmount && values.firstAmount !== "") {
134
- const calculatedSecondAmount = parseFloat(values.firstAmount) - Number((rate == null ? void 0 : rate.fee) ?? "0");
133
+ if (lastChangedField === "firstAmount" && values.firstAmount && values.firstAmount !== "" && (rate == null ? void 0 : rate.fee) && rate.fee !== "0") {
134
+ const calculatedSecondAmount = parseFloat(values.firstAmount) - Number(rate.fee);
135
135
  setFieldValue(
136
136
  "secondAmount",
137
137
  calculatedSecondAmount > 0 ? calculatedSecondAmount : "0"
@@ -143,8 +143,8 @@ const useBridgeFormik = ({
143
143
  setFieldValue("firstAmount", 0, true);
144
144
  return;
145
145
  }
146
- if (lastChangedField === "secondAmount" && values.secondAmount && values.secondAmount !== "") {
147
- const calculatedFirstAmount = parseFloat(values.secondAmount) + Number((rate == null ? void 0 : rate.fee) ?? "0");
146
+ if (lastChangedField === "secondAmount" && values.secondAmount && values.secondAmount !== "" && (rate == null ? void 0 : rate.fee) && rate.fee !== "0") {
147
+ const calculatedFirstAmount = parseFloat(values.secondAmount) + Number(rate.fee);
148
148
  setFieldValue("firstAmount", calculatedFirstAmount);
149
149
  }
150
150
  }, [values.secondAmount, rate == null ? void 0 : rate.fee, lastChangedField, touched.secondAmount]);
package/reactjs/index.js CHANGED
@@ -142,6 +142,7 @@ Object.defineProperty(exports, "useWaitForTransactionReceipt", {
142
142
  enumerable: true,
143
143
  get: () => wagmi.useWaitForTransactionReceipt
144
144
  });
145
+ exports.ALL_NETWORK_ID = reactjs_constants_chains.ALL_NETWORK_ID;
145
146
  exports.chainIdentifier = reactjs_constants_chains.chainIdentifier;
146
147
  exports.useAppKit = index.useAppKit;
147
148
  exports.useAppKitEvents = index.useAppKitEvents;
package/reactjs/index.mjs CHANGED
@@ -63,10 +63,11 @@ import { roundAmount } from "./utils/roundAmount.mjs";
63
63
  import { testNumber } from "./utils/testNumber.mjs";
64
64
  import { u as u2 } from "../react-B9sQBOh0.mjs";
65
65
  import { useWaitForTransactionReceipt } from "wagmi";
66
- import { chainIdentifier } from "./constants/chains.mjs";
66
+ import { ALL_NETWORK_ID, chainIdentifier } from "./constants/chains.mjs";
67
67
  import { u as u3, a, e, b, c, d } from "../index-BXwpbIDQ.mjs";
68
68
  import { u as u4, b as b2, a as a2 } from "../react-CSQpf1zk.mjs";
69
69
  export {
70
+ ALL_NETWORK_ID,
70
71
  AccountAddress,
71
72
  AmountCard,
72
73
  AmountInput,