@multiversx/sdk-dapp-liquidity 1.1.0-alpha.40 → 1.1.0-alpha.43
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/getChains.d.ts +2 -1
- package/api/getChains.js +3 -2
- package/api/getChains.mjs +3 -2
- package/api/tests/getChains.spec.js +6 -2
- package/api/tests/getChains.spec.mjs +6 -2
- package/package.json +1 -1
- package/reactjs/components/BridgeForm/BridgeForm.js +0 -4
- package/reactjs/components/BridgeForm/BridgeForm.mjs +0 -4
- package/reactjs/components/Connect/BridgeAccountDisplay.js +0 -6
- package/reactjs/components/Connect/BridgeAccountDisplay.mjs +0 -6
- package/reactjs/queries/useGetChains.query.js +3 -2
- package/reactjs/queries/useGetChains.query.mjs +3 -2
package/api/getChains.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ChainDTO } from '../dto/Chain.dto';
|
|
2
2
|
import { AxiosResponse } from 'axios';
|
|
3
3
|
|
|
4
|
-
export declare function getChains({ url, nativeAuthToken }: {
|
|
4
|
+
export declare function getChains({ url, nativeAuthToken, bridgeOnly }: {
|
|
5
5
|
url: string;
|
|
6
6
|
nativeAuthToken: string;
|
|
7
|
+
bridgeOnly: boolean;
|
|
7
8
|
}): Promise<AxiosResponse<ChainDTO[]>>;
|
package/api/getChains.js
CHANGED
|
@@ -4,7 +4,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
4
4
|
const axios = require("axios");
|
|
5
5
|
async function getChains({
|
|
6
6
|
url,
|
|
7
|
-
nativeAuthToken
|
|
7
|
+
nativeAuthToken,
|
|
8
|
+
bridgeOnly
|
|
8
9
|
}) {
|
|
9
10
|
const config = {
|
|
10
11
|
baseURL: url,
|
|
@@ -12,6 +13,6 @@ async function getChains({
|
|
|
12
13
|
Authorization: `Bearer ${nativeAuthToken}`
|
|
13
14
|
}
|
|
14
15
|
};
|
|
15
|
-
return await axios.get(
|
|
16
|
+
return await axios.get(`/chains?isBridge=${bridgeOnly}`, config);
|
|
16
17
|
}
|
|
17
18
|
exports.getChains = getChains;
|
package/api/getChains.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
2
|
async function getChains({
|
|
3
3
|
url,
|
|
4
|
-
nativeAuthToken
|
|
4
|
+
nativeAuthToken,
|
|
5
|
+
bridgeOnly
|
|
5
6
|
}) {
|
|
6
7
|
const config = {
|
|
7
8
|
baseURL: url,
|
|
@@ -9,7 +10,7 @@ async function getChains({
|
|
|
9
10
|
Authorization: `Bearer ${nativeAuthToken}`
|
|
10
11
|
}
|
|
11
12
|
};
|
|
12
|
-
return await axios.get(
|
|
13
|
+
return await axios.get(`/chains?isBridge=${bridgeOnly}`, config);
|
|
13
14
|
}
|
|
14
15
|
export {
|
|
15
16
|
getChains
|
|
@@ -27,14 +27,18 @@ describe("getChains", () => {
|
|
|
27
27
|
}
|
|
28
28
|
];
|
|
29
29
|
mockedAxios.get.mockResolvedValue({ data: response });
|
|
30
|
-
const result = await api_getChains.getChains({
|
|
30
|
+
const result = await api_getChains.getChains({
|
|
31
|
+
url,
|
|
32
|
+
nativeAuthToken: "ZKssadass",
|
|
33
|
+
bridgeOnly: false
|
|
34
|
+
});
|
|
31
35
|
expect(mockedAxios.get).toHaveBeenCalledWith("/chains", { baseURL: url });
|
|
32
36
|
expect(result.data).toEqual(response);
|
|
33
37
|
});
|
|
34
38
|
it("handles error when fetching chains", async () => {
|
|
35
39
|
mockedAxios.get.mockRejectedValue(new Error("Network Error"));
|
|
36
40
|
await expect(
|
|
37
|
-
api_getChains.getChains({ url, nativeAuthToken: "ZKssadass" })
|
|
41
|
+
api_getChains.getChains({ url, nativeAuthToken: "ZKssadass", bridgeOnly: false })
|
|
38
42
|
).rejects.toThrow("Network Error");
|
|
39
43
|
});
|
|
40
44
|
});
|
|
@@ -25,14 +25,18 @@ describe("getChains", () => {
|
|
|
25
25
|
}
|
|
26
26
|
];
|
|
27
27
|
mockedAxios.get.mockResolvedValue({ data: response });
|
|
28
|
-
const result = await getChains({
|
|
28
|
+
const result = await getChains({
|
|
29
|
+
url,
|
|
30
|
+
nativeAuthToken: "ZKssadass",
|
|
31
|
+
bridgeOnly: false
|
|
32
|
+
});
|
|
29
33
|
expect(mockedAxios.get).toHaveBeenCalledWith("/chains", { baseURL: url });
|
|
30
34
|
expect(result.data).toEqual(response);
|
|
31
35
|
});
|
|
32
36
|
it("handles error when fetching chains", async () => {
|
|
33
37
|
mockedAxios.get.mockRejectedValue(new Error("Network Error"));
|
|
34
38
|
await expect(
|
|
35
|
-
getChains({ url, nativeAuthToken: "ZKssadass" })
|
|
39
|
+
getChains({ url, nativeAuthToken: "ZKssadass", bridgeOnly: false })
|
|
36
40
|
).rejects.toThrow("Network Error");
|
|
37
41
|
});
|
|
38
42
|
});
|
package/package.json
CHANGED
|
@@ -653,10 +653,6 @@ const BridgeForm = ({
|
|
|
653
653
|
handleOnChangeSecondAmount(secondTokenAmount);
|
|
654
654
|
}
|
|
655
655
|
}, [secondTokenAmount]);
|
|
656
|
-
console.log("BridgeForm=", {
|
|
657
|
-
nativeAuthToken,
|
|
658
|
-
chains
|
|
659
|
-
});
|
|
660
656
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
661
657
|
"form",
|
|
662
658
|
{
|
|
@@ -650,10 +650,6 @@ const BridgeForm = ({
|
|
|
650
650
|
handleOnChangeSecondAmount(secondTokenAmount);
|
|
651
651
|
}
|
|
652
652
|
}, [secondTokenAmount]);
|
|
653
|
-
console.log("BridgeForm=", {
|
|
654
|
-
nativeAuthToken,
|
|
655
|
-
chains
|
|
656
|
-
});
|
|
657
653
|
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
|
|
658
654
|
"form",
|
|
659
655
|
{
|
|
@@ -63,17 +63,11 @@ const BridgeAccountDisplay = ({
|
|
|
63
63
|
chainId: chainId ? chainId.toString() : "",
|
|
64
64
|
nativeAuthToken
|
|
65
65
|
});
|
|
66
|
-
console.log("ownership", {
|
|
67
|
-
ownership,
|
|
68
|
-
accountAddress: account.address,
|
|
69
|
-
chainId: chainId ? chainId.toString() : ""
|
|
70
|
-
});
|
|
71
66
|
if (!(ownership == null ? void 0 : ownership.isLinked)) {
|
|
72
67
|
try {
|
|
73
68
|
const signature = await signMessage(
|
|
74
69
|
(ownership == null ? void 0 : ownership.signMessage) ?? "Missing message"
|
|
75
70
|
);
|
|
76
|
-
console.log("signature = ", signature);
|
|
77
71
|
await linkAccount({
|
|
78
72
|
nativeAuthToken: nativeAuthToken ?? "",
|
|
79
73
|
body: {
|
|
@@ -60,17 +60,11 @@ const BridgeAccountDisplay = ({
|
|
|
60
60
|
chainId: chainId ? chainId.toString() : "",
|
|
61
61
|
nativeAuthToken
|
|
62
62
|
});
|
|
63
|
-
console.log("ownership", {
|
|
64
|
-
ownership,
|
|
65
|
-
accountAddress: account.address,
|
|
66
|
-
chainId: chainId ? chainId.toString() : ""
|
|
67
|
-
});
|
|
68
63
|
if (!(ownership == null ? void 0 : ownership.isLinked)) {
|
|
69
64
|
try {
|
|
70
65
|
const signature = await signMessage(
|
|
71
66
|
(ownership == null ? void 0 : ownership.signMessage) ?? "Missing message"
|
|
72
67
|
);
|
|
73
|
-
console.log("signature = ", signature);
|
|
74
68
|
await linkAccount({
|
|
75
69
|
nativeAuthToken: nativeAuthToken ?? "",
|
|
76
70
|
body: {
|
|
@@ -6,12 +6,13 @@ const reactjs_context_useWeb3App = require("../context/useWeb3App.js");
|
|
|
6
6
|
const api_getChains = require("../../api/getChains.js");
|
|
7
7
|
const helpers_getApiURL = require("../../helpers/getApiURL.js");
|
|
8
8
|
const useGetChainsQuery = () => {
|
|
9
|
-
const { nativeAuthToken } = reactjs_context_useWeb3App.useWeb3App();
|
|
9
|
+
const { nativeAuthToken, bridgeOnly } = reactjs_context_useWeb3App.useWeb3App();
|
|
10
10
|
const queryFn = async () => {
|
|
11
11
|
try {
|
|
12
12
|
const { data } = await api_getChains.getChains({
|
|
13
13
|
url: helpers_getApiURL.getApiURL(),
|
|
14
|
-
nativeAuthToken
|
|
14
|
+
nativeAuthToken,
|
|
15
|
+
bridgeOnly: Boolean(bridgeOnly)
|
|
15
16
|
});
|
|
16
17
|
return data;
|
|
17
18
|
} catch (error) {
|
|
@@ -3,12 +3,13 @@ import { useWeb3App } from "../context/useWeb3App.mjs";
|
|
|
3
3
|
import { getChains } from "../../api/getChains.mjs";
|
|
4
4
|
import { getApiURL } from "../../helpers/getApiURL.mjs";
|
|
5
5
|
const useGetChainsQuery = () => {
|
|
6
|
-
const { nativeAuthToken } = useWeb3App();
|
|
6
|
+
const { nativeAuthToken, bridgeOnly } = useWeb3App();
|
|
7
7
|
const queryFn = async () => {
|
|
8
8
|
try {
|
|
9
9
|
const { data } = await getChains({
|
|
10
10
|
url: getApiURL(),
|
|
11
|
-
nativeAuthToken
|
|
11
|
+
nativeAuthToken,
|
|
12
|
+
bridgeOnly: Boolean(bridgeOnly)
|
|
12
13
|
});
|
|
13
14
|
return data;
|
|
14
15
|
} catch (error) {
|