@getpara/react-sdk 1.12.0 → 2.0.0-alpha.10
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 +35 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +5 -0
- package/dist/modal/ParaModal.js +211 -313
- package/dist/modal/components/Account/Account.js +73 -16
- package/dist/modal/components/AddFunds/AddFunds.js +5 -6
- package/dist/modal/components/AddFunds/AddFundsAsset.js +15 -13
- package/dist/modal/components/AddFunds/AddFundsAwaiting.js +16 -10
- package/dist/modal/components/AddFunds/AddFundsContext.d.ts +2 -2
- package/dist/modal/components/AddFunds/AddFundsContext.js +20 -14
- package/dist/modal/components/AddFunds/AddFundsDone.js +10 -4
- package/dist/modal/components/AddFunds/AddFundsProvider.js +11 -7
- package/dist/modal/components/AddFunds/AddFundsReceive.js +17 -13
- package/dist/modal/components/AddFunds/AddFundsSettings.js +10 -6
- package/dist/modal/components/AddFunds/common.d.ts +1 -1
- package/dist/modal/components/AuthInput/AuthInput.d.ts +1 -1
- package/dist/modal/components/AuthInput/AuthInput.js +70 -91
- package/dist/modal/components/AuthInput/hooks/useDropdownPosition.d.ts +4 -4
- package/dist/modal/components/AuthInput/hooks/useDropdownPosition.js +4 -4
- package/dist/modal/components/AuthMainStep/AuthMainStep.d.ts +4 -3
- package/dist/modal/components/AuthMainStep/AuthMainStep.js +20 -7
- package/dist/modal/components/AuthMainStep/AuthMainStepContent.d.ts +4 -3
- package/dist/modal/components/AuthMainStep/AuthMainStepContent.js +54 -10
- package/dist/modal/components/AuthOptions/AuthOptions.d.ts +4 -3
- package/dist/modal/components/AuthOptions/AuthOptions.js +35 -7
- package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.d.ts +5 -1
- package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.js +9 -4
- package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.d.ts +1 -3
- package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.js +25 -17
- package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.d.ts +1 -1
- package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.js +34 -72
- package/dist/modal/components/Body/Body.d.ts +4 -3
- package/dist/modal/components/Body/Body.js +27 -10
- package/dist/modal/components/ChainSwitch/ChainSwitch.d.ts +1 -1
- package/dist/modal/components/ChainSwitch/ChainSwitch.js +5 -4
- package/dist/modal/components/Controls/Controls.js +5 -2
- package/dist/modal/components/Controls/Selects.d.ts +1 -1
- package/dist/modal/components/Controls/Selects.js +30 -25
- package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.d.ts +1 -1
- package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.js +10 -6
- package/dist/modal/components/ExternalWalletVerificationStep/ExternalWalletVerificationStep.js +7 -69
- package/dist/modal/components/ExternalWallets/ExternalWallets.js +7 -6
- package/dist/modal/components/Footer/Footer.d.ts +1 -1
- package/dist/modal/components/Footer/Footer.js +6 -4
- package/dist/modal/components/Header/hooks/useStepTitle.js +7 -3
- package/dist/modal/components/Hero/Hero.js +5 -5
- package/dist/modal/components/IFrameStep/IFrameStep.js +8 -4
- package/dist/modal/components/LoginDoneStep/LoginDoneStep.js +7 -4
- package/dist/modal/components/ModalContent/ModalContent.js +14 -243
- package/dist/modal/components/OAuth/FarcasterOAuthStep.js +3 -57
- package/dist/modal/components/OAuth/OAuth.d.ts +2 -2
- package/dist/modal/components/OAuth/OAuth.js +11 -85
- package/dist/modal/components/OAuth/TelegramOAuthStep.js +11 -60
- package/dist/modal/components/OnRampComponents/AddingFunds.js +1 -1
- package/dist/modal/components/RecoverySecretStep/RecoverySecretStep.js +10 -4
- package/dist/modal/components/Setup2FAStep/Setup2FAStep.js +23 -32
- package/dist/modal/components/StripeComponents/StripeComponents.js +1 -1
- package/dist/modal/components/TwoFactorDoneStep/TwoFactorDoneStep.js +5 -2
- package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.js +44 -60
- package/dist/modal/components/WalletCard/WalletCard.d.ts +5 -5
- package/dist/modal/components/WalletCard/WalletCard.js +8 -7
- package/dist/modal/components/WalletCreationDoneStep/WalletCreationDoneStep.js +33 -12
- package/dist/modal/components/common.d.ts +5 -5
- package/dist/modal/components/common.js +10 -4
- package/dist/modal/constants/constants.d.ts +1 -1
- package/dist/modal/constants/oAuthLogos.d.ts +3 -3
- package/dist/modal/hooks/useGoBack.js +6 -5
- package/dist/modal/index.d.ts +0 -3
- package/dist/modal/index.js +1 -5
- package/dist/modal/stores/index.d.ts +0 -2
- package/dist/modal/stores/index.js +0 -2
- package/dist/modal/stores/modal/actions.js +69 -16
- package/dist/modal/stores/modal/useModalStore.d.ts +26 -22
- package/dist/modal/stores/modal/useModalStore.js +9 -13
- package/dist/modal/types/commonTypes.d.ts +0 -52
- package/dist/modal/types/modalProps.d.ts +8 -32
- package/dist/modal/utils/authInputHelpers.d.ts +7 -0
- package/dist/modal/utils/authInputHelpers.js +38 -0
- package/dist/modal/utils/authLayoutHelpers.d.ts +2 -2
- package/dist/modal/{components/AuthInput → utils}/countryCodes.js +6 -3
- package/dist/modal/utils/getTileButtonFlex.d.ts +1 -1
- package/dist/modal/utils/isPasskeySupported.d.ts +1 -0
- package/dist/modal/utils/isPasskeySupported.js +15 -0
- package/dist/modal/utils/openPopup.d.ts +2 -2
- package/dist/modal/utils/openPopup.js +2 -2
- package/dist/modal/utils/steps.d.ts +6 -0
- package/dist/modal/utils/steps.js +15 -0
- package/dist/provider/ParaProvider.d.ts +3 -1
- package/dist/provider/ParaProvider.js +69 -8
- package/dist/provider/actions/getAccount.d.ts +26 -8
- package/dist/provider/actions/getAccount.js +42 -14
- package/dist/provider/actions/getWallet.d.ts +3 -3
- package/dist/provider/actions/index.d.ts +27 -0
- package/dist/provider/actions/index.js +59 -0
- package/dist/provider/actions/utils.d.ts +3 -0
- package/dist/provider/actions/utils.js +15 -0
- package/dist/provider/components/CosmosWalletWrapper.d.ts +11 -0
- package/dist/provider/components/CosmosWalletWrapper.js +34 -0
- package/dist/provider/components/EvmWalletWrapper.d.ts +12 -0
- package/dist/provider/components/EvmWalletWrapper.js +34 -0
- package/dist/provider/components/ExternalWalletWrapper.d.ts +8 -0
- package/dist/provider/components/ExternalWalletWrapper.js +139 -0
- package/dist/provider/components/SolanaWalletWrapper.d.ts +9 -0
- package/dist/provider/components/SolanaWalletWrapper.js +36 -0
- package/dist/provider/external/getParaCosmosConnector.d.ts +7 -0
- package/dist/provider/external/getParaCosmosConnector.js +22 -0
- package/dist/provider/external/getParaEvmConnector.d.ts +7 -0
- package/dist/provider/external/getParaEvmConnector.js +22 -0
- package/dist/provider/external/getParaSolanaConnector.d.ts +7 -0
- package/dist/provider/external/getParaSolanaConnector.js +22 -0
- package/dist/provider/external/stubs/CosmosExternalWalletContextStub.d.ts +12 -0
- package/dist/provider/external/stubs/CosmosExternalWalletContextStub.js +18 -0
- package/dist/provider/external/stubs/EvmExternalWalletContextStub.d.ts +3 -0
- package/dist/provider/external/stubs/EvmExternalWalletContextStub.js +21 -0
- package/dist/provider/external/stubs/SolanaExternalWalletContextStub.d.ts +8 -0
- package/dist/provider/external/stubs/SolanaExternalWalletContextStub.js +14 -0
- package/dist/provider/hooks/mutations/index.d.ts +27 -11
- package/dist/provider/hooks/mutations/index.js +54 -17
- package/dist/provider/hooks/mutations/utils.d.ts +5 -0
- package/dist/provider/hooks/mutations/utils.js +59 -0
- package/dist/provider/hooks/queries/useAccount.d.ts +1 -7
- package/dist/provider/hooks/queries/useWallet.d.ts +1 -1
- package/dist/provider/hooks/queries/useWalletBalance.d.ts +1 -2
- package/dist/provider/hooks/queries/useWalletBalance.js +40 -11
- package/dist/provider/hooks/utils/useAutoSessionKeepAlive.js +5 -5
- package/dist/provider/hooks/utils/useEventListeners.d.ts +1 -1
- package/dist/provider/hooks/utils/useEventListeners.js +100 -56
- package/dist/provider/hooks/utils/useWalletState.d.ts +5 -4
- package/dist/provider/hooks/utils/useWalletState.js +24 -9
- package/dist/provider/index.d.ts +1 -0
- package/dist/provider/index.js +1 -0
- package/dist/provider/providers/AuthProvider.d.ts +35 -0
- package/dist/provider/providers/AuthProvider.js +498 -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 +76 -0
- package/dist/{modal/providers/ExternalWalletContext.js → provider/providers/ExternalWalletProvider.js} +146 -112
- package/dist/provider/providers/SolanaExternalWalletProvider.d.ts +7 -0
- package/dist/provider/providers/SolanaExternalWalletProvider.js +66 -0
- package/dist/provider/stores/getters.d.ts +3 -3
- package/dist/provider/stores/setters.d.ts +1 -0
- package/dist/provider/stores/setters.js +7 -0
- package/dist/provider/stores/slices/config.d.ts +3 -0
- package/dist/provider/stores/slices/config.js +9 -0
- package/dist/provider/stores/slices/externalWallets.d.ts +3 -0
- package/dist/provider/stores/slices/externalWallets.js +40 -0
- package/dist/provider/stores/slices/index.d.ts +1 -0
- package/dist/provider/stores/slices/index.js +1 -0
- package/dist/provider/stores/slices/modal.js +11 -4
- package/dist/provider/stores/types.d.ts +50 -4
- package/dist/provider/stores/useStore.js +4 -3
- package/dist/provider/types/externalWalletProviders.d.ts +12 -0
- package/dist/provider/types/externalWalletProviders.js +1 -0
- package/dist/provider/types/provider.d.ts +126 -17
- package/dist/provider/types/utils.d.ts +20 -0
- package/dist/provider/utils/constants.js +3 -4
- package/dist/provider/utils/paraConfigTypeGuards.d.ts +7 -0
- package/dist/provider/utils/paraConfigTypeGuards.js +13 -0
- package/dist/provider/utils/renameMutations.d.ts +3 -0
- package/dist/provider/utils/renameMutations.js +5 -3
- package/package.json +20 -8
- package/dist/modal/components/ExternalWalletsWrapper/ExternalWalletsWrapper.d.ts +0 -8
- package/dist/modal/components/ExternalWalletsWrapper/ExternalWalletsWrapper.js +0 -124
- package/dist/modal/hooks/useActiveWallet.d.ts +0 -1
- package/dist/modal/hooks/useActiveWallet.js +0 -15
- package/dist/modal/hooks/useCreateAccount.d.ts +0 -6
- package/dist/modal/hooks/useCreateAccount.js +0 -77
- package/dist/modal/hooks/useEmbeddedExternalConnection.d.ts +0 -1
- package/dist/modal/hooks/useEmbeddedExternalConnection.js +0 -54
- package/dist/modal/hooks/useSetLoginURLs.d.ts +0 -8
- package/dist/modal/hooks/useSetLoginURLs.js +0 -49
- package/dist/modal/hooks/useWalletBalance.d.ts +0 -4
- package/dist/modal/hooks/useWalletBalance.js +0 -49
- package/dist/modal/providers/CosmosExternalWalletContextStub.d.ts +0 -42
- package/dist/modal/providers/CosmosExternalWalletContextStub.js +0 -38
- package/dist/modal/providers/EvmExternalWalletContextStub.d.ts +0 -46
- package/dist/modal/providers/EvmExternalWalletContextStub.js +0 -55
- package/dist/modal/providers/ExternalWalletContext.d.ts +0 -92
- package/dist/modal/providers/SolanaExternalWalletContextStub.d.ts +0 -32
- package/dist/modal/providers/SolanaExternalWalletContextStub.js +0 -32
- package/dist/modal/stores/externalWalletProvider/actions.d.ts +0 -3
- package/dist/modal/stores/externalWalletProvider/actions.js +0 -10
- package/dist/modal/stores/externalWalletProvider/useExternalWalletProviderStore.d.ts +0 -22
- package/dist/modal/stores/externalWalletProvider/useExternalWalletProviderStore.js +0 -21
- package/dist/modal/stores/theme/actions.d.ts +0 -3
- package/dist/modal/stores/theme/actions.js +0 -28
- package/dist/modal/stores/theme/useThemeStore.d.ts +0 -20
- package/dist/modal/stores/theme/useThemeStore.js +0 -21
- package/dist/modal/stores/userInfo/actions.d.ts +0 -3
- package/dist/modal/stores/userInfo/actions.js +0 -30
- package/dist/modal/stores/userInfo/useUserInfoStore.d.ts +0 -19
- package/dist/modal/stores/userInfo/useUserInfoStore.js +0 -17
- package/dist/provider/actions/checkIfUserExists.d.ts +0 -9
- package/dist/provider/actions/checkIfUserExists.js +0 -21
- package/dist/provider/actions/createGuestWallets.d.ts +0 -2
- package/dist/provider/actions/createGuestWallets.js +0 -13
- package/dist/provider/actions/createUser.d.ts +0 -12
- package/dist/provider/actions/createUser.js +0 -26
- package/dist/provider/actions/getWalletBalance.d.ts +0 -2
- package/dist/provider/actions/getWalletBalance.js +0 -14
- package/dist/provider/actions/initiateLogin.d.ts +0 -4
- package/dist/provider/actions/initiateLogin.js +0 -20
- package/dist/provider/actions/keepSessionAlive.d.ts +0 -2
- package/dist/provider/actions/keepSessionAlive.js +0 -20
- package/dist/provider/actions/logout.d.ts +0 -2
- package/dist/provider/actions/logout.js +0 -17
- package/dist/provider/actions/signMessage.d.ts +0 -8
- package/dist/provider/actions/signMessage.js +0 -20
- package/dist/provider/actions/signTransaction.d.ts +0 -8
- package/dist/provider/actions/signTransaction.js +0 -20
- package/dist/provider/actions/waitForAccountCreation.d.ts +0 -2
- package/dist/provider/actions/waitForAccountCreation.js +0 -21
- package/dist/provider/actions/waitForLoginAndSetup.d.ts +0 -6
- package/dist/provider/actions/waitForLoginAndSetup.js +0 -24
- package/dist/provider/actions/waitForPasskeyAndCreateWallet.d.ts +0 -2
- package/dist/provider/actions/waitForPasskeyAndCreateWallet.js +0 -21
- package/dist/provider/hooks/mutations/useCheckIfUserExists.d.ts +0 -13
- package/dist/provider/hooks/mutations/useCheckIfUserExists.js +0 -23
- package/dist/provider/hooks/mutations/useCreateGuestWallets.d.ts +0 -15
- package/dist/provider/hooks/mutations/useCreateGuestWallets.js +0 -23
- package/dist/provider/hooks/mutations/useCreateUser.d.ts +0 -13
- package/dist/provider/hooks/mutations/useCreateUser.js +0 -20
- package/dist/provider/hooks/mutations/useInitiateLogin.d.ts +0 -14
- package/dist/provider/hooks/mutations/useInitiateLogin.js +0 -23
- package/dist/provider/hooks/mutations/useKeepSessionAlive.d.ts +0 -12
- package/dist/provider/hooks/mutations/useKeepSessionAlive.js +0 -20
- package/dist/provider/hooks/mutations/useLogout.d.ts +0 -12
- package/dist/provider/hooks/mutations/useLogout.js +0 -30
- package/dist/provider/hooks/mutations/useSignMessage.d.ts +0 -15
- package/dist/provider/hooks/mutations/useSignMessage.js +0 -39
- package/dist/provider/hooks/mutations/useSignTransaction.d.ts +0 -14
- package/dist/provider/hooks/mutations/useSignTransaction.js +0 -39
- package/dist/provider/hooks/mutations/useWaitForAccountCreation.d.ts +0 -12
- package/dist/provider/hooks/mutations/useWaitForAccountCreation.js +0 -30
- package/dist/provider/hooks/mutations/useWaitForLoginAndSetup.d.ts +0 -14
- package/dist/provider/hooks/mutations/useWaitForLoginAndSetup.js +0 -30
- package/dist/provider/hooks/mutations/useWaitForPasskeyAndCreateWallet.d.ts +0 -13
- package/dist/provider/hooks/mutations/useWaitForPasskeyAndCreateWallet.js +0 -30
- /package/dist/modal/{components/AuthInput → utils}/countryCodes.d.ts +0 -0
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
__async
|
|
4
|
-
} from "../../../chunk-MMUBH76A.js";
|
|
5
|
-
import { useMutation } from "@tanstack/react-query";
|
|
6
|
-
import { useClient } from "../index.js";
|
|
7
|
-
import { keepSessionAlive } from "../../actions/keepSessionAlive.js";
|
|
8
|
-
import { renameMutations } from "../../utils/renameMutations.js";
|
|
9
|
-
const useKeepSessionAlive = () => {
|
|
10
|
-
const client = useClient();
|
|
11
|
-
const mutation = useMutation({
|
|
12
|
-
mutationFn: () => __async(void 0, null, function* () {
|
|
13
|
-
return yield keepSessionAlive(client);
|
|
14
|
-
})
|
|
15
|
-
});
|
|
16
|
-
return renameMutations(mutation, "keepSessionAlive");
|
|
17
|
-
};
|
|
18
|
-
export {
|
|
19
|
-
useKeepSessionAlive
|
|
20
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { UseMutateAsyncFunction, UseMutateFunction } from '@tanstack/react-query';
|
|
2
|
-
import { Compute } from '../../types/utils.js';
|
|
3
|
-
import { UseMutationReturnType } from '../../types/query.js';
|
|
4
|
-
type UseLogoutReturnType<TData = void, TError = Error, TVariables = void, TContext = unknown> = Compute<UseMutationReturnType<TData, TError, TVariables, TContext> & {
|
|
5
|
-
logout: UseMutateFunction<TData, TError, TVariables, TContext>;
|
|
6
|
-
logoutAsync: UseMutateAsyncFunction<TData, TError, TVariables, TContext>;
|
|
7
|
-
}>;
|
|
8
|
-
/**
|
|
9
|
-
* Hook for logging out a user
|
|
10
|
-
*/
|
|
11
|
-
export declare const useLogout: () => UseLogoutReturnType<void, Error, void, unknown>;
|
|
12
|
-
export {};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
__async
|
|
4
|
-
} from "../../../chunk-MMUBH76A.js";
|
|
5
|
-
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
6
|
-
import { useClient } from "../index.js";
|
|
7
|
-
import { logout } from "../../actions/logout.js";
|
|
8
|
-
import { useStore } from "../../stores/useStore.js";
|
|
9
|
-
import { ACCOUNT_BASE_KEY } from "../queries/useAccount.js";
|
|
10
|
-
import { WALLET_BASE_KEY } from "../queries/useWallet.js";
|
|
11
|
-
import { renameMutations } from "../../utils/renameMutations.js";
|
|
12
|
-
const useLogout = () => {
|
|
13
|
-
const client = useClient();
|
|
14
|
-
const queryClient = useQueryClient();
|
|
15
|
-
const clearSelectedWallet = useStore((state) => state.clearSelectedWallet);
|
|
16
|
-
const mutation = useMutation({
|
|
17
|
-
mutationFn: () => __async(void 0, null, function* () {
|
|
18
|
-
return yield logout(client);
|
|
19
|
-
}),
|
|
20
|
-
onSettled: () => __async(void 0, null, function* () {
|
|
21
|
-
yield queryClient.invalidateQueries({ queryKey: [ACCOUNT_BASE_KEY], exact: false });
|
|
22
|
-
yield queryClient.invalidateQueries({ queryKey: [WALLET_BASE_KEY], exact: false });
|
|
23
|
-
clearSelectedWallet();
|
|
24
|
-
})
|
|
25
|
-
});
|
|
26
|
-
return renameMutations(mutation, "logout");
|
|
27
|
-
};
|
|
28
|
-
export {
|
|
29
|
-
useLogout
|
|
30
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { UseMutateAsyncFunction, UseMutateFunction } from '@tanstack/react-query';
|
|
2
|
-
import { SignMessageArgs } from '../../actions/signMessage.js';
|
|
3
|
-
import { Compute } from '../../types/utils.js';
|
|
4
|
-
import { UseMutationReturnType } from '../../types/query.js';
|
|
5
|
-
import { FullSignatureRes } from '@getpara/web-sdk';
|
|
6
|
-
type SignMessageMutationArgs = Omit<SignMessageArgs, 'walletId'> & Partial<Pick<SignMessageArgs, 'walletId'>>;
|
|
7
|
-
type UseSignMessageReturnType<TData = FullSignatureRes, TError = Error, TVariables = SignMessageMutationArgs, TContext = unknown> = Compute<UseMutationReturnType<TData, TError, TVariables, TContext> & {
|
|
8
|
-
signMessage: UseMutateFunction<TData, TError, TVariables, TContext>;
|
|
9
|
-
signMessageAsync: UseMutateAsyncFunction<TData, TError, TVariables, TContext>;
|
|
10
|
-
}>;
|
|
11
|
-
/**
|
|
12
|
-
* Hook for signing a message
|
|
13
|
-
*/
|
|
14
|
-
export declare const useSignMessage: () => UseSignMessageReturnType<FullSignatureRes, Error, SignMessageMutationArgs, unknown>;
|
|
15
|
-
export {};
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
__async,
|
|
4
|
-
__spreadProps,
|
|
5
|
-
__spreadValues
|
|
6
|
-
} from "../../../chunk-MMUBH76A.js";
|
|
7
|
-
import { useMutation } from "@tanstack/react-query";
|
|
8
|
-
import { useClient, useWallet } from "../index.js";
|
|
9
|
-
import { signMessage } from "../../actions/signMessage.js";
|
|
10
|
-
import { renameMutations } from "../../utils/renameMutations.js";
|
|
11
|
-
import { EXTERNAL_WALLET_PACKAGE_BY_TYPE } from "../../utils/constants.js";
|
|
12
|
-
const useSignMessage = () => {
|
|
13
|
-
const client = useClient();
|
|
14
|
-
const { data: wallet } = useWallet();
|
|
15
|
-
const mutation = useMutation({
|
|
16
|
-
mutationFn: (args) => __async(void 0, null, function* () {
|
|
17
|
-
let walletId = args == null ? void 0 : args.walletId;
|
|
18
|
-
if (!walletId) {
|
|
19
|
-
if (wallet.isExternal) {
|
|
20
|
-
throw Error(
|
|
21
|
-
`Cannot sign with Capsule using an external wallet. Try using the methods from ${wallet.type ? EXTERNAL_WALLET_PACKAGE_BY_TYPE[wallet.type] : "the external wallet provider package"}.`
|
|
22
|
-
);
|
|
23
|
-
}
|
|
24
|
-
walletId = wallet == null ? void 0 : wallet.id;
|
|
25
|
-
}
|
|
26
|
-
if (!walletId) {
|
|
27
|
-
throw Error("no wallet id found");
|
|
28
|
-
}
|
|
29
|
-
return yield signMessage(client, __spreadProps(__spreadValues({}, args), { walletId }));
|
|
30
|
-
})
|
|
31
|
-
});
|
|
32
|
-
return renameMutations(
|
|
33
|
-
mutation,
|
|
34
|
-
"signMessage"
|
|
35
|
-
);
|
|
36
|
-
};
|
|
37
|
-
export {
|
|
38
|
-
useSignMessage
|
|
39
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { UseMutateAsyncFunction, UseMutateFunction } from '@tanstack/react-query';
|
|
2
|
-
import { SignTransactionArgs } from '../../actions/signTransaction.js';
|
|
3
|
-
import { Compute } from '../../types/utils.js';
|
|
4
|
-
import { UseMutationReturnType } from '../../types/query.js';
|
|
5
|
-
import { FullSignatureRes } from '@getpara/web-sdk';
|
|
6
|
-
type UseSignTransactionReturnType<TData = FullSignatureRes, TError = Error, TVariables = SignTransactionArgs, TContext = unknown> = Compute<UseMutationReturnType<TData, TError, TVariables, TContext> & {
|
|
7
|
-
signTransaction: UseMutateFunction<TData, TError, TVariables, TContext>;
|
|
8
|
-
signTransactionAsync: UseMutateAsyncFunction<TData, TError, TVariables, TContext>;
|
|
9
|
-
}>;
|
|
10
|
-
/**
|
|
11
|
-
* Hook for signing a transaction
|
|
12
|
-
*/
|
|
13
|
-
export declare const useSignTransaction: () => UseSignTransactionReturnType<FullSignatureRes, Error, SignTransactionArgs, unknown>;
|
|
14
|
-
export {};
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
__async,
|
|
4
|
-
__spreadProps,
|
|
5
|
-
__spreadValues
|
|
6
|
-
} from "../../../chunk-MMUBH76A.js";
|
|
7
|
-
import { useMutation } from "@tanstack/react-query";
|
|
8
|
-
import { useClient, useWallet } from "../index.js";
|
|
9
|
-
import { signTransaction } from "../../actions/signTransaction.js";
|
|
10
|
-
import { renameMutations } from "../../utils/renameMutations.js";
|
|
11
|
-
import { EXTERNAL_WALLET_PACKAGE_BY_TYPE } from "../../utils/constants.js";
|
|
12
|
-
const useSignTransaction = () => {
|
|
13
|
-
const client = useClient();
|
|
14
|
-
const { data: wallet } = useWallet();
|
|
15
|
-
const mutation = useMutation({
|
|
16
|
-
mutationFn: (args) => __async(void 0, null, function* () {
|
|
17
|
-
let walletId = args == null ? void 0 : args.walletId;
|
|
18
|
-
if (!walletId) {
|
|
19
|
-
if (wallet.isExternal) {
|
|
20
|
-
throw Error(
|
|
21
|
-
`Cannot sign with Capsule using an external wallet. Try using the methods from ${wallet.type ? EXTERNAL_WALLET_PACKAGE_BY_TYPE[wallet.type] : "the external wallet provider package"}.`
|
|
22
|
-
);
|
|
23
|
-
}
|
|
24
|
-
walletId = wallet == null ? void 0 : wallet.id;
|
|
25
|
-
}
|
|
26
|
-
if (!walletId) {
|
|
27
|
-
throw Error("no wallet id found");
|
|
28
|
-
}
|
|
29
|
-
return yield signTransaction(client, __spreadProps(__spreadValues({}, args), { walletId }));
|
|
30
|
-
})
|
|
31
|
-
});
|
|
32
|
-
return renameMutations(
|
|
33
|
-
mutation,
|
|
34
|
-
"signTransaction"
|
|
35
|
-
);
|
|
36
|
-
};
|
|
37
|
-
export {
|
|
38
|
-
useSignTransaction
|
|
39
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { UseMutateAsyncFunction, UseMutateFunction } from '@tanstack/react-query';
|
|
2
|
-
import { UseMutationReturnType } from '../../types/query.js';
|
|
3
|
-
import { Compute } from '../../types/utils.js';
|
|
4
|
-
type UseWaitForAccountCreationReturnType<TData = boolean, TError = Error, TVariables = void, TContext = unknown> = Compute<UseMutationReturnType<TData, TError, TVariables, TContext> & {
|
|
5
|
-
waitForAccountCreation: UseMutateFunction<TData, TError, TVariables, TContext>;
|
|
6
|
-
waitForAccountCreationAsync: UseMutateAsyncFunction<TData, TError, TVariables, TContext>;
|
|
7
|
-
}>;
|
|
8
|
-
/**
|
|
9
|
-
* Hook for waiting for account creation
|
|
10
|
-
*/
|
|
11
|
-
export declare const useWaitForAccountCreation: () => UseWaitForAccountCreationReturnType<boolean, Error, void, unknown>;
|
|
12
|
-
export {};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
__async
|
|
4
|
-
} from "../../../chunk-MMUBH76A.js";
|
|
5
|
-
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
6
|
-
import { useClient } from "../index.js";
|
|
7
|
-
import { waitForAccountCreation } from "../../actions/waitForAccountCreation.js";
|
|
8
|
-
import { ACCOUNT_BASE_KEY } from "../queries/useAccount.js";
|
|
9
|
-
import { WALLET_BASE_KEY } from "../queries/useWallet.js";
|
|
10
|
-
import { renameMutations } from "../../utils/renameMutations.js";
|
|
11
|
-
const useWaitForAccountCreation = () => {
|
|
12
|
-
const client = useClient();
|
|
13
|
-
const queryClient = useQueryClient();
|
|
14
|
-
const mutation = useMutation({
|
|
15
|
-
mutationFn: () => __async(void 0, null, function* () {
|
|
16
|
-
return yield waitForAccountCreation(client);
|
|
17
|
-
}),
|
|
18
|
-
onSettled: () => __async(void 0, null, function* () {
|
|
19
|
-
yield queryClient.invalidateQueries({ queryKey: [ACCOUNT_BASE_KEY], exact: false });
|
|
20
|
-
yield queryClient.invalidateQueries({ queryKey: [WALLET_BASE_KEY], exact: false });
|
|
21
|
-
})
|
|
22
|
-
});
|
|
23
|
-
return renameMutations(
|
|
24
|
-
mutation,
|
|
25
|
-
"waitForAccountCreation"
|
|
26
|
-
);
|
|
27
|
-
};
|
|
28
|
-
export {
|
|
29
|
-
useWaitForAccountCreation
|
|
30
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { UseMutateAsyncFunction, UseMutateFunction } from '@tanstack/react-query';
|
|
2
|
-
import { WaitForLoginAndSetupArgs } from '../../actions/waitForLoginAndSetup.js';
|
|
3
|
-
import { Compute } from '../../types/utils.js';
|
|
4
|
-
import { UseMutationReturnType } from '../../types/query.js';
|
|
5
|
-
import { LoginResponse } from '@getpara/web-sdk';
|
|
6
|
-
type UseWaitForLoginAndSetupReturnType<TData = LoginResponse, TError = Error, TVariables = WaitForLoginAndSetupArgs, TContext = unknown> = Compute<UseMutationReturnType<TData, TError, TVariables, TContext> & {
|
|
7
|
-
waitForLoginAndSetup: UseMutateFunction<TData, TError, TVariables, TContext>;
|
|
8
|
-
waitForLoginAndSetupAsync: UseMutateAsyncFunction<TData, TError, TVariables, TContext>;
|
|
9
|
-
}>;
|
|
10
|
-
/**
|
|
11
|
-
* Hook for waiting for user login and account setup
|
|
12
|
-
*/
|
|
13
|
-
export declare const useWaitForLoginAndSetup: () => UseWaitForLoginAndSetupReturnType<LoginResponse, Error, WaitForLoginAndSetupArgs, unknown>;
|
|
14
|
-
export {};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
__async
|
|
4
|
-
} from "../../../chunk-MMUBH76A.js";
|
|
5
|
-
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
6
|
-
import { useClient } from "../index.js";
|
|
7
|
-
import { waitForLoginAndSetup } from "../../actions/waitForLoginAndSetup.js";
|
|
8
|
-
import { ACCOUNT_BASE_KEY } from "../queries/useAccount.js";
|
|
9
|
-
import { WALLET_BASE_KEY } from "../queries/useWallet.js";
|
|
10
|
-
import { renameMutations } from "../../utils/renameMutations.js";
|
|
11
|
-
const useWaitForLoginAndSetup = () => {
|
|
12
|
-
const client = useClient();
|
|
13
|
-
const queryClient = useQueryClient();
|
|
14
|
-
const mutation = useMutation({
|
|
15
|
-
mutationFn: (args) => __async(void 0, null, function* () {
|
|
16
|
-
return yield waitForLoginAndSetup(client, args);
|
|
17
|
-
}),
|
|
18
|
-
onSettled: () => __async(void 0, null, function* () {
|
|
19
|
-
yield queryClient.invalidateQueries({ queryKey: [ACCOUNT_BASE_KEY], exact: false });
|
|
20
|
-
yield queryClient.invalidateQueries({ queryKey: [WALLET_BASE_KEY], exact: false });
|
|
21
|
-
})
|
|
22
|
-
});
|
|
23
|
-
return renameMutations(
|
|
24
|
-
mutation,
|
|
25
|
-
"waitForLoginAndSetup"
|
|
26
|
-
);
|
|
27
|
-
};
|
|
28
|
-
export {
|
|
29
|
-
useWaitForLoginAndSetup
|
|
30
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { UseMutateAsyncFunction, UseMutateFunction } from '@tanstack/react-query';
|
|
2
|
-
import { UseMutationReturnType } from '../../types/query.js';
|
|
3
|
-
import { Compute } from '../../types/utils.js';
|
|
4
|
-
import { AccountSetupResponse } from '@getpara/web-sdk';
|
|
5
|
-
type UseWaitForPasskeyAndCreateWalletReturnType<TData = AccountSetupResponse, TError = Error, TVariables = void, TContext = unknown> = Compute<UseMutationReturnType<TData, TError, TVariables, TContext> & {
|
|
6
|
-
waitForPasskeyAndCreateWallet: UseMutateFunction<TData, TError, TVariables, TContext>;
|
|
7
|
-
waitForPasskeyAndCreateWalletAsync: UseMutateAsyncFunction<TData, TError, TVariables, TContext>;
|
|
8
|
-
}>;
|
|
9
|
-
/**
|
|
10
|
-
* Hook for waiting for session setup and wallet creation
|
|
11
|
-
*/
|
|
12
|
-
export declare const useWaitForPasskeyAndCreateWallet: () => UseWaitForPasskeyAndCreateWalletReturnType<AccountSetupResponse, Error, void, unknown>;
|
|
13
|
-
export {};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
__async
|
|
4
|
-
} from "../../../chunk-MMUBH76A.js";
|
|
5
|
-
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
6
|
-
import { useClient } from "../index.js";
|
|
7
|
-
import { waitForPasskeyAndCreateWallet } from "../../actions/waitForPasskeyAndCreateWallet.js";
|
|
8
|
-
import { ACCOUNT_BASE_KEY } from "../queries/useAccount.js";
|
|
9
|
-
import { WALLET_BASE_KEY } from "../queries/useWallet.js";
|
|
10
|
-
import { renameMutations } from "../../utils/renameMutations.js";
|
|
11
|
-
const useWaitForPasskeyAndCreateWallet = () => {
|
|
12
|
-
const client = useClient();
|
|
13
|
-
const queryClient = useQueryClient();
|
|
14
|
-
const mutation = useMutation({
|
|
15
|
-
mutationFn: () => __async(void 0, null, function* () {
|
|
16
|
-
return yield waitForPasskeyAndCreateWallet(client);
|
|
17
|
-
}),
|
|
18
|
-
onSettled: () => __async(void 0, null, function* () {
|
|
19
|
-
yield queryClient.invalidateQueries({ queryKey: [ACCOUNT_BASE_KEY], exact: false });
|
|
20
|
-
yield queryClient.invalidateQueries({ queryKey: [WALLET_BASE_KEY], exact: false });
|
|
21
|
-
})
|
|
22
|
-
});
|
|
23
|
-
return renameMutations(
|
|
24
|
-
mutation,
|
|
25
|
-
"waitForPasskeyAndCreateWallet"
|
|
26
|
-
);
|
|
27
|
-
};
|
|
28
|
-
export {
|
|
29
|
-
useWaitForPasskeyAndCreateWallet
|
|
30
|
-
};
|
|
File without changes
|