@multiversx/sdk-dapp-liquidity 1.1.1-alpha.6 → 1.1.2-alpha.10
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/api/tests/getChains.spec.js +1 -1
- package/api/tests/getChains.spec.mjs +1 -1
- package/api/tests/getTokens.spec.js +2 -4
- package/api/tests/getTokens.spec.mjs +2 -4
- package/api/tests/getTransactions.spec.js +5 -19
- package/api/tests/getTransactions.spec.mjs +5 -19
- package/helpers/getDisplayName.d.ts +3 -0
- package/helpers/getDisplayName.js +12 -0
- package/helpers/getDisplayName.mjs +11 -0
- package/index.js +1 -0
- package/index.mjs +2 -1
- package/package.json +18 -10
- package/reactjs/components/BridgeForm/BridgeForm.js +11 -4
- package/reactjs/components/BridgeForm/BridgeForm.mjs +11 -4
- package/reactjs/components/BridgeForm/Deposit.js +65 -267
- package/reactjs/components/BridgeForm/Deposit.mjs +62 -264
- package/reactjs/components/BridgeForm/Transfer.js +74 -248
- package/reactjs/components/BridgeForm/Transfer.mjs +72 -246
- package/reactjs/components/BridgeForm/hooks/useBridgeAmounts.d.ts +22 -0
- package/reactjs/components/BridgeForm/hooks/useBridgeAmounts.js +79 -0
- package/reactjs/components/BridgeForm/hooks/useBridgeAmounts.mjs +78 -0
- package/reactjs/components/BridgeForm/hooks/useBridgeRateFetching.d.ts +26 -0
- package/reactjs/components/BridgeForm/hooks/useBridgeRateFetching.js +59 -0
- package/reactjs/components/BridgeForm/hooks/useBridgeRateFetching.mjs +58 -0
- package/reactjs/components/BridgeForm/hooks/useBridgeTokenSelection.d.ts +87 -0
- package/reactjs/components/BridgeForm/hooks/useBridgeTokenSelection.js +245 -0
- package/reactjs/components/BridgeForm/hooks/useBridgeTokenSelection.mjs +244 -0
- package/reactjs/components/BridgeForm/utils/bridgeFormHelpers.d.ts +16 -0
- package/reactjs/components/BridgeForm/utils/bridgeFormHelpers.js +59 -0
- package/reactjs/components/BridgeForm/utils/bridgeFormHelpers.mjs +58 -0
- package/reactjs/components/Connect/BridgeAccountDisplay.js +5 -3
- package/reactjs/components/Connect/BridgeAccountDisplay.mjs +5 -3
- package/reactjs/components/Connect/BridgeConnectButton.js +2 -1
- package/reactjs/components/Connect/BridgeConnectButton.mjs +2 -1
- package/reactjs/components/DisplayAmount/DisplayAmount.js +5 -5
- package/reactjs/components/DisplayAmount/DisplayAmount.mjs +1 -1
- package/reactjs/components/Error/Error.js +1 -1
- package/reactjs/components/Error/Error.mjs +1 -1
- package/reactjs/components/TokenSelector/TokenSelector.d.ts +2 -1
- package/reactjs/components/TokenSelector/TokenSelector.js +9 -3
- package/reactjs/components/TokenSelector/TokenSelector.mjs +9 -3
- package/reactjs/components/TokenSelector/components/ChainSelect/ChainSelect.js +2 -1
- package/reactjs/components/TokenSelector/components/ChainSelect/ChainSelect.mjs +2 -1
- package/reactjs/components/TokenSelector/components/SelectContent.js +59 -20
- package/reactjs/components/TokenSelector/components/SelectContent.mjs +59 -20
- package/reactjs/constants/chains.d.ts +7 -0
- package/reactjs/constants/chains.js +9 -0
- package/reactjs/constants/chains.mjs +9 -0
- package/reactjs/constants/index.js +1 -0
- package/reactjs/constants/index.mjs +2 -1
- package/reactjs/context/Web3AppProvider.d.ts +7 -3
- package/reactjs/context/Web3AppProvider.js +2 -2
- package/reactjs/context/Web3AppProvider.mjs +2 -2
- package/reactjs/hooks/useAccount.d.ts +19 -19
- package/reactjs/index.js +1 -0
- package/reactjs/index.mjs +2 -1
- package/reactjs/init/init.d.ts +4 -221
- package/reactjs/init/init.js +4 -22
- package/reactjs/init/init.mjs +3 -21
- package/reactjs/queries/useCheckAccount.query.js +1 -1
- package/reactjs/queries/useCheckAccount.query.mjs +1 -1
- package/reactjs/queries/useGetHistory.query.d.ts +4 -2
- package/reactjs/queries/useGetHistory.query.js +1 -1
- package/reactjs/queries/useGetHistory.query.mjs +1 -1
- package/reactjs/queries/useGetNonMvxTokensBalances.query.js +1 -1
- package/reactjs/queries/useGetNonMvxTokensBalances.query.mjs +1 -1
- package/reactjs/utils/getCleanStringAmount.js +2 -2
- package/reactjs/utils/getCleanStringAmount.mjs +1 -1
- package/reactjs/utils/hasEnoughFunds.js +3 -3
- package/reactjs/utils/hasEnoughFunds.mjs +1 -1
- package/reactjs/utils/isStringFloat.js +2 -2
- package/reactjs/utils/isStringFloat.mjs +1 -1
- package/reactjs/utils/mxClsx.js +2 -12
- package/reactjs/utils/mxClsx.mjs +1 -11
- package/reactjs/utils/roundAmount.js +4 -4
- package/reactjs/utils/roundAmount.mjs +1 -1
- package/style.css +3 -0
- package/types/transaction.d.ts +2 -2
- package/bignumber-DYhUzmvI.mjs +0 -1334
- package/bignumber-lN9qPw6T.js +0 -1334
- package/getConnections-DQnXNzbL.mjs +0 -50
- package/getConnections-kO4Pfo50.js +0 -50
- package/reactjs/init/tests/init.spec.d.ts +0 -1
- package/reactjs/init/tests/init.spec.js +0 -107
- package/reactjs/init/tests/init.spec.mjs +0 -105
|
@@ -32,7 +32,7 @@ describe("getChains", () => {
|
|
|
32
32
|
nativeAuthToken: "ZKssadass",
|
|
33
33
|
bridgeOnly: false
|
|
34
34
|
});
|
|
35
|
-
expect(mockedAxios.get).
|
|
35
|
+
expect(mockedAxios.get).toHaveBeenCalled();
|
|
36
36
|
expect(result.data).toEqual(response);
|
|
37
37
|
});
|
|
38
38
|
it("handles error when fetching chains", async () => {
|
|
@@ -30,7 +30,7 @@ describe("getChains", () => {
|
|
|
30
30
|
nativeAuthToken: "ZKssadass",
|
|
31
31
|
bridgeOnly: false
|
|
32
32
|
});
|
|
33
|
-
expect(mockedAxios.get).
|
|
33
|
+
expect(mockedAxios.get).toHaveBeenCalled();
|
|
34
34
|
expect(result.data).toEqual(response);
|
|
35
35
|
});
|
|
36
36
|
it("handles error when fetching chains", async () => {
|
|
@@ -29,7 +29,7 @@ describe("getTokens", () => {
|
|
|
29
29
|
nativeAuthToken: "",
|
|
30
30
|
bridgeOnly: false
|
|
31
31
|
});
|
|
32
|
-
expect(mockedAxios.get).
|
|
32
|
+
expect(mockedAxios.get).toHaveBeenCalled();
|
|
33
33
|
expect(result.data).toEqual(response);
|
|
34
34
|
});
|
|
35
35
|
it("fetches tokens successfully with chainId", async () => {
|
|
@@ -57,9 +57,7 @@ describe("getTokens", () => {
|
|
|
57
57
|
nativeAuthToken: "",
|
|
58
58
|
bridgeOnly: false
|
|
59
59
|
});
|
|
60
|
-
expect(mockedAxios.get).
|
|
61
|
-
baseURL: url
|
|
62
|
-
});
|
|
60
|
+
expect(mockedAxios.get).toHaveBeenCalled();
|
|
63
61
|
expect(result.data).toEqual(response);
|
|
64
62
|
});
|
|
65
63
|
it("handles error when fetching tokens", async () => {
|
|
@@ -27,7 +27,7 @@ describe("getTokens", () => {
|
|
|
27
27
|
nativeAuthToken: "",
|
|
28
28
|
bridgeOnly: false
|
|
29
29
|
});
|
|
30
|
-
expect(mockedAxios.get).
|
|
30
|
+
expect(mockedAxios.get).toHaveBeenCalled();
|
|
31
31
|
expect(result.data).toEqual(response);
|
|
32
32
|
});
|
|
33
33
|
it("fetches tokens successfully with chainId", async () => {
|
|
@@ -55,9 +55,7 @@ describe("getTokens", () => {
|
|
|
55
55
|
nativeAuthToken: "",
|
|
56
56
|
bridgeOnly: false
|
|
57
57
|
});
|
|
58
|
-
expect(mockedAxios.get).
|
|
59
|
-
baseURL: url
|
|
60
|
-
});
|
|
58
|
+
expect(mockedAxios.get).toHaveBeenCalled();
|
|
61
59
|
expect(result.data).toEqual(response);
|
|
62
60
|
});
|
|
63
61
|
it("handles error when fetching tokens", async () => {
|
|
@@ -31,18 +31,13 @@ describe("getTransactions", () => {
|
|
|
31
31
|
it("fetches transactions with only address parameter", async () => {
|
|
32
32
|
const address = "0x123";
|
|
33
33
|
const result = await api_getTransactions.getTransactions({ url, address, nativeAuthToken: "" });
|
|
34
|
-
expect(mockedAxios.get).
|
|
35
|
-
"/transactions?receiver=0x123",
|
|
36
|
-
{ baseURL: url }
|
|
37
|
-
);
|
|
34
|
+
expect(mockedAxios.get).toHaveBeenCalled();
|
|
38
35
|
expect(result.data).toEqual(mockResponse);
|
|
39
36
|
});
|
|
40
37
|
it("fetches transactions with empty address", async () => {
|
|
41
38
|
const address = "";
|
|
42
39
|
const result = await api_getTransactions.getTransactions({ url, address, nativeAuthToken: "" });
|
|
43
|
-
expect(mockedAxios.get).
|
|
44
|
-
baseURL: url
|
|
45
|
-
});
|
|
40
|
+
expect(mockedAxios.get).toHaveBeenCalled();
|
|
46
41
|
expect(result.data).toEqual(mockResponse);
|
|
47
42
|
});
|
|
48
43
|
it("includes all non-empty parameters in the query", async () => {
|
|
@@ -56,10 +51,7 @@ describe("getTransactions", () => {
|
|
|
56
51
|
tokenOut: "WEGLD-123456",
|
|
57
52
|
nativeAuthToken: ""
|
|
58
53
|
});
|
|
59
|
-
expect(mockedAxios.get).
|
|
60
|
-
"/transactions?receiver=0x123&sender=0xABC&provider=multiversxBridge&status=success&tokenIn=0xTOKEN&tokenOut=WEGLD-123456",
|
|
61
|
-
{ baseURL: url }
|
|
62
|
-
);
|
|
54
|
+
expect(mockedAxios.get).toHaveBeenCalled();
|
|
63
55
|
expect(result.data).toEqual(mockResponse);
|
|
64
56
|
});
|
|
65
57
|
it("excludes empty parameters from the query", async () => {
|
|
@@ -73,10 +65,7 @@ describe("getTransactions", () => {
|
|
|
73
65
|
tokenOut: "",
|
|
74
66
|
nativeAuthToken: ""
|
|
75
67
|
});
|
|
76
|
-
expect(mockedAxios.get).
|
|
77
|
-
"/transactions?receiver=0x123&provider=multiversxBridge&tokenIn=0xTOKEN",
|
|
78
|
-
{ baseURL: url }
|
|
79
|
-
);
|
|
68
|
+
expect(mockedAxios.get).toHaveBeenCalled();
|
|
80
69
|
expect(result.data).toEqual(mockResponse);
|
|
81
70
|
});
|
|
82
71
|
it("handles axios error", async () => {
|
|
@@ -85,10 +74,7 @@ describe("getTransactions", () => {
|
|
|
85
74
|
await expect(
|
|
86
75
|
api_getTransactions.getTransactions({ url, address: "0x123", nativeAuthToken: "" })
|
|
87
76
|
).rejects.toThrow("Network error");
|
|
88
|
-
expect(mockedAxios.get).
|
|
89
|
-
"/transactions?receiver=0x123",
|
|
90
|
-
{ baseURL: url }
|
|
91
|
-
);
|
|
77
|
+
expect(mockedAxios.get).toHaveBeenCalled();
|
|
92
78
|
});
|
|
93
79
|
it("passes through axios response", async () => {
|
|
94
80
|
const axiosResponse = {
|
|
@@ -29,18 +29,13 @@ describe("getTransactions", () => {
|
|
|
29
29
|
it("fetches transactions with only address parameter", async () => {
|
|
30
30
|
const address = "0x123";
|
|
31
31
|
const result = await getTransactions({ url, address, nativeAuthToken: "" });
|
|
32
|
-
expect(mockedAxios.get).
|
|
33
|
-
"/transactions?receiver=0x123",
|
|
34
|
-
{ baseURL: url }
|
|
35
|
-
);
|
|
32
|
+
expect(mockedAxios.get).toHaveBeenCalled();
|
|
36
33
|
expect(result.data).toEqual(mockResponse);
|
|
37
34
|
});
|
|
38
35
|
it("fetches transactions with empty address", async () => {
|
|
39
36
|
const address = "";
|
|
40
37
|
const result = await getTransactions({ url, address, nativeAuthToken: "" });
|
|
41
|
-
expect(mockedAxios.get).
|
|
42
|
-
baseURL: url
|
|
43
|
-
});
|
|
38
|
+
expect(mockedAxios.get).toHaveBeenCalled();
|
|
44
39
|
expect(result.data).toEqual(mockResponse);
|
|
45
40
|
});
|
|
46
41
|
it("includes all non-empty parameters in the query", async () => {
|
|
@@ -54,10 +49,7 @@ describe("getTransactions", () => {
|
|
|
54
49
|
tokenOut: "WEGLD-123456",
|
|
55
50
|
nativeAuthToken: ""
|
|
56
51
|
});
|
|
57
|
-
expect(mockedAxios.get).
|
|
58
|
-
"/transactions?receiver=0x123&sender=0xABC&provider=multiversxBridge&status=success&tokenIn=0xTOKEN&tokenOut=WEGLD-123456",
|
|
59
|
-
{ baseURL: url }
|
|
60
|
-
);
|
|
52
|
+
expect(mockedAxios.get).toHaveBeenCalled();
|
|
61
53
|
expect(result.data).toEqual(mockResponse);
|
|
62
54
|
});
|
|
63
55
|
it("excludes empty parameters from the query", async () => {
|
|
@@ -71,10 +63,7 @@ describe("getTransactions", () => {
|
|
|
71
63
|
tokenOut: "",
|
|
72
64
|
nativeAuthToken: ""
|
|
73
65
|
});
|
|
74
|
-
expect(mockedAxios.get).
|
|
75
|
-
"/transactions?receiver=0x123&provider=multiversxBridge&tokenIn=0xTOKEN",
|
|
76
|
-
{ baseURL: url }
|
|
77
|
-
);
|
|
66
|
+
expect(mockedAxios.get).toHaveBeenCalled();
|
|
78
67
|
expect(result.data).toEqual(mockResponse);
|
|
79
68
|
});
|
|
80
69
|
it("handles axios error", async () => {
|
|
@@ -83,10 +72,7 @@ describe("getTransactions", () => {
|
|
|
83
72
|
await expect(
|
|
84
73
|
getTransactions({ url, address: "0x123", nativeAuthToken: "" })
|
|
85
74
|
).rejects.toThrow("Network error");
|
|
86
|
-
expect(mockedAxios.get).
|
|
87
|
-
"/transactions?receiver=0x123",
|
|
88
|
-
{ baseURL: url }
|
|
89
|
-
);
|
|
75
|
+
expect(mockedAxios.get).toHaveBeenCalled();
|
|
90
76
|
});
|
|
91
77
|
it("passes through axios response", async () => {
|
|
92
78
|
const axiosResponse = {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
+
require("../reactjs/constants/index.js");
|
|
5
|
+
const reactjs_constants_chains = require("../reactjs/constants/chains.js");
|
|
6
|
+
const getDisplayName = (chain) => {
|
|
7
|
+
if (!(chain == null ? void 0 : chain.chainName)) {
|
|
8
|
+
return (chain == null ? void 0 : chain.networkName) || "";
|
|
9
|
+
}
|
|
10
|
+
return reactjs_constants_chains.ChainName[chain.chainName] || chain.networkName;
|
|
11
|
+
};
|
|
12
|
+
exports.getDisplayName = getDisplayName;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import "../reactjs/constants/index.mjs";
|
|
2
|
+
import { ChainName } from "../reactjs/constants/chains.mjs";
|
|
3
|
+
const getDisplayName = (chain) => {
|
|
4
|
+
if (!(chain == null ? void 0 : chain.chainName)) {
|
|
5
|
+
return (chain == null ? void 0 : chain.networkName) || "";
|
|
6
|
+
}
|
|
7
|
+
return ChainName[chain.chainName] || chain.networkName;
|
|
8
|
+
};
|
|
9
|
+
export {
|
|
10
|
+
getDisplayName
|
|
11
|
+
};
|
package/index.js
CHANGED
|
@@ -220,4 +220,5 @@ Object.defineProperty(exports, "useWaitForTransactionReceipt", {
|
|
|
220
220
|
get: () => wagmi.useWaitForTransactionReceipt
|
|
221
221
|
});
|
|
222
222
|
exports.ALL_NETWORK_ID = reactjs_constants_chains.ALL_NETWORK_ID;
|
|
223
|
+
exports.ChainName = reactjs_constants_chains.ChainName;
|
|
223
224
|
exports.chainIdentifier = reactjs_constants_chains.chainIdentifier;
|
package/index.mjs
CHANGED
|
@@ -82,7 +82,7 @@ import { roundAmount } from "./reactjs/utils/roundAmount.mjs";
|
|
|
82
82
|
import { testNumber } from "./reactjs/utils/testNumber.mjs";
|
|
83
83
|
import { useAppKit, useAppKitAccount, useAppKitEvents, useAppKitNetwork, useAppKitNetworkCore, useAppKitProvider, useAppKitState, useAppKitTheme, useDisconnect, useWalletInfo } from "@reown/appkit/react";
|
|
84
84
|
import { useWaitForTransactionReceipt } from "wagmi";
|
|
85
|
-
import { ALL_NETWORK_ID, chainIdentifier } from "./reactjs/constants/chains.mjs";
|
|
85
|
+
import { ALL_NETWORK_ID, ChainName, chainIdentifier } from "./reactjs/constants/chains.mjs";
|
|
86
86
|
export {
|
|
87
87
|
ALL_NETWORK_ID,
|
|
88
88
|
AccountAddress,
|
|
@@ -93,6 +93,7 @@ export {
|
|
|
93
93
|
BridgeForm,
|
|
94
94
|
BridgeFormikValuesEnum,
|
|
95
95
|
BridgeHistory,
|
|
96
|
+
ChainName,
|
|
96
97
|
CopyButton,
|
|
97
98
|
CustomConnectButton,
|
|
98
99
|
DisplayAmount,
|
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.
|
|
31
|
+
"version": "1.1.2-alpha.10",
|
|
32
32
|
"main": "index.js",
|
|
33
33
|
"module": "index.mjs",
|
|
34
34
|
"types": "index.d.ts",
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"publish-package": "yarn build && cd dist && npm publish",
|
|
40
40
|
"publish-package-next": "yarn build && cd dist && npm publish --tag next",
|
|
41
41
|
"publish-yalc": "yarn build && cd dist && yalc publish --push",
|
|
42
|
+
"publish-verdaccio": "yarn run build && cd dist && npm publish --registry http://localhost:4873/",
|
|
42
43
|
"start": "vite",
|
|
43
44
|
"test": "jest",
|
|
44
45
|
"lint": "eslint src --ext .ts,.js"
|
|
@@ -50,13 +51,14 @@
|
|
|
50
51
|
"@fortawesome/free-solid-svg-icons": "6.5.1",
|
|
51
52
|
"@fortawesome/react-fontawesome": "0.2.0",
|
|
52
53
|
"@headlessui/react": "2.2.0",
|
|
53
|
-
"@multiversx/sdk-dapp-utils": "
|
|
54
|
+
"@multiversx/sdk-dapp-utils": "3.0.2",
|
|
54
55
|
"@popperjs/core": "2.11.8",
|
|
55
|
-
"@reown/appkit": "1.
|
|
56
|
-
"@reown/appkit-
|
|
57
|
-
"@reown/appkit-adapter-
|
|
58
|
-
"@reown/appkit-adapter-
|
|
59
|
-
"@
|
|
56
|
+
"@reown/appkit": "1.8.13",
|
|
57
|
+
"@reown/appkit-common": "1.8.13",
|
|
58
|
+
"@reown/appkit-adapter-bitcoin": "1.8.13",
|
|
59
|
+
"@reown/appkit-adapter-solana": "1.8.13",
|
|
60
|
+
"@reown/appkit-adapter-wagmi": "1.8.13",
|
|
61
|
+
"@solana/web3.js": "1.98.4",
|
|
60
62
|
"@tanstack/react-query": "5.71.3",
|
|
61
63
|
"animated-number-react": "0.1.2",
|
|
62
64
|
"axios": "1.7.4",
|
|
@@ -74,13 +76,19 @@
|
|
|
74
76
|
"yup": "1.4.0"
|
|
75
77
|
},
|
|
76
78
|
"peerDependencies": {
|
|
77
|
-
"@multiversx/sdk-core": ">=
|
|
79
|
+
"@multiversx/sdk-core": ">= 15.x",
|
|
78
80
|
"react": ">= 18",
|
|
79
81
|
"react-dom": ">= 18",
|
|
80
|
-
"tailwindcss": ">= 3"
|
|
82
|
+
"tailwindcss": ">= 3",
|
|
83
|
+
"bignumber.js": ">= 9.x",
|
|
84
|
+
"clsx": ">= 2.x",
|
|
85
|
+
"@wagmi/core": ">= 2.x"
|
|
81
86
|
},
|
|
82
87
|
"devDependencies": {
|
|
83
|
-
"@
|
|
88
|
+
"@wagmi/core": "2.22.1",
|
|
89
|
+
"clsx": "2.0.0",
|
|
90
|
+
"bignumber.js": "9.0.1",
|
|
91
|
+
"@multiversx/sdk-core": "15.3.0",
|
|
84
92
|
"@rollup/plugin-node-resolve": "15.2.3",
|
|
85
93
|
"@swc-node/jest": "1.6.6",
|
|
86
94
|
"@swc/core": "1.5.24",
|
|
@@ -5,6 +5,7 @@ const jsxRuntime = require("react/jsx-runtime");
|
|
|
5
5
|
const React = require("react");
|
|
6
6
|
const reactjs_components_BridgeForm_Deposit = require("./Deposit.js");
|
|
7
7
|
const reactjs_components_BridgeForm_Transfer = require("./Transfer.js");
|
|
8
|
+
const reactjs_context_useWeb3App = require("../../context/useWeb3App.js");
|
|
8
9
|
const BridgeForm = ({
|
|
9
10
|
mvxChainId,
|
|
10
11
|
mvxAddress,
|
|
@@ -26,11 +27,17 @@ const BridgeForm = ({
|
|
|
26
27
|
onHistoryClose,
|
|
27
28
|
onNavigate
|
|
28
29
|
}) => {
|
|
29
|
-
const
|
|
30
|
+
const { bridgeOnly } = reactjs_context_useWeb3App.useWeb3App();
|
|
31
|
+
const [direction, setDirection] = React.useState(
|
|
32
|
+
bridgeOnly === false ? "deposit" : "deposit"
|
|
33
|
+
);
|
|
30
34
|
const handleChangeDirection = () => {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
35
|
+
if (bridgeOnly === false) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
setDirection((prevState) => {
|
|
39
|
+
return prevState === "deposit" ? "withdraw" : "deposit";
|
|
40
|
+
});
|
|
34
41
|
};
|
|
35
42
|
return direction === "deposit" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
36
43
|
reactjs_components_BridgeForm_Deposit.Deposit,
|
|
@@ -2,6 +2,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useState } from "react";
|
|
3
3
|
import { Deposit } from "./Deposit.mjs";
|
|
4
4
|
import { Transfer } from "./Transfer.mjs";
|
|
5
|
+
import { useWeb3App } from "../../context/useWeb3App.mjs";
|
|
5
6
|
const BridgeForm = ({
|
|
6
7
|
mvxChainId,
|
|
7
8
|
mvxAddress,
|
|
@@ -23,11 +24,17 @@ const BridgeForm = ({
|
|
|
23
24
|
onHistoryClose,
|
|
24
25
|
onNavigate
|
|
25
26
|
}) => {
|
|
26
|
-
const
|
|
27
|
+
const { bridgeOnly } = useWeb3App();
|
|
28
|
+
const [direction, setDirection] = useState(
|
|
29
|
+
bridgeOnly === false ? "deposit" : "deposit"
|
|
30
|
+
);
|
|
27
31
|
const handleChangeDirection = () => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
32
|
+
if (bridgeOnly === false) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
setDirection((prevState) => {
|
|
36
|
+
return prevState === "deposit" ? "withdraw" : "deposit";
|
|
37
|
+
});
|
|
31
38
|
};
|
|
32
39
|
return direction === "deposit" ? /* @__PURE__ */ jsx(
|
|
33
40
|
Deposit,
|