@getpara/react-sdk 2.0.0-alpha.3 → 2.0.0-alpha.6
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/dist/cli/cli.mjs +1 -6
- package/dist/index.js +11 -6499
- package/dist/modal/ParaModal.js +262 -0
- package/dist/modal/components/Account/Account.js +139 -0
- package/dist/modal/components/AddFunds/AddFunds.d.ts +0 -2
- package/dist/modal/components/AddFunds/AddFunds.js +69 -0
- package/dist/modal/components/AddFunds/AddFundsAsset.d.ts +1 -0
- package/dist/modal/components/AddFunds/AddFundsAsset.js +125 -0
- package/dist/modal/components/AddFunds/AddFundsAwaiting.js +78 -0
- package/dist/modal/components/AddFunds/AddFundsContext.d.ts +31 -0
- package/dist/modal/components/AddFunds/AddFundsContext.js +160 -0
- package/dist/modal/components/AddFunds/AddFundsDone.js +49 -0
- package/dist/modal/components/AddFunds/AddFundsProvider.d.ts +1 -0
- package/dist/modal/components/AddFunds/AddFundsProvider.js +109 -0
- package/dist/modal/components/AddFunds/AddFundsReceive.d.ts +1 -0
- package/dist/modal/components/AddFunds/AddFundsReceive.js +83 -0
- package/dist/modal/components/AddFunds/AddFundsSettings.d.ts +1 -0
- package/dist/modal/components/AddFunds/AddFundsSettings.js +237 -0
- package/dist/{MoonPayEmbed-Q2HP2BFI.js → modal/components/AddFunds/MoonPayEmbed.js} +1 -3
- package/dist/modal/components/AddFunds/common.d.ts +19 -0
- package/dist/modal/components/AddFunds/common.js +24 -0
- package/dist/modal/components/AddFunds/index.js +4 -0
- package/dist/modal/components/AuthInput/AuthInput.js +262 -0
- package/dist/modal/components/AuthInput/hooks/useDropdownPosition.js +33 -0
- package/dist/modal/components/AuthInput/phoneMasks.js +253 -0
- package/dist/modal/components/AuthMainStep/AuthMainStep.d.ts +4 -3
- package/dist/modal/components/AuthMainStep/AuthMainStep.js +50 -0
- package/dist/modal/components/AuthMainStep/AuthMainStepContent.d.ts +4 -3
- package/dist/modal/components/AuthMainStep/AuthMainStepContent.js +157 -0
- package/dist/modal/components/AuthOptions/AuthOptions.d.ts +4 -3
- package/dist/modal/components/AuthOptions/AuthOptions.js +67 -0
- package/dist/modal/components/AwaitingBiometricsStep/AwaitingBiometricsStep.js +18 -0
- package/dist/modal/components/AwaitingOAuthStep/AwaitingOAuthStep.js +10 -0
- package/dist/modal/components/AwaitingPasswordStep/AwaitingPasswordStep.js +18 -0
- package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.d.ts +5 -1
- package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.js +49 -0
- package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.js +63 -0
- package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.js +55 -0
- package/dist/modal/components/Body/AnimatedHeightWrapper.js +29 -0
- package/dist/modal/components/Body/Body.d.ts +4 -3
- package/dist/modal/components/Body/Body.js +327 -0
- package/dist/modal/components/ChainSwitch/ChainSwitch.js +95 -0
- package/dist/modal/components/ChainSwitch/config.js +17 -0
- package/dist/modal/components/Controls/Controls.js +77 -0
- package/dist/modal/components/Controls/Selects.js +189 -0
- package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.js +144 -0
- package/dist/modal/components/ExternalWalletStep/config.js +17 -0
- package/dist/modal/components/ExternalWalletVerificationStep/ExternalWalletVerificationStep.js +34 -0
- package/dist/modal/components/ExternalWallets/ExternalWallets.js +173 -0
- package/dist/modal/components/Footer/Footer.js +95 -0
- package/dist/modal/components/Header/Header.js +43 -0
- package/dist/modal/components/Header/hooks/useStepTitle.js +54 -0
- package/dist/modal/components/Hero/Hero.js +116 -0
- package/dist/modal/components/IFrameStep/IFrameStep.js +59 -0
- package/dist/modal/components/LoginDoneStep/LoginDoneStep.js +31 -0
- package/dist/modal/components/ModalContent/ModalContent.js +95 -0
- package/dist/modal/components/OAuth/FarcasterOAuthStep.js +27 -0
- package/dist/modal/components/OAuth/OAuth.d.ts +2 -2
- package/dist/modal/components/OAuth/OAuth.js +79 -0
- package/dist/modal/components/OAuth/TelegramOAuthStep.js +90 -0
- package/dist/modal/components/OnRampComponents/AddingFunds.js +23 -0
- package/dist/modal/components/OnRampComponents/OnRampProviderButton.js +77 -0
- package/dist/modal/components/RecoverySecretStep/RecoverySecretStep.js +107 -0
- package/dist/modal/components/Setup2FAStep/Setup2FAStep.js +132 -0
- package/dist/modal/components/StripeComponents/StripeComponents.js +88 -0
- package/dist/modal/components/TwoFactorDoneStep/TwoFactorDoneStep.js +27 -0
- package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.js +143 -0
- package/dist/modal/components/Waiting/Waiting.js +17 -0
- package/dist/modal/components/WalletCard/PartnerIcon.js +34 -0
- package/dist/modal/components/WalletCard/WalletCard.d.ts +3 -3
- package/dist/modal/components/WalletCard/WalletCard.js +128 -0
- package/dist/modal/components/WalletCreationDoneStep/WalletCreationDoneStep.js +73 -0
- package/dist/modal/components/common.d.ts +32 -13
- package/dist/modal/components/common.js +175 -0
- package/dist/modal/components/index.js +2 -0
- package/dist/modal/constants/constants.d.ts +9 -2
- package/dist/modal/constants/constants.js +138 -0
- package/dist/modal/constants/defaults.js +10 -0
- package/dist/modal/constants/oAuthLogos.d.ts +3 -3
- package/dist/modal/constants/oAuthLogos.js +24 -0
- package/dist/modal/hooks/useGoBack.js +43 -0
- package/dist/modal/index.d.ts +1 -2
- package/dist/modal/index.js +29 -0
- package/dist/modal/stores/index.js +2 -0
- package/dist/modal/stores/modal/actions.js +133 -0
- package/dist/modal/stores/modal/useModalStore.d.ts +12 -4
- package/dist/modal/stores/modal/useModalStore.js +68 -0
- package/dist/modal/types/commonTypes.d.ts +0 -47
- package/dist/modal/types/commonTypes.js +1 -0
- package/dist/modal/types/externalWallets.d.ts +2 -0
- package/dist/modal/types/externalWallets.js +32 -0
- package/dist/modal/types/modalProps.d.ts +10 -2
- package/dist/modal/types/modalProps.js +12 -0
- package/dist/modal/utils/authInputHelpers.d.ts +7 -0
- package/dist/modal/utils/authInputHelpers.js +38 -0
- package/dist/modal/utils/authLayoutHelpers.js +8 -0
- package/dist/modal/utils/countryCodes.js +45 -0
- package/dist/modal/utils/getMailtoLink.js +10 -0
- package/dist/modal/utils/getTileButtonFlex.js +20 -0
- package/dist/modal/utils/isPasskeySupported.js +15 -0
- package/dist/modal/utils/openPopup.js +60 -0
- package/dist/modal/utils/routeMobileExternalWallet.js +31 -0
- package/dist/modal/utils/steps.d.ts +6 -0
- package/dist/modal/utils/steps.js +247 -0
- package/dist/modal/utils/stringFormatters.d.ts +1 -0
- package/dist/modal/utils/stringFormatters.js +19 -0
- package/dist/modal/utils/validateOnRampConfig.js +32 -0
- package/dist/package.json +6 -0
- package/dist/provider/ParaProvider.js +83 -0
- package/dist/provider/actions/getAccount.d.ts +8 -1
- package/dist/provider/actions/getAccount.js +51 -0
- package/dist/provider/actions/getWallet.d.ts +2 -2
- package/dist/provider/actions/getWallet.js +14 -0
- package/dist/provider/actions/index.d.ts +2 -0
- package/dist/provider/actions/index.js +59 -0
- package/dist/provider/actions/utils.js +15 -0
- package/dist/provider/components/CosmosWalletWrapper.js +34 -0
- package/dist/provider/components/EvmWalletWrapper.js +34 -0
- package/dist/provider/components/ExternalWalletWrapper.js +139 -0
- package/dist/provider/components/SolanaWalletWrapper.js +36 -0
- package/dist/provider/external/getParaCosmosConnector.js +22 -0
- package/dist/provider/external/getParaEvmConnector.js +22 -0
- package/dist/provider/external/getParaSolanaConnector.js +22 -0
- package/dist/provider/external/stubs/CosmosExternalWalletContextStub.js +18 -0
- package/dist/provider/external/stubs/EvmExternalWalletContextStub.js +21 -0
- package/dist/provider/external/stubs/SolanaExternalWalletContextStub.js +14 -0
- package/dist/provider/hooks/index.js +4 -0
- package/dist/provider/hooks/mutations/index.d.ts +1 -0
- package/dist/provider/hooks/mutations/index.js +61 -0
- package/dist/provider/hooks/mutations/utils.js +22 -0
- package/dist/provider/hooks/queries/index.d.ts +1 -0
- package/dist/provider/hooks/queries/index.js +10 -0
- package/dist/provider/hooks/queries/useAccount.js +21 -0
- package/dist/provider/hooks/queries/useWallet.js +22 -0
- package/dist/provider/hooks/queries/useWalletBalance.d.ts +6 -0
- package/dist/provider/hooks/queries/useWalletBalance.js +55 -0
- package/dist/provider/hooks/utils/index.js +10 -0
- package/dist/provider/hooks/utils/useAutoSessionKeepAlive.js +74 -0
- package/dist/provider/hooks/utils/useClient.js +10 -0
- package/dist/provider/hooks/utils/useEventListeners.d.ts +1 -1
- package/dist/provider/hooks/utils/useEventListeners.js +147 -0
- package/dist/provider/hooks/utils/useInternalClient.js +10 -0
- package/dist/provider/hooks/utils/useModal.js +17 -0
- package/dist/provider/hooks/utils/useWalletState.d.ts +3 -3
- package/dist/provider/hooks/utils/useWalletState.js +48 -0
- package/dist/provider/index.js +9 -0
- package/dist/provider/providers/AuthProvider.d.ts +10 -6
- package/dist/provider/providers/AuthProvider.js +498 -0
- package/dist/provider/providers/CosmosExternalWalletProvider.js +66 -0
- package/dist/provider/providers/EvmExternalWalletProvider.js +74 -0
- package/dist/provider/providers/ExternalWalletProvider.d.ts +5 -2
- package/dist/provider/providers/ExternalWalletProvider.js +428 -0
- package/dist/provider/providers/SolanaExternalWalletProvider.js +66 -0
- package/dist/provider/stores/getters.d.ts +1 -1
- package/dist/provider/stores/getters.js +13 -0
- package/dist/provider/stores/setters.js +7 -0
- package/dist/provider/stores/slices/client.js +9 -0
- package/dist/provider/stores/slices/config.js +9 -0
- package/dist/provider/stores/slices/externalWallets.js +40 -0
- package/dist/provider/stores/slices/index.js +5 -0
- package/dist/provider/stores/slices/modal.js +16 -0
- package/dist/provider/stores/slices/wallet.js +13 -0
- package/dist/provider/stores/types.d.ts +7 -4
- package/dist/provider/stores/types.js +1 -0
- package/dist/provider/stores/useStore.js +28 -0
- package/dist/provider/types/externalWalletProviders.d.ts +2 -2
- package/dist/provider/types/externalWalletProviders.js +1 -0
- package/dist/provider/types/provider.d.ts +9 -3
- package/dist/provider/types/provider.js +1 -0
- package/dist/provider/types/query.js +1 -0
- package/dist/provider/types/utils.js +1 -0
- package/dist/provider/utils/constants.d.ts +5 -0
- package/dist/provider/utils/constants.js +10 -0
- package/dist/provider/utils/paraConfigTypeGuards.js +13 -0
- package/dist/provider/utils/renameMutations.js +18 -0
- package/package.json +18 -16
- package/dist/MoonPayEmbed-Q2HP2BFI.js.br +0 -0
- package/dist/MoonPayEmbed-Q2HP2BFI.js.gz +0 -0
- package/dist/chunk-MMUBH76A.js.br +0 -0
- package/dist/chunk-MMUBH76A.js.gz +0 -0
- package/dist/index.js.br +0 -0
- package/dist/index.js.gz +0 -0
- /package/dist/modal/{components/AuthInput → utils}/countryCodes.d.ts +0 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../chunk-MMUBH76A.js";
|
|
3
|
+
import { generateAction } from "./utils.js";
|
|
4
|
+
const signUpOrLogIn = generateAction("signUpOrLogIn");
|
|
5
|
+
const verifyNewAccount = generateAction("verifyNewAccount");
|
|
6
|
+
const waitForLogin = generateAction("waitForLogin");
|
|
7
|
+
const waitForSignup = generateAction("waitForSignup");
|
|
8
|
+
const waitForWalletCreation = generateAction("waitForWalletCreation");
|
|
9
|
+
const verifyOAuth = generateAction("verifyOAuth");
|
|
10
|
+
const verifyFarcaster = generateAction("verifyFarcaster");
|
|
11
|
+
const verifyTelegram = generateAction("verifyTelegram");
|
|
12
|
+
const loginExternalWallet = generateAction("loginExternalWallet");
|
|
13
|
+
const verifyExternalWallet = generateAction("verifyExternalWallet");
|
|
14
|
+
const setup2fa = generateAction("setup2fa");
|
|
15
|
+
const enable2fa = generateAction("enable2fa");
|
|
16
|
+
const verify2fa = generateAction("verify2fa");
|
|
17
|
+
const keepSessionAlive = generateAction("keepSessionAlive");
|
|
18
|
+
const logout = generateAction("logout");
|
|
19
|
+
const resendVerificationCode = generateAction("resendVerificationCode");
|
|
20
|
+
const createWallet = generateAction("createWallet");
|
|
21
|
+
const createWalletPerType = generateAction("createWalletPerType");
|
|
22
|
+
const createPregenWallet = generateAction("createPregenWallet");
|
|
23
|
+
const createPregenWalletPerType = generateAction("createPregenWalletPerType");
|
|
24
|
+
const claimPregenWallets = generateAction("claimPregenWallets");
|
|
25
|
+
const hasPregenWallet = generateAction("hasPregenWallet");
|
|
26
|
+
const updatePregenWalletIdentifier = generateAction("updatePregenWalletIdentifier");
|
|
27
|
+
const createGuestWallets = generateAction("createGuestWallets");
|
|
28
|
+
const signMessage = generateAction("signMessage");
|
|
29
|
+
const signTransaction = generateAction("signTransaction");
|
|
30
|
+
const getWalletBalance = generateAction("getWalletBalance");
|
|
31
|
+
export {
|
|
32
|
+
claimPregenWallets,
|
|
33
|
+
createGuestWallets,
|
|
34
|
+
createPregenWallet,
|
|
35
|
+
createPregenWalletPerType,
|
|
36
|
+
createWallet,
|
|
37
|
+
createWalletPerType,
|
|
38
|
+
enable2fa,
|
|
39
|
+
getWalletBalance,
|
|
40
|
+
hasPregenWallet,
|
|
41
|
+
keepSessionAlive,
|
|
42
|
+
loginExternalWallet,
|
|
43
|
+
logout,
|
|
44
|
+
resendVerificationCode,
|
|
45
|
+
setup2fa,
|
|
46
|
+
signMessage,
|
|
47
|
+
signTransaction,
|
|
48
|
+
signUpOrLogIn,
|
|
49
|
+
updatePregenWalletIdentifier,
|
|
50
|
+
verify2fa,
|
|
51
|
+
verifyExternalWallet,
|
|
52
|
+
verifyFarcaster,
|
|
53
|
+
verifyNewAccount,
|
|
54
|
+
verifyOAuth,
|
|
55
|
+
verifyTelegram,
|
|
56
|
+
waitForLogin,
|
|
57
|
+
waitForSignup,
|
|
58
|
+
waitForWalletCreation
|
|
59
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__async
|
|
4
|
+
} from "../../chunk-MMUBH76A.js";
|
|
5
|
+
function generateAction(method) {
|
|
6
|
+
return (para, ...args) => __async(this, null, function* () {
|
|
7
|
+
if (!para) {
|
|
8
|
+
throw new Error("no para instance");
|
|
9
|
+
}
|
|
10
|
+
return yield para[method](...args);
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
generateAction
|
|
15
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../chunk-MMUBH76A.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { CosmosExternalWalletProvider } from "../providers/CosmosExternalWalletProvider.js";
|
|
5
|
+
import { useInternalClient } from "../hooks/utils/useInternalClient.js";
|
|
6
|
+
import { useStore } from "../stores/useStore.js";
|
|
7
|
+
import { CosmosWallet } from "@getpara/react-common";
|
|
8
|
+
import { useWallet } from "../hooks/index.js";
|
|
9
|
+
const CosmosWalletWrapper = ({
|
|
10
|
+
children,
|
|
11
|
+
cosmosConnectorConfig,
|
|
12
|
+
grazProviderProps,
|
|
13
|
+
onSwitchWallet
|
|
14
|
+
}) => {
|
|
15
|
+
const para = useInternalClient();
|
|
16
|
+
const { data: wallet } = useWallet();
|
|
17
|
+
const externalWalletsWithFullAuth = useStore((state) => state.externalWalletsWithFullAuth);
|
|
18
|
+
const wallets = useStore((state) => state.externalWallets);
|
|
19
|
+
const isUsing = wallets.some((w) => w in CosmosWallet);
|
|
20
|
+
return /* @__PURE__ */ jsx(
|
|
21
|
+
CosmosExternalWalletProvider,
|
|
22
|
+
{
|
|
23
|
+
config: cosmosConnectorConfig,
|
|
24
|
+
internalConfig: { onSwitchWallet, para, walletsWithFullAuth: externalWalletsWithFullAuth, connectedWallet: wallet },
|
|
25
|
+
grazProviderProps,
|
|
26
|
+
isUsing,
|
|
27
|
+
wallets,
|
|
28
|
+
children
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
export {
|
|
33
|
+
CosmosWalletWrapper
|
|
34
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../chunk-MMUBH76A.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { EvmExternalWalletProvider } from "../providers/EvmExternalWalletProvider.js";
|
|
5
|
+
import { useInternalClient } from "../hooks/utils/useInternalClient.js";
|
|
6
|
+
import { useStore } from "../stores/useStore.js";
|
|
7
|
+
import { EvmWallet } from "@getpara/react-common";
|
|
8
|
+
import { useWallet } from "../hooks/index.js";
|
|
9
|
+
const EvmWalletWrapper = ({
|
|
10
|
+
children,
|
|
11
|
+
evmProviderConfig,
|
|
12
|
+
wagmiProviderProps,
|
|
13
|
+
onSwitchWallet
|
|
14
|
+
}) => {
|
|
15
|
+
const para = useInternalClient();
|
|
16
|
+
const { data: wallet } = useWallet();
|
|
17
|
+
const externalWalletsWithFullAuth = useStore((state) => state.externalWalletsWithFullAuth);
|
|
18
|
+
const wallets = useStore((state) => state.externalWallets);
|
|
19
|
+
const isUsing = wallets.some((w) => w in EvmWallet);
|
|
20
|
+
return /* @__PURE__ */ jsx(
|
|
21
|
+
EvmExternalWalletProvider,
|
|
22
|
+
{
|
|
23
|
+
config: evmProviderConfig,
|
|
24
|
+
internalConfig: { onSwitchWallet, para, walletsWithFullAuth: externalWalletsWithFullAuth, connectedWallet: wallet },
|
|
25
|
+
wagmiProviderProps,
|
|
26
|
+
isUsing,
|
|
27
|
+
wallets,
|
|
28
|
+
children
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
export {
|
|
33
|
+
EvmWalletWrapper
|
|
34
|
+
};
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__spreadProps,
|
|
4
|
+
__spreadValues
|
|
5
|
+
} from "../../chunk-MMUBH76A.js";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
import { useCallback, useEffect, useMemo } from "react";
|
|
8
|
+
import { useModalStore } from "../../modal/stores/index.js";
|
|
9
|
+
import { ExternalWalletProvider } from "../providers/ExternalWalletProvider.js";
|
|
10
|
+
import { EvmWalletWrapper } from "./EvmWalletWrapper.js";
|
|
11
|
+
import { CosmosWalletWrapper } from "./CosmosWalletWrapper.js";
|
|
12
|
+
import { SolanaWalletWrapper } from "./SolanaWalletWrapper.js";
|
|
13
|
+
import { useStore } from "../stores/useStore.js";
|
|
14
|
+
const ExternalWalletWrapper = ({
|
|
15
|
+
children,
|
|
16
|
+
config
|
|
17
|
+
}) => {
|
|
18
|
+
var _a;
|
|
19
|
+
const { appDescription, appIcon, appUrl, walletConnect, evmConnector, cosmosConnector, solanaConnector } = config != null ? config : {};
|
|
20
|
+
const appName = useStore((state) => state.appName);
|
|
21
|
+
const resetModalState = useModalStore((state) => state.resetState);
|
|
22
|
+
const wallets = useStore((state) => state.externalWallets);
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
if (!!wallets.length && !(walletConnect == null ? void 0 : walletConnect.projectId)) {
|
|
25
|
+
console.warn(
|
|
26
|
+
"It is recommended to provide a WalletConnect project id to ensure wallet connection works as expected. Sign up for your free key at https://cloud.walletconnect.com/sign-in"
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
}, [wallets, walletConnect]);
|
|
30
|
+
const evmProviderConfig = useMemo(
|
|
31
|
+
() => {
|
|
32
|
+
var _a2, _b;
|
|
33
|
+
return !evmConnector ? {
|
|
34
|
+
appName,
|
|
35
|
+
chains: [
|
|
36
|
+
{
|
|
37
|
+
id: 11155111,
|
|
38
|
+
name: "Sepolia",
|
|
39
|
+
nativeCurrency: { name: "Sepolia Ether", symbol: "ETH", decimals: 18 },
|
|
40
|
+
rpcUrls: { default: { http: ["https://rpc.sepolia.org"] } },
|
|
41
|
+
blockExplorers: {
|
|
42
|
+
default: {
|
|
43
|
+
name: "Etherscan",
|
|
44
|
+
url: "https://sepolia.etherscan.io",
|
|
45
|
+
apiUrl: "https://api-sepolia.etherscan.io/api"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
contracts: {
|
|
49
|
+
multicall3: { address: "0xca11bde05977b3631167028862be2a173976ca11", blockCreated: 751532 },
|
|
50
|
+
ensRegistry: { address: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e" },
|
|
51
|
+
ensUniversalResolver: { address: "0xc8Af999e38273D658BE1b921b88A9Ddf005769cC", blockCreated: 5317080 }
|
|
52
|
+
},
|
|
53
|
+
testnet: true
|
|
54
|
+
}
|
|
55
|
+
],
|
|
56
|
+
projectId: (_a2 = walletConnect == null ? void 0 : walletConnect.projectId) != null ? _a2 : ""
|
|
57
|
+
} : __spreadValues({ appName, appDescription, appIcon, appUrl, projectId: (_b = walletConnect == null ? void 0 : walletConnect.projectId) != null ? _b : "" }, evmConnector == null ? void 0 : evmConnector.config);
|
|
58
|
+
},
|
|
59
|
+
[appName, appDescription, appIcon, appUrl, walletConnect == null ? void 0 : walletConnect.projectId, evmConnector]
|
|
60
|
+
);
|
|
61
|
+
const solanaProviderConfig = useMemo(() => {
|
|
62
|
+
var _a2, _b, _c, _d, _e, _f;
|
|
63
|
+
const appIdentity = {
|
|
64
|
+
name: (_b = (_a2 = solanaConnector == null ? void 0 : solanaConnector.config.appIdentity) == null ? void 0 : _a2.name) != null ? _b : appName,
|
|
65
|
+
uri: (_d = (_c = solanaConnector == null ? void 0 : solanaConnector.config.appIdentity) == null ? void 0 : _c.uri) != null ? _d : appUrl,
|
|
66
|
+
icon: (_f = (_e = solanaConnector == null ? void 0 : solanaConnector.config.appIdentity) == null ? void 0 : _e.icon) != null ? _f : appIcon
|
|
67
|
+
};
|
|
68
|
+
return !solanaConnector ? { appIdentity, chain: "devnet", endpoint: "https://api.devnet.solana.com" } : __spreadValues({ appIdentity }, solanaConnector == null ? void 0 : solanaConnector.config);
|
|
69
|
+
}, [solanaConnector]);
|
|
70
|
+
const cosmosProviderConfig = useMemo(
|
|
71
|
+
() => !cosmosConnector ? {
|
|
72
|
+
chains: [
|
|
73
|
+
{
|
|
74
|
+
chainId: "theta-testnet-001",
|
|
75
|
+
currencies: [{ coinDenom: "atom", coinMinimalDenom: "uatom", coinDecimals: 6 }],
|
|
76
|
+
rest: "https://cosmoshubt.lava.build",
|
|
77
|
+
rpc: "https://cosmoshubt.tendermintrpc.lava.build:443",
|
|
78
|
+
bech32Config: {
|
|
79
|
+
bech32PrefixAccAddr: "cosmos",
|
|
80
|
+
bech32PrefixAccPub: "cosmospub",
|
|
81
|
+
bech32PrefixValAddr: "cosmosvaloper",
|
|
82
|
+
bech32PrefixValPub: "cosmosvaloperpub",
|
|
83
|
+
bech32PrefixConsAddr: "cosmosvalcons",
|
|
84
|
+
bech32PrefixConsPub: "cosmosvalconspub"
|
|
85
|
+
},
|
|
86
|
+
chainName: "cosmoshubtestnet",
|
|
87
|
+
feeCurrencies: [
|
|
88
|
+
{
|
|
89
|
+
coinDenom: "atom",
|
|
90
|
+
coinMinimalDenom: "uatom",
|
|
91
|
+
coinDecimals: 6,
|
|
92
|
+
coinGeckoId: "",
|
|
93
|
+
gasPriceStep: { low: 0.01, average: 0.025, high: 0.03 }
|
|
94
|
+
}
|
|
95
|
+
],
|
|
96
|
+
stakeCurrency: { coinDenom: "atom", coinMinimalDenom: "uatom", coinDecimals: 6 },
|
|
97
|
+
bip44: { coinType: 118 }
|
|
98
|
+
}
|
|
99
|
+
],
|
|
100
|
+
onSwitchChain: () => {
|
|
101
|
+
}
|
|
102
|
+
} : cosmosConnector.config,
|
|
103
|
+
[cosmosConnector]
|
|
104
|
+
);
|
|
105
|
+
const grazProviderProps = useMemo(() => {
|
|
106
|
+
var _a2, _b;
|
|
107
|
+
const connectorsGrazProviderProps = cosmosConnector == null ? void 0 : cosmosConnector.grazProviderProps;
|
|
108
|
+
return __spreadProps(__spreadValues({}, connectorsGrazProviderProps), {
|
|
109
|
+
walletConnect: __spreadProps(__spreadValues({}, connectorsGrazProviderProps == null ? void 0 : connectorsGrazProviderProps.walletConnect), {
|
|
110
|
+
options: __spreadProps(__spreadValues({}, (_a2 = connectorsGrazProviderProps == null ? void 0 : connectorsGrazProviderProps.walletConnect) == null ? void 0 : _a2.options), { projectId: (_b = walletConnect == null ? void 0 : walletConnect.projectId) != null ? _b : "" })
|
|
111
|
+
})
|
|
112
|
+
});
|
|
113
|
+
}, [cosmosConnector, walletConnect == null ? void 0 : walletConnect.projectId]);
|
|
114
|
+
const handleSwitchWallet = useCallback(({ address, error }) => {
|
|
115
|
+
if (error || !address) {
|
|
116
|
+
resetModalState();
|
|
117
|
+
}
|
|
118
|
+
}, []);
|
|
119
|
+
return /* @__PURE__ */ jsx(
|
|
120
|
+
EvmWalletWrapper,
|
|
121
|
+
{
|
|
122
|
+
evmProviderConfig,
|
|
123
|
+
wagmiProviderProps: (_a = evmConnector == null ? void 0 : evmConnector.wagmiProviderProps) != null ? _a : {},
|
|
124
|
+
onSwitchWallet: handleSwitchWallet,
|
|
125
|
+
children: /* @__PURE__ */ jsx(
|
|
126
|
+
CosmosWalletWrapper,
|
|
127
|
+
{
|
|
128
|
+
cosmosConnectorConfig: cosmosProviderConfig,
|
|
129
|
+
grazProviderProps,
|
|
130
|
+
onSwitchWallet: handleSwitchWallet,
|
|
131
|
+
children: /* @__PURE__ */ jsx(SolanaWalletWrapper, { onSwitchWallet: handleSwitchWallet, solanaProviderConfig, children: /* @__PURE__ */ jsx(ExternalWalletProvider, { children }) })
|
|
132
|
+
}
|
|
133
|
+
)
|
|
134
|
+
}
|
|
135
|
+
);
|
|
136
|
+
};
|
|
137
|
+
export {
|
|
138
|
+
ExternalWalletWrapper
|
|
139
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../chunk-MMUBH76A.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { SolanaExternalWalletProvider } from "../providers/SolanaExternalWalletProvider.js";
|
|
5
|
+
import { useInternalClient } from "../hooks/utils/useInternalClient.js";
|
|
6
|
+
import { useStore } from "../stores/useStore.js";
|
|
7
|
+
import { SolanaWallet } from "@getpara/react-common";
|
|
8
|
+
const SolanaWalletWrapper = ({
|
|
9
|
+
children,
|
|
10
|
+
solanaProviderConfig,
|
|
11
|
+
onSwitchWallet
|
|
12
|
+
}) => {
|
|
13
|
+
const externalWalletsWithFullAuth = useStore((state) => state.externalWalletsWithFullAuth);
|
|
14
|
+
const para = useInternalClient();
|
|
15
|
+
const wallets = useStore((state) => state.externalWallets);
|
|
16
|
+
const isUsing = wallets.some((w) => w in SolanaWallet);
|
|
17
|
+
if (!solanaProviderConfig) {
|
|
18
|
+
if (isUsing) {
|
|
19
|
+
throw new Error("A valid solanaConnector config is required to use an external Solana wallet.");
|
|
20
|
+
}
|
|
21
|
+
return children;
|
|
22
|
+
}
|
|
23
|
+
return /* @__PURE__ */ jsx(
|
|
24
|
+
SolanaExternalWalletProvider,
|
|
25
|
+
{
|
|
26
|
+
config: solanaProviderConfig,
|
|
27
|
+
internalConfig: { onSwitchWallet, para, walletsWithFullAuth: externalWalletsWithFullAuth },
|
|
28
|
+
isUsing,
|
|
29
|
+
wallets,
|
|
30
|
+
children
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
};
|
|
34
|
+
export {
|
|
35
|
+
SolanaWalletWrapper
|
|
36
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__async
|
|
4
|
+
} from "../../chunk-MMUBH76A.js";
|
|
5
|
+
import { CosmosExternalWalletContext } from "./stubs/CosmosExternalWalletContextStub.js";
|
|
6
|
+
const getParaCosmosConnector = () => __async(void 0, null, function* () {
|
|
7
|
+
let Provider, context, wallets;
|
|
8
|
+
try {
|
|
9
|
+
const lib = yield import("@getpara/cosmos-wallet-connectors");
|
|
10
|
+
Provider = lib.ParaCosmosProvider;
|
|
11
|
+
context = lib.CosmosExternalWalletContext;
|
|
12
|
+
wallets = lib.allWallets;
|
|
13
|
+
} catch (e) {
|
|
14
|
+
Provider = void 0;
|
|
15
|
+
context = CosmosExternalWalletContext;
|
|
16
|
+
wallets = [];
|
|
17
|
+
}
|
|
18
|
+
return { Provider, context, wallets };
|
|
19
|
+
});
|
|
20
|
+
export {
|
|
21
|
+
getParaCosmosConnector
|
|
22
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__async
|
|
4
|
+
} from "../../chunk-MMUBH76A.js";
|
|
5
|
+
import { EvmExternalWalletContext } from "./stubs/EvmExternalWalletContextStub.js";
|
|
6
|
+
const getParaEvmConnector = () => __async(void 0, null, function* () {
|
|
7
|
+
let Provider, context, wallets;
|
|
8
|
+
try {
|
|
9
|
+
const lib = yield import("@getpara/evm-wallet-connectors");
|
|
10
|
+
Provider = lib.ParaEvmProvider;
|
|
11
|
+
context = lib.EvmExternalWalletContext;
|
|
12
|
+
wallets = lib.allWallets;
|
|
13
|
+
} catch (e) {
|
|
14
|
+
Provider = void 0;
|
|
15
|
+
context = EvmExternalWalletContext;
|
|
16
|
+
wallets = [];
|
|
17
|
+
}
|
|
18
|
+
return { Provider, context, wallets };
|
|
19
|
+
});
|
|
20
|
+
export {
|
|
21
|
+
getParaEvmConnector
|
|
22
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__async
|
|
4
|
+
} from "../../chunk-MMUBH76A.js";
|
|
5
|
+
import { SolanaExternalWalletContext } from "./stubs/SolanaExternalWalletContextStub.js";
|
|
6
|
+
const getParaSolanaConnector = () => __async(void 0, null, function* () {
|
|
7
|
+
let Provider, context, wallets;
|
|
8
|
+
try {
|
|
9
|
+
const lib = yield import("@getpara/solana-wallet-connectors");
|
|
10
|
+
Provider = lib.ParaSolanaProvider;
|
|
11
|
+
context = lib.SolanaExternalWalletContext;
|
|
12
|
+
wallets = lib.allWallets;
|
|
13
|
+
} catch (e) {
|
|
14
|
+
Provider = void 0;
|
|
15
|
+
context = SolanaExternalWalletContext;
|
|
16
|
+
wallets = [];
|
|
17
|
+
}
|
|
18
|
+
return { Provider, context, wallets };
|
|
19
|
+
});
|
|
20
|
+
export {
|
|
21
|
+
getParaSolanaConnector
|
|
22
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../../chunk-MMUBH76A.js";
|
|
3
|
+
import { createContext } from "react";
|
|
4
|
+
const defaultCosmosExternalWallet = {
|
|
5
|
+
wallets: [],
|
|
6
|
+
chains: [],
|
|
7
|
+
chainId: void 0,
|
|
8
|
+
disconnect: () => Promise.resolve(),
|
|
9
|
+
switchChain: () => Promise.resolve({}),
|
|
10
|
+
connectParaEmbedded: () => Promise.resolve({}),
|
|
11
|
+
signMessage: () => Promise.resolve({}),
|
|
12
|
+
signVerificationMessage: () => Promise.resolve({})
|
|
13
|
+
};
|
|
14
|
+
const CosmosExternalWalletContext = createContext(defaultCosmosExternalWallet);
|
|
15
|
+
export {
|
|
16
|
+
CosmosExternalWalletContext,
|
|
17
|
+
defaultCosmosExternalWallet
|
|
18
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../../chunk-MMUBH76A.js";
|
|
3
|
+
import { createContext } from "react";
|
|
4
|
+
const defaultEvmExternalWallet = {
|
|
5
|
+
wallets: [],
|
|
6
|
+
chains: [],
|
|
7
|
+
chainId: void 0,
|
|
8
|
+
username: void 0,
|
|
9
|
+
avatar: void 0,
|
|
10
|
+
disconnect: () => Promise.resolve(),
|
|
11
|
+
switchChain: () => Promise.resolve({}),
|
|
12
|
+
connectParaEmbedded: () => Promise.resolve({}),
|
|
13
|
+
signMessage: () => Promise.resolve({}),
|
|
14
|
+
signVerificationMessage: () => Promise.resolve({}),
|
|
15
|
+
getWalletBalance: () => Promise.resolve(void 0)
|
|
16
|
+
};
|
|
17
|
+
const EvmExternalWalletContext = createContext(defaultEvmExternalWallet);
|
|
18
|
+
export {
|
|
19
|
+
EvmExternalWalletContext,
|
|
20
|
+
defaultEvmExternalWallet
|
|
21
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../../chunk-MMUBH76A.js";
|
|
3
|
+
import { createContext } from "react";
|
|
4
|
+
const defaultSolanaExternalWallet = {
|
|
5
|
+
wallets: [],
|
|
6
|
+
disconnect: () => Promise.resolve(),
|
|
7
|
+
signMessage: () => Promise.resolve({}),
|
|
8
|
+
signVerificationMessage: () => Promise.resolve({})
|
|
9
|
+
};
|
|
10
|
+
const SolanaExternalWalletContext = createContext(defaultSolanaExternalWallet);
|
|
11
|
+
export {
|
|
12
|
+
SolanaExternalWalletContext,
|
|
13
|
+
defaultSolanaExternalWallet
|
|
14
|
+
};
|
|
@@ -21,5 +21,6 @@ export declare const useCreatePregenWalletPerType: () => import("../../types/uti
|
|
|
21
21
|
export declare const useClaimPregenWallets: () => import("../../types/utils.js").CoreMethodHook<"claimPregenWallets">;
|
|
22
22
|
export declare const useHasPregenWallet: () => import("../../types/utils.js").CoreMethodHook<"hasPregenWallet">;
|
|
23
23
|
export declare const useUpdatePregenWalletIdentifier: () => import("../../types/utils.js").CoreMethodHook<"updatePregenWalletIdentifier">;
|
|
24
|
+
export declare const useCreateGuestWallets: () => import("../../types/utils.js").CoreMethodHook<"createGuestWallets">;
|
|
24
25
|
export declare const useSignMessage: () => import("../../types/utils.js").CoreMethodHook<"signMessage">;
|
|
25
26
|
export declare const useSignTransaction: () => import("../../types/utils.js").CoreMethodHook<"signTransaction">;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../../chunk-MMUBH76A.js";
|
|
3
|
+
import * as actions from "../../actions/index.js";
|
|
4
|
+
import { generateHook } from "./utils.js";
|
|
5
|
+
const useSignUpOrLogIn = generateHook("signUpOrLogIn", actions.signUpOrLogIn);
|
|
6
|
+
const useVerifyNewAccount = generateHook("verifyNewAccount", actions.verifyNewAccount);
|
|
7
|
+
const useWaitForLogin = generateHook("waitForLogin", actions.waitForLogin);
|
|
8
|
+
const useWaitForSignup = generateHook("waitForSignup", actions.waitForSignup);
|
|
9
|
+
const useWaitForWalletCreation = generateHook("waitForWalletCreation", actions.waitForWalletCreation);
|
|
10
|
+
const useVerifyOAuth = generateHook("verifyOAuth", actions.verifyOAuth);
|
|
11
|
+
const useVerifyFarcaster = generateHook("verifyFarcaster", actions.verifyFarcaster);
|
|
12
|
+
const useVerifyTelegram = generateHook("verifyTelegram", actions.verifyTelegram);
|
|
13
|
+
const useLoginExternalWallet = generateHook("loginExternalWallet", actions.loginExternalWallet);
|
|
14
|
+
const useVerifyExternalWallet = generateHook("verifyExternalWallet", actions.verifyExternalWallet);
|
|
15
|
+
const useSetup2fa = generateHook("setup2fa", actions.setup2fa);
|
|
16
|
+
const useEnable2fa = generateHook("enable2fa", actions.enable2fa);
|
|
17
|
+
const useVerify2fa = generateHook("verify2fa", actions.verify2fa);
|
|
18
|
+
const useKeepSessionAlive = generateHook("keepSessionAlive", actions.keepSessionAlive);
|
|
19
|
+
const useLogout = generateHook("logout", actions.logout);
|
|
20
|
+
const useResendVerificationCode = generateHook("resendVerificationCode", actions.resendVerificationCode);
|
|
21
|
+
const useCreateWallet = generateHook("createWallet", actions.createWallet);
|
|
22
|
+
const useCreateWalletPerType = generateHook("createWalletPerType", actions.createWalletPerType);
|
|
23
|
+
const useCreatePregenWallet = generateHook("createPregenWallet", actions.createPregenWallet);
|
|
24
|
+
const useCreatePregenWalletPerType = generateHook("createPregenWalletPerType", actions.createPregenWalletPerType);
|
|
25
|
+
const useClaimPregenWallets = generateHook("claimPregenWallets", actions.claimPregenWallets);
|
|
26
|
+
const useHasPregenWallet = generateHook("hasPregenWallet", actions.hasPregenWallet);
|
|
27
|
+
const useUpdatePregenWalletIdentifier = generateHook(
|
|
28
|
+
"updatePregenWalletIdentifier",
|
|
29
|
+
actions.updatePregenWalletIdentifier
|
|
30
|
+
);
|
|
31
|
+
const useCreateGuestWallets = generateHook("createGuestWallets", actions.createGuestWallets);
|
|
32
|
+
const useSignMessage = generateHook("signMessage", actions.signMessage);
|
|
33
|
+
const useSignTransaction = generateHook("signTransaction", actions.signTransaction);
|
|
34
|
+
export {
|
|
35
|
+
useClaimPregenWallets,
|
|
36
|
+
useCreateGuestWallets,
|
|
37
|
+
useCreatePregenWallet,
|
|
38
|
+
useCreatePregenWalletPerType,
|
|
39
|
+
useCreateWallet,
|
|
40
|
+
useCreateWalletPerType,
|
|
41
|
+
useEnable2fa,
|
|
42
|
+
useHasPregenWallet,
|
|
43
|
+
useKeepSessionAlive,
|
|
44
|
+
useLoginExternalWallet,
|
|
45
|
+
useLogout,
|
|
46
|
+
useResendVerificationCode,
|
|
47
|
+
useSetup2fa,
|
|
48
|
+
useSignMessage,
|
|
49
|
+
useSignTransaction,
|
|
50
|
+
useSignUpOrLogIn,
|
|
51
|
+
useUpdatePregenWalletIdentifier,
|
|
52
|
+
useVerify2fa,
|
|
53
|
+
useVerifyExternalWallet,
|
|
54
|
+
useVerifyFarcaster,
|
|
55
|
+
useVerifyNewAccount,
|
|
56
|
+
useVerifyOAuth,
|
|
57
|
+
useVerifyTelegram,
|
|
58
|
+
useWaitForLogin,
|
|
59
|
+
useWaitForSignup,
|
|
60
|
+
useWaitForWalletCreation
|
|
61
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__async
|
|
4
|
+
} from "../../../chunk-MMUBH76A.js";
|
|
5
|
+
import { renameCoreMutations } from "../../utils/renameMutations.js";
|
|
6
|
+
import { useClient } from "../utils/index.js";
|
|
7
|
+
import { useMutation } from "@tanstack/react-query";
|
|
8
|
+
function generateHook(method, action, defaultParams) {
|
|
9
|
+
return () => {
|
|
10
|
+
const para = useClient();
|
|
11
|
+
const mutation = useMutation({
|
|
12
|
+
mutationFn: (args) => __async(this, null, function* () {
|
|
13
|
+
const result = yield action(para, args != null ? args : defaultParams);
|
|
14
|
+
return result;
|
|
15
|
+
})
|
|
16
|
+
});
|
|
17
|
+
return renameCoreMutations(mutation, method);
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
generateHook
|
|
22
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../../chunk-MMUBH76A.js";
|
|
3
|
+
import { useAccount } from "./useAccount.js";
|
|
4
|
+
import { useWallet } from "./useWallet.js";
|
|
5
|
+
import { useWalletBalance } from "./useWalletBalance.js";
|
|
6
|
+
export {
|
|
7
|
+
useAccount,
|
|
8
|
+
useWallet,
|
|
9
|
+
useWalletBalance
|
|
10
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__async
|
|
4
|
+
} from "../../../chunk-MMUBH76A.js";
|
|
5
|
+
import { useQuery } from "@tanstack/react-query";
|
|
6
|
+
import { getAccount } from "../../actions/getAccount.js";
|
|
7
|
+
import { useInternalClient } from "../utils/useInternalClient.js";
|
|
8
|
+
const ACCOUNT_BASE_KEY = "PARA_ACCOUNT";
|
|
9
|
+
const useAccount = () => {
|
|
10
|
+
const client = useInternalClient();
|
|
11
|
+
return useQuery({
|
|
12
|
+
queryKey: [ACCOUNT_BASE_KEY, client == null ? void 0 : client.getUserId()],
|
|
13
|
+
queryFn: () => __async(void 0, null, function* () {
|
|
14
|
+
return yield getAccount(client);
|
|
15
|
+
})
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
export {
|
|
19
|
+
ACCOUNT_BASE_KEY,
|
|
20
|
+
useAccount
|
|
21
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__async
|
|
4
|
+
} from "../../../chunk-MMUBH76A.js";
|
|
5
|
+
import { useQuery } from "@tanstack/react-query";
|
|
6
|
+
import { useClient, useWalletState } from "../index.js";
|
|
7
|
+
import { getWallet } from "../../actions/getWallet.js";
|
|
8
|
+
const WALLET_BASE_KEY = "PARA_WALLET";
|
|
9
|
+
const useWallet = () => {
|
|
10
|
+
const client = useClient();
|
|
11
|
+
const { selectedWallet } = useWalletState();
|
|
12
|
+
return useQuery({
|
|
13
|
+
queryKey: [WALLET_BASE_KEY, client == null ? void 0 : client.getUserId(), selectedWallet.id, selectedWallet.type],
|
|
14
|
+
queryFn: () => __async(void 0, null, function* () {
|
|
15
|
+
return yield getWallet(client, selectedWallet);
|
|
16
|
+
})
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
WALLET_BASE_KEY,
|
|
21
|
+
useWallet
|
|
22
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { GetWalletBalanceParams } from '@getpara/web-sdk';
|
|
2
|
+
export declare const WALLET_BALANCE_BASE_KEY = "PARA_WALLET_BALANCE";
|
|
3
|
+
/**
|
|
4
|
+
* Hook for retrieving a wallet balance
|
|
5
|
+
*/
|
|
6
|
+
export declare const useWalletBalance: (args?: Partial<GetWalletBalanceParams>) => import("@tanstack/react-query").UseQueryResult<string | null, Error>;
|