@multiversx/sdk-dapp-liquidity 1.1.0-alpha.25 → 1.1.0-alpha.27
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/package.json +1 -1
- package/reactjs/components/BridgeForm/BridgeForm.js +8 -1
- package/reactjs/components/BridgeForm/BridgeForm.mjs +8 -1
- package/reactjs/hooks/useFetchBridgeData.d.ts +0 -1
- package/reactjs/hooks/useFetchBridgeData.js +0 -2
- package/reactjs/hooks/useFetchBridgeData.mjs +0 -2
- package/reactjs/hooks/useFetchTokens.d.ts +0 -1
- package/reactjs/hooks/useFetchTokens.js +0 -4
- package/reactjs/hooks/useFetchTokens.mjs +0 -4
package/package.json
CHANGED
|
@@ -5,6 +5,7 @@ const jsxRuntime = require("react/jsx-runtime");
|
|
|
5
5
|
const faSpinner = require("@fortawesome/free-solid-svg-icons/faSpinner");
|
|
6
6
|
const reactFontawesome = require("@fortawesome/react-fontawesome");
|
|
7
7
|
const formatAmount = require("@multiversx/sdk-dapp-utils/out/helpers/formatAmount");
|
|
8
|
+
const react = require("@reown/appkit/react");
|
|
8
9
|
const debounce = require("lodash/debounce");
|
|
9
10
|
const React = require("react");
|
|
10
11
|
const reactToastify = require("react-toastify");
|
|
@@ -36,7 +37,6 @@ require("react-popper");
|
|
|
36
37
|
require("../base/MxTooltip/components/TooltipContainer/TooltipContainer.js");
|
|
37
38
|
const reactjs_components_BridgeHistory_BridgeHistory = require("../BridgeHistory/BridgeHistory.js");
|
|
38
39
|
const reactjs_components_Connect_BridgeConnectButton = require("../Connect/BridgeConnectButton.js");
|
|
39
|
-
require("@reown/appkit/react");
|
|
40
40
|
require("wagmi");
|
|
41
41
|
const reactjs_components_Connect_MvxConnectButton = require("../Connect/MvxConnectButton.js");
|
|
42
42
|
const reactjs_components_Connect_BridgeAccountDisplay = require("../Connect/BridgeAccountDisplay.js");
|
|
@@ -144,6 +144,7 @@ const BridgeForm = ({
|
|
|
144
144
|
const [pendingSigning, setPendingSigning] = React.useState(false);
|
|
145
145
|
const [siginingTransactionsCount, setSigningTransactionsCount] = React.useState(0);
|
|
146
146
|
const account = reactjs_hooks_useAccount.useAccount();
|
|
147
|
+
const { switchNetwork } = react.useAppKitNetwork();
|
|
147
148
|
const { config, options, supportedChains: sdkChains } = reactjs_context_useWeb3App.useWeb3App();
|
|
148
149
|
const chainId = reactjs_hooks_useGetChainId.useGetChainId();
|
|
149
150
|
const {
|
|
@@ -400,6 +401,12 @@ const BridgeForm = ({
|
|
|
400
401
|
updateUrlParams({
|
|
401
402
|
firstTokenId: firstOption == null ? void 0 : firstOption.address
|
|
402
403
|
});
|
|
404
|
+
const selectedOptionChain = (sdkChains == null ? void 0 : sdkChains.find(
|
|
405
|
+
(chain) => chain.id.toString() === (firstOption == null ? void 0 : firstOption.chainId.toString())
|
|
406
|
+
)) ?? activeChain;
|
|
407
|
+
if (selectedOptionChain) {
|
|
408
|
+
switchNetwork(selectedOptionChain);
|
|
409
|
+
}
|
|
403
410
|
initializedFirstToken = true;
|
|
404
411
|
}
|
|
405
412
|
let initializedSecondToken = false;
|
|
@@ -2,6 +2,7 @@ import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { faSpinner } from "@fortawesome/free-solid-svg-icons/faSpinner";
|
|
3
3
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
4
4
|
import { formatAmount } from "@multiversx/sdk-dapp-utils/out/helpers/formatAmount";
|
|
5
|
+
import { useAppKitNetwork } from "@reown/appkit/react";
|
|
5
6
|
import debounce from "lodash/debounce";
|
|
6
7
|
import { useRef, useState, useMemo, useCallback, useEffect } from "react";
|
|
7
8
|
import { toast } from "react-toastify";
|
|
@@ -33,7 +34,6 @@ import "react-popper";
|
|
|
33
34
|
import "../base/MxTooltip/components/TooltipContainer/TooltipContainer.mjs";
|
|
34
35
|
import { BridgeHistory } from "../BridgeHistory/BridgeHistory.mjs";
|
|
35
36
|
import { BridgeConnectButton } from "../Connect/BridgeConnectButton.mjs";
|
|
36
|
-
import "@reown/appkit/react";
|
|
37
37
|
import "wagmi";
|
|
38
38
|
import { MvxConnectButton } from "../Connect/MvxConnectButton.mjs";
|
|
39
39
|
import { BridgeAccountDisplay } from "../Connect/BridgeAccountDisplay.mjs";
|
|
@@ -141,6 +141,7 @@ const BridgeForm = ({
|
|
|
141
141
|
const [pendingSigning, setPendingSigning] = useState(false);
|
|
142
142
|
const [siginingTransactionsCount, setSigningTransactionsCount] = useState(0);
|
|
143
143
|
const account = useAccount();
|
|
144
|
+
const { switchNetwork } = useAppKitNetwork();
|
|
144
145
|
const { config, options, supportedChains: sdkChains } = useWeb3App();
|
|
145
146
|
const chainId = useGetChainId();
|
|
146
147
|
const {
|
|
@@ -397,6 +398,12 @@ const BridgeForm = ({
|
|
|
397
398
|
updateUrlParams({
|
|
398
399
|
firstTokenId: firstOption == null ? void 0 : firstOption.address
|
|
399
400
|
});
|
|
401
|
+
const selectedOptionChain = (sdkChains == null ? void 0 : sdkChains.find(
|
|
402
|
+
(chain) => chain.id.toString() === (firstOption == null ? void 0 : firstOption.chainId.toString())
|
|
403
|
+
)) ?? activeChain;
|
|
404
|
+
if (selectedOptionChain) {
|
|
405
|
+
switchNetwork(selectedOptionChain);
|
|
406
|
+
}
|
|
400
407
|
initializedFirstToken = true;
|
|
401
408
|
}
|
|
402
409
|
let initializedSecondToken = false;
|
|
@@ -54,6 +54,5 @@ export declare const useFetchBridgeData: ({ refetchTrigger, mvxAddress, mvxApiUR
|
|
|
54
54
|
chains: import('../..').ChainDTO[] | undefined;
|
|
55
55
|
isChainsLoading: boolean;
|
|
56
56
|
isChainsError: boolean;
|
|
57
|
-
fiatCurrencies: import('../..').TokenType[] | undefined;
|
|
58
57
|
tokens: import('../..').TokenType[] | undefined;
|
|
59
58
|
};
|
|
@@ -17,7 +17,6 @@ const useFetchBridgeData = ({
|
|
|
17
17
|
mvxTokensWithBalances,
|
|
18
18
|
isLoadingMvxTokensBalances,
|
|
19
19
|
isErrorEvmTokensBalances,
|
|
20
|
-
fiatCurrencies,
|
|
21
20
|
tokens
|
|
22
21
|
} = reactjs_hooks_useFetchTokens.useFetchTokens({
|
|
23
22
|
mvxApiURL,
|
|
@@ -41,7 +40,6 @@ const useFetchBridgeData = ({
|
|
|
41
40
|
chains,
|
|
42
41
|
isChainsLoading,
|
|
43
42
|
isChainsError,
|
|
44
|
-
fiatCurrencies,
|
|
45
43
|
tokens
|
|
46
44
|
};
|
|
47
45
|
};
|
|
@@ -14,7 +14,6 @@ const useFetchBridgeData = ({
|
|
|
14
14
|
mvxTokensWithBalances,
|
|
15
15
|
isLoadingMvxTokensBalances,
|
|
16
16
|
isErrorEvmTokensBalances,
|
|
17
|
-
fiatCurrencies,
|
|
18
17
|
tokens
|
|
19
18
|
} = useFetchTokens({
|
|
20
19
|
mvxApiURL,
|
|
@@ -38,7 +37,6 @@ const useFetchBridgeData = ({
|
|
|
38
37
|
chains,
|
|
39
38
|
isChainsLoading,
|
|
40
39
|
isChainsError,
|
|
41
|
-
fiatCurrencies,
|
|
42
40
|
tokens
|
|
43
41
|
};
|
|
44
42
|
};
|
|
@@ -32,9 +32,6 @@ const useFetchTokens = ({
|
|
|
32
32
|
),
|
|
33
33
|
[tokens]
|
|
34
34
|
);
|
|
35
|
-
const fiatCurrencies = React.useMemo(() => {
|
|
36
|
-
return tokens == null ? void 0 : tokens.filter((token) => !token.chainId);
|
|
37
|
-
}, [tokens]);
|
|
38
35
|
const {
|
|
39
36
|
data: evmTokensBalances,
|
|
40
37
|
isLoading: isLoadingEvmTokensBalances,
|
|
@@ -103,7 +100,6 @@ const useFetchTokens = ({
|
|
|
103
100
|
isLoadingMvxTokensBalances,
|
|
104
101
|
isErrorMvxTokensBalances,
|
|
105
102
|
mvxTokensWithBalances,
|
|
106
|
-
fiatCurrencies,
|
|
107
103
|
tokens
|
|
108
104
|
};
|
|
109
105
|
};
|
|
@@ -29,9 +29,6 @@ const useFetchTokens = ({
|
|
|
29
29
|
),
|
|
30
30
|
[tokens]
|
|
31
31
|
);
|
|
32
|
-
const fiatCurrencies = useMemo(() => {
|
|
33
|
-
return tokens == null ? void 0 : tokens.filter((token) => !token.chainId);
|
|
34
|
-
}, [tokens]);
|
|
35
32
|
const {
|
|
36
33
|
data: evmTokensBalances,
|
|
37
34
|
isLoading: isLoadingEvmTokensBalances,
|
|
@@ -100,7 +97,6 @@ const useFetchTokens = ({
|
|
|
100
97
|
isLoadingMvxTokensBalances,
|
|
101
98
|
isErrorMvxTokensBalances,
|
|
102
99
|
mvxTokensWithBalances,
|
|
103
|
-
fiatCurrencies,
|
|
104
100
|
tokens
|
|
105
101
|
};
|
|
106
102
|
};
|