@multiversx/sdk-dapp-liquidity 2.0.0-alpha.1 → 2.0.0-alpha.3
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 +9 -10
- package/reactjs/components/BridgeHistory/BridgeHistory.js +34 -6
- package/reactjs/components/BridgeHistory/BridgeHistory.mjs +35 -7
- package/reactjs/components/TokenSelector/components/ChainSelect/components/ChainOptionLabel.js +9 -2
- package/reactjs/components/TokenSelector/components/ChainSelect/components/ChainOptionLabel.mjs +10 -3
- package/reactjs/components/TokenSelector/components/ChainSelect/components/SelectedChainOption.js +9 -2
- package/reactjs/components/TokenSelector/components/ChainSelect/components/SelectedChainOption.mjs +10 -3
- package/reactjs/hooks/useBridgeFormik.d.ts +2 -2
- package/reactjs/hooks/useSendTransactions.d.ts +1 -1
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": "2.0.0-alpha.
|
|
31
|
+
"version": "2.0.0-alpha.3",
|
|
32
32
|
"main": "index.js",
|
|
33
33
|
"module": "index.mjs",
|
|
34
34
|
"types": "index.d.ts",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@fortawesome/free-brands-svg-icons": "6.5.1",
|
|
51
51
|
"@fortawesome/free-solid-svg-icons": "6.5.1",
|
|
52
52
|
"@fortawesome/react-fontawesome": "0.2.0",
|
|
53
|
-
"@headlessui/react": "2.2.
|
|
53
|
+
"@headlessui/react": "2.2.10",
|
|
54
54
|
"@multiversx/sdk-dapp-utils": "3.0.2",
|
|
55
55
|
"@popperjs/core": "2.11.8",
|
|
56
56
|
"@reown/appkit": "1.8.19",
|
|
@@ -61,18 +61,17 @@
|
|
|
61
61
|
"@reown/appkit-controllers": "1.8.19",
|
|
62
62
|
"@solana/web3.js": "1.98.4",
|
|
63
63
|
"@tanstack/react-query": "5.71.3",
|
|
64
|
-
"@walletconnect/modal": "^2.7.0",
|
|
65
64
|
"@walletconnect/universal-provider": "2.23.9",
|
|
66
65
|
"animated-number-react": "0.1.2",
|
|
67
|
-
"axios": "1.
|
|
68
|
-
"formik": "2.4.
|
|
69
|
-
"lodash": "4.
|
|
66
|
+
"axios": "1.14.0",
|
|
67
|
+
"formik": "2.4.9",
|
|
68
|
+
"lodash": "4.18.1",
|
|
70
69
|
"numeral": "2.0.6",
|
|
71
70
|
"react-joyride": "2.9.3",
|
|
72
|
-
"react-number-format": "5.4.
|
|
71
|
+
"react-number-format": "5.4.5",
|
|
73
72
|
"react-popper": "2.3.0",
|
|
74
|
-
"react-select": "5.10.
|
|
75
|
-
"react-toastify": "11.0.
|
|
73
|
+
"react-select": "5.10.2",
|
|
74
|
+
"react-toastify": "11.0.5",
|
|
76
75
|
"tailwind-merge": "2.6.0",
|
|
77
76
|
"viem": "2.47.10",
|
|
78
77
|
"wagmi": "3.6.1",
|
|
@@ -121,7 +120,7 @@
|
|
|
121
120
|
"eslint-plugin-node": "11.1.0",
|
|
122
121
|
"eslint-plugin-prettier": "5.0.0",
|
|
123
122
|
"eslint-plugin-promise": "6.1.1",
|
|
124
|
-
"glob": "
|
|
123
|
+
"glob": "13.0.6",
|
|
125
124
|
"jest": "29.7.0",
|
|
126
125
|
"jest-environment-jsdom": "29.7.0",
|
|
127
126
|
"jest-fetch-mock": "3.0.3",
|
|
@@ -10,10 +10,23 @@ const faClock = require("@fortawesome/free-solid-svg-icons/faClock");
|
|
|
10
10
|
const faClose = require("@fortawesome/free-solid-svg-icons/faClose");
|
|
11
11
|
const reactFontawesome = require("@fortawesome/react-fontawesome");
|
|
12
12
|
const React = require("react");
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
require("yup");
|
|
14
|
+
require("@multiversx/sdk-dapp-utils/out/helpers/parseAmount");
|
|
15
|
+
require("bignumber.js");
|
|
16
|
+
const reactjs_hooks_useAccount = require("../../hooks/useAccount.js");
|
|
17
|
+
require("@reown/appkit/react");
|
|
18
|
+
require("axios");
|
|
15
19
|
const reactjs_context_useWeb3App = require("../../context/useWeb3App.js");
|
|
20
|
+
require("formik");
|
|
21
|
+
const types_providerType = require("../../../types/providerType.js");
|
|
16
22
|
const reactjs_hooks_useFetchBridgeData = require("../../hooks/useFetchBridgeData.js");
|
|
23
|
+
const constants_index = require("../../../constants/index.js");
|
|
24
|
+
require("@tanstack/react-query");
|
|
25
|
+
require("../../constants/index.js");
|
|
26
|
+
require("@reown/appkit-adapter-solana/react");
|
|
27
|
+
require("@solana/web3.js");
|
|
28
|
+
require("wagmi");
|
|
29
|
+
require("@reown/appkit-controllers");
|
|
17
30
|
const reactjs_queries_useGetHistory_query = require("../../queries/useGetHistory.query.js");
|
|
18
31
|
const reactjs_utils_formatAmount = require("../../utils/formatAmount.js");
|
|
19
32
|
const reactjs_utils_mxClsx = require("../../utils/mxClsx.js");
|
|
@@ -28,10 +41,25 @@ const BridgeHistory = ({
|
|
|
28
41
|
mvxAddress,
|
|
29
42
|
onClose
|
|
30
43
|
}) => {
|
|
31
|
-
const { options } = reactjs_context_useWeb3App.useWeb3App();
|
|
32
|
-
const
|
|
44
|
+
const { options, bridgeOnly } = reactjs_context_useWeb3App.useWeb3App();
|
|
45
|
+
const bridgeAccount = reactjs_hooks_useAccount.useAccount();
|
|
46
|
+
const {
|
|
47
|
+
data: mvxTransactions,
|
|
48
|
+
isLoading,
|
|
49
|
+
isError
|
|
50
|
+
} = reactjs_queries_useGetHistory_query.useGetHistoryQuery({
|
|
33
51
|
address: mvxAddress
|
|
34
52
|
});
|
|
53
|
+
const { data: bridgeTransactions } = reactjs_queries_useGetHistory_query.useGetHistoryQuery({
|
|
54
|
+
address: bridgeAccount.address ?? ""
|
|
55
|
+
});
|
|
56
|
+
const mergedTransactions = React.useMemo(() => {
|
|
57
|
+
const mvxTxs = mvxTransactions ?? [];
|
|
58
|
+
const bridgeTxs = bridgeOnly && bridgeTransactions ? bridgeTransactions : [];
|
|
59
|
+
return [...mvxTxs, ...bridgeTxs].sort(
|
|
60
|
+
(a, b) => b.depositTimestamp - a.depositTimestamp
|
|
61
|
+
);
|
|
62
|
+
}, [bridgeOnly, bridgeTransactions, mvxTransactions]);
|
|
35
63
|
const resolveTransactionIcon = React.useCallback((transaction) => {
|
|
36
64
|
switch (transaction.status) {
|
|
37
65
|
case "success":
|
|
@@ -64,7 +92,7 @@ const BridgeHistory = ({
|
|
|
64
92
|
}
|
|
65
93
|
}, []);
|
|
66
94
|
const transactions = React.useMemo(
|
|
67
|
-
() =>
|
|
95
|
+
() => mergedTransactions == null ? void 0 : mergedTransactions.map((transaction) => {
|
|
68
96
|
return {
|
|
69
97
|
...transaction,
|
|
70
98
|
tokenDestination: transaction.tokenOut.toLowerCase(),
|
|
@@ -73,7 +101,7 @@ const BridgeHistory = ({
|
|
|
73
101
|
statusIcon: resolveTransactionIcon(transaction)
|
|
74
102
|
};
|
|
75
103
|
}),
|
|
76
|
-
[
|
|
104
|
+
[mergedTransactions, resolveTransactionIcon]
|
|
77
105
|
);
|
|
78
106
|
const {
|
|
79
107
|
evmTokensWithBalances,
|
|
@@ -6,11 +6,24 @@ import { faCircleXmark } from "@fortawesome/free-solid-svg-icons/faCircleXmark";
|
|
|
6
6
|
import { faClock } from "@fortawesome/free-solid-svg-icons/faClock";
|
|
7
7
|
import { faClose } from "@fortawesome/free-solid-svg-icons/faClose";
|
|
8
8
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import
|
|
9
|
+
import { useMemo, useCallback } from "react";
|
|
10
|
+
import "yup";
|
|
11
|
+
import "@multiversx/sdk-dapp-utils/out/helpers/parseAmount";
|
|
12
|
+
import "bignumber.js";
|
|
13
|
+
import { useAccount } from "../../hooks/useAccount.mjs";
|
|
14
|
+
import "@reown/appkit/react";
|
|
15
|
+
import "axios";
|
|
12
16
|
import { useWeb3App } from "../../context/useWeb3App.mjs";
|
|
17
|
+
import "formik";
|
|
18
|
+
import { ProviderType } from "../../../types/providerType.mjs";
|
|
13
19
|
import { useFetchBridgeData } from "../../hooks/useFetchBridgeData.mjs";
|
|
20
|
+
import { MVX_CHAIN_IDS } from "../../../constants/index.mjs";
|
|
21
|
+
import "@tanstack/react-query";
|
|
22
|
+
import "../../constants/index.mjs";
|
|
23
|
+
import "@reown/appkit-adapter-solana/react";
|
|
24
|
+
import "@solana/web3.js";
|
|
25
|
+
import "wagmi";
|
|
26
|
+
import "@reown/appkit-controllers";
|
|
14
27
|
import { useGetHistoryQuery } from "../../queries/useGetHistory.query.mjs";
|
|
15
28
|
import { formatAmount } from "../../utils/formatAmount.mjs";
|
|
16
29
|
import { mxClsx } from "../../utils/mxClsx.mjs";
|
|
@@ -25,10 +38,25 @@ const BridgeHistory = ({
|
|
|
25
38
|
mvxAddress,
|
|
26
39
|
onClose
|
|
27
40
|
}) => {
|
|
28
|
-
const { options } = useWeb3App();
|
|
29
|
-
const
|
|
41
|
+
const { options, bridgeOnly } = useWeb3App();
|
|
42
|
+
const bridgeAccount = useAccount();
|
|
43
|
+
const {
|
|
44
|
+
data: mvxTransactions,
|
|
45
|
+
isLoading,
|
|
46
|
+
isError
|
|
47
|
+
} = useGetHistoryQuery({
|
|
30
48
|
address: mvxAddress
|
|
31
49
|
});
|
|
50
|
+
const { data: bridgeTransactions } = useGetHistoryQuery({
|
|
51
|
+
address: bridgeAccount.address ?? ""
|
|
52
|
+
});
|
|
53
|
+
const mergedTransactions = useMemo(() => {
|
|
54
|
+
const mvxTxs = mvxTransactions ?? [];
|
|
55
|
+
const bridgeTxs = bridgeOnly && bridgeTransactions ? bridgeTransactions : [];
|
|
56
|
+
return [...mvxTxs, ...bridgeTxs].sort(
|
|
57
|
+
(a, b) => b.depositTimestamp - a.depositTimestamp
|
|
58
|
+
);
|
|
59
|
+
}, [bridgeOnly, bridgeTransactions, mvxTransactions]);
|
|
32
60
|
const resolveTransactionIcon = useCallback((transaction) => {
|
|
33
61
|
switch (transaction.status) {
|
|
34
62
|
case "success":
|
|
@@ -61,7 +89,7 @@ const BridgeHistory = ({
|
|
|
61
89
|
}
|
|
62
90
|
}, []);
|
|
63
91
|
const transactions = useMemo(
|
|
64
|
-
() =>
|
|
92
|
+
() => mergedTransactions == null ? void 0 : mergedTransactions.map((transaction) => {
|
|
65
93
|
return {
|
|
66
94
|
...transaction,
|
|
67
95
|
tokenDestination: transaction.tokenOut.toLowerCase(),
|
|
@@ -70,7 +98,7 @@ const BridgeHistory = ({
|
|
|
70
98
|
statusIcon: resolveTransactionIcon(transaction)
|
|
71
99
|
};
|
|
72
100
|
}),
|
|
73
|
-
[
|
|
101
|
+
[mergedTransactions, resolveTransactionIcon]
|
|
74
102
|
);
|
|
75
103
|
const {
|
|
76
104
|
evmTokensWithBalances,
|
package/reactjs/components/TokenSelector/components/ChainSelect/components/ChainOptionLabel.js
CHANGED
|
@@ -2,8 +2,13 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
4
|
const jsxRuntime = require("react/jsx-runtime");
|
|
5
|
-
|
|
5
|
+
require("@multiversx/sdk-dapp-utils/out/helpers/formatAmount");
|
|
6
|
+
require("@multiversx/sdk-dapp-utils/out/helpers/stringIsInteger");
|
|
7
|
+
require("bignumber.js");
|
|
6
8
|
require("../../../../../constants/index.js");
|
|
9
|
+
require("@multiversx/sdk-dapp-utils/out/helpers/parseAmount");
|
|
10
|
+
const reactjs_utils_mxClsx = require("../../../../../utils/mxClsx.js");
|
|
11
|
+
const allNetworks = require("../../../../../../all-networks-NYACMyeN.js");
|
|
7
12
|
const reactjs_constants_chains = require("../../../../../constants/chains.js");
|
|
8
13
|
const ChainOptionLabel = ({
|
|
9
14
|
chain,
|
|
@@ -21,7 +26,9 @@ const ChainOptionLabel = ({
|
|
|
21
26
|
src: chain.pngUrl ?? reactjs_constants_chains.chainIdentifier[chain.name],
|
|
22
27
|
alt: "",
|
|
23
28
|
loading: "lazy",
|
|
24
|
-
className: "liq-h-full liq-w-full
|
|
29
|
+
className: reactjs_utils_mxClsx.mxClsx("liq-h-full liq-w-full", {
|
|
30
|
+
"liq-rounded-lg": chain.id !== reactjs_constants_chains.ALL_NETWORK_ID
|
|
31
|
+
})
|
|
25
32
|
}
|
|
26
33
|
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
27
34
|
"img",
|
package/reactjs/components/TokenSelector/components/ChainSelect/components/ChainOptionLabel.mjs
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import "@multiversx/sdk-dapp-utils/out/helpers/formatAmount";
|
|
3
|
+
import "@multiversx/sdk-dapp-utils/out/helpers/stringIsInteger";
|
|
4
|
+
import "bignumber.js";
|
|
3
5
|
import "../../../../../constants/index.mjs";
|
|
4
|
-
import
|
|
6
|
+
import "@multiversx/sdk-dapp-utils/out/helpers/parseAmount";
|
|
7
|
+
import { mxClsx } from "../../../../../utils/mxClsx.mjs";
|
|
8
|
+
import { A as AllNetworks } from "../../../../../../all-networks-EJIVYZ_i.mjs";
|
|
9
|
+
import { chainIdentifier, ALL_NETWORK_ID } from "../../../../../constants/chains.mjs";
|
|
5
10
|
const ChainOptionLabel = ({
|
|
6
11
|
chain,
|
|
7
12
|
inDropdown = false
|
|
@@ -18,7 +23,9 @@ const ChainOptionLabel = ({
|
|
|
18
23
|
src: chain.pngUrl ?? chainIdentifier[chain.name],
|
|
19
24
|
alt: "",
|
|
20
25
|
loading: "lazy",
|
|
21
|
-
className: "liq-h-full liq-w-full
|
|
26
|
+
className: mxClsx("liq-h-full liq-w-full", {
|
|
27
|
+
"liq-rounded-lg": chain.id !== ALL_NETWORK_ID
|
|
28
|
+
})
|
|
22
29
|
}
|
|
23
30
|
) : /* @__PURE__ */ jsx(
|
|
24
31
|
"img",
|
package/reactjs/components/TokenSelector/components/ChainSelect/components/SelectedChainOption.js
CHANGED
|
@@ -3,8 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
4
|
const jsxRuntime = require("react/jsx-runtime");
|
|
5
5
|
const Select = require("react-select");
|
|
6
|
-
|
|
6
|
+
require("@multiversx/sdk-dapp-utils/out/helpers/formatAmount");
|
|
7
|
+
require("@multiversx/sdk-dapp-utils/out/helpers/stringIsInteger");
|
|
8
|
+
require("bignumber.js");
|
|
7
9
|
require("../../../../../constants/index.js");
|
|
10
|
+
require("@multiversx/sdk-dapp-utils/out/helpers/parseAmount");
|
|
11
|
+
const reactjs_utils_mxClsx = require("../../../../../utils/mxClsx.js");
|
|
12
|
+
const allNetworks = require("../../../../../../all-networks-NYACMyeN.js");
|
|
8
13
|
const reactjs_constants_chains = require("../../../../../constants/chains.js");
|
|
9
14
|
const SelectedChainOption = ({
|
|
10
15
|
...props
|
|
@@ -24,7 +29,9 @@ const SelectedChainOption = ({
|
|
|
24
29
|
src: chain.pngUrl ?? reactjs_constants_chains.chainIdentifier[chain.name],
|
|
25
30
|
alt: "",
|
|
26
31
|
loading: "lazy",
|
|
27
|
-
className: "liq-h-full liq-w-full
|
|
32
|
+
className: reactjs_utils_mxClsx.mxClsx("liq-h-full liq-w-full", {
|
|
33
|
+
"liq-rounded-lg": (chain == null ? void 0 : chain.id) !== reactjs_constants_chains.ALL_NETWORK_ID
|
|
34
|
+
})
|
|
28
35
|
}
|
|
29
36
|
) : /* @__PURE__ */ jsxRuntime.jsx("img", { src: allNetworks.AllNetworks, alt: "", className: "liq-h-full liq-w-full" })
|
|
30
37
|
}
|
package/reactjs/components/TokenSelector/components/ChainSelect/components/SelectedChainOption.mjs
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { components } from "react-select";
|
|
3
|
-
import
|
|
3
|
+
import "@multiversx/sdk-dapp-utils/out/helpers/formatAmount";
|
|
4
|
+
import "@multiversx/sdk-dapp-utils/out/helpers/stringIsInteger";
|
|
5
|
+
import "bignumber.js";
|
|
4
6
|
import "../../../../../constants/index.mjs";
|
|
5
|
-
import
|
|
7
|
+
import "@multiversx/sdk-dapp-utils/out/helpers/parseAmount";
|
|
8
|
+
import { mxClsx } from "../../../../../utils/mxClsx.mjs";
|
|
9
|
+
import { A as AllNetworks } from "../../../../../../all-networks-EJIVYZ_i.mjs";
|
|
10
|
+
import { chainIdentifier, ALL_NETWORK_ID } from "../../../../../constants/chains.mjs";
|
|
6
11
|
const SelectedChainOption = ({
|
|
7
12
|
...props
|
|
8
13
|
}) => {
|
|
@@ -21,7 +26,9 @@ const SelectedChainOption = ({
|
|
|
21
26
|
src: chain.pngUrl ?? chainIdentifier[chain.name],
|
|
22
27
|
alt: "",
|
|
23
28
|
loading: "lazy",
|
|
24
|
-
className: "liq-h-full liq-w-full
|
|
29
|
+
className: mxClsx("liq-h-full liq-w-full", {
|
|
30
|
+
"liq-rounded-lg": (chain == null ? void 0 : chain.id) !== ALL_NETWORK_ID
|
|
31
|
+
})
|
|
25
32
|
}
|
|
26
33
|
) : /* @__PURE__ */ jsx("img", { src: AllNetworks, alt: "", className: "liq-h-full liq-w-full" })
|
|
27
34
|
}
|
|
@@ -55,7 +55,7 @@ export declare const useBridgeFormik: ({ sender, receiver, firstToken, firstAmou
|
|
|
55
55
|
setErrors: (errors: import('formik').FormikErrors<TradeFormikValuesType>) => void;
|
|
56
56
|
setFormikState: (stateOrCb: import('formik').FormikState<TradeFormikValuesType> | ((state: import('formik').FormikState<TradeFormikValuesType>) => import('formik').FormikState<TradeFormikValuesType>)) => void;
|
|
57
57
|
setFieldTouched: (field: string, touched?: boolean, shouldValidate?: boolean) => Promise<void> | Promise<import('formik').FormikErrors<TradeFormikValuesType>>;
|
|
58
|
-
setFieldValue: (field: string, value: any
|
|
58
|
+
setFieldValue: (field: string, value: React.SetStateAction<any>, shouldValidate?: boolean) => Promise<void> | Promise<import('formik').FormikErrors<TradeFormikValuesType>>;
|
|
59
59
|
setFieldError: (field: string, value: string | undefined) => void;
|
|
60
60
|
setStatus: (status: any) => void;
|
|
61
61
|
setSubmitting: (isSubmitting: boolean) => void;
|
|
@@ -98,7 +98,7 @@ export declare const useBridgeFormik: ({ sender, receiver, firstToken, firstAmou
|
|
|
98
98
|
<T_1 = string | import('react').ChangeEvent<any>>(field: T_1): T_1 extends React.ChangeEvent<any> ? void : (e: string | React.ChangeEvent<any>) => void;
|
|
99
99
|
};
|
|
100
100
|
handleSubmit: (e?: React.FormEvent<HTMLFormElement>) => void;
|
|
101
|
-
setFieldValue: (field: string, value: any
|
|
101
|
+
setFieldValue: (field: string, value: React.SetStateAction<any>, shouldValidate?: boolean) => Promise<void> | Promise<import('formik').FormikErrors<TradeFormikValuesType>>;
|
|
102
102
|
resetSwapForm: () => void;
|
|
103
103
|
setFieldTouched: (field: string, touched?: boolean, shouldValidate?: boolean) => Promise<void> | Promise<import('formik').FormikErrors<TradeFormikValuesType>>;
|
|
104
104
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { SendTransactionsType } from '../../api/sendTransactions';
|
|
2
2
|
|
|
3
|
-
export declare const useSendTransactions: () => ({ transactions, provider, url, token, axiosConfig }: SendTransactionsType) => Promise<import('axios').AxiosResponse<import('../..').BatchTransactions, any>>;
|
|
3
|
+
export declare const useSendTransactions: () => ({ transactions, provider, url, token, axiosConfig }: SendTransactionsType) => Promise<import('axios').AxiosResponse<import('../..').BatchTransactions, any, {}>>;
|