@multiversx/sdk-dapp-liquidity 1.1.0-alpha.20 → 1.1.0-alpha.21

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-Vfi3IkES.js");
56
+ const reactjs_hooks_useBalances = require("./useBalances-gZTsFZHe.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-DTvWU9si.mjs";
53
+ import { u } from "./useBalances-Bom1mw1J.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.20",
31
+ "version": "1.1.0-alpha.21",
32
32
  "main": "index.js",
33
33
  "module": "index.mjs",
34
34
  "types": "index.d.ts",
@@ -4,6 +4,8 @@ interface BridgeFormProps {
4
4
  username?: string;
5
5
  nativeAuthToken?: string;
6
6
  callbackRoute?: string;
7
+ firstTokenIdentifier?: string;
8
+ secondTokenIdentifier?: string;
7
9
  refetchTrigger?: number;
8
10
  showHistory?: boolean;
9
11
  onSuccessfullySentTransaction?: (txHashes?: string[]) => void;
@@ -13,5 +15,5 @@ interface BridgeFormProps {
13
15
  onMvxDisconnect?: () => void;
14
16
  onNavigate?: (url: string, options?: object) => void;
15
17
  }
16
- export declare const BridgeForm: ({ mvxChainId, mvxAddress, username, nativeAuthToken, callbackRoute, refetchTrigger, showHistory, onSuccessfullySentTransaction, onFailedSentTransaction, onHistoryClose, onMvxConnect, onMvxDisconnect, onNavigate }: BridgeFormProps) => import("react/jsx-runtime").JSX.Element;
18
+ export declare const BridgeForm: ({ mvxChainId, mvxAddress, username, nativeAuthToken, callbackRoute, firstTokenIdentifier, secondTokenIdentifier, refetchTrigger, showHistory, onSuccessfullySentTransaction, onFailedSentTransaction, onHistoryClose, onMvxConnect, onMvxDisconnect, onNavigate }: BridgeFormProps) => import("react/jsx-runtime").JSX.Element;
17
19
  export {};
@@ -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-Vfi3IkES.js");
47
+ const reactjs_hooks_useBalances = require("../../../useBalances-gZTsFZHe.js");
48
48
  function deepEqual(a, b) {
49
49
  if (a === b)
50
50
  return true;
@@ -123,6 +123,8 @@ const BridgeForm = ({
123
123
  username,
124
124
  nativeAuthToken,
125
125
  callbackRoute = "/",
126
+ firstTokenIdentifier,
127
+ secondTokenIdentifier,
126
128
  refetchTrigger,
127
129
  showHistory,
128
130
  onSuccessfullySentTransaction,
@@ -361,7 +363,10 @@ const BridgeForm = ({
361
363
  if (isTokensLoading || initializedInitialTokensRef.current) {
362
364
  return;
363
365
  }
364
- const initialTokens = reactjs_utils_getInitialTokens.getInitialTokens();
366
+ const initialTokens = reactjs_utils_getInitialTokens.getInitialTokens({
367
+ firstTokenId: firstTokenIdentifier,
368
+ secondTokenId: secondTokenIdentifier
369
+ });
365
370
  const firstOption = (fromOptions == null ? void 0 : fromOptions.find(
366
371
  ({ identifier }) => (initialTokens == null ? void 0 : initialTokens.firstTokenId) === identifier
367
372
  )) ?? fromOptions.find(
@@ -735,7 +740,7 @@ const BridgeForm = ({
735
740
  reactjs_components_Connect_MvxConnectButton.MvxConnectButton,
736
741
  {
737
742
  mvxAccountAddress: mvxAddress,
738
- chain: mvxChain,
743
+ icon: mvxChain == null ? void 0 : mvxChain.svgUrl,
739
744
  onClick: onMvxConnect
740
745
  }
741
746
  ),
@@ -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-DTvWU9si.mjs";
44
+ import { g as getAction } from "../../../useBalances-Bom1mw1J.mjs";
45
45
  function deepEqual(a, b) {
46
46
  if (a === b)
47
47
  return true;
@@ -120,6 +120,8 @@ const BridgeForm = ({
120
120
  username,
121
121
  nativeAuthToken,
122
122
  callbackRoute = "/",
123
+ firstTokenIdentifier,
124
+ secondTokenIdentifier,
123
125
  refetchTrigger,
124
126
  showHistory,
125
127
  onSuccessfullySentTransaction,
@@ -358,7 +360,10 @@ const BridgeForm = ({
358
360
  if (isTokensLoading || initializedInitialTokensRef.current) {
359
361
  return;
360
362
  }
361
- const initialTokens = getInitialTokens();
363
+ const initialTokens = getInitialTokens({
364
+ firstTokenId: firstTokenIdentifier,
365
+ secondTokenId: secondTokenIdentifier
366
+ });
362
367
  const firstOption = (fromOptions == null ? void 0 : fromOptions.find(
363
368
  ({ identifier }) => (initialTokens == null ? void 0 : initialTokens.firstTokenId) === identifier
364
369
  )) ?? fromOptions.find(
@@ -732,7 +737,7 @@ const BridgeForm = ({
732
737
  MvxConnectButton,
733
738
  {
734
739
  mvxAccountAddress: mvxAddress,
735
- chain: mvxChain,
740
+ icon: mvxChain == null ? void 0 : mvxChain.svgUrl,
736
741
  onClick: onMvxConnect
737
742
  }
738
743
  ),
@@ -179,7 +179,16 @@ const BridgeHistory = ({
179
179
  "liq-text-red-200": transaction.status === "failed"
180
180
  }),
181
181
  children: [
182
- transaction.statusIcon,
182
+ /* @__PURE__ */ jsxRuntime.jsx(
183
+ reactjs_components_base_MxTooltip_MxTooltip.MxTooltip,
184
+ {
185
+ placement: "top",
186
+ buttonText: transaction.statusIcon,
187
+ children: new Date(
188
+ transaction.depositTimestamp * 1e3
189
+ ).toLocaleString()
190
+ }
191
+ ),
183
192
  constants_index.MVX_CHAIN_IDS.includes(transaction.toChainId) ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
184
193
  /* @__PURE__ */ jsxRuntime.jsx(
185
194
  reactjs_components_base_MxTooltip_MxTooltip.MxTooltip,
@@ -176,7 +176,16 @@ const BridgeHistory = ({
176
176
  "liq-text-red-200": transaction.status === "failed"
177
177
  }),
178
178
  children: [
179
- transaction.statusIcon,
179
+ /* @__PURE__ */ jsx(
180
+ MxTooltip,
181
+ {
182
+ placement: "top",
183
+ buttonText: transaction.statusIcon,
184
+ children: new Date(
185
+ transaction.depositTimestamp * 1e3
186
+ ).toLocaleString()
187
+ }
188
+ ),
180
189
  MVX_CHAIN_IDS.includes(transaction.toChainId) ? /* @__PURE__ */ jsxs(Fragment, { children: [
181
190
  /* @__PURE__ */ jsx(
182
191
  MxTooltip,
@@ -1,11 +1,9 @@
1
- import { ChainDTO } from '../../../dto/Chain.dto';
2
-
3
1
  interface ConnectButtonProps {
4
2
  mvxAccountAddress?: string;
5
- chain?: ChainDTO;
3
+ icon?: string;
6
4
  disabled?: boolean;
7
5
  className?: string;
8
6
  onClick?: () => void;
9
7
  }
10
- export declare const MvxConnectButton: ({ mvxAccountAddress, chain, disabled, className, onClick }: ConnectButtonProps) => import("react/jsx-runtime").JSX.Element | null;
8
+ export declare const MvxConnectButton: ({ mvxAccountAddress, icon, disabled, className, onClick }: ConnectButtonProps) => import("react/jsx-runtime").JSX.Element | null;
11
9
  export {};
@@ -6,7 +6,7 @@ const reactjs_utils_mxClsx = require("../../utils/mxClsx.js");
6
6
  const reactjs_components_base_MxButton_MxButton = require("../base/MxButton/MxButton.js");
7
7
  const MvxConnectButton = ({
8
8
  mvxAccountAddress,
9
- chain,
9
+ icon,
10
10
  disabled,
11
11
  className = "",
12
12
  onClick
@@ -30,7 +30,7 @@ const MvxConnectButton = ({
30
30
  /* @__PURE__ */ jsxRuntime.jsx(
31
31
  "img",
32
32
  {
33
- src: (chain == null ? void 0 : chain.svgUrl) ?? "",
33
+ src: icon ?? "",
34
34
  alt: "",
35
35
  className: "liq-h-[1.5rem] liq-w-[1.5rem]"
36
36
  }
@@ -3,7 +3,7 @@ import { mxClsx } from "../../utils/mxClsx.mjs";
3
3
  import { MxButton } from "../base/MxButton/MxButton.mjs";
4
4
  const MvxConnectButton = ({
5
5
  mvxAccountAddress,
6
- chain,
6
+ icon,
7
7
  disabled,
8
8
  className = "",
9
9
  onClick
@@ -27,7 +27,7 @@ const MvxConnectButton = ({
27
27
  /* @__PURE__ */ jsx(
28
28
  "img",
29
29
  {
30
- src: (chain == null ? void 0 : chain.svgUrl) ?? "",
30
+ src: icon ?? "",
31
31
  alt: "",
32
32
  className: "liq-h-[1.5rem] liq-w-[1.5rem]"
33
33
  }
@@ -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-Vfi3IkES.js");
9
+ const reactjs_hooks_useBalances = require("../../useBalances-gZTsFZHe.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-DTvWU9si.mjs";
6
+ import { u } from "../../useBalances-Bom1mw1J.mjs";
7
7
  import { BridgeFormikValuesEnum, useBridgeFormik } from "./useBridgeFormik.mjs";
8
8
  import { useDebounce } from "./useDebounce.mjs";
9
9
  import { useFetchBridgeData } from "./useFetchBridgeData.mjs";
@@ -15,7 +15,7 @@ require("yup");
15
15
  require("@multiversx/sdk-dapp-utils/out/helpers/parseAmount");
16
16
  require("../../bignumber-B8vjg9qn.js");
17
17
  require("wagmi");
18
- const reactjs_hooks_useBalances = require("../../useBalances-Vfi3IkES.js");
18
+ const reactjs_hooks_useBalances = require("../../useBalances-gZTsFZHe.js");
19
19
  require("formik");
20
20
  require("../constants/index.js");
21
21
  require("@reown/appkit-adapter-solana/react");
@@ -12,7 +12,7 @@ import "yup";
12
12
  import "@multiversx/sdk-dapp-utils/out/helpers/parseAmount";
13
13
  import "../../bignumber-CKZkoo0g.mjs";
14
14
  import "wagmi";
15
- import { u } from "../../useBalances-DTvWU9si.mjs";
15
+ import { u } from "../../useBalances-Bom1mw1J.mjs";
16
16
  import "formik";
17
17
  import "../constants/index.mjs";
18
18
  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-Vfi3IkES.js");
39
+ const reactjs_hooks_useBalances = require("../useBalances-gZTsFZHe.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-DTvWU9si.mjs";
36
+ import { u } from "../useBalances-Bom1mw1J.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";
@@ -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-Vfi3IkES.js");
12
+ const reactjs_hooks_useBalances = require("../../useBalances-gZTsFZHe.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-DTvWU9si.mjs";
9
+ import { u as useBalances } from "../../useBalances-Bom1mw1J.mjs";
10
10
  import "formik";
11
11
  import "axios";
12
12
  import "../context/Web3AppProvider.mjs";
@@ -2,7 +2,10 @@ export interface InitialTokensType {
2
2
  firstTokenId?: string;
3
3
  secondTokenId?: string;
4
4
  }
5
- export declare const getInitialTokens: () => {
5
+ export declare const getInitialTokens: (initialTokens?: {
6
+ firstTokenId?: string;
7
+ secondTokenId?: string;
8
+ }) => {
6
9
  firstTokenId: string;
7
10
  secondTokenId: string;
8
11
  };
@@ -2,12 +2,12 @@
2
2
  "use strict";
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
4
  const reactjs_constants_index = require("../constants/index.js");
5
- const getInitialTokens = () => {
5
+ const getInitialTokens = (initialTokens) => {
6
6
  const urlParams = new URLSearchParams(reactjs_constants_index.safeWindow.location.search);
7
7
  const { firstToken, secondToken } = Object.fromEntries(urlParams);
8
8
  return {
9
- firstTokenId: firstToken,
10
- secondTokenId: secondToken
9
+ firstTokenId: (initialTokens == null ? void 0 : initialTokens.firstTokenId) || firstToken,
10
+ secondTokenId: (initialTokens == null ? void 0 : initialTokens.secondTokenId) || secondToken
11
11
  };
12
12
  };
13
13
  exports.getInitialTokens = getInitialTokens;
@@ -1,10 +1,10 @@
1
1
  import { safeWindow } from "../constants/index.mjs";
2
- const getInitialTokens = () => {
2
+ const getInitialTokens = (initialTokens) => {
3
3
  const urlParams = new URLSearchParams(safeWindow.location.search);
4
4
  const { firstToken, secondToken } = Object.fromEntries(urlParams);
5
5
  return {
6
- firstTokenId: firstToken,
7
- secondTokenId: secondToken
6
+ firstTokenId: (initialTokens == null ? void 0 : initialTokens.firstTokenId) || firstToken,
7
+ secondTokenId: (initialTokens == null ? void 0 : initialTokens.secondTokenId) || secondToken
8
8
  };
9
9
  };
10
10
  export {
@@ -221,6 +221,9 @@ const useBalances = () => {
221
221
  let balance = BigInt(0);
222
222
  switch (chainType) {
223
223
  case ChainType.evm:
224
+ if ((activeChain == null ? void 0 : activeChain.chainType) !== ChainType.evm) {
225
+ break;
226
+ }
224
227
  balance = (await getBalance(config, {
225
228
  address,
226
229
  chainId: Number(token.chainId),
@@ -229,6 +232,9 @@ const useBalances = () => {
229
232
  })).value;
230
233
  break;
231
234
  case ChainType.sol:
235
+ if ((activeChain == null ? void 0 : activeChain.chainType) !== ChainType.sol) {
236
+ break;
237
+ }
232
238
  if (!(activeChain == null ? void 0 : activeChain.rpc)) {
233
239
  throw new Error(
234
240
  `RPC URL not found for chain ID: ${token.chainId}`
@@ -237,6 +243,9 @@ const useBalances = () => {
237
243
  balance = await getSolBalance(activeChain == null ? void 0 : activeChain.rpc, address);
238
244
  break;
239
245
  case ChainType.btc:
246
+ if ((activeChain == null ? void 0 : activeChain.chainType) !== ChainType.btc) {
247
+ break;
248
+ }
240
249
  balance = await getBtcBalance();
241
250
  break;
242
251
  case ChainType.mvx:
@@ -223,6 +223,9 @@ const useBalances = () => {
223
223
  let balance = BigInt(0);
224
224
  switch (chainType) {
225
225
  case types_chainType.ChainType.evm:
226
+ if ((activeChain == null ? void 0 : activeChain.chainType) !== types_chainType.ChainType.evm) {
227
+ break;
228
+ }
226
229
  balance = (await getBalance(config, {
227
230
  address,
228
231
  chainId: Number(token.chainId),
@@ -231,6 +234,9 @@ const useBalances = () => {
231
234
  })).value;
232
235
  break;
233
236
  case types_chainType.ChainType.sol:
237
+ if ((activeChain == null ? void 0 : activeChain.chainType) !== types_chainType.ChainType.sol) {
238
+ break;
239
+ }
234
240
  if (!(activeChain == null ? void 0 : activeChain.rpc)) {
235
241
  throw new Error(
236
242
  `RPC URL not found for chain ID: ${token.chainId}`
@@ -239,6 +245,9 @@ const useBalances = () => {
239
245
  balance = await getSolBalance(activeChain == null ? void 0 : activeChain.rpc, address);
240
246
  break;
241
247
  case types_chainType.ChainType.btc:
248
+ if ((activeChain == null ? void 0 : activeChain.chainType) !== types_chainType.ChainType.btc) {
249
+ break;
250
+ }
242
251
  balance = await getBtcBalance();
243
252
  break;
244
253
  case types_chainType.ChainType.mvx: