@getpara/react-sdk-lite 2.0.0-alpha.33
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/chunk-MMUBH76A.js +59 -0
- package/dist/cli/cli.mjs +51 -0
- package/dist/css/modal.css +13 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +10 -0
- package/dist/modal/ParaModal.d.ts +2 -0
- package/dist/modal/ParaModal.js +308 -0
- package/dist/modal/components/Account/Account.d.ts +5 -0
- package/dist/modal/components/Account/Account.js +148 -0
- package/dist/modal/components/Account/AccountProfile.d.ts +1 -0
- package/dist/modal/components/Account/AccountProfile.js +168 -0
- package/dist/modal/components/Account/AccountProfileLink.d.ts +1 -0
- package/dist/modal/components/Account/AccountProfileLink.js +206 -0
- package/dist/modal/components/Account/AccountProfileLinkOptions.d.ts +1 -0
- package/dist/modal/components/Account/AccountProfileLinkOptions.js +111 -0
- package/dist/modal/components/Account/AccountProfileUnlink.d.ts +1 -0
- package/dist/modal/components/Account/AccountProfileUnlink.js +47 -0
- package/dist/modal/components/AddFunds/AddFunds.d.ts +1 -0
- 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.d.ts +1 -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.d.ts +6 -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/modal/components/AddFunds/MoonPayEmbed.d.ts +2 -0
- package/dist/modal/components/AddFunds/MoonPayEmbed.js +7 -0
- 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.d.ts +3 -0
- package/dist/modal/components/AddFunds/index.js +4 -0
- package/dist/modal/components/AuthInput/AuthInput.d.ts +20 -0
- package/dist/modal/components/AuthInput/AuthInput.js +277 -0
- package/dist/modal/components/AuthInput/hooks/useDropdownPosition.d.ts +7 -0
- package/dist/modal/components/AuthInput/hooks/useDropdownPosition.js +33 -0
- package/dist/modal/components/AuthInput/phoneMasks.d.ts +247 -0
- package/dist/modal/components/AuthInput/phoneMasks.js +253 -0
- package/dist/modal/components/AuthMainStep/AuthMainStep.d.ts +9 -0
- package/dist/modal/components/AuthMainStep/AuthMainStep.js +50 -0
- package/dist/modal/components/AuthMainStep/AuthMainStepContent.d.ts +9 -0
- package/dist/modal/components/AuthMainStep/AuthMainStepContent.js +179 -0
- package/dist/modal/components/AuthOptions/AuthOptions.d.ts +9 -0
- package/dist/modal/components/AuthOptions/AuthOptions.js +85 -0
- package/dist/modal/components/AwaitingBiometricsStep/AwaitingBiometricsStep.d.ts +1 -0
- package/dist/modal/components/AwaitingBiometricsStep/AwaitingBiometricsStep.js +18 -0
- package/dist/modal/components/AwaitingIFrameStep/AwaitingIFrameStep.d.ts +1 -0
- package/dist/modal/components/AwaitingIFrameStep/AwaitingIFrameStep.js +12 -0
- package/dist/modal/components/AwaitingOAuthStep/AwaitingOAuthStep.d.ts +1 -0
- package/dist/modal/components/AwaitingOAuthStep/AwaitingOAuthStep.js +10 -0
- package/dist/modal/components/AwaitingPasswordStep/AwaitingPasswordStep.d.ts +1 -0
- package/dist/modal/components/AwaitingPasswordStep/AwaitingPasswordStep.js +18 -0
- package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.d.ts +5 -0
- package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.js +49 -0
- package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.d.ts +1 -0
- package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.js +62 -0
- package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.d.ts +1 -0
- package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.js +48 -0
- package/dist/modal/components/Body/AnimatedHeightWrapper.d.ts +6 -0
- package/dist/modal/components/Body/AnimatedHeightWrapper.js +29 -0
- package/dist/modal/components/Body/Body.d.ts +11 -0
- package/dist/modal/components/Body/Body.js +354 -0
- package/dist/modal/components/ChainSwitch/ChainSwitch.d.ts +1 -0
- package/dist/modal/components/ChainSwitch/ChainSwitch.js +95 -0
- package/dist/modal/components/ChainSwitch/config.d.ts +7 -0
- package/dist/modal/components/ChainSwitch/config.js +17 -0
- package/dist/modal/components/Controls/Controls.d.ts +5 -0
- package/dist/modal/components/Controls/Controls.js +78 -0
- package/dist/modal/components/Controls/Selects.d.ts +2 -0
- package/dist/modal/components/Controls/Selects.js +173 -0
- package/dist/modal/components/ExternalWalletNetworkSelectStep/ExternalWalletNetworkSelectStep.d.ts +1 -0
- package/dist/modal/components/ExternalWalletNetworkSelectStep/ExternalWalletNetworkSelectStep.js +75 -0
- package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.d.ts +8 -0
- package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.js +175 -0
- package/dist/modal/components/ExternalWalletStep/config.d.ts +7 -0
- package/dist/modal/components/ExternalWalletStep/config.js +17 -0
- package/dist/modal/components/ExternalWalletVerificationStep/ExternalWalletVerificationStep.d.ts +1 -0
- package/dist/modal/components/ExternalWalletVerificationStep/ExternalWalletVerificationStep.js +39 -0
- package/dist/modal/components/ExternalWallets/ExternalWallets.d.ts +1 -0
- package/dist/modal/components/ExternalWallets/ExternalWallets.js +182 -0
- package/dist/modal/components/Footer/Footer.d.ts +1 -0
- package/dist/modal/components/Footer/Footer.js +95 -0
- package/dist/modal/components/Header/Header.d.ts +1 -0
- package/dist/modal/components/Header/Header.js +43 -0
- package/dist/modal/components/Header/hooks/useStepTitle.d.ts +3 -0
- package/dist/modal/components/Header/hooks/useStepTitle.js +62 -0
- package/dist/modal/components/Hero/Hero.d.ts +1 -0
- package/dist/modal/components/Hero/Hero.js +116 -0
- package/dist/modal/components/IFrameStep/IFrameStep.d.ts +1 -0
- package/dist/modal/components/IFrameStep/IFrameStep.js +70 -0
- package/dist/modal/components/LoginDoneStep/LoginDoneStep.d.ts +5 -0
- package/dist/modal/components/LoginDoneStep/LoginDoneStep.js +44 -0
- package/dist/modal/components/ModalContent/ModalContent.d.ts +10 -0
- package/dist/modal/components/ModalContent/ModalContent.js +88 -0
- package/dist/modal/components/OAuth/FarcasterOAuthStep.d.ts +3 -0
- package/dist/modal/components/OAuth/FarcasterOAuthStep.js +31 -0
- package/dist/modal/components/OAuth/OAuth.d.ts +6 -0
- package/dist/modal/components/OAuth/OAuth.js +81 -0
- package/dist/modal/components/OAuth/TelegramOAuthStep.d.ts +8 -0
- package/dist/modal/components/OAuth/TelegramOAuthStep.js +74 -0
- package/dist/modal/components/OnRampComponents/AddingFunds.d.ts +1 -0
- package/dist/modal/components/OnRampComponents/AddingFunds.js +23 -0
- package/dist/modal/components/OnRampComponents/OnRampProviderButton.d.ts +9 -0
- package/dist/modal/components/OnRampComponents/OnRampProviderButton.js +77 -0
- package/dist/modal/components/RecoverySecretStep/RecoverySecretStep.d.ts +6 -0
- package/dist/modal/components/RecoverySecretStep/RecoverySecretStep.js +107 -0
- package/dist/modal/components/Setup2FAStep/Setup2FAStep.d.ts +5 -0
- package/dist/modal/components/Setup2FAStep/Setup2FAStep.js +132 -0
- package/dist/modal/components/TwoFactorDoneStep/TwoFactorDoneStep.d.ts +5 -0
- package/dist/modal/components/TwoFactorDoneStep/TwoFactorDoneStep.js +27 -0
- package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.d.ts +12 -0
- package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.js +160 -0
- package/dist/modal/components/Waiting/Waiting.d.ts +6 -0
- package/dist/modal/components/Waiting/Waiting.js +17 -0
- package/dist/modal/components/WalletCard/PartnerIcon.d.ts +6 -0
- package/dist/modal/components/WalletCard/PartnerIcon.js +34 -0
- package/dist/modal/components/WalletCard/WalletCard.d.ts +18 -0
- package/dist/modal/components/WalletCard/WalletCard.js +128 -0
- package/dist/modal/components/WalletCreationDoneStep/WalletCreationDoneStep.d.ts +6 -0
- package/dist/modal/components/WalletCreationDoneStep/WalletCreationDoneStep.js +83 -0
- package/dist/modal/components/common.d.ts +59 -0
- package/dist/modal/components/common.js +261 -0
- package/dist/modal/components/index.d.ts +1 -0
- package/dist/modal/components/index.js +2 -0
- package/dist/modal/constants/constants.d.ts +40 -0
- package/dist/modal/constants/constants.js +142 -0
- package/dist/modal/constants/defaults.d.ts +5 -0
- package/dist/modal/constants/defaults.js +10 -0
- package/dist/modal/constants/oAuthLogos.d.ts +17 -0
- package/dist/modal/constants/oAuthLogos.js +158 -0
- package/dist/modal/constants/walletTypeConfig.d.ts +6 -0
- package/dist/modal/constants/walletTypeConfig.js +13 -0
- package/dist/modal/hooks/useGoBack.d.ts +1 -0
- package/dist/modal/hooks/useGoBack.js +43 -0
- package/dist/modal/hooks/useTelegramLogin.d.ts +12 -0
- package/dist/modal/hooks/useTelegramLogin.js +65 -0
- package/dist/modal/index.d.ts +8 -0
- package/dist/modal/index.js +29 -0
- package/dist/modal/stores/index.d.ts +1 -0
- package/dist/modal/stores/index.js +2 -0
- package/dist/modal/stores/modal/actions.d.ts +3 -0
- package/dist/modal/stores/modal/actions.js +139 -0
- package/dist/modal/stores/modal/useModalStore.d.ts +105 -0
- package/dist/modal/stores/modal/useModalStore.js +75 -0
- package/dist/modal/types/commonTypes.d.ts +6 -0
- package/dist/modal/types/commonTypes.js +1 -0
- package/dist/modal/types/modalProps.d.ts +129 -0
- package/dist/modal/types/modalProps.js +12 -0
- package/dist/modal/utils/authInputHelpers.d.ts +5 -0
- package/dist/modal/utils/authInputHelpers.js +41 -0
- package/dist/modal/utils/authLayoutHelpers.d.ts +3 -0
- package/dist/modal/utils/authLayoutHelpers.js +8 -0
- package/dist/modal/utils/countryCodes.d.ts +8 -0
- package/dist/modal/utils/countryCodes.js +45 -0
- package/dist/modal/utils/getMailtoLink.d.ts +1 -0
- package/dist/modal/utils/getMailtoLink.js +10 -0
- package/dist/modal/utils/getTileButtonFlex.d.ts +1 -0
- package/dist/modal/utils/getTileButtonFlex.js +20 -0
- package/dist/modal/utils/getWalletDisplayName.d.ts +5 -0
- package/dist/modal/utils/getWalletDisplayName.js +22 -0
- package/dist/modal/utils/isPasskeySupported.d.ts +1 -0
- package/dist/modal/utils/isPasskeySupported.js +15 -0
- package/dist/modal/utils/openPopup.d.ts +6 -0
- package/dist/modal/utils/openPopup.js +60 -0
- package/dist/modal/utils/routeMobileExternalWallet.d.ts +1 -0
- package/dist/modal/utils/routeMobileExternalWallet.js +31 -0
- package/dist/modal/utils/steps.d.ts +136 -0
- package/dist/modal/utils/steps.js +279 -0
- package/dist/modal/utils/stringFormatters.d.ts +5 -0
- package/dist/modal/utils/stringFormatters.js +19 -0
- package/dist/modal/utils/validateOnRampConfig.d.ts +5 -0
- package/dist/modal/utils/validateOnRampConfig.js +32 -0
- package/dist/package.json +6 -0
- package/dist/provider/ParaProvider.d.ts +4 -0
- package/dist/provider/ParaProvider.js +140 -0
- package/dist/provider/actions/getEmbeddedAccount.d.ts +26 -0
- package/dist/provider/actions/getEmbeddedAccount.js +57 -0
- package/dist/provider/actions/getWallet.d.ts +5 -0
- package/dist/provider/actions/getWallet.js +18 -0
- package/dist/provider/actions/index.d.ts +47 -0
- package/dist/provider/actions/index.js +79 -0
- package/dist/provider/actions/utils.d.ts +4 -0
- package/dist/provider/actions/utils.js +34 -0
- package/dist/provider/components/CosmosWalletWrapper.d.ts +11 -0
- package/dist/provider/components/CosmosWalletWrapper.js +43 -0
- package/dist/provider/components/EvmWalletWrapper.d.ts +12 -0
- package/dist/provider/components/EvmWalletWrapper.js +43 -0
- package/dist/provider/components/ExternalWalletWrapper.d.ts +8 -0
- package/dist/provider/components/ExternalWalletWrapper.js +140 -0
- package/dist/provider/components/SolanaWalletWrapper.d.ts +9 -0
- package/dist/provider/components/SolanaWalletWrapper.js +44 -0
- package/dist/provider/external/getParaCosmosConnector.d.ts +7 -0
- package/dist/provider/external/getParaCosmosConnector.js +19 -0
- package/dist/provider/external/getParaCosmosLib.d.ts +4 -0
- package/dist/provider/external/getParaCosmosLib.js +16 -0
- package/dist/provider/external/getParaEvmConnector.d.ts +7 -0
- package/dist/provider/external/getParaEvmConnector.js +19 -0
- package/dist/provider/external/getParaEvmLib.d.ts +4 -0
- package/dist/provider/external/getParaEvmLib.js +16 -0
- package/dist/provider/external/getParaSolanaConnector.d.ts +7 -0
- package/dist/provider/external/getParaSolanaConnector.js +19 -0
- package/dist/provider/external/getParaSolanaLib.d.ts +4 -0
- package/dist/provider/external/getParaSolanaLib.js +16 -0
- package/dist/provider/external/stubs/CosmosExternalWalletContextStub.d.ts +2 -0
- package/dist/provider/external/stubs/CosmosExternalWalletContextStub.js +8 -0
- package/dist/provider/external/stubs/EvmExternalWalletContextStub.d.ts +2 -0
- package/dist/provider/external/stubs/EvmExternalWalletContextStub.js +8 -0
- package/dist/provider/external/stubs/SolanaExternalWalletContextStub.d.ts +2 -0
- package/dist/provider/external/stubs/SolanaExternalWalletContextStub.js +8 -0
- package/dist/provider/hooks/index.d.ts +3 -0
- package/dist/provider/hooks/index.js +4 -0
- package/dist/provider/hooks/mutations/core.d.ts +27 -0
- package/dist/provider/hooks/mutations/core.js +66 -0
- package/dist/provider/hooks/mutations/index.d.ts +3 -0
- package/dist/provider/hooks/mutations/index.js +9 -0
- package/dist/provider/hooks/mutations/useLinkAccount.d.ts +9 -0
- package/dist/provider/hooks/mutations/useLinkAccount.js +18 -0
- package/dist/provider/hooks/mutations/utils.d.ts +12 -0
- package/dist/provider/hooks/mutations/utils.js +90 -0
- package/dist/provider/hooks/queries/core.d.ts +4 -0
- package/dist/provider/hooks/queries/core.js +16 -0
- package/dist/provider/hooks/queries/index.d.ts +5 -0
- package/dist/provider/hooks/queries/index.js +13 -0
- package/dist/provider/hooks/queries/useAccount.d.ts +90 -0
- package/dist/provider/hooks/queries/useAccount.js +141 -0
- package/dist/provider/hooks/queries/useIsFullyLoggedIn.d.ts +5 -0
- package/dist/provider/hooks/queries/useIsFullyLoggedIn.js +24 -0
- package/dist/provider/hooks/queries/useParaStatus.d.ts +22 -0
- package/dist/provider/hooks/queries/useParaStatus.js +25 -0
- package/dist/provider/hooks/queries/useWallet.d.ts +5 -0
- package/dist/provider/hooks/queries/useWallet.js +26 -0
- package/dist/provider/hooks/queries/useWalletBalance.d.ts +6 -0
- package/dist/provider/hooks/queries/useWalletBalance.js +55 -0
- package/dist/provider/hooks/queries/utils.d.ts +7 -0
- package/dist/provider/hooks/queries/utils.js +25 -0
- package/dist/provider/hooks/utils/index.d.ts +3 -0
- package/dist/provider/hooks/utils/index.js +10 -0
- package/dist/provider/hooks/utils/useAutoSessionKeepAlive.d.ts +3 -0
- package/dist/provider/hooks/utils/useAutoSessionKeepAlive.js +74 -0
- package/dist/provider/hooks/utils/useClient.d.ts +5 -0
- package/dist/provider/hooks/utils/useClient.js +10 -0
- package/dist/provider/hooks/utils/useEventListeners.d.ts +2 -0
- package/dist/provider/hooks/utils/useEventListeners.js +157 -0
- package/dist/provider/hooks/utils/useFormattedBiometricHints.d.ts +4 -0
- package/dist/provider/hooks/utils/useFormattedBiometricHints.js +27 -0
- package/dist/provider/hooks/utils/useInternalClient.d.ts +5 -0
- package/dist/provider/hooks/utils/useInternalClient.js +10 -0
- package/dist/provider/hooks/utils/useModal.d.ts +11 -0
- package/dist/provider/hooks/utils/useModal.js +27 -0
- package/dist/provider/hooks/utils/useWalletState.d.ts +15 -0
- package/dist/provider/hooks/utils/useWalletState.js +48 -0
- package/dist/provider/index.d.ts +6 -0
- package/dist/provider/index.js +11 -0
- package/dist/provider/providers/AccountLinkProvider.d.ts +47 -0
- package/dist/provider/providers/AccountLinkProvider.js +452 -0
- package/dist/provider/providers/AuthProvider.d.ts +38 -0
- package/dist/provider/providers/AuthProvider.js +575 -0
- package/dist/provider/providers/CosmosExternalWalletProvider.d.ts +7 -0
- package/dist/provider/providers/CosmosExternalWalletProvider.js +66 -0
- package/dist/provider/providers/EvmExternalWalletProvider.d.ts +7 -0
- package/dist/provider/providers/EvmExternalWalletProvider.js +74 -0
- package/dist/provider/providers/ExternalWalletProvider.d.ts +61 -0
- package/dist/provider/providers/ExternalWalletProvider.js +626 -0
- package/dist/provider/providers/SolanaExternalWalletProvider.d.ts +7 -0
- package/dist/provider/providers/SolanaExternalWalletProvider.js +66 -0
- package/dist/provider/stores/getters.d.ts +4 -0
- package/dist/provider/stores/getters.js +13 -0
- package/dist/provider/stores/setters.d.ts +1 -0
- package/dist/provider/stores/setters.js +7 -0
- package/dist/provider/stores/slices/analytics.d.ts +3 -0
- package/dist/provider/stores/slices/analytics.js +9 -0
- package/dist/provider/stores/slices/client.d.ts +3 -0
- package/dist/provider/stores/slices/client.js +9 -0
- package/dist/provider/stores/slices/config.d.ts +3 -0
- package/dist/provider/stores/slices/config.js +11 -0
- package/dist/provider/stores/slices/externalWallets.d.ts +3 -0
- package/dist/provider/stores/slices/externalWallets.js +46 -0
- package/dist/provider/stores/slices/index.d.ts +5 -0
- package/dist/provider/stores/slices/index.js +6 -0
- package/dist/provider/stores/slices/modal.d.ts +3 -0
- package/dist/provider/stores/slices/modal.js +18 -0
- package/dist/provider/stores/slices/wallet.d.ts +3 -0
- package/dist/provider/stores/slices/wallet.js +13 -0
- package/dist/provider/stores/types.d.ts +86 -0
- package/dist/provider/stores/types.js +1 -0
- package/dist/provider/stores/useStore.d.ts +17 -0
- package/dist/provider/stores/useStore.js +34 -0
- package/dist/provider/types/externalWalletProviders.d.ts +12 -0
- package/dist/provider/types/externalWalletProviders.js +1 -0
- package/dist/provider/types/provider.d.ts +166 -0
- package/dist/provider/types/provider.js +1 -0
- package/dist/provider/types/query.d.ts +3 -0
- package/dist/provider/types/query.js +1 -0
- package/dist/provider/types/utils.d.ts +45 -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.d.ts +7 -0
- package/dist/provider/utils/paraConfigTypeGuards.js +13 -0
- package/dist/provider/utils/renameMutations.d.ts +5 -0
- package/dist/provider/utils/renameMutations.js +18 -0
- package/dist/public/Inter-VariableFont_slnt,wght.ttf +0 -0
- package/package.json +63 -0
- package/styles.css/package.json +3 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../../chunk-MMUBH76A.js";
|
|
3
|
+
import { defaultCosmosExternalWallet } from "@getpara/react-common";
|
|
4
|
+
import { createContext } from "react";
|
|
5
|
+
const CosmosExternalWalletContext = createContext(defaultCosmosExternalWallet);
|
|
6
|
+
export {
|
|
7
|
+
CosmosExternalWalletContext
|
|
8
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../../chunk-MMUBH76A.js";
|
|
3
|
+
import { createContext } from "react";
|
|
4
|
+
import { defaultEvmExternalWallet } from "@getpara/react-common";
|
|
5
|
+
const EvmExternalWalletContext = createContext(defaultEvmExternalWallet);
|
|
6
|
+
export {
|
|
7
|
+
EvmExternalWalletContext
|
|
8
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../../chunk-MMUBH76A.js";
|
|
3
|
+
import { createContext } from "react";
|
|
4
|
+
import { defaultSolanaExternalWallet } from "@getpara/react-common";
|
|
5
|
+
const SolanaExternalWalletContext = createContext(defaultSolanaExternalWallet);
|
|
6
|
+
export {
|
|
7
|
+
SolanaExternalWalletContext
|
|
8
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare const useSignUpOrLogIn: () => import("../../types/utils.js").CoreMethodMutationHook<"signUpOrLogIn">;
|
|
2
|
+
export declare const useVerifyNewAccount: () => import("../../types/utils.js").CoreMethodMutationHook<"verifyNewAccount">;
|
|
3
|
+
export declare const useWaitForLogin: () => import("../../types/utils.js").CoreMethodMutationHook<"waitForLogin">;
|
|
4
|
+
export declare const useWaitForSignup: () => import("../../types/utils.js").CoreMethodMutationHook<"waitForSignup">;
|
|
5
|
+
export declare const useWaitForWalletCreation: () => import("../../types/utils.js").CoreMethodMutationHook<"waitForWalletCreation">;
|
|
6
|
+
export declare const useVerifyOAuth: () => import("../../types/utils.js").CoreMethodMutationHook<"verifyOAuth">;
|
|
7
|
+
export declare const useVerifyFarcaster: () => import("../../types/utils.js").CoreMethodMutationHook<"verifyFarcaster">;
|
|
8
|
+
export declare const useVerifyTelegram: () => import("../../types/utils.js").CoreMethodMutationHook<"verifyTelegram">;
|
|
9
|
+
export declare const useLoginExternalWallet: () => import("../../types/utils.js").CoreMethodMutationHook<"loginExternalWallet">;
|
|
10
|
+
export declare const useVerifyExternalWallet: () => import("../../types/utils.js").CoreMethodMutationHook<"verifyExternalWallet">;
|
|
11
|
+
export declare const useSetup2fa: () => import("../../types/utils.js").CoreMethodMutationHook<"setup2fa">;
|
|
12
|
+
export declare const useEnable2fa: () => import("../../types/utils.js").CoreMethodMutationHook<"enable2fa">;
|
|
13
|
+
export declare const useVerify2fa: () => import("../../types/utils.js").CoreMethodMutationHook<"verify2fa">;
|
|
14
|
+
export declare const useKeepSessionAlive: () => import("../../types/utils.js").CoreMethodMutationHook<"keepSessionAlive">;
|
|
15
|
+
export declare const useLogout: () => import("../../types/utils.js").CoreMethodMutationHook<"logout">;
|
|
16
|
+
export declare const useResendVerificationCode: () => import("../../types/utils.js").CoreMethodMutationHook<"resendVerificationCode">;
|
|
17
|
+
export declare const useCreateWallet: () => import("../../types/utils.js").CoreMethodMutationHook<"createWallet">;
|
|
18
|
+
export declare const useCreateWalletPerType: () => import("../../types/utils.js").CoreMethodMutationHook<"createWalletPerType">;
|
|
19
|
+
export declare const useCreatePregenWallet: () => import("../../types/utils.js").CoreMethodMutationHook<"createPregenWallet">;
|
|
20
|
+
export declare const useCreatePregenWalletPerType: () => import("../../types/utils.js").CoreMethodMutationHook<"createPregenWalletPerType">;
|
|
21
|
+
export declare const useClaimPregenWallets: () => import("../../types/utils.js").CoreMethodMutationHook<"claimPregenWallets">;
|
|
22
|
+
export declare const useHasPregenWallet: () => import("../../types/utils.js").CoreMethodMutationHook<"hasPregenWallet">;
|
|
23
|
+
export declare const useUpdatePregenWalletIdentifier: () => import("../../types/utils.js").CoreMethodMutationHook<"updatePregenWalletIdentifier">;
|
|
24
|
+
export declare const useCreateGuestWallets: () => import("../../types/utils.js").CoreMethodMutationHook<"createGuestWallets">;
|
|
25
|
+
export declare const useSignMessage: () => import("../../types/utils.js").CoreMethodMutationHook<"signMessage">;
|
|
26
|
+
export declare const useSignTransaction: () => import("../../types/utils.js").CoreMethodMutationHook<"signTransaction">;
|
|
27
|
+
export declare const useIssueJwt: () => import("../../types/utils.js").CoreMethodMutationHook<"issueJwt">;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../../chunk-MMUBH76A.js";
|
|
3
|
+
import * as actions from "../../actions/index.js";
|
|
4
|
+
import { generateCoreMutation } from "./utils.js";
|
|
5
|
+
const useSignUpOrLogIn = generateCoreMutation("signUpOrLogIn", actions.signUpOrLogIn);
|
|
6
|
+
const useVerifyNewAccount = generateCoreMutation("verifyNewAccount", actions.verifyNewAccount);
|
|
7
|
+
const useWaitForLogin = generateCoreMutation("waitForLogin", actions.waitForLogin);
|
|
8
|
+
const useWaitForSignup = generateCoreMutation("waitForSignup", actions.waitForSignup);
|
|
9
|
+
const useWaitForWalletCreation = generateCoreMutation("waitForWalletCreation", actions.waitForWalletCreation);
|
|
10
|
+
const useVerifyOAuth = generateCoreMutation("verifyOAuth", actions.verifyOAuth);
|
|
11
|
+
const useVerifyFarcaster = generateCoreMutation("verifyFarcaster", actions.verifyFarcaster);
|
|
12
|
+
const useVerifyTelegram = generateCoreMutation("verifyTelegram", actions.verifyTelegram);
|
|
13
|
+
const useLoginExternalWallet = generateCoreMutation("loginExternalWallet", actions.loginExternalWallet);
|
|
14
|
+
const useVerifyExternalWallet = generateCoreMutation("verifyExternalWallet", actions.verifyExternalWallet);
|
|
15
|
+
const useSetup2fa = generateCoreMutation("setup2fa", actions.setup2fa);
|
|
16
|
+
const useEnable2fa = generateCoreMutation("enable2fa", actions.enable2fa);
|
|
17
|
+
const useVerify2fa = generateCoreMutation("verify2fa", actions.verify2fa);
|
|
18
|
+
const useKeepSessionAlive = generateCoreMutation("keepSessionAlive", actions.keepSessionAlive);
|
|
19
|
+
const useLogout = generateCoreMutation("logout", actions.logout);
|
|
20
|
+
const useResendVerificationCode = generateCoreMutation("resendVerificationCode", actions.resendVerificationCode);
|
|
21
|
+
const useCreateWallet = generateCoreMutation("createWallet", actions.createWallet);
|
|
22
|
+
const useCreateWalletPerType = generateCoreMutation("createWalletPerType", actions.createWalletPerType);
|
|
23
|
+
const useCreatePregenWallet = generateCoreMutation("createPregenWallet", actions.createPregenWallet);
|
|
24
|
+
const useCreatePregenWalletPerType = generateCoreMutation(
|
|
25
|
+
"createPregenWalletPerType",
|
|
26
|
+
actions.createPregenWalletPerType
|
|
27
|
+
);
|
|
28
|
+
const useClaimPregenWallets = generateCoreMutation("claimPregenWallets", actions.claimPregenWallets);
|
|
29
|
+
const useHasPregenWallet = generateCoreMutation("hasPregenWallet", actions.hasPregenWallet);
|
|
30
|
+
const useUpdatePregenWalletIdentifier = generateCoreMutation(
|
|
31
|
+
"updatePregenWalletIdentifier",
|
|
32
|
+
actions.updatePregenWalletIdentifier
|
|
33
|
+
);
|
|
34
|
+
const useCreateGuestWallets = generateCoreMutation("createGuestWallets", actions.createGuestWallets);
|
|
35
|
+
const useSignMessage = generateCoreMutation("signMessage", actions.signMessage);
|
|
36
|
+
const useSignTransaction = generateCoreMutation("signTransaction", actions.signTransaction);
|
|
37
|
+
const useIssueJwt = generateCoreMutation("issueJwt", actions.issueJwt);
|
|
38
|
+
export {
|
|
39
|
+
useClaimPregenWallets,
|
|
40
|
+
useCreateGuestWallets,
|
|
41
|
+
useCreatePregenWallet,
|
|
42
|
+
useCreatePregenWalletPerType,
|
|
43
|
+
useCreateWallet,
|
|
44
|
+
useCreateWalletPerType,
|
|
45
|
+
useEnable2fa,
|
|
46
|
+
useHasPregenWallet,
|
|
47
|
+
useIssueJwt,
|
|
48
|
+
useKeepSessionAlive,
|
|
49
|
+
useLoginExternalWallet,
|
|
50
|
+
useLogout,
|
|
51
|
+
useResendVerificationCode,
|
|
52
|
+
useSetup2fa,
|
|
53
|
+
useSignMessage,
|
|
54
|
+
useSignTransaction,
|
|
55
|
+
useSignUpOrLogIn,
|
|
56
|
+
useUpdatePregenWalletIdentifier,
|
|
57
|
+
useVerify2fa,
|
|
58
|
+
useVerifyExternalWallet,
|
|
59
|
+
useVerifyFarcaster,
|
|
60
|
+
useVerifyNewAccount,
|
|
61
|
+
useVerifyOAuth,
|
|
62
|
+
useVerifyTelegram,
|
|
63
|
+
useWaitForLogin,
|
|
64
|
+
useWaitForSignup,
|
|
65
|
+
useWaitForWalletCreation
|
|
66
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../../chunk-MMUBH76A.js";
|
|
3
|
+
import { generateStateHook } from "./utils.js";
|
|
4
|
+
export * from "./core.js";
|
|
5
|
+
export * from "./useLinkAccount.js";
|
|
6
|
+
const useCreateGuestWalletsState = generateStateHook("createGuestWallets");
|
|
7
|
+
export {
|
|
8
|
+
useCreateGuestWalletsState
|
|
9
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const useLinkAccount: () => {
|
|
2
|
+
linkAccount: (_: import("../../providers/AccountLinkProvider.js").ModalLinkAccountArgs) => Promise<void>;
|
|
3
|
+
error: string | null;
|
|
4
|
+
status: import("@tanstack/query-core").MutationStatus;
|
|
5
|
+
isPending: boolean;
|
|
6
|
+
isError: boolean;
|
|
7
|
+
isIdle: boolean;
|
|
8
|
+
isSuccess: boolean;
|
|
9
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../../chunk-MMUBH76A.js";
|
|
3
|
+
import { useAccountLinking } from "../../providers/AccountLinkProvider.js";
|
|
4
|
+
const useLinkAccount = () => {
|
|
5
|
+
const { linkAccount, linkAccountError, linkAccountStatus } = useAccountLinking();
|
|
6
|
+
return {
|
|
7
|
+
linkAccount,
|
|
8
|
+
error: linkAccountError,
|
|
9
|
+
status: linkAccountStatus,
|
|
10
|
+
isPending: linkAccountStatus === "pending",
|
|
11
|
+
isError: linkAccountStatus === "error",
|
|
12
|
+
isIdle: linkAccountStatus === "idle",
|
|
13
|
+
isSuccess: linkAccountStatus === "success"
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
useLinkAccount
|
|
18
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CoreMethodName, CoreMethodParams, CoreMethods, InternalAction, InternalMethodName, InternalMethodParams, InternalMethods } from '@getpara/web-sdk';
|
|
2
|
+
import { CoreMethodMutationHook, CoreMethodMutationStateHook, InternalMethodMutationHook } from '../../types/utils.js';
|
|
3
|
+
import { CoreAction } from '../../actions/utils.js';
|
|
4
|
+
export declare function generateCoreMutation<const method extends CoreMethodName & keyof CoreMethods>(method: method, action: CoreAction<method>, { delay, defaultParams, }?: {
|
|
5
|
+
delay?: number;
|
|
6
|
+
defaultParams?: CoreMethodParams<method>;
|
|
7
|
+
}): () => CoreMethodMutationHook<method>;
|
|
8
|
+
export declare function generateInternalMutation<const method extends InternalMethodName & keyof InternalMethods>(method: method, action: InternalAction<method>, { delay, defaultParams, }?: {
|
|
9
|
+
delay?: number;
|
|
10
|
+
defaultParams?: InternalMethodParams<method>;
|
|
11
|
+
}): () => InternalMethodMutationHook<method>;
|
|
12
|
+
export declare function generateStateHook<const method extends CoreMethodName & keyof CoreMethods>(method: method): CoreMethodMutationStateHook<method>;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__async,
|
|
4
|
+
__spreadProps,
|
|
5
|
+
__spreadValues
|
|
6
|
+
} from "../../../chunk-MMUBH76A.js";
|
|
7
|
+
import { renameCoreMutations } from "../../utils/renameMutations.js";
|
|
8
|
+
import { useClient } from "../utils/index.js";
|
|
9
|
+
import { useMutation, useMutationState } from "@tanstack/react-query";
|
|
10
|
+
import { useInternalClient } from "../utils/useInternalClient.js";
|
|
11
|
+
function generateCoreMutation(method, action, {
|
|
12
|
+
delay,
|
|
13
|
+
defaultParams
|
|
14
|
+
} = {}) {
|
|
15
|
+
return () => {
|
|
16
|
+
const para = useClient();
|
|
17
|
+
const mutation = useMutation({
|
|
18
|
+
mutationKey: [method],
|
|
19
|
+
mutationFn: (args) => __async(this, null, function* () {
|
|
20
|
+
if (typeof delay === "number") yield new Promise((resolve) => setTimeout(resolve, delay));
|
|
21
|
+
try {
|
|
22
|
+
const result = yield action(para, args != null ? args : defaultParams);
|
|
23
|
+
return result;
|
|
24
|
+
} catch (error) {
|
|
25
|
+
throw error;
|
|
26
|
+
}
|
|
27
|
+
})
|
|
28
|
+
});
|
|
29
|
+
return renameCoreMutations(mutation, method);
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function generateInternalMutation(method, action, {
|
|
33
|
+
delay,
|
|
34
|
+
defaultParams
|
|
35
|
+
} = {}) {
|
|
36
|
+
return () => {
|
|
37
|
+
const para = useInternalClient();
|
|
38
|
+
const mutation = useMutation({
|
|
39
|
+
mutationKey: [method],
|
|
40
|
+
mutationFn: (args) => __async(this, null, function* () {
|
|
41
|
+
if (typeof delay === "number") yield new Promise((resolve) => setTimeout(resolve, delay));
|
|
42
|
+
try {
|
|
43
|
+
const result = yield action(para, args != null ? args : defaultParams);
|
|
44
|
+
return result;
|
|
45
|
+
} catch (error) {
|
|
46
|
+
throw error;
|
|
47
|
+
}
|
|
48
|
+
})
|
|
49
|
+
});
|
|
50
|
+
return mutation;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function generateStateHook(method) {
|
|
54
|
+
return () => {
|
|
55
|
+
const frames = useMutationState({
|
|
56
|
+
filters: { mutationKey: [method] },
|
|
57
|
+
select: (mutation) => mutation.state
|
|
58
|
+
});
|
|
59
|
+
const latest = frames[frames.length - 1];
|
|
60
|
+
if (!latest) {
|
|
61
|
+
return {
|
|
62
|
+
data: void 0,
|
|
63
|
+
error: null,
|
|
64
|
+
failureCount: 0,
|
|
65
|
+
isLoading: false,
|
|
66
|
+
isPaused: false,
|
|
67
|
+
isPending: false,
|
|
68
|
+
isError: false,
|
|
69
|
+
isSuccess: false,
|
|
70
|
+
isIdle: true,
|
|
71
|
+
status: "idle",
|
|
72
|
+
variables: void 0,
|
|
73
|
+
context: null,
|
|
74
|
+
failureReason: null,
|
|
75
|
+
submittedAt: 0
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
return __spreadProps(__spreadValues({}, latest), {
|
|
79
|
+
isPending: latest.status === "pending",
|
|
80
|
+
isError: latest.status === "error",
|
|
81
|
+
isSuccess: latest.status === "success",
|
|
82
|
+
isIdle: latest.status === "idle"
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
export {
|
|
87
|
+
generateCoreMutation,
|
|
88
|
+
generateInternalMutation,
|
|
89
|
+
generateStateHook
|
|
90
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const useLinkedAccounts: (params?: {
|
|
2
|
+
withMetadata?: boolean;
|
|
3
|
+
} | undefined) => import("../../types/utils.js").CoreMethodQueryHook<"getLinkedAccounts">;
|
|
4
|
+
export declare const useAccountLinkInProgress: (params?: undefined) => import("../../types/utils.js").CoreMethodQueryHook<"accountLinkInProgress">;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../../chunk-MMUBH76A.js";
|
|
3
|
+
import * as actions from "../../actions/index.js";
|
|
4
|
+
import { generateCoreQueryHook } from "./utils.js";
|
|
5
|
+
const useLinkedAccounts = generateCoreQueryHook("getLinkedAccounts", actions.getLinkedAccounts, {
|
|
6
|
+
defaultParams: { withMetadata: false }
|
|
7
|
+
});
|
|
8
|
+
const useAccountLinkInProgress = generateCoreQueryHook(
|
|
9
|
+
"accountLinkInProgress",
|
|
10
|
+
actions.accountLinkInProgress,
|
|
11
|
+
{ isGetter: true }
|
|
12
|
+
);
|
|
13
|
+
export {
|
|
14
|
+
useAccountLinkInProgress,
|
|
15
|
+
useLinkedAccounts
|
|
16
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../../chunk-MMUBH76A.js";
|
|
3
|
+
import { useAccount } from "./useAccount.js";
|
|
4
|
+
import { useParaStatus } from "./useParaStatus.js";
|
|
5
|
+
import { useWallet } from "./useWallet.js";
|
|
6
|
+
import { useWalletBalance } from "./useWalletBalance.js";
|
|
7
|
+
export * from "./core.js";
|
|
8
|
+
export {
|
|
9
|
+
useAccount,
|
|
10
|
+
useParaStatus,
|
|
11
|
+
useWallet,
|
|
12
|
+
useWalletBalance
|
|
13
|
+
};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import { Account } from '../../actions/getEmbeddedAccount.js';
|
|
3
|
+
import type { CosmosExternalWalletContextType, UseAccountParameters as UseCosmosAccountParameters } from '@getpara/cosmos-wallet-connectors';
|
|
4
|
+
import type { EvmExternalWalletContextType } from '@getpara/evm-wallet-connectors';
|
|
5
|
+
import type { Adapter } from '@getpara/solana-wallet-connectors';
|
|
6
|
+
export declare const ACCOUNT_BASE_KEY = "PARA_ACCOUNT";
|
|
7
|
+
type EVMAccountType = ReturnType<ReturnType<typeof useContext<EvmExternalWalletContextType>>['useAccount']>;
|
|
8
|
+
type CosmosAccountType = Omit<ReturnType<ReturnType<typeof useContext<CosmosExternalWalletContextType>>['useAccount']>, 'reconnect'>;
|
|
9
|
+
type SolanaAccountType = Pick<Adapter, 'publicKey' | 'name' | 'icon' | 'readyState' | 'supportedTransactionVersions' | 'url'> & {
|
|
10
|
+
isConnected?: boolean;
|
|
11
|
+
isConnecting?: boolean;
|
|
12
|
+
};
|
|
13
|
+
type ConnectionType = 'embedded' | 'external' | 'both' | 'none';
|
|
14
|
+
type ExternalNetwork = 'evm' | 'cosmos' | 'solana';
|
|
15
|
+
/**
|
|
16
|
+
* The return type for the useAccount hook.
|
|
17
|
+
*
|
|
18
|
+
* @property isConnected - Indicates whether there is a wallet connected (either embedded, external or both).
|
|
19
|
+
* @property isLoading - Indicates whether the account is currently loading.
|
|
20
|
+
* @property connectionType - The type of connection for the account:
|
|
21
|
+
* @property embedded - The embedded account object.
|
|
22
|
+
* @property external - An object containing connected external wallet account data:
|
|
23
|
+
* - `evm`: The connected EVM wallet account (if any).
|
|
24
|
+
* - `cosmos`: The connected Cosmos wallet account (if any), with the `reconnect` property omitted.
|
|
25
|
+
* - `solana`: The connected Solana wallet adapter, with only allowed properties included.
|
|
26
|
+
*/
|
|
27
|
+
export type UseAccountReturn = {
|
|
28
|
+
/**
|
|
29
|
+
* Indicates whether there is a wallet connected (either embedded, external or both).
|
|
30
|
+
*/
|
|
31
|
+
isConnected: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Indicates whether the account is currently loading.
|
|
34
|
+
*/
|
|
35
|
+
isLoading: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* The type of connection for the account.
|
|
38
|
+
* - 'embedded': Only the embedded account is connected.
|
|
39
|
+
* - 'external': Only an external wallet is connected.
|
|
40
|
+
* - 'both': Both embedded and external wallets are connected.
|
|
41
|
+
* - 'none': No wallets are connected.
|
|
42
|
+
*/
|
|
43
|
+
connectionType: ConnectionType;
|
|
44
|
+
/**
|
|
45
|
+
* The embedded account object. Use this instead of the deprecated top-level properties.
|
|
46
|
+
*/
|
|
47
|
+
embedded: Omit<Account, 'isReady' | 'isFarcasterMiniApp' | 'isConnected' | 'isGuestMode'> & {
|
|
48
|
+
isConnected: boolean;
|
|
49
|
+
isGuestMode?: boolean;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Connected external wallet account data.
|
|
53
|
+
*/
|
|
54
|
+
external: {
|
|
55
|
+
/**
|
|
56
|
+
* The list of connected external networks, which can include 'evm', 'cosmos', and 'solana'.
|
|
57
|
+
*/
|
|
58
|
+
connectedNetworks: ExternalNetwork[];
|
|
59
|
+
/**
|
|
60
|
+
* The connected EVM wallet (if any), with only allowed properties included.
|
|
61
|
+
*/
|
|
62
|
+
evm: EVMAccountType;
|
|
63
|
+
/**
|
|
64
|
+
* The connected Cosmos wallet (if any), with only allowed properties included.
|
|
65
|
+
*/
|
|
66
|
+
cosmos: CosmosAccountType;
|
|
67
|
+
/**
|
|
68
|
+
* The connected Solana wallet (if any), with only allowed properties included.
|
|
69
|
+
*/
|
|
70
|
+
solana: SolanaAccountType;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
export type UseAccountParameters = {
|
|
74
|
+
cosmos?: UseCosmosAccountParameters;
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* React Query hook for retrieving the current embedded account and connected external wallets.
|
|
78
|
+
*
|
|
79
|
+
* @returns {UseAccountReturn}
|
|
80
|
+
* The account data object, or undefined while loading.
|
|
81
|
+
*
|
|
82
|
+
* The returned object contains:
|
|
83
|
+
* - `isConnected`: Indicates whether there is a wallet connected (either embedded, external or both).
|
|
84
|
+
* - `isLoading`: Indicates whether the account is currently loading.
|
|
85
|
+
* - `connectionType`: The type of connection for the account:
|
|
86
|
+
* - `embedded`: The embedded account object.
|
|
87
|
+
* - `external`: Connected external wallet data (EVM, Cosmos, Solana).
|
|
88
|
+
*/
|
|
89
|
+
export declare const useAccount: ({ cosmos }?: UseAccountParameters) => UseAccountReturn;
|
|
90
|
+
export {};
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__objRest,
|
|
4
|
+
__spreadProps,
|
|
5
|
+
__spreadValues
|
|
6
|
+
} from "../../../chunk-MMUBH76A.js";
|
|
7
|
+
import { useQuery } from "@tanstack/react-query";
|
|
8
|
+
import { useInternalClient } from "../utils/useInternalClient.js";
|
|
9
|
+
import { useIsFullyLoggedIn } from "./useIsFullyLoggedIn.js";
|
|
10
|
+
import { useStore } from "../../stores/useStore.js";
|
|
11
|
+
import { useContext } from "react";
|
|
12
|
+
import { getEmbeddedAccount } from "../../actions/getEmbeddedAccount.js";
|
|
13
|
+
const ACCOUNT_BASE_KEY = "PARA_ACCOUNT";
|
|
14
|
+
function pickSolanaAdapter(adapter) {
|
|
15
|
+
if (!adapter) return { isConnected: false };
|
|
16
|
+
const { connected, connecting, publicKey, name, icon, readyState, supportedTransactionVersions, url } = adapter;
|
|
17
|
+
return {
|
|
18
|
+
isConnected: connected,
|
|
19
|
+
isConnecting: connecting,
|
|
20
|
+
publicKey,
|
|
21
|
+
name,
|
|
22
|
+
icon,
|
|
23
|
+
readyState,
|
|
24
|
+
supportedTransactionVersions,
|
|
25
|
+
url
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function pickCosmosAccount(account) {
|
|
29
|
+
if (!account) return { isConnected: false };
|
|
30
|
+
const _a = account, { reconnect: _ } = _a, rest = __objRest(_a, ["reconnect"]);
|
|
31
|
+
return rest;
|
|
32
|
+
}
|
|
33
|
+
const useAccount = ({ cosmos } = {}) => {
|
|
34
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
35
|
+
const client = useInternalClient();
|
|
36
|
+
const { data: isFullyLoggedIn, isSuccess } = useIsFullyLoggedIn();
|
|
37
|
+
const evmContext = useStore((state) => state.evmContext);
|
|
38
|
+
const { useAccount: useEvmAccount } = useContext(evmContext);
|
|
39
|
+
const evmAccount = useEvmAccount();
|
|
40
|
+
const evmQueryKeys = [evmAccount == null ? void 0 : evmAccount.status, evmAccount == null ? void 0 : evmAccount.addresses, evmAccount == null ? void 0 : evmAccount.chainId];
|
|
41
|
+
const cosmosContext = useStore((state) => state.cosmosContext);
|
|
42
|
+
const { useAccount: useCosmosAccount } = useContext(cosmosContext);
|
|
43
|
+
const cosmosAccount = useCosmosAccount(cosmos);
|
|
44
|
+
const cosmosQueryKeys = [cosmosAccount == null ? void 0 : cosmosAccount.status, cosmosAccount == null ? void 0 : cosmosAccount.data];
|
|
45
|
+
const solanaContext = useStore((state) => state.solanaContext);
|
|
46
|
+
const { useWallet: useSolanaWallet } = useContext(solanaContext);
|
|
47
|
+
const solanaWallet = useSolanaWallet();
|
|
48
|
+
const solanaQueryKeys = [
|
|
49
|
+
(_b = (_a = solanaWallet == null ? void 0 : solanaWallet.wallet) == null ? void 0 : _a.adapter) == null ? void 0 : _b.connected,
|
|
50
|
+
(_d = (_c = solanaWallet == null ? void 0 : solanaWallet.wallet) == null ? void 0 : _c.adapter) == null ? void 0 : _d.connecting,
|
|
51
|
+
(_f = (_e = solanaWallet == null ? void 0 : solanaWallet.wallet) == null ? void 0 : _e.adapter) == null ? void 0 : _f.publicKey
|
|
52
|
+
];
|
|
53
|
+
const solanaAdapter = (_g = solanaWallet == null ? void 0 : solanaWallet.wallet) == null ? void 0 : _g.adapter;
|
|
54
|
+
const { data, isLoading } = useQuery({
|
|
55
|
+
enabled: isSuccess && !!client,
|
|
56
|
+
queryKey: [
|
|
57
|
+
ACCOUNT_BASE_KEY,
|
|
58
|
+
isFullyLoggedIn != null ? isFullyLoggedIn : null,
|
|
59
|
+
(_h = client == null ? void 0 : client.userId) != null ? _h : null,
|
|
60
|
+
evmQueryKeys,
|
|
61
|
+
cosmosQueryKeys,
|
|
62
|
+
solanaQueryKeys
|
|
63
|
+
],
|
|
64
|
+
queryFn: () => {
|
|
65
|
+
const paraAccount = getEmbeddedAccount(client, isFullyLoggedIn);
|
|
66
|
+
let connectionType = "none";
|
|
67
|
+
if (paraAccount.isConnected) {
|
|
68
|
+
connectionType = "embedded";
|
|
69
|
+
if (paraAccount.wallets.some((w) => w.isExternal)) {
|
|
70
|
+
connectionType = "both";
|
|
71
|
+
}
|
|
72
|
+
if (paraAccount.wallets.every((w) => w.isExternal) && ((evmAccount == null ? void 0 : evmAccount.isConnected) || (cosmosAccount == null ? void 0 : cosmosAccount.isConnected) || (solanaAdapter == null ? void 0 : solanaAdapter.connected))) {
|
|
73
|
+
connectionType = "external";
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
const isEmbeddedConnected = paraAccount.isConnected && (!!paraAccount.userId || paraAccount.isGuestMode);
|
|
77
|
+
const connectedNetworks = [];
|
|
78
|
+
if (evmAccount == null ? void 0 : evmAccount.isConnected) {
|
|
79
|
+
connectedNetworks.push("evm");
|
|
80
|
+
}
|
|
81
|
+
if (cosmosAccount == null ? void 0 : cosmosAccount.isConnected) {
|
|
82
|
+
connectedNetworks.push("cosmos");
|
|
83
|
+
}
|
|
84
|
+
if (solanaAdapter == null ? void 0 : solanaAdapter.connected) {
|
|
85
|
+
connectedNetworks.push("solana");
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
isConnected: paraAccount.isConnected,
|
|
89
|
+
connectionType,
|
|
90
|
+
embedded: __spreadProps(__spreadValues({}, paraAccount), { isConnected: isEmbeddedConnected }),
|
|
91
|
+
external: {
|
|
92
|
+
connectedNetworks,
|
|
93
|
+
evm: evmAccount != null ? evmAccount : {
|
|
94
|
+
address: void 0,
|
|
95
|
+
addresses: void 0,
|
|
96
|
+
chain: void 0,
|
|
97
|
+
chainId: void 0,
|
|
98
|
+
connector: void 0,
|
|
99
|
+
isConnected: false,
|
|
100
|
+
isReconnecting: false,
|
|
101
|
+
isConnecting: false,
|
|
102
|
+
isDisconnected: true,
|
|
103
|
+
status: "disconnected"
|
|
104
|
+
},
|
|
105
|
+
cosmos: pickCosmosAccount(cosmosAccount),
|
|
106
|
+
solana: pickSolanaAdapter(solanaAdapter)
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
const defaultResp = {
|
|
112
|
+
isConnected: false,
|
|
113
|
+
connectionType: "none",
|
|
114
|
+
isLoading,
|
|
115
|
+
embedded: {
|
|
116
|
+
isConnected: false
|
|
117
|
+
},
|
|
118
|
+
external: {
|
|
119
|
+
connectedNetworks: [],
|
|
120
|
+
evm: {
|
|
121
|
+
address: void 0,
|
|
122
|
+
addresses: void 0,
|
|
123
|
+
chain: void 0,
|
|
124
|
+
chainId: void 0,
|
|
125
|
+
connector: void 0,
|
|
126
|
+
isConnected: false,
|
|
127
|
+
isReconnecting: false,
|
|
128
|
+
isConnecting: false,
|
|
129
|
+
isDisconnected: true,
|
|
130
|
+
status: "disconnected"
|
|
131
|
+
},
|
|
132
|
+
cosmos: { isConnected: false },
|
|
133
|
+
solana: { isConnected: false }
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
return __spreadProps(__spreadValues({}, data != null ? data : defaultResp), { isLoading });
|
|
137
|
+
};
|
|
138
|
+
export {
|
|
139
|
+
ACCOUNT_BASE_KEY,
|
|
140
|
+
useAccount
|
|
141
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__async
|
|
4
|
+
} from "../../../chunk-MMUBH76A.js";
|
|
5
|
+
import { useQuery } from "@tanstack/react-query";
|
|
6
|
+
import { useInternalClient } from "../utils/useInternalClient.js";
|
|
7
|
+
const IS_FULLY_LOGGED_IN_BASE_KEY = "PARA_FULLY_LOGGED_IN";
|
|
8
|
+
const useIsFullyLoggedIn = () => {
|
|
9
|
+
var _a;
|
|
10
|
+
const client = useInternalClient();
|
|
11
|
+
return useQuery({
|
|
12
|
+
enabled: !!(client == null ? void 0 : client.isReady),
|
|
13
|
+
staleTime: 5e3,
|
|
14
|
+
queryKey: [IS_FULLY_LOGGED_IN_BASE_KEY, (_a = client == null ? void 0 : client.userId) != null ? _a : null],
|
|
15
|
+
queryFn: () => __async(void 0, null, function* () {
|
|
16
|
+
var _a2;
|
|
17
|
+
return (_a2 = yield client == null ? void 0 : client.isFullyLoggedIn()) != null ? _a2 : false;
|
|
18
|
+
})
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
IS_FULLY_LOGGED_IN_BASE_KEY,
|
|
23
|
+
useIsFullyLoggedIn
|
|
24
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare const IS_FULLY_LOGGED_IN_BASE_KEY = "PARA_FULLY_LOGGED_IN";
|
|
2
|
+
export type ParaStatus = {
|
|
3
|
+
/**
|
|
4
|
+
* Indicates whether the client's first-time setup is complete.
|
|
5
|
+
*/
|
|
6
|
+
isReady: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Indicates whether the current application is a Farcaster Mini App.
|
|
9
|
+
*/
|
|
10
|
+
isFarcasterMiniApp: boolean;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Hook for retrieving the initial setup status of the Para client.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* const status = useParaStatus();
|
|
17
|
+
* if (status.isReady) {
|
|
18
|
+
* const isFarcasterMiniApp = status.isFarcasterMiniApp;
|
|
19
|
+
* // ...
|
|
20
|
+
* }
|
|
21
|
+
*/
|
|
22
|
+
export declare const useParaStatus: () => ParaStatus;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../../chunk-MMUBH76A.js";
|
|
3
|
+
import { useQuery } from "@tanstack/react-query";
|
|
4
|
+
import { useInternalClient } from "../utils/useInternalClient.js";
|
|
5
|
+
const IS_FULLY_LOGGED_IN_BASE_KEY = "PARA_FULLY_LOGGED_IN";
|
|
6
|
+
const useParaStatus = () => {
|
|
7
|
+
var _a, _b;
|
|
8
|
+
const client = useInternalClient();
|
|
9
|
+
const { data } = useQuery({
|
|
10
|
+
enabled: !!client,
|
|
11
|
+
queryKey: ["useParaStatus", (_a = client == null ? void 0 : client.isReady) != null ? _a : null, (_b = client == null ? void 0 : client.isFarcasterMiniApp) != null ? _b : null],
|
|
12
|
+
queryFn: () => {
|
|
13
|
+
var _a2, _b2;
|
|
14
|
+
return {
|
|
15
|
+
isReady: (_a2 = client == null ? void 0 : client.isReady) != null ? _a2 : false,
|
|
16
|
+
isFarcasterMiniApp: (_b2 = client == null ? void 0 : client.isFarcasterMiniApp) != null ? _b2 : false
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
return data != null ? data : { isReady: false, isFarcasterMiniApp: false };
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
IS_FULLY_LOGGED_IN_BASE_KEY,
|
|
24
|
+
useParaStatus
|
|
25
|
+
};
|