@multiversx/sdk-dapp-liquidity 1.1.0-alpha.2 → 1.1.0-alpha.21
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/README.md +6 -1
- package/api/getTransactions.d.ts +8 -2
- package/api/getTransactions.js +23 -3
- package/api/getTransactions.mjs +23 -3
- package/api/tests/getChains.spec.js +2 -1
- package/api/tests/getChains.spec.mjs +2 -1
- package/api/tests/getTokens.spec.js +2 -2
- package/api/tests/getTokens.spec.mjs +2 -2
- package/api/tests/getTransactions.spec.js +79 -69
- package/api/tests/getTransactions.spec.mjs +79 -69
- package/constants/index.d.ts +1 -1
- package/constants/index.js +1 -1
- package/constants/index.mjs +1 -1
- package/dto/Chain.dto.d.ts +3 -1
- package/dto/ConfirmRate.dto.d.ts +1 -0
- package/dto/Token.dto.d.ts +7 -2
- package/index.js +44 -16
- package/index.mjs +14 -16
- package/package.json +10 -6
- package/reactjs/components/BridgeForm/BridgeForm.d.ts +3 -1
- package/reactjs/components/BridgeForm/BridgeForm.js +182 -87
- package/reactjs/components/BridgeForm/BridgeForm.mjs +153 -58
- package/reactjs/components/BridgeHistory/BridgeHistory.js +73 -26
- package/reactjs/components/BridgeHistory/BridgeHistory.mjs +68 -21
- package/reactjs/components/Connect/BridgeAccountDisplay.js +2 -5
- package/reactjs/components/Connect/BridgeAccountDisplay.mjs +2 -5
- package/reactjs/components/Connect/CustomConnectButton.js +2 -5
- package/reactjs/components/Connect/CustomConnectButton.mjs +1 -4
- package/reactjs/components/Connect/MvxConnectButton.d.ts +2 -4
- package/reactjs/components/Connect/MvxConnectButton.js +2 -2
- package/reactjs/components/Connect/MvxConnectButton.mjs +2 -2
- package/reactjs/components/Connect/SwitchChainButton.js +2 -6
- package/reactjs/components/Connect/SwitchChainButton.mjs +1 -5
- package/reactjs/components/CopyButton/CopyButton.js +2 -2
- package/reactjs/components/CopyButton/CopyButton.mjs +2 -2
- package/reactjs/components/DisplayAmount/components/AnimateNumber/AnimateNumber.js +5 -5
- package/reactjs/components/Error/Error.d.ts +6 -0
- package/reactjs/components/Error/Error.js +67 -0
- package/reactjs/components/Error/Error.mjs +66 -0
- package/reactjs/components/Error/index.d.ts +1 -0
- package/reactjs/components/Error/index.js +5 -0
- package/reactjs/components/Error/index.mjs +4 -0
- package/reactjs/components/TokenSelector/TokenSelector.d.ts +2 -1
- package/reactjs/components/TokenSelector/TokenSelector.js +17 -9
- package/reactjs/components/TokenSelector/TokenSelector.mjs +13 -5
- package/reactjs/components/TokenSelector/components/ChainSelect/ChainSelect.d.ts +2 -1
- package/reactjs/components/TokenSelector/components/ChainSelect/ChainSelect.js +7 -3
- package/reactjs/components/TokenSelector/components/ChainSelect/ChainSelect.mjs +4 -0
- package/reactjs/components/TokenSelector/components/SelectContent.d.ts +2 -1
- package/reactjs/components/TokenSelector/components/SelectContent.js +12 -9
- package/reactjs/components/TokenSelector/components/SelectContent.mjs +4 -1
- package/reactjs/components/TokenSelector/components/TokenIcon.js +3 -3
- package/reactjs/components/TokenSelector/components/TokenItem.js +9 -9
- package/reactjs/components/TokenSelector/components/TokenItem.mjs +6 -6
- package/reactjs/components/base/MxCard/MxCard.js +2 -2
- package/reactjs/components/base/MxCircleLoader/MxCircleLoader.d.ts +4 -0
- package/reactjs/components/base/MxCircleLoader/MxCircleLoader.js +29 -0
- package/reactjs/components/base/MxCircleLoader/MxCircleLoader.mjs +28 -0
- package/reactjs/components/base/MxCircleLoader/index.d.ts +1 -0
- package/reactjs/components/base/MxCircleLoader/index.js +5 -0
- package/reactjs/components/base/MxCircleLoader/index.mjs +4 -0
- package/reactjs/components/base/MxLink/MxLink.js +2 -2
- package/reactjs/components/base/MxSearch/MxSearch.js +4 -4
- package/reactjs/components/base/MxSlideover/MxSlideover.js +4 -4
- package/reactjs/components/base/MxTooltip/MxTooltip.js +9 -9
- package/reactjs/components/base/MxTooltip/components/TooltipContainer/TooltipContainer.js +2 -2
- package/reactjs/components/index.d.ts +1 -0
- package/reactjs/components/index.js +2 -0
- package/reactjs/components/index.mjs +2 -0
- package/reactjs/context/Web3AppProvider.d.ts +3 -1
- package/reactjs/context/Web3AppProvider.js +7 -5
- package/reactjs/context/Web3AppProvider.mjs +4 -2
- package/reactjs/context/useWeb3App.js +2 -2
- package/reactjs/hooks/index.js +1 -1
- package/reactjs/hooks/index.mjs +1 -1
- package/reactjs/hooks/useAccount.js +1 -5
- package/reactjs/hooks/useAccount.mjs +1 -5
- package/reactjs/hooks/useBalances.d.ts +4 -4
- package/reactjs/hooks/useBalances.js +16 -1
- package/reactjs/hooks/useBalances.mjs +16 -1
- package/reactjs/hooks/useBridgeFormik.js +9 -16
- package/reactjs/hooks/useBridgeFormik.mjs +0 -7
- package/reactjs/hooks/useDebounce.js +3 -3
- package/reactjs/hooks/useFetchBridgeData.d.ts +14 -4
- package/reactjs/hooks/useFetchTokens.d.ts +14 -4
- package/reactjs/hooks/useFetchTokens.js +9 -9
- package/reactjs/hooks/useFetchTokens.mjs +2 -2
- package/reactjs/hooks/useFiatData.d.ts +7 -2
- package/reactjs/hooks/useFiatData.js +6 -6
- package/reactjs/hooks/useFiatData.mjs +1 -1
- package/reactjs/hooks/useGetChainId.js +3 -3
- package/reactjs/hooks/useGetChainId.mjs +1 -1
- package/reactjs/hooks/useResolveTokenChain.js +2 -2
- package/reactjs/hooks/useSendTransactions.js +2 -2
- package/reactjs/hooks/useSignTransaction.d.ts +93 -67
- package/reactjs/hooks/useSignTransaction.js +53 -4
- package/reactjs/hooks/useSignTransaction.mjs +53 -4
- package/reactjs/hooks/validation/useTestHasEnoughFunds.js +3 -3
- package/reactjs/hooks/validation/useTestIsConnected.js +2 -2
- package/reactjs/index.js +44 -16
- package/reactjs/index.mjs +14 -16
- package/reactjs/init/init.d.ts +220 -1
- package/reactjs/init/init.js +34 -10
- package/reactjs/init/init.mjs +31 -7
- package/reactjs/init/tests/init.spec.js +5 -6
- package/reactjs/init/tests/init.spec.mjs +5 -6
- package/reactjs/queries/index.d.ts +0 -1
- package/reactjs/queries/index.js +0 -2
- package/reactjs/queries/index.mjs +1 -3
- package/reactjs/queries/useGetEvmTokensBalances.query.d.ts +8 -3
- package/reactjs/queries/useGetEvmTokensBalances.query.js +15 -18
- package/reactjs/queries/useGetEvmTokensBalances.query.mjs +15 -18
- package/reactjs/queries/useGetHistory.query.d.ts +9 -1
- package/reactjs/queries/useGetHistory.query.js +23 -5
- package/reactjs/queries/useGetHistory.query.mjs +23 -5
- package/reactjs/queries/useGetMvxTokensBalances.query.d.ts +7 -2
- package/reactjs/queries/useGetMvxTokensBalances.query.js +2 -2
- package/reactjs/reexports.d.ts +2 -1
- package/reactjs/reexports.js +41 -13
- package/reactjs/reexports.mjs +11 -13
- package/reactjs/utils/getInitialTokens.d.ts +4 -1
- package/reactjs/utils/getInitialTokens.js +3 -3
- package/reactjs/utils/getInitialTokens.mjs +3 -3
- package/style.css +33 -1730
- package/types/chainType.d.ts +6 -0
- package/types/chainType.js +11 -0
- package/types/chainType.mjs +10 -0
- package/types/transaction.d.ts +28 -0
- package/types/utxo.d.ts +11 -0
- package/types/utxo.js +2 -0
- package/types/utxo.mjs +1 -0
- package/{useBalances-C_69CFoa.mjs → useBalances-Bom1mw1J.mjs} +101 -23
- package/{useBalances-C4YhEYxy.js → useBalances-gZTsFZHe.js} +102 -24
- package/index-BIVnypNe.mjs +0 -108
- package/index-Ben8n3bd.js +0 -58656
- package/index-CnKr4rL1.mjs +0 -91
- package/index-CnuruJNu.js +0 -329
- package/index-DsBh-EBw.js +0 -108
- package/index-iN9APQ6x.mjs +0 -58735
- package/modules/fiat/components/FiatForm/FiatForm.d.ts +0 -9
- package/modules/fiat/components/FiatForm/FiatForm.js +0 -314
- package/modules/fiat/components/FiatForm/FiatForm.mjs +0 -313
- package/modules/fiat/components/FiatForm/components/AmountInput/AmountInput.d.ts +0 -13
- package/modules/fiat/components/FiatForm/components/AmountInput/AmountInput.js +0 -117
- package/modules/fiat/components/FiatForm/components/AmountInput/AmountInput.mjs +0 -116
- package/modules/fiat/components/FiatForm/components/AmountInput/index.d.ts +0 -1
- package/modules/fiat/components/FiatForm/components/AmountInput/index.js +0 -5
- package/modules/fiat/components/FiatForm/components/AmountInput/index.mjs +0 -4
- package/modules/fiat/components/FiatForm/components/RateReloading/RateReloading.d.ts +0 -7
- package/modules/fiat/components/FiatForm/components/RateReloading/RateReloading.js +0 -74
- package/modules/fiat/components/FiatForm/components/RateReloading/RateReloading.mjs +0 -73
- package/modules/fiat/components/FiatForm/components/TokenSelector/TokenSelector.d.ts +0 -14
- package/modules/fiat/components/FiatForm/components/TokenSelector/TokenSelector.js +0 -94
- package/modules/fiat/components/FiatForm/components/TokenSelector/TokenSelector.mjs +0 -93
- package/modules/fiat/components/FiatForm/components/TokenSelector/components/SelectContainer.d.ts +0 -7
- package/modules/fiat/components/FiatForm/components/TokenSelector/components/SelectContainer.js +0 -82
- package/modules/fiat/components/FiatForm/components/TokenSelector/components/SelectContainer.mjs +0 -81
- package/modules/fiat/components/FiatForm/components/TokenSelector/components/SelectContent.d.ts +0 -7
- package/modules/fiat/components/FiatForm/components/TokenSelector/components/SelectContent.js +0 -91
- package/modules/fiat/components/FiatForm/components/TokenSelector/components/SelectContent.mjs +0 -90
- package/modules/fiat/components/FiatForm/components/TokenSelector/components/SelectedOption.d.ts +0 -5
- package/modules/fiat/components/FiatForm/components/TokenSelector/components/SelectedOption.js +0 -30
- package/modules/fiat/components/FiatForm/components/TokenSelector/components/SelectedOption.mjs +0 -29
- package/modules/fiat/components/FiatForm/components/TokenSelector/components/TokenIcon.d.ts +0 -8
- package/modules/fiat/components/FiatForm/components/TokenSelector/components/TokenIcon.js +0 -103
- package/modules/fiat/components/FiatForm/components/TokenSelector/components/TokenIcon.mjs +0 -102
- package/modules/fiat/components/FiatForm/components/TokenSelector/components/TokenItem.d.ts +0 -7
- package/modules/fiat/components/FiatForm/components/TokenSelector/components/TokenItem.js +0 -33
- package/modules/fiat/components/FiatForm/components/TokenSelector/components/TokenItem.mjs +0 -32
- package/modules/fiat/components/FiatForm/components/TokenSelector/components/TokenList.d.ts +0 -7
- package/modules/fiat/components/FiatForm/components/TokenSelector/components/TokenList.js +0 -21
- package/modules/fiat/components/FiatForm/components/TokenSelector/components/TokenList.mjs +0 -20
- package/modules/fiat/components/FiatForm/components/TokenSelector/components/TokenSymbol.d.ts +0 -9
- package/modules/fiat/components/FiatForm/components/TokenSelector/components/TokenSymbol.js +0 -26
- package/modules/fiat/components/FiatForm/components/TokenSelector/components/TokenSymbol.mjs +0 -25
- package/modules/fiat/components/FiatForm/components/TokenSelector/index.d.ts +0 -1
- package/modules/fiat/components/FiatForm/components/TokenSelector/index.js +0 -5
- package/modules/fiat/components/FiatForm/components/TokenSelector/index.mjs +0 -4
- package/modules/fiat/components/FiatForm/index.d.ts +0 -1
- package/modules/fiat/components/FiatForm/index.js +0 -5
- package/modules/fiat/components/FiatForm/index.mjs +0 -4
- package/modules/fiat/components/index.d.ts +0 -1
- package/modules/fiat/components/index.js +0 -5
- package/modules/fiat/components/index.mjs +0 -4
- package/modules/fiat/context/FiatProvider.d.ts +0 -8
- package/modules/fiat/context/FiatProvider.js +0 -24
- package/modules/fiat/context/FiatProvider.mjs +0 -23
- package/modules/fiat/context/queryClient.d.ts +0 -3
- package/modules/fiat/context/queryClient.js +0 -12
- package/modules/fiat/context/queryClient.mjs +0 -11
- package/modules/fiat/context/useFiat.d.ts +0 -1
- package/modules/fiat/context/useFiat.js +0 -13
- package/modules/fiat/context/useFiat.mjs +0 -12
- package/modules/fiat/hooks/index.d.ts +0 -2
- package/modules/fiat/hooks/index.js +0 -7
- package/modules/fiat/hooks/index.mjs +0 -6
- package/modules/fiat/hooks/useFiatData.d.ts +0 -7
- package/modules/fiat/hooks/useFiatData.js +0 -75
- package/modules/fiat/hooks/useFiatData.mjs +0 -74
- package/modules/fiat/hooks/validation/index.d.ts +0 -1
- package/modules/fiat/hooks/validation/index.js +0 -5
- package/modules/fiat/hooks/validation/index.mjs +0 -4
- package/modules/fiat/hooks/validation/useAmountSchema.d.ts +0 -2
- package/modules/fiat/hooks/validation/useAmountSchema.js +0 -27
- package/modules/fiat/hooks/validation/useAmountSchema.mjs +0 -9
- package/modules/fiat/index.d.ts +0 -8
- package/modules/fiat/index.js +0 -22
- package/modules/fiat/index.mjs +0 -21
- package/modules/fiat/init/index.d.ts +0 -2
- package/modules/fiat/init/index.js +0 -5
- package/modules/fiat/init/index.mjs +0 -4
- package/modules/fiat/init/init.d.ts +0 -22
- package/modules/fiat/init/init.js +0 -15
- package/modules/fiat/init/init.mjs +0 -14
- package/modules/fiat/queries/index.d.ts +0 -2
- package/modules/fiat/queries/index.js +0 -7
- package/modules/fiat/queries/index.mjs +0 -6
- package/modules/fiat/queries/useGetRate.mutation.d.ts +0 -6
- package/modules/fiat/queries/useGetRate.mutation.js +0 -20
- package/modules/fiat/queries/useGetRate.mutation.mjs +0 -19
- package/modules/fiat/queries/useGetTokens.query.d.ts +0 -5
- package/modules/fiat/queries/useGetTokens.query.js +0 -33
- package/modules/fiat/queries/useGetTokens.query.mjs +0 -32
- package/react-47kZTyAT.mjs +0 -51
- package/react-B_iI3-1z.mjs +0 -3133
- package/react-BomcNL1v.js +0 -254
- package/react-CqKlu0W0.js +0 -51
- package/react-R_xxu7fN.js +0 -3133
- package/react-cXurUY4Z.mjs +0 -254
- package/reactjs/queries/useGetTokens.query.d.ts +0 -3
- package/reactjs/queries/useGetTokens.query.js +0 -34
- package/reactjs/queries/useGetTokens.query.mjs +0 -33
- package/w3m-modal-Bhg44d6I.js +0 -356
- package/w3m-modal-Br2Ec3MM.mjs +0 -356
package/modules/fiat/index.mjs
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { FiatForm } from "./components/FiatForm/FiatForm.mjs";
|
|
2
|
-
import { getQueryClient } from "./context/queryClient.mjs";
|
|
3
|
-
import { FiatContext, FiatProvider } from "./context/FiatProvider.mjs";
|
|
4
|
-
import { useFiat } from "./context/useFiat.mjs";
|
|
5
|
-
import { useAmountSchema } from "./hooks/validation/useAmountSchema.mjs";
|
|
6
|
-
import { useFiatData } from "./hooks/useFiatData.mjs";
|
|
7
|
-
import { init } from "./init/init.mjs";
|
|
8
|
-
import { useGetRateMutation } from "./queries/useGetRate.mutation.mjs";
|
|
9
|
-
import { useGetTokensQuery } from "./queries/useGetTokens.query.mjs";
|
|
10
|
-
export {
|
|
11
|
-
FiatContext,
|
|
12
|
-
FiatForm,
|
|
13
|
-
FiatProvider,
|
|
14
|
-
getQueryClient,
|
|
15
|
-
init,
|
|
16
|
-
useAmountSchema,
|
|
17
|
-
useFiat,
|
|
18
|
-
useFiatData,
|
|
19
|
-
useGetRateMutation,
|
|
20
|
-
useGetTokensQuery
|
|
21
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export type InitFiatOptions = {
|
|
2
|
-
/**
|
|
3
|
-
* Liquidity API URL
|
|
4
|
-
*/
|
|
5
|
-
apiURL: string;
|
|
6
|
-
/**
|
|
7
|
-
* MultiversX API URL
|
|
8
|
-
*/
|
|
9
|
-
mvxApiURL: string;
|
|
10
|
-
/**
|
|
11
|
-
* MultiversX Explorer URL
|
|
12
|
-
*/
|
|
13
|
-
mvxExplorerAddress: string;
|
|
14
|
-
/**
|
|
15
|
-
* MultiversX Chain ID
|
|
16
|
-
* Possible options 31 | 44 | 54 which are mapped to 1 | D | T
|
|
17
|
-
*/
|
|
18
|
-
mvxChainId: '31' | '44' | '54';
|
|
19
|
-
};
|
|
20
|
-
export declare function init(options: InitFiatOptions): {
|
|
21
|
-
options: InitFiatOptions;
|
|
22
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const store_inMemoryStore = require("../../../store/inMemoryStore.js");
|
|
5
|
-
function init(options) {
|
|
6
|
-
const store = store_inMemoryStore.InMemoryStore.getInstance();
|
|
7
|
-
store.setItem("apiURL", options.apiURL);
|
|
8
|
-
store.setItem("mvxApiURL", options.mvxApiURL);
|
|
9
|
-
store.setItem("mvxExplorerAddress", options.mvxExplorerAddress);
|
|
10
|
-
store.setItem("mvxChainId", options.mvxChainId);
|
|
11
|
-
return {
|
|
12
|
-
options
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
exports.init = init;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { InMemoryStore } from "../../../store/inMemoryStore.mjs";
|
|
2
|
-
function init(options) {
|
|
3
|
-
const store = InMemoryStore.getInstance();
|
|
4
|
-
store.setItem("apiURL", options.apiURL);
|
|
5
|
-
store.setItem("mvxApiURL", options.mvxApiURL);
|
|
6
|
-
store.setItem("mvxExplorerAddress", options.mvxExplorerAddress);
|
|
7
|
-
store.setItem("mvxChainId", options.mvxChainId);
|
|
8
|
-
return {
|
|
9
|
-
options
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
export {
|
|
13
|
-
init
|
|
14
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const modules_fiat_queries_useGetRate_mutation = require("./useGetRate.mutation.js");
|
|
5
|
-
const modules_fiat_queries_useGetTokens_query = require("./useGetTokens.query.js");
|
|
6
|
-
exports.useGetRateMutation = modules_fiat_queries_useGetRate_mutation.useGetRateMutation;
|
|
7
|
-
exports.useGetTokensQuery = modules_fiat_queries_useGetTokens_query.useGetTokensQuery;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { RateRequestBody } from '../../../types';
|
|
2
|
-
|
|
3
|
-
export declare const useGetRateMutation: () => import('@tanstack/react-query').UseMutationResult<import('../../../types').RateRequestResponse, Error, {
|
|
4
|
-
nativeAuthToken: string;
|
|
5
|
-
body: RateRequestBody;
|
|
6
|
-
}, unknown>;
|
|
@@ -1,20 +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
|
-
require("axios");
|
|
6
|
-
const api_getRate = require("../../../api/getRate.js");
|
|
7
|
-
const helpers_getApiURL = require("../../../helpers/getApiURL.js");
|
|
8
|
-
const useGetRateMutation = () => {
|
|
9
|
-
const mutationFn = async (params) => {
|
|
10
|
-
const { data } = await api_getRate.getRate({
|
|
11
|
-
url: helpers_getApiURL.getApiURL(),
|
|
12
|
-
...params
|
|
13
|
-
});
|
|
14
|
-
return data;
|
|
15
|
-
};
|
|
16
|
-
return reactQuery.useMutation({
|
|
17
|
-
mutationFn
|
|
18
|
-
});
|
|
19
|
-
};
|
|
20
|
-
exports.useGetRateMutation = useGetRateMutation;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { useMutation } from "@tanstack/react-query";
|
|
2
|
-
import "axios";
|
|
3
|
-
import { getRate } from "../../../api/getRate.mjs";
|
|
4
|
-
import { getApiURL } from "../../../helpers/getApiURL.mjs";
|
|
5
|
-
const useGetRateMutation = () => {
|
|
6
|
-
const mutationFn = async (params) => {
|
|
7
|
-
const { data } = await getRate({
|
|
8
|
-
url: getApiURL(),
|
|
9
|
-
...params
|
|
10
|
-
});
|
|
11
|
-
return data;
|
|
12
|
-
};
|
|
13
|
-
return useMutation({
|
|
14
|
-
mutationFn
|
|
15
|
-
});
|
|
16
|
-
};
|
|
17
|
-
export {
|
|
18
|
-
useGetRateMutation
|
|
19
|
-
};
|
|
@@ -1,33 +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
|
-
require("axios");
|
|
6
|
-
const api_getTokens = require("../../../api/getTokens.js");
|
|
7
|
-
const helpers_getApiURL = require("../../../helpers/getApiURL.js");
|
|
8
|
-
const useGetTokensQuery = ({ chainId }) => {
|
|
9
|
-
const queryFn = async () => {
|
|
10
|
-
try {
|
|
11
|
-
const { data } = await api_getTokens.getTokens({
|
|
12
|
-
url: helpers_getApiURL.getApiURL(),
|
|
13
|
-
chainId: Number(chainId)
|
|
14
|
-
});
|
|
15
|
-
return data;
|
|
16
|
-
} catch (error) {
|
|
17
|
-
throw error;
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
const retry = (_failureCount, error) => {
|
|
21
|
-
var _a;
|
|
22
|
-
return ((_a = error.response) == null ? void 0 : _a.status) === 404;
|
|
23
|
-
};
|
|
24
|
-
return reactQuery.useQuery({
|
|
25
|
-
queryKey: ["tokens", chainId],
|
|
26
|
-
queryFn,
|
|
27
|
-
retry,
|
|
28
|
-
refetchOnWindowFocus: false,
|
|
29
|
-
gcTime: 5 * 60 * 1e3,
|
|
30
|
-
staleTime: 0
|
|
31
|
-
});
|
|
32
|
-
};
|
|
33
|
-
exports.useGetTokensQuery = useGetTokensQuery;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { useQuery } from "@tanstack/react-query";
|
|
2
|
-
import "axios";
|
|
3
|
-
import { getTokens } from "../../../api/getTokens.mjs";
|
|
4
|
-
import { getApiURL } from "../../../helpers/getApiURL.mjs";
|
|
5
|
-
const useGetTokensQuery = ({ chainId }) => {
|
|
6
|
-
const queryFn = async () => {
|
|
7
|
-
try {
|
|
8
|
-
const { data } = await getTokens({
|
|
9
|
-
url: getApiURL(),
|
|
10
|
-
chainId: Number(chainId)
|
|
11
|
-
});
|
|
12
|
-
return data;
|
|
13
|
-
} catch (error) {
|
|
14
|
-
throw error;
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
const retry = (_failureCount, error) => {
|
|
18
|
-
var _a;
|
|
19
|
-
return ((_a = error.response) == null ? void 0 : _a.status) === 404;
|
|
20
|
-
};
|
|
21
|
-
return useQuery({
|
|
22
|
-
queryKey: ["tokens", chainId],
|
|
23
|
-
queryFn,
|
|
24
|
-
retry,
|
|
25
|
-
refetchOnWindowFocus: false,
|
|
26
|
-
gcTime: 5 * 60 * 1e3,
|
|
27
|
-
staleTime: 0
|
|
28
|
-
});
|
|
29
|
-
};
|
|
30
|
-
export {
|
|
31
|
-
useGetTokensQuery
|
|
32
|
-
};
|
package/react-47kZTyAT.mjs
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { az as ChainController, aA as ConnectorController, aB as CoreHelperUtil, aC as ConnectionController } from "./index-iN9APQ6x.mjs";
|
|
2
|
-
import { u as useSnapshot } from "./react-cXurUY4Z.mjs";
|
|
3
|
-
function useAppKitNetworkCore() {
|
|
4
|
-
const { activeCaipNetwork } = useSnapshot(ChainController.state);
|
|
5
|
-
return {
|
|
6
|
-
caipNetwork: activeCaipNetwork,
|
|
7
|
-
chainId: activeCaipNetwork == null ? void 0 : activeCaipNetwork.id,
|
|
8
|
-
caipNetworkId: activeCaipNetwork == null ? void 0 : activeCaipNetwork.caipNetworkId
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
function useAppKitAccount(options) {
|
|
12
|
-
var _a;
|
|
13
|
-
const state = useSnapshot(ChainController.state);
|
|
14
|
-
const chainNamespace = (options == null ? void 0 : options.namespace) || state.activeChain;
|
|
15
|
-
if (!chainNamespace) {
|
|
16
|
-
return {
|
|
17
|
-
allAccounts: [],
|
|
18
|
-
address: void 0,
|
|
19
|
-
caipAddress: void 0,
|
|
20
|
-
status: void 0,
|
|
21
|
-
isConnected: false,
|
|
22
|
-
embeddedWalletInfo: void 0
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
const chainAccountState = (_a = state.chains.get(chainNamespace)) == null ? void 0 : _a.accountState;
|
|
26
|
-
const authConnector = ConnectorController.getAuthConnector(chainNamespace);
|
|
27
|
-
return {
|
|
28
|
-
allAccounts: (chainAccountState == null ? void 0 : chainAccountState.allAccounts) || [],
|
|
29
|
-
caipAddress: chainAccountState == null ? void 0 : chainAccountState.caipAddress,
|
|
30
|
-
address: CoreHelperUtil.getPlainAddress(chainAccountState == null ? void 0 : chainAccountState.caipAddress),
|
|
31
|
-
isConnected: Boolean(chainAccountState == null ? void 0 : chainAccountState.caipAddress),
|
|
32
|
-
status: chainAccountState == null ? void 0 : chainAccountState.status,
|
|
33
|
-
embeddedWalletInfo: authConnector ? {
|
|
34
|
-
user: chainAccountState == null ? void 0 : chainAccountState.user,
|
|
35
|
-
authProvider: (chainAccountState == null ? void 0 : chainAccountState.socialProvider) || "email",
|
|
36
|
-
accountType: chainAccountState == null ? void 0 : chainAccountState.preferredAccountType,
|
|
37
|
-
isSmartAccountDeployed: Boolean(chainAccountState == null ? void 0 : chainAccountState.smartAccountDeployed)
|
|
38
|
-
} : void 0
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
function useDisconnect() {
|
|
42
|
-
async function disconnect() {
|
|
43
|
-
await ConnectionController.disconnect();
|
|
44
|
-
}
|
|
45
|
-
return { disconnect };
|
|
46
|
-
}
|
|
47
|
-
export {
|
|
48
|
-
useDisconnect as a,
|
|
49
|
-
useAppKitNetworkCore as b,
|
|
50
|
-
useAppKitAccount as u
|
|
51
|
-
};
|