@multiversx/sdk-dapp-liquidity 1.1.2 → 1.1.4

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/index.d.ts CHANGED
@@ -6,4 +6,3 @@ export * from './getTokensBalances';
6
6
  export * from './getTransactions';
7
7
  export * from './sendTransactions';
8
8
  export * from './checkAccount';
9
- export * from './linkAccount';
package/api/index.js CHANGED
@@ -9,7 +9,6 @@ const api_getTokensBalances = require("./getTokensBalances.js");
9
9
  const api_getTransactions = require("./getTransactions.js");
10
10
  const api_sendTransactions = require("./sendTransactions.js");
11
11
  const api_checkAccount = require("./checkAccount.js");
12
- const api_linkAccount = require("./linkAccount.js");
13
12
  exports.confirmRate = api_confirmRate.confirmRate;
14
13
  exports.getChains = api_getChains.getChains;
15
14
  exports.getRate = api_getRate.getRate;
@@ -18,4 +17,3 @@ exports.getTokensBalances = api_getTokensBalances.getTokensBalances;
18
17
  exports.getTransactions = api_getTransactions.getTransactions;
19
18
  exports.sendTransactions = api_sendTransactions.sendTransactions;
20
19
  exports.checkAccount = api_checkAccount.checkAccount;
21
- exports.linkAccount = api_linkAccount.linkAccount;
package/api/index.mjs CHANGED
@@ -6,7 +6,6 @@ import { getTokensBalances } from "./getTokensBalances.mjs";
6
6
  import { getTransactions } from "./getTransactions.mjs";
7
7
  import { sendTransactions } from "./sendTransactions.mjs";
8
8
  import { checkAccount } from "./checkAccount.mjs";
9
- import { linkAccount } from "./linkAccount.mjs";
10
9
  export {
11
10
  checkAccount,
12
11
  confirmRate,
@@ -15,6 +14,5 @@ export {
15
14
  getTokens,
16
15
  getTokensBalances,
17
16
  getTransactions,
18
- linkAccount,
19
17
  sendTransactions
20
18
  };
package/index.js CHANGED
@@ -9,7 +9,6 @@ const api_getTokensBalances = require("./api/getTokensBalances.js");
9
9
  const api_getTransactions = require("./api/getTransactions.js");
10
10
  const api_sendTransactions = require("./api/sendTransactions.js");
11
11
  const api_checkAccount = require("./api/checkAccount.js");
12
- const api_linkAccount = require("./api/linkAccount.js");
13
12
  const constants_index = require("./constants/index.js");
14
13
  const helpers_base64Utils = require("./helpers/base64Utils.js");
15
14
  const helpers_decodeLoginToken = require("./helpers/decodeLoginToken.js");
@@ -94,7 +93,6 @@ exports.getTokensBalances = api_getTokensBalances.getTokensBalances;
94
93
  exports.getTransactions = api_getTransactions.getTransactions;
95
94
  exports.sendTransactions = api_sendTransactions.sendTransactions;
96
95
  exports.checkAccount = api_checkAccount.checkAccount;
97
- exports.linkAccount = api_linkAccount.linkAccount;
98
96
  exports.MVX_CHAIN_IDS = constants_index.MVX_CHAIN_IDS;
99
97
  exports.decodeBase64 = helpers_base64Utils.decodeBase64;
100
98
  exports.encodeToBase64 = helpers_base64Utils.encodeToBase64;
package/index.mjs CHANGED
@@ -6,7 +6,6 @@ import { getTokensBalances } from "./api/getTokensBalances.mjs";
6
6
  import { getTransactions } from "./api/getTransactions.mjs";
7
7
  import { sendTransactions } from "./api/sendTransactions.mjs";
8
8
  import { checkAccount } from "./api/checkAccount.mjs";
9
- import { linkAccount } from "./api/linkAccount.mjs";
10
9
  import { MVX_CHAIN_IDS } from "./constants/index.mjs";
11
10
  import { decodeBase64, encodeToBase64, isStringBase64 } from "./helpers/base64Utils.mjs";
12
11
  import { decodeLoginToken } from "./helpers/decodeLoginToken.mjs";
@@ -145,7 +144,6 @@ export {
145
144
  invalidateMvxTokensBalancesQuery,
146
145
  isStringBase64,
147
146
  isStringFloat,
148
- linkAccount,
149
147
  mxClsx,
150
148
  pipe,
151
149
  removeCommas,
package/package.json CHANGED
@@ -28,18 +28,18 @@
28
28
  },
29
29
  "homepage": "https://github.com/multiversx/mx-sdk-dapp-liquidity#readme",
30
30
  "license": "MIT",
31
- "version": "1.1.2",
31
+ "version": "1.1.4",
32
32
  "main": "index.js",
33
33
  "module": "index.mjs",
34
34
  "types": "index.d.ts",
35
35
  "scripts": {
36
36
  "build": "rimraf dist && vite build && cp package.json dist && cp README.md dist",
37
- "build-dev": "yarn build && sh copy-dist.sh",
37
+ "build-dev": "pnpm build && sh copy-dist.sh",
38
38
  "build:watch": "tsc && vite build --watch",
39
- "publish-package": "yarn build && cd dist && npm publish",
40
- "publish-package-next": "yarn build && cd dist && npm publish --tag next",
41
- "publish-yalc": "yarn build && cd dist && yalc publish --push",
42
- "publish-verdaccio": "yarn run build && cd dist && npm publish --registry http://localhost:4873/",
39
+ "publish-package": "pnpm build && cd dist && npm publish",
40
+ "publish-package-next": "pnpm build && cd dist && npm publish --tag next",
41
+ "publish-yalc": "pnpm build && cd dist && yalc publish --push",
42
+ "publish-verdaccio": "pnpm build && cd dist && npm publish --registry http://localhost:4873/",
43
43
  "start": "vite",
44
44
  "test": "jest",
45
45
  "lint": "eslint src --ext .ts,.js"
@@ -53,11 +53,11 @@
53
53
  "@headlessui/react": "2.2.0",
54
54
  "@multiversx/sdk-dapp-utils": "3.0.2",
55
55
  "@popperjs/core": "2.11.8",
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",
56
+ "@reown/appkit": "1.8.14",
57
+ "@reown/appkit-common": "1.8.14",
58
+ "@reown/appkit-adapter-bitcoin": "1.8.14",
59
+ "@reown/appkit-adapter-solana": "1.8.14",
60
+ "@reown/appkit-adapter-wagmi": "1.8.14",
61
61
  "@solana/web3.js": "1.98.4",
62
62
  "@tanstack/react-query": "5.71.3",
63
63
  "animated-number-react": "0.1.2",
@@ -71,8 +71,8 @@
71
71
  "react-select": "5.10.0",
72
72
  "react-toastify": "11.0.3",
73
73
  "tailwind-merge": "2.6.0",
74
- "viem": "^2.24.1",
75
- "wagmi": "^2.14.15",
74
+ "viem": "2.39.3",
75
+ "wagmi": "2.19.5",
76
76
  "yup": "1.4.0"
77
77
  },
78
78
  "peerDependencies": {
@@ -5,26 +5,9 @@ const jsxRuntime = require("react/jsx-runtime");
5
5
  const faPowerOff = require("@fortawesome/free-solid-svg-icons/faPowerOff");
6
6
  const reactFontawesome = require("@fortawesome/react-fontawesome");
7
7
  const react = require("@reown/appkit/react");
8
- const React = require("react");
9
- const api_checkAccount = require("../../../api/checkAccount.js");
10
8
  const helpers_getDisplayName = require("../../../helpers/getDisplayName.js");
11
9
  const reactjs_components_Connect_SwitchChainButton = require("./SwitchChainButton.js");
12
- const helpers_getApiURL = require("../../../helpers/getApiURL.js");
13
- const reactjs_context_useWeb3App = require("../../context/useWeb3App.js");
14
- require("yup");
15
- require("@multiversx/sdk-dapp-utils/out/helpers/parseAmount");
16
- require("bignumber.js");
17
10
  const reactjs_hooks_useAccount = require("../../hooks/useAccount.js");
18
- require("axios");
19
- require("formik");
20
- require("@tanstack/react-query");
21
- const reactjs_hooks_useGetChainId = require("../../hooks/useGetChainId.js");
22
- require("../../constants/index.js");
23
- require("@reown/appkit-adapter-solana/react");
24
- require("@solana/web3.js");
25
- require("wagmi");
26
- const reactjs_hooks_useGenericSignMessage = require("../../hooks/useGenericSignMessage.js");
27
- const reactjs_queries_useLinkAccount_mutation = require("../../queries/useLinkAccount.mutation.js");
28
11
  require("clsx");
29
12
  require("tailwind-merge");
30
13
  require("../base/MxCard/MxCard.js");
@@ -32,9 +15,11 @@ const reactjs_components_base_MxLink_MxLink = require("../base/MxLink/MxLink.js"
32
15
  require("../base/MxSearch/MxSearch.js");
33
16
  require("@fortawesome/free-solid-svg-icons/faClose");
34
17
  require("@headlessui/react");
18
+ require("react");
35
19
  require("react-dom");
36
20
  require("react-popper");
37
21
  require("../base/MxTooltip/components/TooltipContainer/TooltipContainer.js");
22
+ require("../../constants/index.js");
38
23
  const reactjs_components_CopyButton_CopyButton = require("../CopyButton/CopyButton.js");
39
24
  const reactjs_components_TrimAddress_TrimAddress = require("../TrimAddress/TrimAddress.js");
40
25
  const BridgeAccountDisplay = ({
@@ -44,10 +29,6 @@ const BridgeAccountDisplay = ({
44
29
  var _a;
45
30
  const account = reactjs_hooks_useAccount.useAccount();
46
31
  const { disconnect } = react.useDisconnect();
47
- const chainId = reactjs_hooks_useGetChainId.useGetChainId();
48
- const { signMessage } = reactjs_hooks_useGenericSignMessage.useGenericSignMessage();
49
- const { nativeAuthToken } = reactjs_context_useWeb3App.useWeb3App();
50
- const { mutateAsync: linkAccount } = reactjs_queries_useLinkAccount_mutation.useLinkAccountMutation();
51
32
  const handleDisconnect = async (e) => {
52
33
  try {
53
34
  e.preventDefault();
@@ -56,42 +37,6 @@ const BridgeAccountDisplay = ({
56
37
  console.error("Failed to disconnect:", error);
57
38
  }
58
39
  };
59
- const validateOwnership = React.useCallback(async () => {
60
- if (account.address && chainId) {
61
- try {
62
- const { data: ownership } = await api_checkAccount.checkAccount({
63
- url: helpers_getApiURL.getApiURL(),
64
- walletAddress: account.address,
65
- chainId: chainId ? chainId.toString() : "",
66
- nativeAuthToken
67
- });
68
- if (!(ownership == null ? void 0 : ownership.isLinked)) {
69
- try {
70
- const signature = await signMessage(
71
- (ownership == null ? void 0 : ownership.signMessage) ?? "Missing message"
72
- );
73
- await linkAccount({
74
- nativeAuthToken: nativeAuthToken ?? "",
75
- body: {
76
- chainId: chainId ? chainId.toString() : "",
77
- address: account.address,
78
- signature,
79
- message: (ownership == null ? void 0 : ownership.signMessage) ?? ""
80
- }
81
- });
82
- } catch (error) {
83
- console.error("Failed to link account:", error);
84
- }
85
- }
86
- } catch (error) {
87
- console.error("Failed to check account:", error);
88
- return;
89
- }
90
- }
91
- }, [account.address, chainId, nativeAuthToken]);
92
- React.useEffect(() => {
93
- validateOwnership();
94
- }, [account.address]);
95
40
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
96
41
  account.address && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
97
42
  /* @__PURE__ */ jsxRuntime.jsx("img", { src: activeChain == null ? void 0 : activeChain.pngUrl, alt: "", className: "liq-w-6" }),
@@ -2,26 +2,9 @@ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
2
  import { faPowerOff } from "@fortawesome/free-solid-svg-icons/faPowerOff";
3
3
  import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
4
4
  import { useDisconnect } from "@reown/appkit/react";
5
- import { useCallback, useEffect } from "react";
6
- import { checkAccount } from "../../../api/checkAccount.mjs";
7
5
  import { getDisplayName } from "../../../helpers/getDisplayName.mjs";
8
6
  import { SwitchChainButton } from "./SwitchChainButton.mjs";
9
- import { getApiURL } from "../../../helpers/getApiURL.mjs";
10
- import { useWeb3App } from "../../context/useWeb3App.mjs";
11
- import "yup";
12
- import "@multiversx/sdk-dapp-utils/out/helpers/parseAmount";
13
- import "bignumber.js";
14
7
  import { useAccount } from "../../hooks/useAccount.mjs";
15
- import "axios";
16
- import "formik";
17
- import "@tanstack/react-query";
18
- import { useGetChainId } from "../../hooks/useGetChainId.mjs";
19
- import "../../constants/index.mjs";
20
- import "@reown/appkit-adapter-solana/react";
21
- import "@solana/web3.js";
22
- import "wagmi";
23
- import { useGenericSignMessage } from "../../hooks/useGenericSignMessage.mjs";
24
- import { useLinkAccountMutation } from "../../queries/useLinkAccount.mutation.mjs";
25
8
  import "clsx";
26
9
  import "tailwind-merge";
27
10
  import "../base/MxCard/MxCard.mjs";
@@ -29,9 +12,11 @@ import { MxLink } from "../base/MxLink/MxLink.mjs";
29
12
  import "../base/MxSearch/MxSearch.mjs";
30
13
  import "@fortawesome/free-solid-svg-icons/faClose";
31
14
  import "@headlessui/react";
15
+ import "react";
32
16
  import "react-dom";
33
17
  import "react-popper";
34
18
  import "../base/MxTooltip/components/TooltipContainer/TooltipContainer.mjs";
19
+ import "../../constants/index.mjs";
35
20
  import { CopyButton } from "../CopyButton/CopyButton.mjs";
36
21
  import { TrimAddress } from "../TrimAddress/TrimAddress.mjs";
37
22
  const BridgeAccountDisplay = ({
@@ -41,10 +26,6 @@ const BridgeAccountDisplay = ({
41
26
  var _a;
42
27
  const account = useAccount();
43
28
  const { disconnect } = useDisconnect();
44
- const chainId = useGetChainId();
45
- const { signMessage } = useGenericSignMessage();
46
- const { nativeAuthToken } = useWeb3App();
47
- const { mutateAsync: linkAccount } = useLinkAccountMutation();
48
29
  const handleDisconnect = async (e) => {
49
30
  try {
50
31
  e.preventDefault();
@@ -53,42 +34,6 @@ const BridgeAccountDisplay = ({
53
34
  console.error("Failed to disconnect:", error);
54
35
  }
55
36
  };
56
- const validateOwnership = useCallback(async () => {
57
- if (account.address && chainId) {
58
- try {
59
- const { data: ownership } = await checkAccount({
60
- url: getApiURL(),
61
- walletAddress: account.address,
62
- chainId: chainId ? chainId.toString() : "",
63
- nativeAuthToken
64
- });
65
- if (!(ownership == null ? void 0 : ownership.isLinked)) {
66
- try {
67
- const signature = await signMessage(
68
- (ownership == null ? void 0 : ownership.signMessage) ?? "Missing message"
69
- );
70
- await linkAccount({
71
- nativeAuthToken: nativeAuthToken ?? "",
72
- body: {
73
- chainId: chainId ? chainId.toString() : "",
74
- address: account.address,
75
- signature,
76
- message: (ownership == null ? void 0 : ownership.signMessage) ?? ""
77
- }
78
- });
79
- } catch (error) {
80
- console.error("Failed to link account:", error);
81
- }
82
- }
83
- } catch (error) {
84
- console.error("Failed to check account:", error);
85
- return;
86
- }
87
- }
88
- }, [account.address, chainId, nativeAuthToken]);
89
- useEffect(() => {
90
- validateOwnership();
91
- }, [account.address]);
92
37
  return /* @__PURE__ */ jsxs(Fragment, { children: [
93
38
  account.address && /* @__PURE__ */ jsxs(Fragment, { children: [
94
39
  /* @__PURE__ */ jsx("img", { src: activeChain == null ? void 0 : activeChain.pngUrl, alt: "", className: "liq-w-6" }),
@@ -1,10 +0,0 @@
1
- import { LinkAccountRequestBody } from '../types/linkAccount';
2
- import { AxiosResponse } from 'axios';
3
-
4
- interface LinkAccountProps {
5
- url: string;
6
- nativeAuthToken: string;
7
- body: LinkAccountRequestBody;
8
- }
9
- export declare function linkAccount({ url, nativeAuthToken, body }: LinkAccountProps): Promise<AxiosResponse>;
10
- export {};
@@ -1,32 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
- const axios = require("axios");
5
- const helpers_decodeToken = require("../helpers/decodeToken.js");
6
- async function linkAccount({
7
- url,
8
- nativeAuthToken,
9
- body
10
- }) {
11
- var _a;
12
- const config = {
13
- baseURL: url,
14
- headers: {
15
- Authorization: `Bearer ${nativeAuthToken}`
16
- }
17
- };
18
- if (!nativeAuthToken) {
19
- (_a = config.headers) == null ? true : delete _a.Authorization;
20
- }
21
- const decodedToken = await helpers_decodeToken.decodeToken(nativeAuthToken);
22
- config.headers = {
23
- ...config.headers,
24
- origin: decodedToken == null ? void 0 : decodedToken.origin
25
- };
26
- return await axios.post(
27
- `/user/linkAccount`,
28
- body,
29
- config
30
- );
31
- }
32
- exports.linkAccount = linkAccount;
@@ -1,31 +0,0 @@
1
- import axios from "axios";
2
- import { decodeToken } from "../helpers/decodeToken.mjs";
3
- async function linkAccount({
4
- url,
5
- nativeAuthToken,
6
- body
7
- }) {
8
- var _a;
9
- const config = {
10
- baseURL: url,
11
- headers: {
12
- Authorization: `Bearer ${nativeAuthToken}`
13
- }
14
- };
15
- if (!nativeAuthToken) {
16
- (_a = config.headers) == null ? true : delete _a.Authorization;
17
- }
18
- const decodedToken = await decodeToken(nativeAuthToken);
19
- config.headers = {
20
- ...config.headers,
21
- origin: decodedToken == null ? void 0 : decodedToken.origin
22
- };
23
- return await axios.post(
24
- `/user/linkAccount`,
25
- body,
26
- config
27
- );
28
- }
29
- export {
30
- linkAccount
31
- };
@@ -1,6 +0,0 @@
1
- import { LinkAccountRequestBody } from '../../types/linkAccount';
2
-
3
- export declare const useLinkAccountMutation: () => import('@tanstack/react-query').UseMutationResult<any, Error, {
4
- nativeAuthToken: string;
5
- body: LinkAccountRequestBody;
6
- }, unknown>;
@@ -1,19 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
- const reactQuery = require("@tanstack/react-query");
5
- const api_linkAccount = require("../../api/linkAccount.js");
6
- const helpers_getApiURL = require("../../helpers/getApiURL.js");
7
- const useLinkAccountMutation = () => {
8
- const mutationFn = async (params) => {
9
- const { data } = await api_linkAccount.linkAccount({
10
- url: helpers_getApiURL.getApiURL(),
11
- ...params
12
- });
13
- return data;
14
- };
15
- return reactQuery.useMutation({
16
- mutationFn
17
- });
18
- };
19
- exports.useLinkAccountMutation = useLinkAccountMutation;
@@ -1,18 +0,0 @@
1
- import { useMutation } from "@tanstack/react-query";
2
- import { linkAccount } from "../../api/linkAccount.mjs";
3
- import { getApiURL } from "../../helpers/getApiURL.mjs";
4
- const useLinkAccountMutation = () => {
5
- const mutationFn = async (params) => {
6
- const { data } = await linkAccount({
7
- url: getApiURL(),
8
- ...params
9
- });
10
- return data;
11
- };
12
- return useMutation({
13
- mutationFn
14
- });
15
- };
16
- export {
17
- useLinkAccountMutation
18
- };
@@ -1,6 +0,0 @@
1
- export interface LinkAccountRequestBody {
2
- address: string;
3
- chainId: string;
4
- signature: string;
5
- message: string;
6
- }
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
@@ -1 +0,0 @@
1
-