@multiversx/sdk-dapp-liquidity 1.1.0-alpha.33 → 1.1.0-alpha.35
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/checkAccount.d.ts +9 -0
- package/api/checkAccount.js +22 -0
- package/api/checkAccount.mjs +21 -0
- package/api/getChains.d.ts +2 -1
- package/api/getChains.js +9 -4
- package/api/getChains.mjs +9 -4
- package/api/getTokens.d.ts +2 -1
- package/api/getTokens.js +9 -4
- package/api/getTokens.mjs +9 -4
- package/api/getTokensBalances.d.ts +2 -1
- package/api/getTokensBalances.js +9 -4
- package/api/getTokensBalances.mjs +9 -4
- package/api/getTransactions.d.ts +2 -1
- package/api/getTransactions.js +9 -4
- package/api/getTransactions.mjs +9 -4
- package/api/index.d.ts +2 -0
- package/api/index.js +4 -0
- package/api/index.mjs +4 -0
- package/api/linkAccount.d.ts +10 -0
- package/api/linkAccount.js +32 -0
- package/api/linkAccount.mjs +31 -0
- package/api/tests/getChains.spec.js +4 -2
- package/api/tests/getChains.spec.mjs +4 -2
- package/dto/CheckAccount.dto.d.ts +4 -0
- package/dto/CheckAccount.dto.js +2 -0
- package/dto/CheckAccount.dto.mjs +1 -0
- package/index.js +5 -1
- package/index.mjs +5 -1
- package/package.json +1 -1
- package/reactjs/components/BridgeForm/BridgeForm.js +20 -6
- package/reactjs/components/BridgeForm/BridgeForm.mjs +20 -6
- package/reactjs/components/BridgeHistory/BridgeHistory.d.ts +2 -1
- package/reactjs/components/BridgeHistory/BridgeHistory.js +3 -1
- package/reactjs/components/BridgeHistory/BridgeHistory.mjs +3 -1
- package/reactjs/components/Connect/BridgeAccountDisplay.d.ts +2 -1
- package/reactjs/components/Connect/BridgeAccountDisplay.js +63 -2
- package/reactjs/components/Connect/BridgeAccountDisplay.mjs +63 -2
- package/reactjs/components/TokenSelector/TokenSelector.d.ts +2 -1
- package/reactjs/components/TokenSelector/TokenSelector.js +7 -3
- package/reactjs/components/TokenSelector/TokenSelector.mjs +7 -3
- package/reactjs/components/TokenSelector/components/TokenItem.d.ts +2 -1
- package/reactjs/components/TokenSelector/components/TokenItem.js +4 -2
- package/reactjs/components/TokenSelector/components/TokenItem.mjs +4 -2
- package/reactjs/hooks/index.js +1 -1
- package/reactjs/hooks/index.mjs +1 -1
- package/reactjs/hooks/useBalances.d.ts +3 -1
- package/reactjs/hooks/useBalances.js +1 -1
- package/reactjs/hooks/useBalances.mjs +1 -1
- package/reactjs/hooks/useFetchBridgeData.d.ts +2 -1
- package/reactjs/hooks/useFetchBridgeData.js +7 -3
- package/reactjs/hooks/useFetchBridgeData.mjs +7 -3
- package/reactjs/hooks/useFetchTokens.d.ts +2 -1
- package/reactjs/hooks/useFetchTokens.js +7 -3
- package/reactjs/hooks/useFetchTokens.mjs +7 -3
- package/reactjs/hooks/useFiatData.d.ts +2 -1
- package/reactjs/hooks/useFiatData.js +5 -2
- package/reactjs/hooks/useFiatData.mjs +5 -2
- package/reactjs/hooks/useGenericSignMessage.d.ts +3 -0
- package/reactjs/hooks/useGenericSignMessage.js +42 -0
- package/reactjs/hooks/useGenericSignMessage.mjs +41 -0
- package/reactjs/hooks/useResolveTokenChain.d.ts +2 -1
- package/reactjs/hooks/useResolveTokenChain.js +7 -2
- package/reactjs/hooks/useResolveTokenChain.mjs +7 -2
- package/reactjs/index.js +1 -1
- package/reactjs/index.mjs +1 -1
- package/reactjs/queries/useCheckAccount.query.d.ts +5 -0
- package/reactjs/queries/useCheckAccount.query.js +51 -0
- package/reactjs/queries/useCheckAccount.query.mjs +50 -0
- package/reactjs/queries/useGetAllTokens.query.d.ts +3 -1
- package/reactjs/queries/useGetAllTokens.query.js +5 -2
- package/reactjs/queries/useGetAllTokens.query.mjs +5 -2
- package/reactjs/queries/useGetChains.query.d.ts +3 -1
- package/reactjs/queries/useGetChains.query.js +5 -2
- package/reactjs/queries/useGetChains.query.mjs +5 -2
- package/reactjs/queries/useGetEvmTokensBalances.query.d.ts +2 -1
- package/reactjs/queries/useGetEvmTokensBalances.query.js +4 -3
- package/reactjs/queries/useGetEvmTokensBalances.query.mjs +4 -3
- package/reactjs/queries/useGetHistory.query.d.ts +2 -1
- package/reactjs/queries/useGetHistory.query.js +4 -2
- package/reactjs/queries/useGetHistory.query.mjs +4 -2
- package/reactjs/queries/useGetMvxTokensBalances.query.d.ts +2 -1
- package/reactjs/queries/useGetMvxTokensBalances.query.js +9 -4
- package/reactjs/queries/useGetMvxTokensBalances.query.mjs +9 -4
- package/reactjs/queries/useLinkAccount.mutation.d.ts +6 -0
- package/reactjs/queries/useLinkAccount.mutation.js +19 -0
- package/reactjs/queries/useLinkAccount.mutation.mjs +18 -0
- package/types/linkAccount.d.ts +6 -0
- package/types/linkAccount.js +2 -0
- package/types/linkAccount.mjs +1 -0
- package/{useBalances-BWufkhuy.mjs → useBalances-84Wb5V4N.mjs} +12 -4
- package/{useBalances-BwQplEkY.js → useBalances-BrSgRL7R.js} +12 -4
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CheckAccountDto } from '../dto/CheckAccount.dto';
|
|
2
|
+
import { AxiosResponse } from 'axios';
|
|
3
|
+
|
|
4
|
+
export declare function checkAccount({ url, walletAddress, chainId, nativeAuthToken }: {
|
|
5
|
+
url: string;
|
|
6
|
+
walletAddress: string;
|
|
7
|
+
chainId: string;
|
|
8
|
+
nativeAuthToken?: string;
|
|
9
|
+
}): Promise<AxiosResponse<CheckAccountDto>>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
+
const axios = require("axios");
|
|
5
|
+
async function checkAccount({
|
|
6
|
+
url,
|
|
7
|
+
walletAddress,
|
|
8
|
+
chainId,
|
|
9
|
+
nativeAuthToken
|
|
10
|
+
}) {
|
|
11
|
+
const config = {
|
|
12
|
+
baseURL: url,
|
|
13
|
+
headers: {
|
|
14
|
+
Authorization: `Bearer ${nativeAuthToken}`
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
return await axios.get(
|
|
18
|
+
`/user/checkAccount?walletAddress=${walletAddress}&chainId=${chainId}`,
|
|
19
|
+
config
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
exports.checkAccount = checkAccount;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
async function checkAccount({
|
|
3
|
+
url,
|
|
4
|
+
walletAddress,
|
|
5
|
+
chainId,
|
|
6
|
+
nativeAuthToken
|
|
7
|
+
}) {
|
|
8
|
+
const config = {
|
|
9
|
+
baseURL: url,
|
|
10
|
+
headers: {
|
|
11
|
+
Authorization: `Bearer ${nativeAuthToken}`
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
return await axios.get(
|
|
15
|
+
`/user/checkAccount?walletAddress=${walletAddress}&chainId=${chainId}`,
|
|
16
|
+
config
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
checkAccount
|
|
21
|
+
};
|
package/api/getChains.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ChainDTO } from '../dto/Chain.dto';
|
|
2
2
|
import { AxiosResponse } from 'axios';
|
|
3
3
|
|
|
4
|
-
export declare function getChains({ url }: {
|
|
4
|
+
export declare function getChains({ url, nativeAuthToken }: {
|
|
5
5
|
url: string;
|
|
6
|
+
nativeAuthToken?: string;
|
|
6
7
|
}): Promise<AxiosResponse<ChainDTO[]>>;
|
package/api/getChains.js
CHANGED
|
@@ -3,10 +3,15 @@
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
4
|
const axios = require("axios");
|
|
5
5
|
async function getChains({
|
|
6
|
-
url
|
|
6
|
+
url,
|
|
7
|
+
nativeAuthToken
|
|
7
8
|
}) {
|
|
8
|
-
|
|
9
|
-
baseURL: url
|
|
10
|
-
|
|
9
|
+
const config = {
|
|
10
|
+
baseURL: url,
|
|
11
|
+
headers: {
|
|
12
|
+
Authorization: `Bearer ${nativeAuthToken}`
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
return await axios.get("/chains", config);
|
|
11
16
|
}
|
|
12
17
|
exports.getChains = getChains;
|
package/api/getChains.mjs
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
2
|
async function getChains({
|
|
3
|
-
url
|
|
3
|
+
url,
|
|
4
|
+
nativeAuthToken
|
|
4
5
|
}) {
|
|
5
|
-
|
|
6
|
-
baseURL: url
|
|
7
|
-
|
|
6
|
+
const config = {
|
|
7
|
+
baseURL: url,
|
|
8
|
+
headers: {
|
|
9
|
+
Authorization: `Bearer ${nativeAuthToken}`
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
return await axios.get("/chains", config);
|
|
8
13
|
}
|
|
9
14
|
export {
|
|
10
15
|
getChains
|
package/api/getTokens.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { TokenType } from '../types/token';
|
|
2
2
|
import { AxiosResponse } from 'axios';
|
|
3
3
|
|
|
4
|
-
export declare function getTokens({ url, chainId }: {
|
|
4
|
+
export declare function getTokens({ url, chainId, nativeAuthToken }: {
|
|
5
5
|
url: string;
|
|
6
6
|
chainId?: number;
|
|
7
|
+
nativeAuthToken?: string;
|
|
7
8
|
}): Promise<AxiosResponse<TokenType[]>>;
|
package/api/getTokens.js
CHANGED
|
@@ -4,11 +4,16 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
4
4
|
const axios = require("axios");
|
|
5
5
|
async function getTokens({
|
|
6
6
|
url,
|
|
7
|
-
chainId
|
|
7
|
+
chainId,
|
|
8
|
+
nativeAuthToken
|
|
8
9
|
}) {
|
|
10
|
+
const config = {
|
|
11
|
+
baseURL: url,
|
|
12
|
+
headers: {
|
|
13
|
+
Authorization: `Bearer ${nativeAuthToken}`
|
|
14
|
+
}
|
|
15
|
+
};
|
|
9
16
|
const endpoint = chainId ? `/tokens/${chainId}` : "/tokens";
|
|
10
|
-
return await axios.get(endpoint,
|
|
11
|
-
baseURL: url
|
|
12
|
-
});
|
|
17
|
+
return await axios.get(endpoint, config);
|
|
13
18
|
}
|
|
14
19
|
exports.getTokens = getTokens;
|
package/api/getTokens.mjs
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
2
|
async function getTokens({
|
|
3
3
|
url,
|
|
4
|
-
chainId
|
|
4
|
+
chainId,
|
|
5
|
+
nativeAuthToken
|
|
5
6
|
}) {
|
|
7
|
+
const config = {
|
|
8
|
+
baseURL: url,
|
|
9
|
+
headers: {
|
|
10
|
+
Authorization: `Bearer ${nativeAuthToken}`
|
|
11
|
+
}
|
|
12
|
+
};
|
|
6
13
|
const endpoint = chainId ? `/tokens/${chainId}` : "/tokens";
|
|
7
|
-
return await axios.get(endpoint,
|
|
8
|
-
baseURL: url
|
|
9
|
-
});
|
|
14
|
+
return await axios.get(endpoint, config);
|
|
10
15
|
}
|
|
11
16
|
export {
|
|
12
17
|
getTokens
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { TokenBalanceDTO } from '../dto/TokenBalance.dto';
|
|
2
2
|
import { AxiosResponse } from 'axios';
|
|
3
3
|
|
|
4
|
-
export declare function getTokensBalances({ url, userAddress, chainId }: {
|
|
4
|
+
export declare function getTokensBalances({ url, userAddress, chainId, nativeAuthToken }: {
|
|
5
5
|
url: string;
|
|
6
6
|
userAddress: string;
|
|
7
7
|
chainId: string;
|
|
8
|
+
nativeAuthToken?: string;
|
|
8
9
|
}): Promise<AxiosResponse<TokenBalanceDTO[]>>;
|
package/api/getTokensBalances.js
CHANGED
|
@@ -5,13 +5,18 @@ const axios = require("axios");
|
|
|
5
5
|
async function getTokensBalances({
|
|
6
6
|
url,
|
|
7
7
|
userAddress,
|
|
8
|
-
chainId
|
|
8
|
+
chainId,
|
|
9
|
+
nativeAuthToken
|
|
9
10
|
}) {
|
|
11
|
+
const config = {
|
|
12
|
+
baseURL: url,
|
|
13
|
+
headers: {
|
|
14
|
+
Authorization: `Bearer ${nativeAuthToken}`
|
|
15
|
+
}
|
|
16
|
+
};
|
|
10
17
|
return await axios.get(
|
|
11
18
|
`/tokens/balances/${userAddress}/${chainId}`,
|
|
12
|
-
|
|
13
|
-
baseURL: url
|
|
14
|
-
}
|
|
19
|
+
config
|
|
15
20
|
);
|
|
16
21
|
}
|
|
17
22
|
exports.getTokensBalances = getTokensBalances;
|
|
@@ -2,13 +2,18 @@ import axios from "axios";
|
|
|
2
2
|
async function getTokensBalances({
|
|
3
3
|
url,
|
|
4
4
|
userAddress,
|
|
5
|
-
chainId
|
|
5
|
+
chainId,
|
|
6
|
+
nativeAuthToken
|
|
6
7
|
}) {
|
|
8
|
+
const config = {
|
|
9
|
+
baseURL: url,
|
|
10
|
+
headers: {
|
|
11
|
+
Authorization: `Bearer ${nativeAuthToken}`
|
|
12
|
+
}
|
|
13
|
+
};
|
|
7
14
|
return await axios.get(
|
|
8
15
|
`/tokens/balances/${userAddress}/${chainId}`,
|
|
9
|
-
|
|
10
|
-
baseURL: url
|
|
11
|
-
}
|
|
16
|
+
config
|
|
12
17
|
);
|
|
13
18
|
}
|
|
14
19
|
export {
|
package/api/getTransactions.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { ProviderType } from 'types/providerType';
|
|
|
2
2
|
import { TransactionDTO } from 'dto/Transaction.dto';
|
|
3
3
|
import { AxiosResponse } from 'axios';
|
|
4
4
|
|
|
5
|
-
export declare function getTransactions({ url, address, sender, provider, status, tokenIn, tokenOut }: {
|
|
5
|
+
export declare function getTransactions({ url, address, sender, provider, status, tokenIn, tokenOut, nativeAuthToken }: {
|
|
6
6
|
url: string;
|
|
7
7
|
address: string;
|
|
8
8
|
sender?: string;
|
|
@@ -10,4 +10,5 @@ export declare function getTransactions({ url, address, sender, provider, status
|
|
|
10
10
|
status?: string;
|
|
11
11
|
tokenIn?: string;
|
|
12
12
|
tokenOut?: string;
|
|
13
|
+
nativeAuthToken?: string;
|
|
13
14
|
}): Promise<AxiosResponse<TransactionDTO[]>>;
|
package/api/getTransactions.js
CHANGED
|
@@ -9,7 +9,8 @@ async function getTransactions({
|
|
|
9
9
|
provider,
|
|
10
10
|
status,
|
|
11
11
|
tokenIn,
|
|
12
|
-
tokenOut
|
|
12
|
+
tokenOut,
|
|
13
|
+
nativeAuthToken
|
|
13
14
|
}) {
|
|
14
15
|
const queryParams = new URLSearchParams({
|
|
15
16
|
receiver: address || "",
|
|
@@ -27,8 +28,12 @@ async function getTransactions({
|
|
|
27
28
|
}
|
|
28
29
|
const queryString = queryParams.toString();
|
|
29
30
|
const endpointWithParams = `/transactions?${queryString}`;
|
|
30
|
-
|
|
31
|
-
baseURL: url
|
|
32
|
-
|
|
31
|
+
const config = {
|
|
32
|
+
baseURL: url,
|
|
33
|
+
headers: {
|
|
34
|
+
Authorization: `Bearer ${nativeAuthToken}`
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
return await axios.get(endpointWithParams, config);
|
|
33
38
|
}
|
|
34
39
|
exports.getTransactions = getTransactions;
|
package/api/getTransactions.mjs
CHANGED
|
@@ -6,7 +6,8 @@ async function getTransactions({
|
|
|
6
6
|
provider,
|
|
7
7
|
status,
|
|
8
8
|
tokenIn,
|
|
9
|
-
tokenOut
|
|
9
|
+
tokenOut,
|
|
10
|
+
nativeAuthToken
|
|
10
11
|
}) {
|
|
11
12
|
const queryParams = new URLSearchParams({
|
|
12
13
|
receiver: address || "",
|
|
@@ -24,9 +25,13 @@ async function getTransactions({
|
|
|
24
25
|
}
|
|
25
26
|
const queryString = queryParams.toString();
|
|
26
27
|
const endpointWithParams = `/transactions?${queryString}`;
|
|
27
|
-
|
|
28
|
-
baseURL: url
|
|
29
|
-
|
|
28
|
+
const config = {
|
|
29
|
+
baseURL: url,
|
|
30
|
+
headers: {
|
|
31
|
+
Authorization: `Bearer ${nativeAuthToken}`
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
return await axios.get(endpointWithParams, config);
|
|
30
35
|
}
|
|
31
36
|
export {
|
|
32
37
|
getTransactions
|
package/api/index.d.ts
CHANGED
package/api/index.js
CHANGED
|
@@ -8,6 +8,8 @@ const api_getTokens = require("./getTokens.js");
|
|
|
8
8
|
const api_getTokensBalances = require("./getTokensBalances.js");
|
|
9
9
|
const api_getTransactions = require("./getTransactions.js");
|
|
10
10
|
const api_sendTransactions = require("./sendTransactions.js");
|
|
11
|
+
const api_checkAccount = require("./checkAccount.js");
|
|
12
|
+
const api_linkAccount = require("./linkAccount.js");
|
|
11
13
|
exports.confirmRate = api_confirmRate.confirmRate;
|
|
12
14
|
exports.getChains = api_getChains.getChains;
|
|
13
15
|
exports.getRate = api_getRate.getRate;
|
|
@@ -15,3 +17,5 @@ exports.getTokens = api_getTokens.getTokens;
|
|
|
15
17
|
exports.getTokensBalances = api_getTokensBalances.getTokensBalances;
|
|
16
18
|
exports.getTransactions = api_getTransactions.getTransactions;
|
|
17
19
|
exports.sendTransactions = api_sendTransactions.sendTransactions;
|
|
20
|
+
exports.checkAccount = api_checkAccount.checkAccount;
|
|
21
|
+
exports.linkAccount = api_linkAccount.linkAccount;
|
package/api/index.mjs
CHANGED
|
@@ -5,12 +5,16 @@ import { getTokens } from "./getTokens.mjs";
|
|
|
5
5
|
import { getTokensBalances } from "./getTokensBalances.mjs";
|
|
6
6
|
import { getTransactions } from "./getTransactions.mjs";
|
|
7
7
|
import { sendTransactions } from "./sendTransactions.mjs";
|
|
8
|
+
import { checkAccount } from "./checkAccount.mjs";
|
|
9
|
+
import { linkAccount } from "./linkAccount.mjs";
|
|
8
10
|
export {
|
|
11
|
+
checkAccount,
|
|
9
12
|
confirmRate,
|
|
10
13
|
getChains,
|
|
11
14
|
getRate,
|
|
12
15
|
getTokens,
|
|
13
16
|
getTokensBalances,
|
|
14
17
|
getTransactions,
|
|
18
|
+
linkAccount,
|
|
15
19
|
sendTransactions
|
|
16
20
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,32 @@
|
|
|
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;
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
};
|
|
@@ -27,12 +27,14 @@ describe("getChains", () => {
|
|
|
27
27
|
}
|
|
28
28
|
];
|
|
29
29
|
mockedAxios.get.mockResolvedValue({ data: response });
|
|
30
|
-
const result = await api_getChains.getChains({ url });
|
|
30
|
+
const result = await api_getChains.getChains({ url, nativeAuthToken: "ZKssadass" });
|
|
31
31
|
expect(mockedAxios.get).toHaveBeenCalledWith("/chains", { baseURL: url });
|
|
32
32
|
expect(result.data).toEqual(response);
|
|
33
33
|
});
|
|
34
34
|
it("handles error when fetching chains", async () => {
|
|
35
35
|
mockedAxios.get.mockRejectedValue(new Error("Network Error"));
|
|
36
|
-
await expect(
|
|
36
|
+
await expect(
|
|
37
|
+
api_getChains.getChains({ url, nativeAuthToken: "ZKssadass" })
|
|
38
|
+
).rejects.toThrow("Network Error");
|
|
37
39
|
});
|
|
38
40
|
});
|
|
@@ -25,12 +25,14 @@ describe("getChains", () => {
|
|
|
25
25
|
}
|
|
26
26
|
];
|
|
27
27
|
mockedAxios.get.mockResolvedValue({ data: response });
|
|
28
|
-
const result = await getChains({ url });
|
|
28
|
+
const result = await getChains({ url, nativeAuthToken: "ZKssadass" });
|
|
29
29
|
expect(mockedAxios.get).toHaveBeenCalledWith("/chains", { baseURL: url });
|
|
30
30
|
expect(result.data).toEqual(response);
|
|
31
31
|
});
|
|
32
32
|
it("handles error when fetching chains", async () => {
|
|
33
33
|
mockedAxios.get.mockRejectedValue(new Error("Network Error"));
|
|
34
|
-
await expect(
|
|
34
|
+
await expect(
|
|
35
|
+
getChains({ url, nativeAuthToken: "ZKssadass" })
|
|
36
|
+
).rejects.toThrow("Network Error");
|
|
35
37
|
});
|
|
36
38
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/index.js
CHANGED
|
@@ -8,6 +8,8 @@ const api_getTokens = require("./api/getTokens.js");
|
|
|
8
8
|
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
|
+
const api_checkAccount = require("./api/checkAccount.js");
|
|
12
|
+
const api_linkAccount = require("./api/linkAccount.js");
|
|
11
13
|
const constants_index = require("./constants/index.js");
|
|
12
14
|
const helpers_base64Utils = require("./helpers/base64Utils.js");
|
|
13
15
|
const helpers_decodeLoginToken = require("./helpers/decodeLoginToken.js");
|
|
@@ -53,7 +55,7 @@ const reactjs_hooks_validation_useSecondAmountSchema = require("./reactjs/hooks/
|
|
|
53
55
|
const reactjs_hooks_validation_useTestHasEnoughFunds = require("./reactjs/hooks/validation/useTestHasEnoughFunds.js");
|
|
54
56
|
const reactjs_hooks_validation_useTestIsConnected = require("./reactjs/hooks/validation/useTestIsConnected.js");
|
|
55
57
|
const reactjs_hooks_useAccount = require("./reactjs/hooks/useAccount.js");
|
|
56
|
-
const reactjs_hooks_useBalances = require("./useBalances-
|
|
58
|
+
const reactjs_hooks_useBalances = require("./useBalances-BrSgRL7R.js");
|
|
57
59
|
const reactjs_hooks_useBridgeFormik = require("./reactjs/hooks/useBridgeFormik.js");
|
|
58
60
|
const reactjs_hooks_useDebounce = require("./reactjs/hooks/useDebounce.js");
|
|
59
61
|
const reactjs_hooks_useFetchBridgeData = require("./reactjs/hooks/useFetchBridgeData.js");
|
|
@@ -91,6 +93,8 @@ exports.getTokens = api_getTokens.getTokens;
|
|
|
91
93
|
exports.getTokensBalances = api_getTokensBalances.getTokensBalances;
|
|
92
94
|
exports.getTransactions = api_getTransactions.getTransactions;
|
|
93
95
|
exports.sendTransactions = api_sendTransactions.sendTransactions;
|
|
96
|
+
exports.checkAccount = api_checkAccount.checkAccount;
|
|
97
|
+
exports.linkAccount = api_linkAccount.linkAccount;
|
|
94
98
|
exports.MVX_CHAIN_IDS = constants_index.MVX_CHAIN_IDS;
|
|
95
99
|
exports.decodeBase64 = helpers_base64Utils.decodeBase64;
|
|
96
100
|
exports.encodeToBase64 = helpers_base64Utils.encodeToBase64;
|
package/index.mjs
CHANGED
|
@@ -5,6 +5,8 @@ import { getTokens } from "./api/getTokens.mjs";
|
|
|
5
5
|
import { getTokensBalances } from "./api/getTokensBalances.mjs";
|
|
6
6
|
import { getTransactions } from "./api/getTransactions.mjs";
|
|
7
7
|
import { sendTransactions } from "./api/sendTransactions.mjs";
|
|
8
|
+
import { checkAccount } from "./api/checkAccount.mjs";
|
|
9
|
+
import { linkAccount } from "./api/linkAccount.mjs";
|
|
8
10
|
import { MVX_CHAIN_IDS } from "./constants/index.mjs";
|
|
9
11
|
import { decodeBase64, encodeToBase64, isStringBase64 } from "./helpers/base64Utils.mjs";
|
|
10
12
|
import { decodeLoginToken } from "./helpers/decodeLoginToken.mjs";
|
|
@@ -50,7 +52,7 @@ import { useSecondAmountSchema } from "./reactjs/hooks/validation/useSecondAmoun
|
|
|
50
52
|
import { useTestHasEnoughFunds } from "./reactjs/hooks/validation/useTestHasEnoughFunds.mjs";
|
|
51
53
|
import { useTestIsConnected } from "./reactjs/hooks/validation/useTestIsConnected.mjs";
|
|
52
54
|
import { useAccount } from "./reactjs/hooks/useAccount.mjs";
|
|
53
|
-
import { u } from "./useBalances-
|
|
55
|
+
import { u } from "./useBalances-84Wb5V4N.mjs";
|
|
54
56
|
import { BridgeFormikValuesEnum, useBridgeFormik } from "./reactjs/hooks/useBridgeFormik.mjs";
|
|
55
57
|
import { useDebounce } from "./reactjs/hooks/useDebounce.mjs";
|
|
56
58
|
import { useFetchBridgeData } from "./reactjs/hooks/useFetchBridgeData.mjs";
|
|
@@ -113,6 +115,7 @@ export {
|
|
|
113
115
|
Web3AppContext,
|
|
114
116
|
Web3AppProvider,
|
|
115
117
|
chainIdentifier,
|
|
118
|
+
checkAccount,
|
|
116
119
|
confirmRate,
|
|
117
120
|
decodeBase64,
|
|
118
121
|
decodeLoginToken,
|
|
@@ -141,6 +144,7 @@ export {
|
|
|
141
144
|
invalidateMvxTokensBalancesQuery,
|
|
142
145
|
isStringBase64,
|
|
143
146
|
isStringFloat,
|
|
147
|
+
linkAccount,
|
|
144
148
|
mxClsx,
|
|
145
149
|
pipe,
|
|
146
150
|
removeCommas,
|
package/package.json
CHANGED
|
@@ -44,7 +44,7 @@ const reactjs_components_Connect_MvxAccountDisplay = require("../Connect/MvxAcco
|
|
|
44
44
|
const reactjs_components_TokenSelector_TokenSelector = require("../TokenSelector/TokenSelector.js");
|
|
45
45
|
const viem = require("viem");
|
|
46
46
|
const actions = require("viem/actions");
|
|
47
|
-
const reactjs_hooks_useBalances = require("../../../useBalances-
|
|
47
|
+
const reactjs_hooks_useBalances = require("../../../useBalances-BrSgRL7R.js");
|
|
48
48
|
function deepEqual(a, b) {
|
|
49
49
|
if (a === b)
|
|
50
50
|
return true;
|
|
@@ -147,6 +147,9 @@ const BridgeForm = ({
|
|
|
147
147
|
const { switchNetwork } = react.useAppKitNetwork();
|
|
148
148
|
const { config, options, supportedChains: sdkChains } = reactjs_context_useWeb3App.useWeb3App();
|
|
149
149
|
const chainId = reactjs_hooks_useGetChainId.useGetChainId();
|
|
150
|
+
console.log("BridgeForm", {
|
|
151
|
+
nativeAuthToken
|
|
152
|
+
});
|
|
150
153
|
const {
|
|
151
154
|
evmTokensWithBalances,
|
|
152
155
|
mvxTokensWithBalances,
|
|
@@ -158,7 +161,8 @@ const BridgeForm = ({
|
|
|
158
161
|
} = reactjs_hooks_useFetchBridgeData.useFetchBridgeData({
|
|
159
162
|
refetchTrigger,
|
|
160
163
|
mvxAddress,
|
|
161
|
-
mvxApiURL: options.mvxApiURL
|
|
164
|
+
mvxApiURL: options.mvxApiURL,
|
|
165
|
+
nativeAuthToken
|
|
162
166
|
});
|
|
163
167
|
const isTokensLoading = tokensLoading || isLoadingEvmTokensBalances || isLoadingMvxTokensBalances || isChainsLoading;
|
|
164
168
|
const activeChain = React.useMemo(() => {
|
|
@@ -659,7 +663,14 @@ const BridgeForm = ({
|
|
|
659
663
|
autoComplete: "off",
|
|
660
664
|
onSubmit: handleSubmit,
|
|
661
665
|
children: [
|
|
662
|
-
showHistory && /* @__PURE__ */ jsxRuntime.jsx(
|
|
666
|
+
showHistory && /* @__PURE__ */ jsxRuntime.jsx(
|
|
667
|
+
reactjs_components_BridgeHistory_BridgeHistory.BridgeHistory,
|
|
668
|
+
{
|
|
669
|
+
mvxAddress,
|
|
670
|
+
onClose: handleHistoryClose,
|
|
671
|
+
nativeAuthToken
|
|
672
|
+
}
|
|
673
|
+
),
|
|
663
674
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
664
675
|
reactjs_components_AmountCard_AmountCard.AmountCard,
|
|
665
676
|
{
|
|
@@ -677,7 +688,8 @@ const BridgeForm = ({
|
|
|
677
688
|
reactjs_components_Connect_BridgeAccountDisplay.BridgeAccountDisplay,
|
|
678
689
|
{
|
|
679
690
|
disabled: isPendingRate,
|
|
680
|
-
activeChain: selectedChainOption
|
|
691
|
+
activeChain: selectedChainOption,
|
|
692
|
+
nativeAuthToken
|
|
681
693
|
}
|
|
682
694
|
)
|
|
683
695
|
] }),
|
|
@@ -707,7 +719,8 @@ const BridgeForm = ({
|
|
|
707
719
|
onBlur: handleBlur,
|
|
708
720
|
onMaxBtnClick: handleOnFirstMaxBtnChange,
|
|
709
721
|
selectedOption: firstToken,
|
|
710
|
-
onTokenSelectorDisplay: (visible) => setIsTokenSelectorVisible(visible)
|
|
722
|
+
onTokenSelectorDisplay: (visible) => setIsTokenSelectorVisible(visible),
|
|
723
|
+
nativeAuthToken
|
|
711
724
|
}
|
|
712
725
|
)
|
|
713
726
|
] })
|
|
@@ -764,7 +777,8 @@ const BridgeForm = ({
|
|
|
764
777
|
color: "neutral-850",
|
|
765
778
|
onChange: onChangeSecondSelect,
|
|
766
779
|
onBlur: handleBlur,
|
|
767
|
-
selectedOption: secondToken
|
|
780
|
+
selectedOption: secondToken,
|
|
781
|
+
nativeAuthToken
|
|
768
782
|
}
|
|
769
783
|
)
|
|
770
784
|
] })
|