@multiversx/sdk-dapp-liquidity 1.1.0-alpha.40 → 1.1.0-alpha.42

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.
@@ -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("/chains", config);
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("/chains", config);
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({ url, nativeAuthToken: "ZKssadass" });
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({ url, nativeAuthToken: "ZKssadass" });
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
@@ -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.40",
31
+ "version": "1.1.0-alpha.42",
32
32
  "main": "index.js",
33
33
  "module": "index.mjs",
34
34
  "types": "index.d.ts",
@@ -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) {