@getpara/react-sdk 2.0.0-dev.1 → 2.0.0-dev.3
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 +22 -7
- package/dist/index.d.ts +0 -1
- package/dist/index.js +6 -7058
- package/dist/modal/ParaModal.js +301 -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 +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.d.ts +17 -3
- package/dist/modal/components/AuthInput/AuthInput.js +277 -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 +164 -0
- package/dist/modal/components/AuthOptions/AuthOptions.d.ts +4 -3
- package/dist/modal/components/AuthOptions/AuthOptions.js +85 -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.d.ts +1 -1
- package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.js +62 -0
- package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.d.ts +1 -1
- package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.js +48 -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 +350 -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 +78 -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 +7 -0
- package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.js +175 -0
- package/dist/modal/components/ExternalWalletStep/config.js +17 -0
- package/dist/modal/components/ExternalWalletVerificationStep/ExternalWalletVerificationStep.js +39 -0
- package/dist/modal/components/ExternalWallets/ExternalWallets.js +184 -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 +61 -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.d.ts +4 -0
- package/dist/modal/components/LoginDoneStep/LoginDoneStep.js +44 -0
- package/dist/modal/components/ModalContent/ModalContent.d.ts +0 -4
- package/dist/modal/components/ModalContent/ModalContent.js +88 -0
- package/dist/modal/components/OAuth/FarcasterOAuthStep.d.ts +1 -0
- package/dist/modal/components/OAuth/FarcasterOAuthStep.js +31 -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.d.ts +7 -0
- package/dist/modal/components/OAuth/TelegramOAuthStep.js +74 -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/TwoFactorDoneStep/TwoFactorDoneStep.js +27 -0
- package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.d.ts +12 -1
- package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.js +160 -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 +83 -0
- package/dist/modal/components/common.d.ts +49 -13
- package/dist/modal/components/common.js +261 -0
- package/dist/modal/components/index.js +2 -0
- package/dist/modal/constants/constants.d.ts +10 -2
- package/dist/modal/constants/constants.js +142 -0
- package/dist/modal/constants/defaults.js +10 -0
- package/dist/modal/constants/oAuthLogos.d.ts +15 -6
- 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.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 +1 -1
- package/dist/modal/index.js +29 -0
- package/dist/modal/stores/index.d.ts +0 -1
- package/dist/modal/stores/index.js +2 -0
- package/dist/modal/stores/modal/actions.js +135 -0
- package/dist/modal/stores/modal/useModalStore.d.ts +17 -16
- package/dist/modal/stores/modal/useModalStore.js +73 -0
- package/dist/modal/types/commonTypes.js +1 -0
- package/dist/modal/types/modalProps.d.ts +15 -2
- 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.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/getWalletDisplayName.d.ts +5 -0
- package/dist/modal/utils/getWalletDisplayName.js +22 -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 +21 -2
- package/dist/modal/utils/steps.js +273 -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 +117 -0
- package/dist/provider/actions/getEmbeddedAccount.d.ts +26 -0
- package/dist/provider/actions/getEmbeddedAccount.js +52 -0
- package/dist/provider/actions/getWallet.d.ts +3 -3
- package/dist/provider/actions/getWallet.js +18 -0
- package/dist/provider/actions/index.d.ts +40 -18
- package/dist/provider/actions/index.js +79 -0
- package/dist/provider/actions/utils.d.ts +4 -3
- package/dist/provider/actions/utils.js +34 -0
- package/dist/provider/components/CosmosWalletWrapper.js +43 -0
- package/dist/provider/components/EvmWalletWrapper.js +43 -0
- package/dist/provider/components/ExternalWalletWrapper.js +140 -0
- package/dist/provider/components/SolanaWalletWrapper.js +44 -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.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.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 +1 -11
- package/dist/provider/external/stubs/CosmosExternalWalletContextStub.js +8 -0
- package/dist/provider/external/stubs/EvmExternalWalletContextStub.d.ts +1 -2
- package/dist/provider/external/stubs/EvmExternalWalletContextStub.js +8 -0
- package/dist/provider/external/stubs/SolanaExternalWalletContextStub.d.ts +1 -7
- package/dist/provider/external/stubs/SolanaExternalWalletContextStub.js +8 -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 -34
- 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 +11 -3
- 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 +2 -0
- package/dist/provider/hooks/queries/index.js +11 -0
- package/dist/provider/hooks/queries/useAccount.d.ts +86 -7
- package/dist/provider/hooks/queries/useAccount.js +135 -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/useWallet.d.ts +1 -1
- 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.js +10 -0
- package/dist/provider/hooks/utils/useAutoSessionKeepAlive.js +74 -0
- package/dist/provider/hooks/utils/useClient.d.ts +1 -1
- 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 +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.js +10 -0
- package/dist/provider/hooks/utils/useModal.d.ts +4 -1
- package/dist/provider/hooks/utils/useModal.js +27 -0
- package/dist/provider/hooks/utils/useWalletState.d.ts +3 -3
- package/dist/provider/hooks/utils/useWalletState.js +48 -0
- package/dist/provider/index.d.ts +2 -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 +12 -6
- package/dist/provider/providers/AuthProvider.js +523 -0
- package/dist/provider/providers/CosmosExternalWalletProvider.js +66 -0
- package/dist/provider/providers/EvmExternalWalletProvider.js +74 -0
- package/dist/provider/providers/ExternalWalletProvider.d.ts +23 -43
- package/dist/provider/providers/ExternalWalletProvider.js +596 -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/analytics.d.ts +3 -0
- package/dist/provider/stores/slices/analytics.js +9 -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 +46 -0
- package/dist/provider/stores/slices/index.d.ts +1 -0
- package/dist/provider/stores/slices/index.js +6 -0
- package/dist/provider/stores/slices/modal.js +18 -0
- package/dist/provider/stores/slices/wallet.js +13 -0
- package/dist/provider/stores/types.d.ts +19 -5
- package/dist/provider/stores/types.js +1 -0
- package/dist/provider/stores/useStore.js +34 -0
- package/dist/provider/types/externalWalletProviders.js +1 -0
- package/dist/provider/types/provider.d.ts +23 -4
- package/dist/provider/types/provider.js +1 -0
- package/dist/provider/types/query.js +1 -0
- package/dist/provider/types/utils.d.ts +28 -5
- 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.d.ts +2 -2
- package/dist/provider/utils/renameMutations.js +18 -0
- package/package.json +40 -39
- 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/StripeComponents/StripeComponents.d.ts +0 -16
- package/dist/modal/hooks/useCreateAccount.d.ts +0 -4
- package/dist/modal/stores/userInfo/actions.d.ts +0 -3
- package/dist/modal/stores/userInfo/useUserInfoStore.d.ts +0 -19
- package/dist/provider/actions/checkIfUserExists.d.ts +0 -4
- package/dist/provider/actions/createUser.d.ts +0 -4
- package/dist/provider/actions/getAccount.d.ts +0 -10
- package/dist/provider/actions/initiateLogin.d.ts +0 -4
- package/dist/provider/actions/keepSessionAlive.d.ts +0 -2
- package/dist/provider/actions/logout.d.ts +0 -5
- package/dist/provider/actions/signMessage.d.ts +0 -8
- package/dist/provider/actions/signTransaction.d.ts +0 -8
- package/dist/provider/actions/waitForAccountCreation.d.ts +0 -5
- package/dist/provider/actions/waitForLoginAndSetup.d.ts +0 -6
- package/dist/provider/actions/waitForPasskeyAndCreateWallet.d.ts +0 -2
- package/dist/provider/hooks/mutations/useCheckIfUserExists.d.ts +0 -13
- package/dist/provider/hooks/mutations/useCreateUser.d.ts +0 -13
- package/dist/provider/hooks/mutations/useInitiateLogin.d.ts +0 -14
- package/dist/provider/hooks/mutations/useKeepSessionAlive.d.ts +0 -12
- package/dist/provider/hooks/mutations/useLogout.d.ts +0 -13
- package/dist/provider/hooks/mutations/useSignMessage.d.ts +0 -15
- package/dist/provider/hooks/mutations/useSignTransaction.d.ts +0 -15
- package/dist/provider/hooks/mutations/useWaitForAccountCreation.d.ts +0 -13
- package/dist/provider/hooks/mutations/useWaitForLoginAndSetup.d.ts +0 -14
- package/dist/provider/hooks/mutations/useWaitForPasskeyAndCreateWallet.d.ts +0 -13
- /package/dist/modal/{components/AuthInput → utils}/countryCodes.d.ts +0 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__spreadProps,
|
|
4
|
+
__spreadValues
|
|
5
|
+
} from "../chunk-MMUBH76A.js";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { forwardRef, useEffect } from "react";
|
|
8
|
+
import { useStore } from "./stores/useStore.js";
|
|
9
|
+
import { useAutoSessionKeepAlive } from "./hooks/utils/useAutoSessionKeepAlive.js";
|
|
10
|
+
import { useEventListeners } from "./hooks/utils/useEventListeners.js";
|
|
11
|
+
import { ExternalWalletWrapper } from "./components/ExternalWalletWrapper.js";
|
|
12
|
+
import { ParaModal } from "../modal/ParaModal.js";
|
|
13
|
+
import { isConfigType, isParaWeb } from "./utils/paraConfigTypeGuards.js";
|
|
14
|
+
import ParaWeb from "@getpara/web-sdk";
|
|
15
|
+
import { EXTERNAL_WALLET_TYPES } from "@getpara/web-sdk";
|
|
16
|
+
import { AuthProvider } from "./providers/AuthProvider.js";
|
|
17
|
+
import { AccountLinkProvider } from "./providers/AccountLinkProvider.js";
|
|
18
|
+
const ParaProvider = forwardRef(({ children, paraClientConfig, callbacks, config, externalWalletConfig, paraModalConfig }, ref) => {
|
|
19
|
+
useEventListeners(callbacks);
|
|
20
|
+
useAutoSessionKeepAlive({ disabled: config.disableAutoSessionKeepAlive });
|
|
21
|
+
const setClient = useStore((state) => state.setClient);
|
|
22
|
+
const client = useStore((state) => state.client);
|
|
23
|
+
const setExternalWallets = useStore((state) => state.setExternalWallets);
|
|
24
|
+
const externalWallets = useStore((state) => state.externalWallets);
|
|
25
|
+
const setExternalWalletsWithFullAuth = useStore((state) => state.setExternalWalletsWithFullAuth);
|
|
26
|
+
const externalWalletsWithFullAuth = useStore((state) => state.externalWalletsWithFullAuth);
|
|
27
|
+
const setIncludeWalletVerification = useStore((state) => state.setIncludeWalletVerification);
|
|
28
|
+
const includeWalletVerification = useStore((state) => state.includeWalletVerification);
|
|
29
|
+
const setConnectionOnly = useStore((state) => state.setConnectionOnly);
|
|
30
|
+
const connectionOnly = useStore((state) => state.connectionOnly);
|
|
31
|
+
const setModalConfig = useStore((state) => state.setModalConfig);
|
|
32
|
+
const modalConfig = useStore((state) => state.modalConfig);
|
|
33
|
+
const setAppName = useStore((state) => state.setAppName);
|
|
34
|
+
const appName = useStore((state) => state.appName);
|
|
35
|
+
const rpcUrl = useStore((state) => state.rpcUrl);
|
|
36
|
+
const setRpcUrl = useStore((state) => state.setRpcUrl);
|
|
37
|
+
const setProviderProps = useStore((state) => state.setProviderProps);
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
setProviderProps(__spreadProps(__spreadValues(__spreadValues(__spreadValues({}, config), externalWalletConfig), paraModalConfig), {
|
|
40
|
+
// Redacting walletConnect to avoid exposing project id
|
|
41
|
+
walletConnect: void 0
|
|
42
|
+
}));
|
|
43
|
+
}, [config, externalWalletConfig, paraModalConfig]);
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
if (rpcUrl !== config.rpcUrl) setRpcUrl(config.rpcUrl);
|
|
46
|
+
}, [config.rpcUrl]);
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
if (appName !== config.appName) setAppName(config.appName);
|
|
49
|
+
}, [config.appName]);
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
if (modalConfig !== paraModalConfig) setModalConfig(paraModalConfig);
|
|
52
|
+
}, [paraModalConfig]);
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
var _a;
|
|
55
|
+
if (connectionOnly !== (externalWalletConfig == null ? void 0 : externalWalletConfig.connectionOnly)) {
|
|
56
|
+
setConnectionOnly((_a = externalWalletConfig == null ? void 0 : externalWalletConfig.connectionOnly) != null ? _a : false);
|
|
57
|
+
}
|
|
58
|
+
}, [externalWalletConfig == null ? void 0 : externalWalletConfig.connectionOnly]);
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
var _a, _b;
|
|
61
|
+
if (includeWalletVerification !== (externalWalletConfig == null ? void 0 : externalWalletConfig.includeWalletVerification)) {
|
|
62
|
+
if ((externalWalletConfig == null ? void 0 : externalWalletConfig.connectionOnly) || (isConfigType(paraClientConfig) ? (_a = paraClientConfig.opts) == null ? void 0 : _a.externalWalletConnectionOnly : paraClientConfig.externalWalletConnectionOnly)) {
|
|
63
|
+
console.warn("includeWalletVerification has no effect when using connection only external wallets");
|
|
64
|
+
setIncludeWalletVerification(false);
|
|
65
|
+
} else {
|
|
66
|
+
setIncludeWalletVerification((_b = externalWalletConfig == null ? void 0 : externalWalletConfig.includeWalletVerification) != null ? _b : false);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}, [externalWalletConfig == null ? void 0 : externalWalletConfig.includeWalletVerification]);
|
|
70
|
+
useEffect(() => {
|
|
71
|
+
var _a;
|
|
72
|
+
if (externalWallets !== (externalWalletConfig == null ? void 0 : externalWalletConfig.wallets)) {
|
|
73
|
+
setExternalWallets((_a = externalWalletConfig == null ? void 0 : externalWalletConfig.wallets) != null ? _a : [...EXTERNAL_WALLET_TYPES]);
|
|
74
|
+
}
|
|
75
|
+
}, [externalWalletConfig == null ? void 0 : externalWalletConfig.wallets]);
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
var _a, _b;
|
|
78
|
+
if (externalWalletsWithFullAuth !== (externalWalletConfig == null ? void 0 : externalWalletConfig.createLinkedEmbeddedForExternalWallets)) {
|
|
79
|
+
if ((externalWalletConfig == null ? void 0 : externalWalletConfig.connectionOnly) || (isConfigType(paraClientConfig) ? (_a = paraClientConfig.opts) == null ? void 0 : _a.externalWalletConnectionOnly : paraClientConfig.externalWalletConnectionOnly)) {
|
|
80
|
+
console.warn("createLinkedEmbeddedForExternalWallets has no effect when using connection only external wallets");
|
|
81
|
+
setExternalWalletsWithFullAuth([]);
|
|
82
|
+
} else {
|
|
83
|
+
setExternalWalletsWithFullAuth(
|
|
84
|
+
(externalWalletConfig == null ? void 0 : externalWalletConfig.createLinkedEmbeddedForExternalWallets) === "ALL" ? [...EXTERNAL_WALLET_TYPES] : (_b = externalWalletConfig == null ? void 0 : externalWalletConfig.createLinkedEmbeddedForExternalWallets) != null ? _b : []
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}, [externalWalletConfig == null ? void 0 : externalWalletConfig.createLinkedEmbeddedForExternalWallets]);
|
|
89
|
+
useEffect(() => {
|
|
90
|
+
if (!isConfigType(paraClientConfig) && !isParaWeb(paraClientConfig)) {
|
|
91
|
+
throw new Error("Invalid Para config");
|
|
92
|
+
}
|
|
93
|
+
const newClient = isConfigType(paraClientConfig) ? new ParaWeb(paraClientConfig.env, paraClientConfig.apiKey, paraClientConfig.opts) : paraClientConfig;
|
|
94
|
+
setClient(newClient);
|
|
95
|
+
}, [paraClientConfig]);
|
|
96
|
+
if (!client) {
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
return /* @__PURE__ */ jsx(
|
|
100
|
+
AuthProvider,
|
|
101
|
+
{
|
|
102
|
+
is2faEnabled: paraModalConfig == null ? void 0 : paraModalConfig.twoFactorAuthEnabled,
|
|
103
|
+
isRecoverySecretStepEnabled: paraModalConfig == null ? void 0 : paraModalConfig.recoverySecretStepEnabled,
|
|
104
|
+
overrides: {
|
|
105
|
+
login: paraModalConfig == null ? void 0 : paraModalConfig.loginTransitionOverride,
|
|
106
|
+
createWallets: paraModalConfig == null ? void 0 : paraModalConfig.createWalletOverride
|
|
107
|
+
},
|
|
108
|
+
children: /* @__PURE__ */ jsx(ExternalWalletWrapper, { config: externalWalletConfig, children: /* @__PURE__ */ jsxs(AccountLinkProvider, { children: [
|
|
109
|
+
children,
|
|
110
|
+
!config.disableEmbeddedModal && client.isReady && /* @__PURE__ */ jsx(ParaModal, { ref })
|
|
111
|
+
] }) })
|
|
112
|
+
}
|
|
113
|
+
);
|
|
114
|
+
});
|
|
115
|
+
export {
|
|
116
|
+
ParaProvider
|
|
117
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import ParaWeb, { PrimaryAuthInfo } from '@getpara/web-sdk';
|
|
2
|
+
type AccountValue = PrimaryAuthInfo & {
|
|
3
|
+
email?: string;
|
|
4
|
+
phone?: `+${number}`;
|
|
5
|
+
farcasterUsername?: string;
|
|
6
|
+
telegramUserId?: string;
|
|
7
|
+
externalWalletAddress?: string;
|
|
8
|
+
wallets: (typeof ParaWeb.prototype)['availableWallets'];
|
|
9
|
+
userId?: string;
|
|
10
|
+
};
|
|
11
|
+
export type Account = ({
|
|
12
|
+
isConnected: false;
|
|
13
|
+
isGuestMode?: false;
|
|
14
|
+
} & {
|
|
15
|
+
[key in keyof AccountValue]?: undefined;
|
|
16
|
+
}) | ({
|
|
17
|
+
isConnected: true;
|
|
18
|
+
isGuestMode: true;
|
|
19
|
+
} & Pick<AccountValue, 'wallets'> & {
|
|
20
|
+
[key in keyof Omit<AccountValue, 'wallets'>]?: undefined;
|
|
21
|
+
}) | ({
|
|
22
|
+
isConnected: true;
|
|
23
|
+
isGuestMode: false;
|
|
24
|
+
} & AccountValue);
|
|
25
|
+
export declare const getEmbeddedAccount: (para?: ParaWeb, _isConnected?: boolean) => Promise<Account>;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__async
|
|
4
|
+
} from "../../chunk-MMUBH76A.js";
|
|
5
|
+
const getEmbeddedAccount = (para, _isConnected) => __async(void 0, null, function* () {
|
|
6
|
+
if (!!para && para.isGuestMode) {
|
|
7
|
+
return {
|
|
8
|
+
isConnected: true,
|
|
9
|
+
isGuestMode: true,
|
|
10
|
+
wallets: para.availableWallets
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
const isConnected = !!para && (_isConnected != null ? _isConnected : yield para == null ? void 0 : para.isFullyLoggedIn());
|
|
14
|
+
if (isConnected) {
|
|
15
|
+
const authInfo = para.authInfo;
|
|
16
|
+
const value = {
|
|
17
|
+
auth: authInfo == null ? void 0 : authInfo.auth,
|
|
18
|
+
authType: authInfo == null ? void 0 : authInfo.authType,
|
|
19
|
+
identifier: authInfo == null ? void 0 : authInfo.identifier,
|
|
20
|
+
userId: para.userId,
|
|
21
|
+
wallets: para.availableWallets,
|
|
22
|
+
isConnected: true,
|
|
23
|
+
isGuestMode: false
|
|
24
|
+
};
|
|
25
|
+
if (authInfo) {
|
|
26
|
+
switch (authInfo.authType) {
|
|
27
|
+
case "email":
|
|
28
|
+
value.email = authInfo.identifier;
|
|
29
|
+
break;
|
|
30
|
+
case "phone":
|
|
31
|
+
value.phone = authInfo.identifier;
|
|
32
|
+
break;
|
|
33
|
+
case "farcaster":
|
|
34
|
+
value.farcasterUsername = authInfo.identifier;
|
|
35
|
+
break;
|
|
36
|
+
case "telegram":
|
|
37
|
+
value.telegramUserId = authInfo.identifier;
|
|
38
|
+
break;
|
|
39
|
+
case "externalWallet":
|
|
40
|
+
value.externalWalletAddress = authInfo.identifier;
|
|
41
|
+
break;
|
|
42
|
+
default:
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return value;
|
|
47
|
+
}
|
|
48
|
+
return { isConnected: false };
|
|
49
|
+
});
|
|
50
|
+
export {
|
|
51
|
+
getEmbeddedAccount
|
|
52
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import ParaWeb, {
|
|
1
|
+
import ParaWeb, { TWalletType } from '@getpara/web-sdk';
|
|
2
2
|
export declare const getWallet: (para?: ParaWeb, selectedWallet?: {
|
|
3
3
|
id?: string;
|
|
4
|
-
type?:
|
|
5
|
-
}) => Promise<Omit<import("@getpara/web-sdk").Wallet, "signer"> | null
|
|
4
|
+
type?: TWalletType;
|
|
5
|
+
}, isConnected?: boolean) => Promise<Omit<import("@getpara/web-sdk").Wallet, "signer"> | null>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__async
|
|
4
|
+
} from "../../chunk-MMUBH76A.js";
|
|
5
|
+
const getWallet = (para, selectedWallet, isConnected) => __async(void 0, null, function* () {
|
|
6
|
+
var _a;
|
|
7
|
+
if (!para) {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
const isLoggedIn = isConnected != null ? isConnected : yield para == null ? void 0 : para.isFullyLoggedIn();
|
|
11
|
+
if (!isLoggedIn) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
return (_a = para.findWallet(selectedWallet == null ? void 0 : selectedWallet.id, selectedWallet == null ? void 0 : selectedWallet.type)) != null ? _a : null;
|
|
15
|
+
});
|
|
16
|
+
export {
|
|
17
|
+
getWallet
|
|
18
|
+
};
|
|
@@ -1,25 +1,47 @@
|
|
|
1
|
-
export declare const signUpOrLogIn: import("./utils.js").CoreAction<"
|
|
2
|
-
export declare const verifyNewAccount: import("./utils.js").CoreAction<"
|
|
3
|
-
export declare const waitForLogin: import("./utils.js").CoreAction<"
|
|
4
|
-
export declare const waitForSignup: import("./utils.js").CoreAction<"
|
|
5
|
-
export declare const waitForWalletCreation: import("./utils.js").CoreAction<"
|
|
6
|
-
export declare const verifyOAuth: import("./utils.js").CoreAction<"
|
|
7
|
-
export declare const verifyFarcaster: import("./utils.js").CoreAction<"
|
|
8
|
-
export declare const verifyTelegram: import("./utils.js").CoreAction<"
|
|
9
|
-
export declare const loginExternalWallet: import("./utils.js").CoreAction<"
|
|
10
|
-
export declare const verifyExternalWallet: import("./utils.js").CoreAction<"
|
|
11
|
-
export declare const setup2fa: import("./utils.js").CoreAction<"
|
|
12
|
-
export declare const enable2fa: import("./utils.js").CoreAction<"
|
|
13
|
-
export declare const verify2fa: import("./utils.js").CoreAction<"
|
|
1
|
+
export declare const signUpOrLogIn: import("./utils.js").CoreAction<"signUpOrLogIn">;
|
|
2
|
+
export declare const verifyNewAccount: import("./utils.js").CoreAction<"verifyNewAccount">;
|
|
3
|
+
export declare const waitForLogin: import("./utils.js").CoreAction<"waitForLogin">;
|
|
4
|
+
export declare const waitForSignup: import("./utils.js").CoreAction<"waitForSignup">;
|
|
5
|
+
export declare const waitForWalletCreation: import("./utils.js").CoreAction<"waitForWalletCreation">;
|
|
6
|
+
export declare const verifyOAuth: import("./utils.js").CoreAction<"verifyOAuth">;
|
|
7
|
+
export declare const verifyFarcaster: import("./utils.js").CoreAction<"verifyFarcaster">;
|
|
8
|
+
export declare const verifyTelegram: import("./utils.js").CoreAction<"verifyTelegram">;
|
|
9
|
+
export declare const loginExternalWallet: import("./utils.js").CoreAction<"loginExternalWallet">;
|
|
10
|
+
export declare const verifyExternalWallet: import("./utils.js").CoreAction<"verifyExternalWallet">;
|
|
11
|
+
export declare const setup2fa: import("./utils.js").CoreAction<"setup2fa">;
|
|
12
|
+
export declare const enable2fa: import("./utils.js").CoreAction<"enable2fa">;
|
|
13
|
+
export declare const verify2fa: import("./utils.js").CoreAction<"verify2fa">;
|
|
14
14
|
export declare const keepSessionAlive: import("./utils.js").CoreAction<"keepSessionAlive">;
|
|
15
15
|
export declare const logout: import("./utils.js").CoreAction<"logout">;
|
|
16
16
|
export declare const resendVerificationCode: import("./utils.js").CoreAction<"resendVerificationCode">;
|
|
17
17
|
export declare const createWallet: import("./utils.js").CoreAction<"createWallet">;
|
|
18
18
|
export declare const createWalletPerType: import("./utils.js").CoreAction<"createWalletPerType">;
|
|
19
|
-
export declare const createPregenWallet: import("./utils.js").CoreAction<"
|
|
20
|
-
export declare const createPregenWalletPerType: import("./utils.js").CoreAction<"
|
|
21
|
-
export declare const claimPregenWallets: import("./utils.js").CoreAction<"
|
|
22
|
-
export declare const hasPregenWallet: import("./utils.js").CoreAction<"
|
|
23
|
-
export declare const updatePregenWalletIdentifier: import("./utils.js").CoreAction<"
|
|
19
|
+
export declare const createPregenWallet: import("./utils.js").CoreAction<"createPregenWallet">;
|
|
20
|
+
export declare const createPregenWalletPerType: import("./utils.js").CoreAction<"createPregenWalletPerType">;
|
|
21
|
+
export declare const claimPregenWallets: import("./utils.js").CoreAction<"claimPregenWallets">;
|
|
22
|
+
export declare const hasPregenWallet: import("./utils.js").CoreAction<"hasPregenWallet">;
|
|
23
|
+
export declare const updatePregenWalletIdentifier: import("./utils.js").CoreAction<"updatePregenWalletIdentifier">;
|
|
24
|
+
export declare const createGuestWallets: import("./utils.js").CoreAction<"createGuestWallets">;
|
|
24
25
|
export declare const signMessage: import("./utils.js").CoreAction<"signMessage">;
|
|
25
26
|
export declare const signTransaction: import("./utils.js").CoreAction<"signTransaction">;
|
|
27
|
+
export declare const getWalletBalance: import("./utils.js").CoreAction<"getWalletBalance">;
|
|
28
|
+
export declare const issueJwt: import("./utils.js").CoreAction<"issueJwt">;
|
|
29
|
+
export declare const getLinkedAccounts: import("./utils.js").CoreAction<"getLinkedAccounts">;
|
|
30
|
+
export declare const accountLinkInProgress: import("./utils.js").CoreAction<"accountLinkInProgress">;
|
|
31
|
+
export declare const linkAccount: (_?: import("@getpara/core-sdk").default, __?: {
|
|
32
|
+
auth: import("@getpara/user-management-client").VerifiedAuth;
|
|
33
|
+
} | {
|
|
34
|
+
externalWallet: import("@getpara/user-management-client").ExternalWalletInfo;
|
|
35
|
+
} | {
|
|
36
|
+
type: import("@getpara/user-management-client").TLinkedAccountType | "X";
|
|
37
|
+
} | undefined) => Promise<import("@getpara/core-sdk").AccountLinkInProgress>;
|
|
38
|
+
export declare const unlinkAccount: (_?: import("@getpara/core-sdk").default, __?: {
|
|
39
|
+
linkedAccountId: string;
|
|
40
|
+
} | undefined) => Promise<import("@getpara/user-management-client").LinkedAccounts>;
|
|
41
|
+
export declare const verifyEmailOrPhoneLink: (_?: import("@getpara/core-sdk").default, __?: {
|
|
42
|
+
verificationCode?: string;
|
|
43
|
+
} | undefined) => Promise<import("@getpara/user-management-client").LinkedAccounts>;
|
|
44
|
+
export declare const verifyFarcasterLink: (_?: import("@getpara/core-sdk").default, __?: import("@getpara/core-sdk/dist/types/types/methods.js").FarcasterParams | undefined) => Promise<import("@getpara/user-management-client").LinkedAccounts>;
|
|
45
|
+
export declare const verifyTelegramLink: (_?: import("@getpara/core-sdk").default, __?: import("@getpara/core-sdk/dist/types/types/methods.js").TelegramParams | undefined) => Promise<import("@getpara/user-management-client").LinkedAccounts>;
|
|
46
|
+
export declare const verifyOAuthLink: (_?: import("@getpara/core-sdk").default, __?: import("@getpara/core-sdk/dist/types/types/methods.js").OAuthParams | undefined) => Promise<import("@getpara/user-management-client").LinkedAccounts>;
|
|
47
|
+
export declare const verifyExternalWalletLink: (_?: import("@getpara/core-sdk").default, __?: Omit<import("@getpara/user-management-client").VerifyExternalWalletParams, "externalWallet"> | undefined) => Promise<import("@getpara/user-management-client").LinkedAccounts>;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../chunk-MMUBH76A.js";
|
|
3
|
+
import { generateCoreAction, generateInternalAction } from "./utils.js";
|
|
4
|
+
const signUpOrLogIn = generateCoreAction("signUpOrLogIn");
|
|
5
|
+
const verifyNewAccount = generateCoreAction("verifyNewAccount");
|
|
6
|
+
const waitForLogin = generateCoreAction("waitForLogin");
|
|
7
|
+
const waitForSignup = generateCoreAction("waitForSignup");
|
|
8
|
+
const waitForWalletCreation = generateCoreAction("waitForWalletCreation");
|
|
9
|
+
const verifyOAuth = generateCoreAction("verifyOAuth");
|
|
10
|
+
const verifyFarcaster = generateCoreAction("verifyFarcaster");
|
|
11
|
+
const verifyTelegram = generateCoreAction("verifyTelegram");
|
|
12
|
+
const loginExternalWallet = generateCoreAction("loginExternalWallet");
|
|
13
|
+
const verifyExternalWallet = generateCoreAction("verifyExternalWallet");
|
|
14
|
+
const setup2fa = generateCoreAction("setup2fa");
|
|
15
|
+
const enable2fa = generateCoreAction("enable2fa");
|
|
16
|
+
const verify2fa = generateCoreAction("verify2fa");
|
|
17
|
+
const keepSessionAlive = generateCoreAction("keepSessionAlive");
|
|
18
|
+
const logout = generateCoreAction("logout");
|
|
19
|
+
const resendVerificationCode = generateCoreAction("resendVerificationCode");
|
|
20
|
+
const createWallet = generateCoreAction("createWallet");
|
|
21
|
+
const createWalletPerType = generateCoreAction("createWalletPerType");
|
|
22
|
+
const createPregenWallet = generateCoreAction("createPregenWallet");
|
|
23
|
+
const createPregenWalletPerType = generateCoreAction("createPregenWalletPerType");
|
|
24
|
+
const claimPregenWallets = generateCoreAction("claimPregenWallets");
|
|
25
|
+
const hasPregenWallet = generateCoreAction("hasPregenWallet");
|
|
26
|
+
const updatePregenWalletIdentifier = generateCoreAction("updatePregenWalletIdentifier");
|
|
27
|
+
const createGuestWallets = generateCoreAction("createGuestWallets");
|
|
28
|
+
const signMessage = generateCoreAction("signMessage");
|
|
29
|
+
const signTransaction = generateCoreAction("signTransaction");
|
|
30
|
+
const getWalletBalance = generateCoreAction("getWalletBalance");
|
|
31
|
+
const issueJwt = generateCoreAction("issueJwt");
|
|
32
|
+
const getLinkedAccounts = generateCoreAction("getLinkedAccounts");
|
|
33
|
+
const accountLinkInProgress = generateCoreAction("accountLinkInProgress");
|
|
34
|
+
const linkAccount = generateInternalAction("linkAccount");
|
|
35
|
+
const unlinkAccount = generateInternalAction("unlinkAccount");
|
|
36
|
+
const verifyEmailOrPhoneLink = generateInternalAction("verifyEmailOrPhoneLink");
|
|
37
|
+
const verifyFarcasterLink = generateInternalAction("verifyFarcasterLink");
|
|
38
|
+
const verifyTelegramLink = generateInternalAction("verifyTelegramLink");
|
|
39
|
+
const verifyOAuthLink = generateInternalAction("verifyOAuthLink");
|
|
40
|
+
const verifyExternalWalletLink = generateInternalAction("verifyExternalWalletLink");
|
|
41
|
+
export {
|
|
42
|
+
accountLinkInProgress,
|
|
43
|
+
claimPregenWallets,
|
|
44
|
+
createGuestWallets,
|
|
45
|
+
createPregenWallet,
|
|
46
|
+
createPregenWalletPerType,
|
|
47
|
+
createWallet,
|
|
48
|
+
createWalletPerType,
|
|
49
|
+
enable2fa,
|
|
50
|
+
getLinkedAccounts,
|
|
51
|
+
getWalletBalance,
|
|
52
|
+
hasPregenWallet,
|
|
53
|
+
issueJwt,
|
|
54
|
+
keepSessionAlive,
|
|
55
|
+
linkAccount,
|
|
56
|
+
loginExternalWallet,
|
|
57
|
+
logout,
|
|
58
|
+
resendVerificationCode,
|
|
59
|
+
setup2fa,
|
|
60
|
+
signMessage,
|
|
61
|
+
signTransaction,
|
|
62
|
+
signUpOrLogIn,
|
|
63
|
+
unlinkAccount,
|
|
64
|
+
updatePregenWalletIdentifier,
|
|
65
|
+
verify2fa,
|
|
66
|
+
verifyEmailOrPhoneLink,
|
|
67
|
+
verifyExternalWallet,
|
|
68
|
+
verifyExternalWalletLink,
|
|
69
|
+
verifyFarcaster,
|
|
70
|
+
verifyFarcasterLink,
|
|
71
|
+
verifyNewAccount,
|
|
72
|
+
verifyOAuth,
|
|
73
|
+
verifyOAuthLink,
|
|
74
|
+
verifyTelegram,
|
|
75
|
+
verifyTelegramLink,
|
|
76
|
+
waitForLogin,
|
|
77
|
+
waitForSignup,
|
|
78
|
+
waitForWalletCreation
|
|
79
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import ParaWeb, { CoreMethodName, CoreMethodParams, CoreMethodResponse, CoreMethods } from '@getpara/web-sdk';
|
|
2
|
-
export type CoreAction<method extends CoreMethodName & keyof CoreMethods> = (para?: ParaWeb, ...args: [CoreMethodParams<method>]) => Promise<Awaited<CoreMethodResponse<method>>>;
|
|
3
|
-
export declare function
|
|
1
|
+
import ParaWeb, { CoreMethodName, CoreMethodParams, CoreMethodResponse, CoreMethods, InternalAction, InternalMethodName, InternalMethods } from '@getpara/web-sdk';
|
|
2
|
+
export type CoreAction<method extends CoreMethodName & keyof CoreMethods> = (para?: ParaWeb, ...args: [CoreMethodParams<method>] | []) => Promise<Awaited<CoreMethodResponse<method>>>;
|
|
3
|
+
export declare function generateCoreAction<const method extends CoreMethodName & keyof CoreMethods>(method: method): CoreAction<method>;
|
|
4
|
+
export declare function generateInternalAction<const method extends InternalMethodName & keyof InternalMethods>(method: method): InternalAction<method>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__async
|
|
4
|
+
} from "../../chunk-MMUBH76A.js";
|
|
5
|
+
function generateCoreAction(method) {
|
|
6
|
+
return (_para, ...args) => __async(this, null, function* () {
|
|
7
|
+
try {
|
|
8
|
+
if (!_para) {
|
|
9
|
+
throw new Error("no para instance");
|
|
10
|
+
}
|
|
11
|
+
const para = _para;
|
|
12
|
+
return typeof para[method] === "function" ? yield para[method](...args) : para[method];
|
|
13
|
+
} catch (e) {
|
|
14
|
+
throw e;
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
function generateInternalAction(method) {
|
|
19
|
+
return (_para, ...args) => __async(this, null, function* () {
|
|
20
|
+
try {
|
|
21
|
+
if (!_para) {
|
|
22
|
+
throw new Error("no para instance");
|
|
23
|
+
}
|
|
24
|
+
const para = _para;
|
|
25
|
+
return typeof para[method] === "function" ? yield para[method](...args) : para[method];
|
|
26
|
+
} catch (e) {
|
|
27
|
+
throw e;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
generateCoreAction,
|
|
33
|
+
generateInternalAction
|
|
34
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
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 { COSMOS_WALLETS } from "@getpara/web-sdk";
|
|
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 COSMOS_WALLETS);
|
|
20
|
+
const connectionOnly = useStore((state) => state.connectionOnly);
|
|
21
|
+
const includeWalletVerification = useStore((state) => state.includeWalletVerification);
|
|
22
|
+
return /* @__PURE__ */ jsx(
|
|
23
|
+
CosmosExternalWalletProvider,
|
|
24
|
+
{
|
|
25
|
+
config: cosmosConnectorConfig,
|
|
26
|
+
internalConfig: {
|
|
27
|
+
onSwitchWallet,
|
|
28
|
+
para,
|
|
29
|
+
walletsWithFullAuth: externalWalletsWithFullAuth,
|
|
30
|
+
connectedWallet: wallet,
|
|
31
|
+
connectionOnly,
|
|
32
|
+
includeWalletVerification
|
|
33
|
+
},
|
|
34
|
+
grazProviderProps,
|
|
35
|
+
isUsing,
|
|
36
|
+
wallets,
|
|
37
|
+
children
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
export {
|
|
42
|
+
CosmosWalletWrapper
|
|
43
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
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 { EVM_WALLETS } from "@getpara/web-sdk";
|
|
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 connectionOnly = useStore((state) => state.connectionOnly);
|
|
20
|
+
const includeWalletVerification = useStore((state) => state.includeWalletVerification);
|
|
21
|
+
const isUsing = wallets.some((w) => w in EVM_WALLETS);
|
|
22
|
+
return /* @__PURE__ */ jsx(
|
|
23
|
+
EvmExternalWalletProvider,
|
|
24
|
+
{
|
|
25
|
+
config: evmProviderConfig,
|
|
26
|
+
internalConfig: {
|
|
27
|
+
onSwitchWallet,
|
|
28
|
+
para,
|
|
29
|
+
walletsWithFullAuth: externalWalletsWithFullAuth,
|
|
30
|
+
connectedWallet: wallet,
|
|
31
|
+
connectionOnly,
|
|
32
|
+
includeWalletVerification
|
|
33
|
+
},
|
|
34
|
+
wagmiProviderProps,
|
|
35
|
+
isUsing,
|
|
36
|
+
wallets,
|
|
37
|
+
children
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
export {
|
|
42
|
+
EvmWalletWrapper
|
|
43
|
+
};
|
|
@@ -0,0 +1,140 @@
|
|
|
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
|
+
selectedChainId: "theta-testnet-001"
|
|
103
|
+
} : cosmosConnector.config,
|
|
104
|
+
[cosmosConnector]
|
|
105
|
+
);
|
|
106
|
+
const grazProviderProps = useMemo(() => {
|
|
107
|
+
var _a2, _b;
|
|
108
|
+
const connectorsGrazProviderProps = cosmosConnector == null ? void 0 : cosmosConnector.grazProviderProps;
|
|
109
|
+
return __spreadProps(__spreadValues({}, connectorsGrazProviderProps), {
|
|
110
|
+
walletConnect: __spreadProps(__spreadValues({}, connectorsGrazProviderProps == null ? void 0 : connectorsGrazProviderProps.walletConnect), {
|
|
111
|
+
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 : "" })
|
|
112
|
+
})
|
|
113
|
+
});
|
|
114
|
+
}, [cosmosConnector, walletConnect == null ? void 0 : walletConnect.projectId]);
|
|
115
|
+
const handleSwitchWallet = useCallback(({ address, error }) => {
|
|
116
|
+
if (error || !address) {
|
|
117
|
+
resetModalState();
|
|
118
|
+
}
|
|
119
|
+
}, []);
|
|
120
|
+
return /* @__PURE__ */ jsx(
|
|
121
|
+
EvmWalletWrapper,
|
|
122
|
+
{
|
|
123
|
+
evmProviderConfig,
|
|
124
|
+
wagmiProviderProps: (_a = evmConnector == null ? void 0 : evmConnector.wagmiProviderProps) != null ? _a : {},
|
|
125
|
+
onSwitchWallet: handleSwitchWallet,
|
|
126
|
+
children: /* @__PURE__ */ jsx(
|
|
127
|
+
CosmosWalletWrapper,
|
|
128
|
+
{
|
|
129
|
+
cosmosConnectorConfig: cosmosProviderConfig,
|
|
130
|
+
grazProviderProps,
|
|
131
|
+
onSwitchWallet: handleSwitchWallet,
|
|
132
|
+
children: /* @__PURE__ */ jsx(SolanaWalletWrapper, { onSwitchWallet: handleSwitchWallet, solanaProviderConfig, children: /* @__PURE__ */ jsx(ExternalWalletProvider, { children }) })
|
|
133
|
+
}
|
|
134
|
+
)
|
|
135
|
+
}
|
|
136
|
+
);
|
|
137
|
+
};
|
|
138
|
+
export {
|
|
139
|
+
ExternalWalletWrapper
|
|
140
|
+
};
|