@cometh/connect-react-hooks 0.0.1 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.cjs CHANGED
@@ -1294,7 +1294,7 @@ var useWriteContract = (mutationProps) => {
1294
1294
  };
1295
1295
  };
1296
1296
 
1297
- // src/hooks/useSendTransactionWithSessionKey.ts
1297
+ // src/hooks/sessionKeys/useSendTransactionWithSessionKey.ts
1298
1298
  var useSendTransactionWithSessionKey = (mutationProps) => {
1299
1299
  const { smartAccountClient, queryClient } = useSmartAccount();
1300
1300
  const { mutate, mutateAsync, ...result } = useMutation(
@@ -1328,7 +1328,7 @@ var useSendTransactionWithSessionKey = (mutationProps) => {
1328
1328
  };
1329
1329
  };
1330
1330
 
1331
- // src/hooks/useWriteContractWithSessionKey.ts
1331
+ // src/hooks/sessionKeys/useWriteContractWithSessionKey.ts
1332
1332
 
1333
1333
  var useWriteContractWithSessionKey = (mutationProps) => {
1334
1334
  const { smartAccountClient, queryClient } = useSmartAccount();
@@ -1464,7 +1464,7 @@ var useDisconnect = () => {
1464
1464
  };
1465
1465
  };
1466
1466
 
1467
- // src/hooks/useOwners.ts
1467
+ // src/hooks/owners/useOwners.ts
1468
1468
  var useAddOwner = (mutationProps) => {
1469
1469
  const { smartAccountClient, queryClient } = useSmartAccount();
1470
1470
  const { mutate, mutateAsync, ...result } = useMutation(
@@ -1550,7 +1550,7 @@ var useGetEnrichedOwners = (queryProps) => {
1550
1550
  );
1551
1551
  };
1552
1552
 
1553
- // src/hooks/useSessionKeys.ts
1553
+ // src/hooks/sessionKeys/useSessionKeys.ts
1554
1554
  var useAddSessionKey = (mutationProps) => {
1555
1555
  const { smartAccountClient, queryClient } = useSmartAccount();
1556
1556
  const { mutate, mutateAsync, ...result } = useMutation(
@@ -1705,7 +1705,7 @@ var useIsAddressWhitelistDestination = (sessionKey, targetAddress, queryProps) =
1705
1705
  );
1706
1706
  };
1707
1707
 
1708
- // src/hooks/useValidateAddDevice.ts
1708
+ // src/hooks/owners/useValidateAddDevice.ts
1709
1709
  var useValidateAddDevice = (mutationProps) => {
1710
1710
  const { smartAccountClient, queryClient } = useSmartAccount();
1711
1711
  const { mutate, mutateAsync, ...result } = useMutation(
@@ -2034,6 +2034,83 @@ function useSignMessage() {
2034
2034
  };
2035
2035
  }
2036
2036
 
2037
+ // src/hooks/recovery/useSetUpRecovery.ts
2038
+ function useSetUpRecovery() {
2039
+ const { smartAccountClient, queryClient } = useSmartAccount();
2040
+ const { mutate, mutateAsync, ...result } = useMutation(
2041
+ {
2042
+ mutationFn: async (variables) => {
2043
+ if (!smartAccountClient) {
2044
+ throw new Error("No smart account found");
2045
+ }
2046
+ return smartAccountClient.setUpRecoveryModule({
2047
+ passKeyName: variables.passKeyName,
2048
+ rpcUrl: variables.rpcUrl,
2049
+ webAuthnOptions: variables.webAuthnOptions,
2050
+ // biome-ignore lint/suspicious/noExplicitAny: TODO: remove any
2051
+ middleware: variables.middleware
2052
+ });
2053
+ }
2054
+ },
2055
+ queryClient
2056
+ );
2057
+ return {
2058
+ setUpRecoveryModule: mutate,
2059
+ setUpRecoveryModuleAsync: mutateAsync,
2060
+ isPending: result.isPending,
2061
+ isError: result.isError,
2062
+ error: result.error,
2063
+ isSuccess: result.isSuccess,
2064
+ data: result.data
2065
+ };
2066
+ }
2067
+
2068
+ // src/hooks/recovery/useIsRecoveryActive.ts
2069
+ function useIsRecoveryActive(props = {}) {
2070
+ const { smartAccountClient, queryClient } = useSmartAccount();
2071
+ return useQuery(
2072
+ {
2073
+ queryKey: ["isRecoveryActive", props.rpcUrl],
2074
+ queryFn: async () => {
2075
+ if (!smartAccountClient) {
2076
+ throw new Error("No smart account found");
2077
+ }
2078
+ return smartAccountClient.isRecoveryActive(props);
2079
+ },
2080
+ enabled: !!smartAccountClient
2081
+ },
2082
+ queryClient
2083
+ );
2084
+ }
2085
+
2086
+ // src/hooks/recovery/useGetRecoveryRequest.ts
2087
+ function useGetRecoveryRequest(props = {}, queryOptions) {
2088
+ const { smartAccountClient, queryClient } = useSmartAccount();
2089
+ const { data, isLoading, isError, error } = useQuery(
2090
+ {
2091
+ queryKey: ["getRecoveryRequest", props.rpcUrl],
2092
+ queryFn: async () => {
2093
+ if (!smartAccountClient) {
2094
+ throw new Error("No smart account found");
2095
+ }
2096
+ return smartAccountClient.getRecoveryRequest(props);
2097
+ },
2098
+ enabled: !!smartAccountClient,
2099
+ ...queryOptions
2100
+ },
2101
+ queryClient
2102
+ );
2103
+ return {
2104
+ data,
2105
+ isLoading,
2106
+ isError,
2107
+ error
2108
+ };
2109
+ }
2110
+
2111
+
2112
+
2113
+
2037
2114
 
2038
2115
 
2039
2116
 
@@ -2061,4 +2138,4 @@ function useSignMessage() {
2061
2138
 
2062
2139
 
2063
2140
 
2064
- exports.ConnectProvider = ConnectProvider; exports.useAccount = useAccount; exports.useAddOwner = useAddOwner; exports.useAddSessionKey = useAddSessionKey; exports.useAddWhitelistDestination = useAddWhitelistDestination; exports.useConnect = useConnect; exports.useCreateNewSigner = useCreateNewSigner; exports.useDisconnect = useDisconnect; exports.useGenerateQRCodeUrl = useGenerateQRCodeUrl; exports.useGetEnrichedOwners = useGetEnrichedOwners; exports.useGetGasPrice = useGetGasPrice; exports.useGetOwners = useGetOwners; exports.useGetSessionFromAddress = useGetSessionFromAddress; exports.useIsAddressWhitelistDestination = useIsAddressWhitelistDestination; exports.useRemoveOwner = useRemoveOwner; exports.useRemoveWhitelistDestination = useRemoveWhitelistDestination; exports.useRetrieveAccountAddressFromPasskeyId = useRetrieveAccountAddressFromPasskeyId; exports.useRetrieveAccountAddressFromPasskeys = useRetrieveAccountAddressFromPasskeys; exports.useRevokeSessionKey = useRevokeSessionKey; exports.useSendTransaction = useSendTransaction; exports.useSendTransactionWithSessionKey = useSendTransactionWithSessionKey; exports.useSerializeUrlWithSignerPayload = useSerializeUrlWithSignerPayload; exports.useSignMessage = useSignMessage; exports.useValidateAddDevice = useValidateAddDevice; exports.useVerifyMessage = useVerifyMessage; exports.useWriteContract = useWriteContract; exports.useWriteContractWithSessionKey = useWriteContractWithSessionKey;
2141
+ exports.ConnectProvider = ConnectProvider; exports.useAccount = useAccount; exports.useAddOwner = useAddOwner; exports.useAddSessionKey = useAddSessionKey; exports.useAddWhitelistDestination = useAddWhitelistDestination; exports.useConnect = useConnect; exports.useCreateNewSigner = useCreateNewSigner; exports.useDisconnect = useDisconnect; exports.useGenerateQRCodeUrl = useGenerateQRCodeUrl; exports.useGetEnrichedOwners = useGetEnrichedOwners; exports.useGetGasPrice = useGetGasPrice; exports.useGetOwners = useGetOwners; exports.useGetRecoveryRequest = useGetRecoveryRequest; exports.useGetSessionFromAddress = useGetSessionFromAddress; exports.useIsAddressWhitelistDestination = useIsAddressWhitelistDestination; exports.useIsRecoveryActive = useIsRecoveryActive; exports.useRemoveOwner = useRemoveOwner; exports.useRemoveWhitelistDestination = useRemoveWhitelistDestination; exports.useRetrieveAccountAddressFromPasskeyId = useRetrieveAccountAddressFromPasskeyId; exports.useRetrieveAccountAddressFromPasskeys = useRetrieveAccountAddressFromPasskeys; exports.useRevokeSessionKey = useRevokeSessionKey; exports.useSendTransaction = useSendTransaction; exports.useSendTransactionWithSessionKey = useSendTransactionWithSessionKey; exports.useSerializeUrlWithSignerPayload = useSerializeUrlWithSignerPayload; exports.useSetUpRecovery = useSetUpRecovery; exports.useSignMessage = useSignMessage; exports.useValidateAddDevice = useValidateAddDevice; exports.useVerifyMessage = useVerifyMessage; exports.useWriteContract = useWriteContract; exports.useWriteContractWithSessionKey = useWriteContractWithSessionKey;
package/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as viem_chains from 'viem/chains';
2
2
  import { Prettify } from 'viem/chains';
3
3
  import * as permissionless_types_entrypoint from 'permissionless/types/entrypoint';
4
- import { ENTRYPOINT_ADDRESS_V07_TYPE } from 'permissionless/types/entrypoint';
4
+ import { EntryPoint, ENTRYPOINT_ADDRESS_V07_TYPE } from 'permissionless/types/entrypoint';
5
5
  import * as permissionless_actions_smartAccount from 'permissionless/actions/smartAccount';
6
6
  import * as permissionless from 'permissionless';
7
7
  import * as permissionless__types_accounts from 'permissionless/_types/accounts';
@@ -10,7 +10,7 @@ import { TypedDataParameter, Abi, Address } from '../abi.js';
10
10
  import * as permissionless__types_actions_smartAccount from 'permissionless/_types/actions/smartAccount';
11
11
  import * as permissionless__types_types_bundler from 'permissionless/_types/types/bundler';
12
12
  import * as _cometh_connect_sdk_4337 from '@cometh/connect-sdk-4337';
13
- import { EnrichedOwner, Session, AddSessionKeyParams, Signer, webAuthnOptions, QRCodeOptions, createSafeSmartAccountParameters } from '@cometh/connect-sdk-4337';
13
+ import { EnrichedOwner, Session, AddSessionKeyParams, Signer, webAuthnOptions, QRCodeOptions, SetUpRecoveryModuleParams, IsRecoveryActiveParams, IsRecoveryActiveReturnType, RecoveryParamsResponse, GetRecoveryRequestParams, createSafeSmartAccountParameters } from '@cometh/connect-sdk-4337';
14
14
  import * as viem from 'viem';
15
15
  import { Hash, Address as Address$1, Hex, Abi as Abi$1, ContractFunctionName, ContractFunctionArgs, Chain, Account, DeriveChain, ContractFunctionParameters, GetChainParameter, GetValue, FormattedTransactionRequest, UnionOmit, SignableMessage } from 'viem';
16
16
  import { y, z, O, aI, a3, at, aQ, aK, b } from './hydration-Bnn1iiSg.js';
@@ -501,6 +501,62 @@ declare const useAccount: () => {
501
501
  entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032";
502
502
  }) => Promise<permissionless.UserOperation<permissionless_types_entrypoint.GetEntryPointVersion<"0x0000000071727De22E5E9d8BAf0edAc6f37da032">>>) | undefined;
503
503
  }) => Promise<viem.Hash>;
504
+ setUpRecoveryModule: <TTransport extends viem.Transport>(args: {
505
+ passKeyName?: string;
506
+ webAuthnOptions?: _cometh_connect_sdk_4337.webAuthnOptions;
507
+ rpcUrl?: string;
508
+ middleware?: {
509
+ gasPrice?: () => Promise<{
510
+ maxFeePerGas: bigint;
511
+ maxPriorityFeePerGas: bigint;
512
+ }>;
513
+ sponsorUserOperation?: ((args: {
514
+ userOperation: {
515
+ sender: Address;
516
+ nonce: bigint;
517
+ factory?: Address;
518
+ factoryData?: viem.Hex;
519
+ callData: viem.Hex;
520
+ callGasLimit: bigint;
521
+ verificationGasLimit: bigint;
522
+ preVerificationGas: bigint;
523
+ maxFeePerGas: bigint;
524
+ maxPriorityFeePerGas: bigint;
525
+ paymaster?: Address;
526
+ paymasterVerificationGasLimit?: bigint;
527
+ paymasterPostOpGasLimit?: bigint;
528
+ paymasterData?: viem.Hex;
529
+ signature: viem.Hex;
530
+ initCode?: never;
531
+ paymasterAndData?: never;
532
+ };
533
+ entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032";
534
+ }) => Promise<permissionless_actions_smartAccount.SponsorUserOperationReturnType<"0x0000000071727De22E5E9d8BAf0edAc6f37da032">>) | undefined;
535
+ } | ((args: {
536
+ userOperation: {
537
+ sender: Address;
538
+ nonce: bigint;
539
+ factory?: Address;
540
+ factoryData?: viem.Hex;
541
+ callData: viem.Hex;
542
+ callGasLimit: bigint;
543
+ verificationGasLimit: bigint;
544
+ preVerificationGas: bigint;
545
+ maxFeePerGas: bigint;
546
+ maxPriorityFeePerGas: bigint;
547
+ paymaster?: Address;
548
+ paymasterVerificationGasLimit?: bigint;
549
+ paymasterPostOpGasLimit?: bigint;
550
+ paymasterData?: viem.Hex;
551
+ signature: viem.Hex;
552
+ initCode?: never;
553
+ paymasterAndData?: never;
554
+ };
555
+ entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032";
556
+ }) => Promise<permissionless.UserOperation<permissionless_types_entrypoint.GetEntryPointVersion<"0x0000000071727De22E5E9d8BAf0edAc6f37da032">>>) | undefined;
557
+ }) => Promise<viem.Hash>;
558
+ isRecoveryActive: <TTransport extends viem.Transport>(args: Parameters<(client: viem.Client<TTransport, viem.Chain, _cometh_connect_sdk_4337.SafeSmartAccount<"0x0000000071727De22E5E9d8BAf0edAc6f37da032", viem.Transport, viem.Chain>>, args?: permissionless__types_types.Prettify<_cometh_connect_sdk_4337.IsRecoveryActiveParams>) => Promise<_cometh_connect_sdk_4337.IsRecoveryActiveReturnType>>[1]) => Promise<_cometh_connect_sdk_4337.IsRecoveryActiveReturnType>;
559
+ getRecoveryRequest: <TTransport extends viem.Transport>(args: Parameters<(client: viem.Client<TTransport, viem.Chain, _cometh_connect_sdk_4337.SafeSmartAccount<"0x0000000071727De22E5E9d8BAf0edAc6f37da032", viem.Transport, viem.Chain>>, args?: permissionless__types_types.Prettify<_cometh_connect_sdk_4337.GetRecoveryRequestParams>) => Promise<_cometh_connect_sdk_4337.RecoveryParamsResponse | undefined>>[1]) => Promise<_cometh_connect_sdk_4337.RecoveryParamsResponse | undefined>;
504
560
  verifySignature: <TTransport extends viem.Transport>(args: Parameters<(client: viem.Client<TTransport, viem.Chain, _cometh_connect_sdk_4337.SafeSmartAccount<"0x0000000071727De22E5E9d8BAf0edAc6f37da032", viem.Transport, viem.Chain>>, args: permissionless__types_types.Prettify<{
505
561
  message: string;
506
562
  signature: viem.Hex;
@@ -649,7 +705,7 @@ declare const useAccount: () => {
649
705
  ownerToRemove: Address;
650
706
  }) => Promise<viem.Hash>;
651
707
  getOwners: () => Promise<readonly Address[]>;
652
- getEnrichedOwners: () => Promise<_cometh_connect_sdk_4337.EnrichedOwner | _cometh_connect_sdk_4337.EnrichedOwner[]>;
708
+ getEnrichedOwners: () => Promise<_cometh_connect_sdk_4337.EnrichedOwner[]>;
653
709
  addSessionKey: (args: _cometh_connect_sdk_4337.AddSessionKeyParams) => Promise<viem.Hash>;
654
710
  revokeSessionKey: (args: {
655
711
  sessionKey: Address;
@@ -736,6 +792,62 @@ declare const useAccount: () => {
736
792
  entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032";
737
793
  }) => Promise<permissionless.UserOperation<permissionless_types_entrypoint.GetEntryPointVersion<"0x0000000071727De22E5E9d8BAf0edAc6f37da032">>>) | undefined;
738
794
  }) => Promise<viem.Hash>;
795
+ setUpRecoveryModule: <TTransport extends viem.Transport>(args: {
796
+ passKeyName?: string;
797
+ webAuthnOptions?: _cometh_connect_sdk_4337.webAuthnOptions;
798
+ rpcUrl?: string;
799
+ middleware?: {
800
+ gasPrice?: () => Promise<{
801
+ maxFeePerGas: bigint;
802
+ maxPriorityFeePerGas: bigint;
803
+ }>;
804
+ sponsorUserOperation?: ((args: {
805
+ userOperation: {
806
+ sender: Address;
807
+ nonce: bigint;
808
+ factory?: Address;
809
+ factoryData?: viem.Hex;
810
+ callData: viem.Hex;
811
+ callGasLimit: bigint;
812
+ verificationGasLimit: bigint;
813
+ preVerificationGas: bigint;
814
+ maxFeePerGas: bigint;
815
+ maxPriorityFeePerGas: bigint;
816
+ paymaster?: Address;
817
+ paymasterVerificationGasLimit?: bigint;
818
+ paymasterPostOpGasLimit?: bigint;
819
+ paymasterData?: viem.Hex;
820
+ signature: viem.Hex;
821
+ initCode?: never;
822
+ paymasterAndData?: never;
823
+ };
824
+ entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032";
825
+ }) => Promise<permissionless_actions_smartAccount.SponsorUserOperationReturnType<"0x0000000071727De22E5E9d8BAf0edAc6f37da032">>) | undefined;
826
+ } | ((args: {
827
+ userOperation: {
828
+ sender: Address;
829
+ nonce: bigint;
830
+ factory?: Address;
831
+ factoryData?: viem.Hex;
832
+ callData: viem.Hex;
833
+ callGasLimit: bigint;
834
+ verificationGasLimit: bigint;
835
+ preVerificationGas: bigint;
836
+ maxFeePerGas: bigint;
837
+ maxPriorityFeePerGas: bigint;
838
+ paymaster?: Address;
839
+ paymasterVerificationGasLimit?: bigint;
840
+ paymasterPostOpGasLimit?: bigint;
841
+ paymasterData?: viem.Hex;
842
+ signature: viem.Hex;
843
+ initCode?: never;
844
+ paymasterAndData?: never;
845
+ };
846
+ entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032";
847
+ }) => Promise<permissionless.UserOperation<permissionless_types_entrypoint.GetEntryPointVersion<"0x0000000071727De22E5E9d8BAf0edAc6f37da032">>>) | undefined;
848
+ }) => Promise<viem.Hash>;
849
+ isRecoveryActive: <TTransport extends viem.Transport>(args: Parameters<(client: viem.Client<TTransport, viem.Chain, _cometh_connect_sdk_4337.SafeSmartAccount<"0x0000000071727De22E5E9d8BAf0edAc6f37da032", viem.Transport, viem.Chain>>, args?: permissionless__types_types.Prettify<_cometh_connect_sdk_4337.IsRecoveryActiveParams>) => Promise<_cometh_connect_sdk_4337.IsRecoveryActiveReturnType>>[1]) => Promise<_cometh_connect_sdk_4337.IsRecoveryActiveReturnType>;
850
+ getRecoveryRequest: <TTransport extends viem.Transport>(args: Parameters<(client: viem.Client<TTransport, viem.Chain, _cometh_connect_sdk_4337.SafeSmartAccount<"0x0000000071727De22E5E9d8BAf0edAc6f37da032", viem.Transport, viem.Chain>>, args?: permissionless__types_types.Prettify<_cometh_connect_sdk_4337.GetRecoveryRequestParams>) => Promise<_cometh_connect_sdk_4337.RecoveryParamsResponse | undefined>>[1]) => Promise<_cometh_connect_sdk_4337.RecoveryParamsResponse | undefined>;
739
851
  verifySignature: <TTransport extends viem.Transport>(args: Parameters<(client: viem.Client<TTransport, viem.Chain, _cometh_connect_sdk_4337.SafeSmartAccount<"0x0000000071727De22E5E9d8BAf0edAc6f37da032", viem.Transport, viem.Chain>>, args: permissionless__types_types.Prettify<{
740
852
  message: string;
741
853
  signature: viem.Hex;
@@ -885,7 +997,7 @@ declare const useAccount: () => {
885
997
  ownerToRemove: Address;
886
998
  }) => Promise<viem.Hash>;
887
999
  getOwners: () => Promise<readonly Address[]>;
888
- getEnrichedOwners: () => Promise<_cometh_connect_sdk_4337.EnrichedOwner | _cometh_connect_sdk_4337.EnrichedOwner[]>;
1000
+ getEnrichedOwners: () => Promise<_cometh_connect_sdk_4337.EnrichedOwner[]>;
889
1001
  } & {
890
1002
  addSessionKey: (args: _cometh_connect_sdk_4337.AddSessionKeyParams) => Promise<viem.Hash>;
891
1003
  revokeSessionKey: (args: {
@@ -959,6 +1071,62 @@ declare const useAccount: () => {
959
1071
  entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032";
960
1072
  }) => Promise<permissionless.UserOperation<permissionless_types_entrypoint.GetEntryPointVersion<"0x0000000071727De22E5E9d8BAf0edAc6f37da032">>>) | undefined;
961
1073
  }) => Promise<viem.Hash>;
1074
+ setUpRecoveryModule: <TTransport extends viem.Transport>(args: {
1075
+ passKeyName?: string;
1076
+ webAuthnOptions?: _cometh_connect_sdk_4337.webAuthnOptions;
1077
+ rpcUrl?: string;
1078
+ middleware?: {
1079
+ gasPrice?: () => Promise<{
1080
+ maxFeePerGas: bigint;
1081
+ maxPriorityFeePerGas: bigint;
1082
+ }>;
1083
+ sponsorUserOperation?: ((args: {
1084
+ userOperation: {
1085
+ sender: Address;
1086
+ nonce: bigint;
1087
+ factory?: Address;
1088
+ factoryData?: viem.Hex;
1089
+ callData: viem.Hex;
1090
+ callGasLimit: bigint;
1091
+ verificationGasLimit: bigint;
1092
+ preVerificationGas: bigint;
1093
+ maxFeePerGas: bigint;
1094
+ maxPriorityFeePerGas: bigint;
1095
+ paymaster?: Address;
1096
+ paymasterVerificationGasLimit?: bigint;
1097
+ paymasterPostOpGasLimit?: bigint;
1098
+ paymasterData?: viem.Hex;
1099
+ signature: viem.Hex;
1100
+ initCode?: never;
1101
+ paymasterAndData?: never;
1102
+ };
1103
+ entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032";
1104
+ }) => Promise<permissionless_actions_smartAccount.SponsorUserOperationReturnType<"0x0000000071727De22E5E9d8BAf0edAc6f37da032">>) | undefined;
1105
+ } | ((args: {
1106
+ userOperation: {
1107
+ sender: Address;
1108
+ nonce: bigint;
1109
+ factory?: Address;
1110
+ factoryData?: viem.Hex;
1111
+ callData: viem.Hex;
1112
+ callGasLimit: bigint;
1113
+ verificationGasLimit: bigint;
1114
+ preVerificationGas: bigint;
1115
+ maxFeePerGas: bigint;
1116
+ maxPriorityFeePerGas: bigint;
1117
+ paymaster?: Address;
1118
+ paymasterVerificationGasLimit?: bigint;
1119
+ paymasterPostOpGasLimit?: bigint;
1120
+ paymasterData?: viem.Hex;
1121
+ signature: viem.Hex;
1122
+ initCode?: never;
1123
+ paymasterAndData?: never;
1124
+ };
1125
+ entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032";
1126
+ }) => Promise<permissionless.UserOperation<permissionless_types_entrypoint.GetEntryPointVersion<"0x0000000071727De22E5E9d8BAf0edAc6f37da032">>>) | undefined;
1127
+ }) => Promise<viem.Hash>;
1128
+ isRecoveryActive: <TTransport extends viem.Transport>(args: Parameters<(client: viem.Client<TTransport, viem.Chain, _cometh_connect_sdk_4337.SafeSmartAccount<"0x0000000071727De22E5E9d8BAf0edAc6f37da032", viem.Transport, viem.Chain>>, args?: permissionless__types_types.Prettify<_cometh_connect_sdk_4337.IsRecoveryActiveParams>) => Promise<_cometh_connect_sdk_4337.IsRecoveryActiveReturnType>>[1]) => Promise<_cometh_connect_sdk_4337.IsRecoveryActiveReturnType>;
1129
+ getRecoveryRequest: <TTransport extends viem.Transport>(args: Parameters<(client: viem.Client<TTransport, viem.Chain, _cometh_connect_sdk_4337.SafeSmartAccount<"0x0000000071727De22E5E9d8BAf0edAc6f37da032", viem.Transport, viem.Chain>>, args?: permissionless__types_types.Prettify<_cometh_connect_sdk_4337.GetRecoveryRequestParams>) => Promise<_cometh_connect_sdk_4337.RecoveryParamsResponse | undefined>>[1]) => Promise<_cometh_connect_sdk_4337.RecoveryParamsResponse | undefined>;
962
1130
  verifySignature: <TTransport extends viem.Transport>(args: Parameters<(client: viem.Client<TTransport, viem.Chain, _cometh_connect_sdk_4337.SafeSmartAccount<"0x0000000071727De22E5E9d8BAf0edAc6f37da032", viem.Transport, viem.Chain>>, args: permissionless__types_types.Prettify<{
963
1131
  message: string;
964
1132
  signature: viem.Hex;
@@ -1108,7 +1276,7 @@ declare const useAccount: () => {
1108
1276
  ownerToRemove: Address;
1109
1277
  }) => Promise<viem.Hash>;
1110
1278
  getOwners: () => Promise<readonly Address[]>;
1111
- getEnrichedOwners: () => Promise<_cometh_connect_sdk_4337.EnrichedOwner | _cometh_connect_sdk_4337.EnrichedOwner[]>;
1279
+ getEnrichedOwners: () => Promise<_cometh_connect_sdk_4337.EnrichedOwner[]>;
1112
1280
  } & {
1113
1281
  addSessionKey: (args: _cometh_connect_sdk_4337.AddSessionKeyParams) => Promise<viem.Hash>;
1114
1282
  revokeSessionKey: (args: {
@@ -1196,6 +1364,62 @@ declare const useAccount: () => {
1196
1364
  entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032";
1197
1365
  }) => Promise<permissionless.UserOperation<permissionless_types_entrypoint.GetEntryPointVersion<"0x0000000071727De22E5E9d8BAf0edAc6f37da032">>>) | undefined;
1198
1366
  }) => Promise<viem.Hash>;
1367
+ setUpRecoveryModule: <TTransport extends viem.Transport>(args: {
1368
+ passKeyName?: string;
1369
+ webAuthnOptions?: _cometh_connect_sdk_4337.webAuthnOptions;
1370
+ rpcUrl?: string;
1371
+ middleware?: {
1372
+ gasPrice?: () => Promise<{
1373
+ maxFeePerGas: bigint;
1374
+ maxPriorityFeePerGas: bigint;
1375
+ }>;
1376
+ sponsorUserOperation?: ((args: {
1377
+ userOperation: {
1378
+ sender: Address;
1379
+ nonce: bigint;
1380
+ factory?: Address;
1381
+ factoryData?: viem.Hex;
1382
+ callData: viem.Hex;
1383
+ callGasLimit: bigint;
1384
+ verificationGasLimit: bigint;
1385
+ preVerificationGas: bigint;
1386
+ maxFeePerGas: bigint;
1387
+ maxPriorityFeePerGas: bigint;
1388
+ paymaster?: Address;
1389
+ paymasterVerificationGasLimit?: bigint;
1390
+ paymasterPostOpGasLimit?: bigint;
1391
+ paymasterData?: viem.Hex;
1392
+ signature: viem.Hex;
1393
+ initCode?: never;
1394
+ paymasterAndData?: never;
1395
+ };
1396
+ entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032";
1397
+ }) => Promise<permissionless_actions_smartAccount.SponsorUserOperationReturnType<"0x0000000071727De22E5E9d8BAf0edAc6f37da032">>) | undefined;
1398
+ } | ((args: {
1399
+ userOperation: {
1400
+ sender: Address;
1401
+ nonce: bigint;
1402
+ factory?: Address;
1403
+ factoryData?: viem.Hex;
1404
+ callData: viem.Hex;
1405
+ callGasLimit: bigint;
1406
+ verificationGasLimit: bigint;
1407
+ preVerificationGas: bigint;
1408
+ maxFeePerGas: bigint;
1409
+ maxPriorityFeePerGas: bigint;
1410
+ paymaster?: Address;
1411
+ paymasterVerificationGasLimit?: bigint;
1412
+ paymasterPostOpGasLimit?: bigint;
1413
+ paymasterData?: viem.Hex;
1414
+ signature: viem.Hex;
1415
+ initCode?: never;
1416
+ paymasterAndData?: never;
1417
+ };
1418
+ entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032";
1419
+ }) => Promise<permissionless.UserOperation<permissionless_types_entrypoint.GetEntryPointVersion<"0x0000000071727De22E5E9d8BAf0edAc6f37da032">>>) | undefined;
1420
+ }) => Promise<viem.Hash>;
1421
+ isRecoveryActive: <TTransport extends viem.Transport>(args: Parameters<(client: viem.Client<TTransport, viem.Chain, _cometh_connect_sdk_4337.SafeSmartAccount<"0x0000000071727De22E5E9d8BAf0edAc6f37da032", viem.Transport, viem.Chain>>, args?: permissionless__types_types.Prettify<_cometh_connect_sdk_4337.IsRecoveryActiveParams>) => Promise<_cometh_connect_sdk_4337.IsRecoveryActiveReturnType>>[1]) => Promise<_cometh_connect_sdk_4337.IsRecoveryActiveReturnType>;
1422
+ getRecoveryRequest: <TTransport extends viem.Transport>(args: Parameters<(client: viem.Client<TTransport, viem.Chain, _cometh_connect_sdk_4337.SafeSmartAccount<"0x0000000071727De22E5E9d8BAf0edAc6f37da032", viem.Transport, viem.Chain>>, args?: permissionless__types_types.Prettify<_cometh_connect_sdk_4337.GetRecoveryRequestParams>) => Promise<_cometh_connect_sdk_4337.RecoveryParamsResponse | undefined>>[1]) => Promise<_cometh_connect_sdk_4337.RecoveryParamsResponse | undefined>;
1199
1423
  verifySignature: <TTransport extends viem.Transport>(args: Parameters<(client: viem.Client<TTransport, viem.Chain, _cometh_connect_sdk_4337.SafeSmartAccount<"0x0000000071727De22E5E9d8BAf0edAc6f37da032", viem.Transport, viem.Chain>>, args: permissionless__types_types.Prettify<{
1200
1424
  message: string;
1201
1425
  signature: viem.Hex;
@@ -1345,7 +1569,7 @@ declare const useAccount: () => {
1345
1569
  ownerToRemove: Address;
1346
1570
  }) => Promise<viem.Hash>;
1347
1571
  getOwners: () => Promise<readonly Address[]>;
1348
- getEnrichedOwners: () => Promise<_cometh_connect_sdk_4337.EnrichedOwner | _cometh_connect_sdk_4337.EnrichedOwner[]>;
1572
+ getEnrichedOwners: () => Promise<_cometh_connect_sdk_4337.EnrichedOwner[]>;
1349
1573
  } & {
1350
1574
  addSessionKey: (args: _cometh_connect_sdk_4337.AddSessionKeyParams) => Promise<viem.Hash>;
1351
1575
  revokeSessionKey: (args: {
@@ -1778,7 +2002,7 @@ declare const useGetOwners: (queryProps?: Omit<UseQueryOptions<readonly Address$
1778
2002
  * @returns An object containing the query result and related properties.
1779
2003
  * @throws {Error} If no smart account is found when trying to get enriched owners.
1780
2004
  */
1781
- declare const useGetEnrichedOwners: (queryProps?: Omit<UseQueryOptions<EnrichedOwner | EnrichedOwner[], Error>, "queryKey" | "queryFn">) => UseQueryResult<EnrichedOwner | EnrichedOwner[], Error>;
2005
+ declare const useGetEnrichedOwners: (queryProps?: Omit<UseQueryOptions<EnrichedOwner[], Error>, "queryKey" | "queryFn">) => UseQueryResult<EnrichedOwner[], Error>;
1782
2006
 
1783
2007
  type AddSessionKeyParameters = AddSessionKeyParams;
1784
2008
  type RevokeSessionKeyParameters = {
@@ -2038,6 +2262,173 @@ type UseSignMessageReturn = QueryResultType & {
2038
2262
  };
2039
2263
  declare function useSignMessage(): UseSignMessageReturn;
2040
2264
 
2265
+ type UseSetUpRecoveryModuleProps = SetUpRecoveryModuleParams<EntryPoint>;
2266
+ type SetUpRecoveryModuleMutate = (variables: UseSetUpRecoveryModuleProps) => void;
2267
+ type SetUpRecoveryModuleMutateAsync = (variables: UseSetUpRecoveryModuleProps) => Promise<Hex>;
2268
+ type UseSetUpRecoveryModuleReturn = QueryResultType & {
2269
+ setUpRecoveryModule: SetUpRecoveryModuleMutate;
2270
+ setUpRecoveryModuleAsync: SetUpRecoveryModuleMutateAsync;
2271
+ };
2272
+ /**
2273
+ * A custom hook for setting up a recovery module for a smart account.
2274
+ *
2275
+ * This hook provides functionality to set up a recovery module, which includes
2276
+ * deploying a delay module and enabling necessary modules for the smart account.
2277
+ * It uses the smart account client to process and send the required transactions.
2278
+ *
2279
+ * @template entryPoint - The type of EntryPoint used in the smart account setup.
2280
+ *
2281
+ * @example
2282
+ * ```tsx
2283
+ * import { useSetUpRecoveryModule } from "@/hooks/useSetUpRecoveryModule";
2284
+ *
2285
+ * export const RecoverySetup = () => {
2286
+ * const {
2287
+ * setUpRecoveryModule,
2288
+ * setUpRecoveryModuleAsync,
2289
+ * isLoading,
2290
+ * isError,
2291
+ * error,
2292
+ * isSuccess,
2293
+ * data
2294
+ * } = useSetUpRecoveryModule();
2295
+ *
2296
+ * const handleSetUp = async () => {
2297
+ * try {
2298
+ * const result = await setUpRecoveryModuleAsync({
2299
+ * passKeyName: 'myPassKey',
2300
+ * rpcUrl: 'https://my-rpc-url.com',
2301
+ * // other necessary parameters
2302
+ * });
2303
+ * console.log('Recovery module set up successfully:', result);
2304
+ * } catch (error) {
2305
+ * console.error('Error setting up recovery module:', error);
2306
+ * }
2307
+ * };
2308
+ *
2309
+ * return (
2310
+ * <div>
2311
+ * <button onClick={handleSetUp} disabled={isLoading}>
2312
+ * Set Up Recovery Module
2313
+ * </button>
2314
+ * {isLoading && <p>Setting up recovery module...</p>}
2315
+ * {isError && <p>Error: {error?.message}</p>}
2316
+ * {isSuccess && <p>Recovery module set up successfully. Hash: {data}</p>}
2317
+ * </div>
2318
+ * );
2319
+ * };
2320
+ * ```
2321
+ *
2322
+ * @returns An object containing:
2323
+ * - `setUpRecoveryModule`: A function to trigger the recovery module setup without waiting for the result.
2324
+ * - `setUpRecoveryModuleAsync`: A function to trigger the recovery module setup and wait for the result.
2325
+ * - `isLoading`: A boolean indicating if the setup is in progress.
2326
+ * - `isError`: A boolean indicating if an error occurred during setup.
2327
+ * - `error`: The error object if an error occurred, null otherwise.
2328
+ * - `isSuccess`: A boolean indicating if the setup was successful.
2329
+ * - `data`: The transaction hash (Hex) returned after successful setup.
2330
+ */
2331
+ declare function useSetUpRecovery(): UseSetUpRecoveryModuleReturn;
2332
+
2333
+ type UseIsRecoveryActiveProps = IsRecoveryActiveParams;
2334
+ type UseIsRecoveryActiveReturn = {
2335
+ data: IsRecoveryActiveReturnType | undefined;
2336
+ isLoading: boolean;
2337
+ isError: boolean;
2338
+ error: Error | null;
2339
+ };
2340
+ /**
2341
+ * A custom hook for checking if recovery is active for a smart account.
2342
+ *
2343
+ * This hook provides functionality to check if a delay module is deployed
2344
+ * and retrieve the guardian address for the smart account's recovery setup.
2345
+ *
2346
+ * @param {UseIsRecoveryActiveProps} props - The properties for the hook.
2347
+ * @param {string} [props.rpcUrl] - Optional RPC URL for the blockchain network.
2348
+ *
2349
+ * @example
2350
+ * ```tsx
2351
+ * import { useIsRecoveryActive } from "@/hooks/useIsRecoveryActive";
2352
+ *
2353
+ * export const RecoveryStatus = () => {
2354
+ * const { data, isLoading, isError, error } = useIsRecoveryActive({
2355
+ * rpcUrl: 'https://my-rpc-url.com',
2356
+ * });
2357
+ *
2358
+ * if (isLoading) return <p>Loading recovery status...</p>;
2359
+ * if (isError) return <p>Error: {error?.message}</p>;
2360
+ *
2361
+ * return (
2362
+ * <div>
2363
+ * <p>Recovery Module Deployed: {data?.isDelayModuleDeployed ? 'Yes' : 'No'}</p>
2364
+ * <p>Guardian Address: {data?.guardianAddress || 'Not set'}</p>
2365
+ * </div>
2366
+ * );
2367
+ * };
2368
+ * ```
2369
+ *
2370
+ * @returns An object containing:
2371
+ * - `data`: The result of the recovery status check, or undefined if not yet loaded.
2372
+ * - `isLoading`: A boolean indicating if the check is in progress.
2373
+ * - `isError`: A boolean indicating if an error occurred during the check.
2374
+ * - `error`: The error object if an error occurred, null otherwise.
2375
+ */
2376
+ declare function useIsRecoveryActive(props?: UseIsRecoveryActiveProps): UseIsRecoveryActiveReturn;
2377
+
2378
+ type UseGetRecoveryRequestProps = GetRecoveryRequestParams;
2379
+ type UseGetRecoveryRequestReturn = {
2380
+ data: RecoveryParamsResponse | undefined;
2381
+ isLoading: boolean;
2382
+ isError: boolean;
2383
+ error: Error | null;
2384
+ };
2385
+ /**
2386
+ * A custom hook for getting the recovery request for a smart account.
2387
+ *
2388
+ * This hook provides functionality to check if a recovery request is active
2389
+ * and retrieve the details of the recovery request if one exists.
2390
+ *
2391
+ * @param {UseGetRecoveryRequestProps} props - The properties for the hook.
2392
+ * @param {string} [props.rpcUrl] - Optional RPC URL for the blockchain network.
2393
+ * @param {UseQueryOptions} [queryOptions] - Optional configuration for the React Query hook.
2394
+ *
2395
+ * @example
2396
+ * ```tsx
2397
+ * import { useGetRecoveryRequest } from "@/hooks/useGetRecoveryRequest";
2398
+ *
2399
+ * export const RecoveryRequestStatus = () => {
2400
+ * const { data, isLoading, isError, error } = useGetRecoveryRequest({
2401
+ * rpcUrl: 'https://my-rpc-url.com',
2402
+ * });
2403
+ *
2404
+ * if (isLoading) return <p>Loading recovery request status...</p>;
2405
+ * if (isError) return <p>Error: {error?.message}</p>;
2406
+ *
2407
+ * return (
2408
+ * <div>
2409
+ * {data ? (
2410
+ * <>
2411
+ * <p>Recovery Request Active</p>
2412
+ * <p>New Owner: {data.newOwner}</p>
2413
+ * <p>Execution Time: {new Date(data.executionTime * 1000).toLocaleString()}</p>
2414
+ * </>
2415
+ * ) : (
2416
+ * <p>No active recovery request</p>
2417
+ * )}
2418
+ * </div>
2419
+ * );
2420
+ * };
2421
+ * ```
2422
+ *
2423
+ * @returns An object containing:
2424
+ * - `data`: The recovery request details, or undefined if no request is active or not yet loaded.
2425
+ * - `isLoading`: A boolean indicating if the check is in progress.
2426
+ * - `isError`: A boolean indicating if an error occurred during the check.
2427
+ * - `error`: The error object if an error occurred, null otherwise.
2428
+ * - `refetch`: A function to manually trigger a refetch of the recovery request status.
2429
+ */
2430
+ declare function useGetRecoveryRequest(props?: UseGetRecoveryRequestProps, queryOptions?: Omit<UseQueryOptions<RecoveryParamsResponse | undefined, Error>, "queryKey" | "queryFn">): UseGetRecoveryRequestReturn;
2431
+
2041
2432
  type ConnectConfig = createSafeSmartAccountParameters<ENTRYPOINT_ADDRESS_V07_TYPE> & {
2042
2433
  bundlerUrl: string;
2043
2434
  paymasterUrl?: string;
@@ -2048,4 +2439,4 @@ declare const ConnectProvider: <TConfig extends ConnectConfig, TQueryClient exte
2048
2439
  queryClient: TQueryClient;
2049
2440
  }) => React.JSX.Element;
2050
2441
 
2051
- export { ConnectProvider, type SendTransactionMutate, type SendTransactionMutateAsync, type SendTransactionWithSessionKeyMutate, type SendTransactionWithSessionKeyMutateAsync, type UseAddOwnerReturn, type UseAddSessionKeyReturn, type UseAddWhitelistDestinationReturn, type UseRemoveOwnerReturn, type UseRemoveWhitelistDestinationReturn, type UseRetrieveAccountAddressFromPasskeyOptions, type UseRevokeSessionKeyReturn, type VerifyMessageMutate, type VerifyMessageMutateAsync, type WriteContractMutate, type WriteContractMutateAsync, type WriteContractWithSessionKeyMutate, type WriteContractWithSessionKeyMutateAsync, useAccount, useAddOwner, useAddSessionKey, useAddWhitelistDestination, useConnect, useCreateNewSigner, useDisconnect, useGenerateQRCodeUrl, useGetEnrichedOwners, useGetGasPrice, useGetOwners, useGetSessionFromAddress, useIsAddressWhitelistDestination, useRemoveOwner, useRemoveWhitelistDestination, useRetrieveAccountAddressFromPasskeyId, useRetrieveAccountAddressFromPasskeys, useRevokeSessionKey, useSendTransaction, useSendTransactionWithSessionKey, useSerializeUrlWithSignerPayload, useSignMessage, useValidateAddDevice, useVerifyMessage, useWriteContract, useWriteContractWithSessionKey };
2442
+ export { ConnectProvider, type SendTransactionMutate, type SendTransactionMutateAsync, type SendTransactionWithSessionKeyMutate, type SendTransactionWithSessionKeyMutateAsync, type UseAddOwnerReturn, type UseAddSessionKeyReturn, type UseAddWhitelistDestinationReturn, type UseRemoveOwnerReturn, type UseRemoveWhitelistDestinationReturn, type UseRetrieveAccountAddressFromPasskeyOptions, type UseRevokeSessionKeyReturn, type VerifyMessageMutate, type VerifyMessageMutateAsync, type WriteContractMutate, type WriteContractMutateAsync, type WriteContractWithSessionKeyMutate, type WriteContractWithSessionKeyMutateAsync, useAccount, useAddOwner, useAddSessionKey, useAddWhitelistDestination, useConnect, useCreateNewSigner, useDisconnect, useGenerateQRCodeUrl, useGetEnrichedOwners, useGetGasPrice, useGetOwners, useGetRecoveryRequest, useGetSessionFromAddress, useIsAddressWhitelistDestination, useIsRecoveryActive, useRemoveOwner, useRemoveWhitelistDestination, useRetrieveAccountAddressFromPasskeyId, useRetrieveAccountAddressFromPasskeys, useRevokeSessionKey, useSendTransaction, useSendTransactionWithSessionKey, useSerializeUrlWithSignerPayload, useSetUpRecovery, useSignMessage, useValidateAddDevice, useVerifyMessage, useWriteContract, useWriteContractWithSessionKey };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as viem_chains from 'viem/chains';
2
2
  import { Prettify } from 'viem/chains';
3
3
  import * as permissionless_types_entrypoint from 'permissionless/types/entrypoint';
4
- import { ENTRYPOINT_ADDRESS_V07_TYPE } from 'permissionless/types/entrypoint';
4
+ import { EntryPoint, ENTRYPOINT_ADDRESS_V07_TYPE } from 'permissionless/types/entrypoint';
5
5
  import * as permissionless_actions_smartAccount from 'permissionless/actions/smartAccount';
6
6
  import * as permissionless from 'permissionless';
7
7
  import * as permissionless__types_accounts from 'permissionless/_types/accounts';
@@ -10,7 +10,7 @@ import { TypedDataParameter, Abi, Address } from '../abi.js';
10
10
  import * as permissionless__types_actions_smartAccount from 'permissionless/_types/actions/smartAccount';
11
11
  import * as permissionless__types_types_bundler from 'permissionless/_types/types/bundler';
12
12
  import * as _cometh_connect_sdk_4337 from '@cometh/connect-sdk-4337';
13
- import { EnrichedOwner, Session, AddSessionKeyParams, Signer, webAuthnOptions, QRCodeOptions, createSafeSmartAccountParameters } from '@cometh/connect-sdk-4337';
13
+ import { EnrichedOwner, Session, AddSessionKeyParams, Signer, webAuthnOptions, QRCodeOptions, SetUpRecoveryModuleParams, IsRecoveryActiveParams, IsRecoveryActiveReturnType, RecoveryParamsResponse, GetRecoveryRequestParams, createSafeSmartAccountParameters } from '@cometh/connect-sdk-4337';
14
14
  import * as viem from 'viem';
15
15
  import { Hash, Address as Address$1, Hex, Abi as Abi$1, ContractFunctionName, ContractFunctionArgs, Chain, Account, DeriveChain, ContractFunctionParameters, GetChainParameter, GetValue, FormattedTransactionRequest, UnionOmit, SignableMessage } from 'viem';
16
16
  import { y, z, O, aI, a3, at, aQ, aK, b } from './hydration-Bnn1iiSg.js';
@@ -501,6 +501,62 @@ declare const useAccount: () => {
501
501
  entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032";
502
502
  }) => Promise<permissionless.UserOperation<permissionless_types_entrypoint.GetEntryPointVersion<"0x0000000071727De22E5E9d8BAf0edAc6f37da032">>>) | undefined;
503
503
  }) => Promise<viem.Hash>;
504
+ setUpRecoveryModule: <TTransport extends viem.Transport>(args: {
505
+ passKeyName?: string;
506
+ webAuthnOptions?: _cometh_connect_sdk_4337.webAuthnOptions;
507
+ rpcUrl?: string;
508
+ middleware?: {
509
+ gasPrice?: () => Promise<{
510
+ maxFeePerGas: bigint;
511
+ maxPriorityFeePerGas: bigint;
512
+ }>;
513
+ sponsorUserOperation?: ((args: {
514
+ userOperation: {
515
+ sender: Address;
516
+ nonce: bigint;
517
+ factory?: Address;
518
+ factoryData?: viem.Hex;
519
+ callData: viem.Hex;
520
+ callGasLimit: bigint;
521
+ verificationGasLimit: bigint;
522
+ preVerificationGas: bigint;
523
+ maxFeePerGas: bigint;
524
+ maxPriorityFeePerGas: bigint;
525
+ paymaster?: Address;
526
+ paymasterVerificationGasLimit?: bigint;
527
+ paymasterPostOpGasLimit?: bigint;
528
+ paymasterData?: viem.Hex;
529
+ signature: viem.Hex;
530
+ initCode?: never;
531
+ paymasterAndData?: never;
532
+ };
533
+ entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032";
534
+ }) => Promise<permissionless_actions_smartAccount.SponsorUserOperationReturnType<"0x0000000071727De22E5E9d8BAf0edAc6f37da032">>) | undefined;
535
+ } | ((args: {
536
+ userOperation: {
537
+ sender: Address;
538
+ nonce: bigint;
539
+ factory?: Address;
540
+ factoryData?: viem.Hex;
541
+ callData: viem.Hex;
542
+ callGasLimit: bigint;
543
+ verificationGasLimit: bigint;
544
+ preVerificationGas: bigint;
545
+ maxFeePerGas: bigint;
546
+ maxPriorityFeePerGas: bigint;
547
+ paymaster?: Address;
548
+ paymasterVerificationGasLimit?: bigint;
549
+ paymasterPostOpGasLimit?: bigint;
550
+ paymasterData?: viem.Hex;
551
+ signature: viem.Hex;
552
+ initCode?: never;
553
+ paymasterAndData?: never;
554
+ };
555
+ entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032";
556
+ }) => Promise<permissionless.UserOperation<permissionless_types_entrypoint.GetEntryPointVersion<"0x0000000071727De22E5E9d8BAf0edAc6f37da032">>>) | undefined;
557
+ }) => Promise<viem.Hash>;
558
+ isRecoveryActive: <TTransport extends viem.Transport>(args: Parameters<(client: viem.Client<TTransport, viem.Chain, _cometh_connect_sdk_4337.SafeSmartAccount<"0x0000000071727De22E5E9d8BAf0edAc6f37da032", viem.Transport, viem.Chain>>, args?: permissionless__types_types.Prettify<_cometh_connect_sdk_4337.IsRecoveryActiveParams>) => Promise<_cometh_connect_sdk_4337.IsRecoveryActiveReturnType>>[1]) => Promise<_cometh_connect_sdk_4337.IsRecoveryActiveReturnType>;
559
+ getRecoveryRequest: <TTransport extends viem.Transport>(args: Parameters<(client: viem.Client<TTransport, viem.Chain, _cometh_connect_sdk_4337.SafeSmartAccount<"0x0000000071727De22E5E9d8BAf0edAc6f37da032", viem.Transport, viem.Chain>>, args?: permissionless__types_types.Prettify<_cometh_connect_sdk_4337.GetRecoveryRequestParams>) => Promise<_cometh_connect_sdk_4337.RecoveryParamsResponse | undefined>>[1]) => Promise<_cometh_connect_sdk_4337.RecoveryParamsResponse | undefined>;
504
560
  verifySignature: <TTransport extends viem.Transport>(args: Parameters<(client: viem.Client<TTransport, viem.Chain, _cometh_connect_sdk_4337.SafeSmartAccount<"0x0000000071727De22E5E9d8BAf0edAc6f37da032", viem.Transport, viem.Chain>>, args: permissionless__types_types.Prettify<{
505
561
  message: string;
506
562
  signature: viem.Hex;
@@ -649,7 +705,7 @@ declare const useAccount: () => {
649
705
  ownerToRemove: Address;
650
706
  }) => Promise<viem.Hash>;
651
707
  getOwners: () => Promise<readonly Address[]>;
652
- getEnrichedOwners: () => Promise<_cometh_connect_sdk_4337.EnrichedOwner | _cometh_connect_sdk_4337.EnrichedOwner[]>;
708
+ getEnrichedOwners: () => Promise<_cometh_connect_sdk_4337.EnrichedOwner[]>;
653
709
  addSessionKey: (args: _cometh_connect_sdk_4337.AddSessionKeyParams) => Promise<viem.Hash>;
654
710
  revokeSessionKey: (args: {
655
711
  sessionKey: Address;
@@ -736,6 +792,62 @@ declare const useAccount: () => {
736
792
  entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032";
737
793
  }) => Promise<permissionless.UserOperation<permissionless_types_entrypoint.GetEntryPointVersion<"0x0000000071727De22E5E9d8BAf0edAc6f37da032">>>) | undefined;
738
794
  }) => Promise<viem.Hash>;
795
+ setUpRecoveryModule: <TTransport extends viem.Transport>(args: {
796
+ passKeyName?: string;
797
+ webAuthnOptions?: _cometh_connect_sdk_4337.webAuthnOptions;
798
+ rpcUrl?: string;
799
+ middleware?: {
800
+ gasPrice?: () => Promise<{
801
+ maxFeePerGas: bigint;
802
+ maxPriorityFeePerGas: bigint;
803
+ }>;
804
+ sponsorUserOperation?: ((args: {
805
+ userOperation: {
806
+ sender: Address;
807
+ nonce: bigint;
808
+ factory?: Address;
809
+ factoryData?: viem.Hex;
810
+ callData: viem.Hex;
811
+ callGasLimit: bigint;
812
+ verificationGasLimit: bigint;
813
+ preVerificationGas: bigint;
814
+ maxFeePerGas: bigint;
815
+ maxPriorityFeePerGas: bigint;
816
+ paymaster?: Address;
817
+ paymasterVerificationGasLimit?: bigint;
818
+ paymasterPostOpGasLimit?: bigint;
819
+ paymasterData?: viem.Hex;
820
+ signature: viem.Hex;
821
+ initCode?: never;
822
+ paymasterAndData?: never;
823
+ };
824
+ entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032";
825
+ }) => Promise<permissionless_actions_smartAccount.SponsorUserOperationReturnType<"0x0000000071727De22E5E9d8BAf0edAc6f37da032">>) | undefined;
826
+ } | ((args: {
827
+ userOperation: {
828
+ sender: Address;
829
+ nonce: bigint;
830
+ factory?: Address;
831
+ factoryData?: viem.Hex;
832
+ callData: viem.Hex;
833
+ callGasLimit: bigint;
834
+ verificationGasLimit: bigint;
835
+ preVerificationGas: bigint;
836
+ maxFeePerGas: bigint;
837
+ maxPriorityFeePerGas: bigint;
838
+ paymaster?: Address;
839
+ paymasterVerificationGasLimit?: bigint;
840
+ paymasterPostOpGasLimit?: bigint;
841
+ paymasterData?: viem.Hex;
842
+ signature: viem.Hex;
843
+ initCode?: never;
844
+ paymasterAndData?: never;
845
+ };
846
+ entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032";
847
+ }) => Promise<permissionless.UserOperation<permissionless_types_entrypoint.GetEntryPointVersion<"0x0000000071727De22E5E9d8BAf0edAc6f37da032">>>) | undefined;
848
+ }) => Promise<viem.Hash>;
849
+ isRecoveryActive: <TTransport extends viem.Transport>(args: Parameters<(client: viem.Client<TTransport, viem.Chain, _cometh_connect_sdk_4337.SafeSmartAccount<"0x0000000071727De22E5E9d8BAf0edAc6f37da032", viem.Transport, viem.Chain>>, args?: permissionless__types_types.Prettify<_cometh_connect_sdk_4337.IsRecoveryActiveParams>) => Promise<_cometh_connect_sdk_4337.IsRecoveryActiveReturnType>>[1]) => Promise<_cometh_connect_sdk_4337.IsRecoveryActiveReturnType>;
850
+ getRecoveryRequest: <TTransport extends viem.Transport>(args: Parameters<(client: viem.Client<TTransport, viem.Chain, _cometh_connect_sdk_4337.SafeSmartAccount<"0x0000000071727De22E5E9d8BAf0edAc6f37da032", viem.Transport, viem.Chain>>, args?: permissionless__types_types.Prettify<_cometh_connect_sdk_4337.GetRecoveryRequestParams>) => Promise<_cometh_connect_sdk_4337.RecoveryParamsResponse | undefined>>[1]) => Promise<_cometh_connect_sdk_4337.RecoveryParamsResponse | undefined>;
739
851
  verifySignature: <TTransport extends viem.Transport>(args: Parameters<(client: viem.Client<TTransport, viem.Chain, _cometh_connect_sdk_4337.SafeSmartAccount<"0x0000000071727De22E5E9d8BAf0edAc6f37da032", viem.Transport, viem.Chain>>, args: permissionless__types_types.Prettify<{
740
852
  message: string;
741
853
  signature: viem.Hex;
@@ -885,7 +997,7 @@ declare const useAccount: () => {
885
997
  ownerToRemove: Address;
886
998
  }) => Promise<viem.Hash>;
887
999
  getOwners: () => Promise<readonly Address[]>;
888
- getEnrichedOwners: () => Promise<_cometh_connect_sdk_4337.EnrichedOwner | _cometh_connect_sdk_4337.EnrichedOwner[]>;
1000
+ getEnrichedOwners: () => Promise<_cometh_connect_sdk_4337.EnrichedOwner[]>;
889
1001
  } & {
890
1002
  addSessionKey: (args: _cometh_connect_sdk_4337.AddSessionKeyParams) => Promise<viem.Hash>;
891
1003
  revokeSessionKey: (args: {
@@ -959,6 +1071,62 @@ declare const useAccount: () => {
959
1071
  entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032";
960
1072
  }) => Promise<permissionless.UserOperation<permissionless_types_entrypoint.GetEntryPointVersion<"0x0000000071727De22E5E9d8BAf0edAc6f37da032">>>) | undefined;
961
1073
  }) => Promise<viem.Hash>;
1074
+ setUpRecoveryModule: <TTransport extends viem.Transport>(args: {
1075
+ passKeyName?: string;
1076
+ webAuthnOptions?: _cometh_connect_sdk_4337.webAuthnOptions;
1077
+ rpcUrl?: string;
1078
+ middleware?: {
1079
+ gasPrice?: () => Promise<{
1080
+ maxFeePerGas: bigint;
1081
+ maxPriorityFeePerGas: bigint;
1082
+ }>;
1083
+ sponsorUserOperation?: ((args: {
1084
+ userOperation: {
1085
+ sender: Address;
1086
+ nonce: bigint;
1087
+ factory?: Address;
1088
+ factoryData?: viem.Hex;
1089
+ callData: viem.Hex;
1090
+ callGasLimit: bigint;
1091
+ verificationGasLimit: bigint;
1092
+ preVerificationGas: bigint;
1093
+ maxFeePerGas: bigint;
1094
+ maxPriorityFeePerGas: bigint;
1095
+ paymaster?: Address;
1096
+ paymasterVerificationGasLimit?: bigint;
1097
+ paymasterPostOpGasLimit?: bigint;
1098
+ paymasterData?: viem.Hex;
1099
+ signature: viem.Hex;
1100
+ initCode?: never;
1101
+ paymasterAndData?: never;
1102
+ };
1103
+ entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032";
1104
+ }) => Promise<permissionless_actions_smartAccount.SponsorUserOperationReturnType<"0x0000000071727De22E5E9d8BAf0edAc6f37da032">>) | undefined;
1105
+ } | ((args: {
1106
+ userOperation: {
1107
+ sender: Address;
1108
+ nonce: bigint;
1109
+ factory?: Address;
1110
+ factoryData?: viem.Hex;
1111
+ callData: viem.Hex;
1112
+ callGasLimit: bigint;
1113
+ verificationGasLimit: bigint;
1114
+ preVerificationGas: bigint;
1115
+ maxFeePerGas: bigint;
1116
+ maxPriorityFeePerGas: bigint;
1117
+ paymaster?: Address;
1118
+ paymasterVerificationGasLimit?: bigint;
1119
+ paymasterPostOpGasLimit?: bigint;
1120
+ paymasterData?: viem.Hex;
1121
+ signature: viem.Hex;
1122
+ initCode?: never;
1123
+ paymasterAndData?: never;
1124
+ };
1125
+ entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032";
1126
+ }) => Promise<permissionless.UserOperation<permissionless_types_entrypoint.GetEntryPointVersion<"0x0000000071727De22E5E9d8BAf0edAc6f37da032">>>) | undefined;
1127
+ }) => Promise<viem.Hash>;
1128
+ isRecoveryActive: <TTransport extends viem.Transport>(args: Parameters<(client: viem.Client<TTransport, viem.Chain, _cometh_connect_sdk_4337.SafeSmartAccount<"0x0000000071727De22E5E9d8BAf0edAc6f37da032", viem.Transport, viem.Chain>>, args?: permissionless__types_types.Prettify<_cometh_connect_sdk_4337.IsRecoveryActiveParams>) => Promise<_cometh_connect_sdk_4337.IsRecoveryActiveReturnType>>[1]) => Promise<_cometh_connect_sdk_4337.IsRecoveryActiveReturnType>;
1129
+ getRecoveryRequest: <TTransport extends viem.Transport>(args: Parameters<(client: viem.Client<TTransport, viem.Chain, _cometh_connect_sdk_4337.SafeSmartAccount<"0x0000000071727De22E5E9d8BAf0edAc6f37da032", viem.Transport, viem.Chain>>, args?: permissionless__types_types.Prettify<_cometh_connect_sdk_4337.GetRecoveryRequestParams>) => Promise<_cometh_connect_sdk_4337.RecoveryParamsResponse | undefined>>[1]) => Promise<_cometh_connect_sdk_4337.RecoveryParamsResponse | undefined>;
962
1130
  verifySignature: <TTransport extends viem.Transport>(args: Parameters<(client: viem.Client<TTransport, viem.Chain, _cometh_connect_sdk_4337.SafeSmartAccount<"0x0000000071727De22E5E9d8BAf0edAc6f37da032", viem.Transport, viem.Chain>>, args: permissionless__types_types.Prettify<{
963
1131
  message: string;
964
1132
  signature: viem.Hex;
@@ -1108,7 +1276,7 @@ declare const useAccount: () => {
1108
1276
  ownerToRemove: Address;
1109
1277
  }) => Promise<viem.Hash>;
1110
1278
  getOwners: () => Promise<readonly Address[]>;
1111
- getEnrichedOwners: () => Promise<_cometh_connect_sdk_4337.EnrichedOwner | _cometh_connect_sdk_4337.EnrichedOwner[]>;
1279
+ getEnrichedOwners: () => Promise<_cometh_connect_sdk_4337.EnrichedOwner[]>;
1112
1280
  } & {
1113
1281
  addSessionKey: (args: _cometh_connect_sdk_4337.AddSessionKeyParams) => Promise<viem.Hash>;
1114
1282
  revokeSessionKey: (args: {
@@ -1196,6 +1364,62 @@ declare const useAccount: () => {
1196
1364
  entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032";
1197
1365
  }) => Promise<permissionless.UserOperation<permissionless_types_entrypoint.GetEntryPointVersion<"0x0000000071727De22E5E9d8BAf0edAc6f37da032">>>) | undefined;
1198
1366
  }) => Promise<viem.Hash>;
1367
+ setUpRecoveryModule: <TTransport extends viem.Transport>(args: {
1368
+ passKeyName?: string;
1369
+ webAuthnOptions?: _cometh_connect_sdk_4337.webAuthnOptions;
1370
+ rpcUrl?: string;
1371
+ middleware?: {
1372
+ gasPrice?: () => Promise<{
1373
+ maxFeePerGas: bigint;
1374
+ maxPriorityFeePerGas: bigint;
1375
+ }>;
1376
+ sponsorUserOperation?: ((args: {
1377
+ userOperation: {
1378
+ sender: Address;
1379
+ nonce: bigint;
1380
+ factory?: Address;
1381
+ factoryData?: viem.Hex;
1382
+ callData: viem.Hex;
1383
+ callGasLimit: bigint;
1384
+ verificationGasLimit: bigint;
1385
+ preVerificationGas: bigint;
1386
+ maxFeePerGas: bigint;
1387
+ maxPriorityFeePerGas: bigint;
1388
+ paymaster?: Address;
1389
+ paymasterVerificationGasLimit?: bigint;
1390
+ paymasterPostOpGasLimit?: bigint;
1391
+ paymasterData?: viem.Hex;
1392
+ signature: viem.Hex;
1393
+ initCode?: never;
1394
+ paymasterAndData?: never;
1395
+ };
1396
+ entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032";
1397
+ }) => Promise<permissionless_actions_smartAccount.SponsorUserOperationReturnType<"0x0000000071727De22E5E9d8BAf0edAc6f37da032">>) | undefined;
1398
+ } | ((args: {
1399
+ userOperation: {
1400
+ sender: Address;
1401
+ nonce: bigint;
1402
+ factory?: Address;
1403
+ factoryData?: viem.Hex;
1404
+ callData: viem.Hex;
1405
+ callGasLimit: bigint;
1406
+ verificationGasLimit: bigint;
1407
+ preVerificationGas: bigint;
1408
+ maxFeePerGas: bigint;
1409
+ maxPriorityFeePerGas: bigint;
1410
+ paymaster?: Address;
1411
+ paymasterVerificationGasLimit?: bigint;
1412
+ paymasterPostOpGasLimit?: bigint;
1413
+ paymasterData?: viem.Hex;
1414
+ signature: viem.Hex;
1415
+ initCode?: never;
1416
+ paymasterAndData?: never;
1417
+ };
1418
+ entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032";
1419
+ }) => Promise<permissionless.UserOperation<permissionless_types_entrypoint.GetEntryPointVersion<"0x0000000071727De22E5E9d8BAf0edAc6f37da032">>>) | undefined;
1420
+ }) => Promise<viem.Hash>;
1421
+ isRecoveryActive: <TTransport extends viem.Transport>(args: Parameters<(client: viem.Client<TTransport, viem.Chain, _cometh_connect_sdk_4337.SafeSmartAccount<"0x0000000071727De22E5E9d8BAf0edAc6f37da032", viem.Transport, viem.Chain>>, args?: permissionless__types_types.Prettify<_cometh_connect_sdk_4337.IsRecoveryActiveParams>) => Promise<_cometh_connect_sdk_4337.IsRecoveryActiveReturnType>>[1]) => Promise<_cometh_connect_sdk_4337.IsRecoveryActiveReturnType>;
1422
+ getRecoveryRequest: <TTransport extends viem.Transport>(args: Parameters<(client: viem.Client<TTransport, viem.Chain, _cometh_connect_sdk_4337.SafeSmartAccount<"0x0000000071727De22E5E9d8BAf0edAc6f37da032", viem.Transport, viem.Chain>>, args?: permissionless__types_types.Prettify<_cometh_connect_sdk_4337.GetRecoveryRequestParams>) => Promise<_cometh_connect_sdk_4337.RecoveryParamsResponse | undefined>>[1]) => Promise<_cometh_connect_sdk_4337.RecoveryParamsResponse | undefined>;
1199
1423
  verifySignature: <TTransport extends viem.Transport>(args: Parameters<(client: viem.Client<TTransport, viem.Chain, _cometh_connect_sdk_4337.SafeSmartAccount<"0x0000000071727De22E5E9d8BAf0edAc6f37da032", viem.Transport, viem.Chain>>, args: permissionless__types_types.Prettify<{
1200
1424
  message: string;
1201
1425
  signature: viem.Hex;
@@ -1345,7 +1569,7 @@ declare const useAccount: () => {
1345
1569
  ownerToRemove: Address;
1346
1570
  }) => Promise<viem.Hash>;
1347
1571
  getOwners: () => Promise<readonly Address[]>;
1348
- getEnrichedOwners: () => Promise<_cometh_connect_sdk_4337.EnrichedOwner | _cometh_connect_sdk_4337.EnrichedOwner[]>;
1572
+ getEnrichedOwners: () => Promise<_cometh_connect_sdk_4337.EnrichedOwner[]>;
1349
1573
  } & {
1350
1574
  addSessionKey: (args: _cometh_connect_sdk_4337.AddSessionKeyParams) => Promise<viem.Hash>;
1351
1575
  revokeSessionKey: (args: {
@@ -1778,7 +2002,7 @@ declare const useGetOwners: (queryProps?: Omit<UseQueryOptions<readonly Address$
1778
2002
  * @returns An object containing the query result and related properties.
1779
2003
  * @throws {Error} If no smart account is found when trying to get enriched owners.
1780
2004
  */
1781
- declare const useGetEnrichedOwners: (queryProps?: Omit<UseQueryOptions<EnrichedOwner | EnrichedOwner[], Error>, "queryKey" | "queryFn">) => UseQueryResult<EnrichedOwner | EnrichedOwner[], Error>;
2005
+ declare const useGetEnrichedOwners: (queryProps?: Omit<UseQueryOptions<EnrichedOwner[], Error>, "queryKey" | "queryFn">) => UseQueryResult<EnrichedOwner[], Error>;
1782
2006
 
1783
2007
  type AddSessionKeyParameters = AddSessionKeyParams;
1784
2008
  type RevokeSessionKeyParameters = {
@@ -2038,6 +2262,173 @@ type UseSignMessageReturn = QueryResultType & {
2038
2262
  };
2039
2263
  declare function useSignMessage(): UseSignMessageReturn;
2040
2264
 
2265
+ type UseSetUpRecoveryModuleProps = SetUpRecoveryModuleParams<EntryPoint>;
2266
+ type SetUpRecoveryModuleMutate = (variables: UseSetUpRecoveryModuleProps) => void;
2267
+ type SetUpRecoveryModuleMutateAsync = (variables: UseSetUpRecoveryModuleProps) => Promise<Hex>;
2268
+ type UseSetUpRecoveryModuleReturn = QueryResultType & {
2269
+ setUpRecoveryModule: SetUpRecoveryModuleMutate;
2270
+ setUpRecoveryModuleAsync: SetUpRecoveryModuleMutateAsync;
2271
+ };
2272
+ /**
2273
+ * A custom hook for setting up a recovery module for a smart account.
2274
+ *
2275
+ * This hook provides functionality to set up a recovery module, which includes
2276
+ * deploying a delay module and enabling necessary modules for the smart account.
2277
+ * It uses the smart account client to process and send the required transactions.
2278
+ *
2279
+ * @template entryPoint - The type of EntryPoint used in the smart account setup.
2280
+ *
2281
+ * @example
2282
+ * ```tsx
2283
+ * import { useSetUpRecoveryModule } from "@/hooks/useSetUpRecoveryModule";
2284
+ *
2285
+ * export const RecoverySetup = () => {
2286
+ * const {
2287
+ * setUpRecoveryModule,
2288
+ * setUpRecoveryModuleAsync,
2289
+ * isLoading,
2290
+ * isError,
2291
+ * error,
2292
+ * isSuccess,
2293
+ * data
2294
+ * } = useSetUpRecoveryModule();
2295
+ *
2296
+ * const handleSetUp = async () => {
2297
+ * try {
2298
+ * const result = await setUpRecoveryModuleAsync({
2299
+ * passKeyName: 'myPassKey',
2300
+ * rpcUrl: 'https://my-rpc-url.com',
2301
+ * // other necessary parameters
2302
+ * });
2303
+ * console.log('Recovery module set up successfully:', result);
2304
+ * } catch (error) {
2305
+ * console.error('Error setting up recovery module:', error);
2306
+ * }
2307
+ * };
2308
+ *
2309
+ * return (
2310
+ * <div>
2311
+ * <button onClick={handleSetUp} disabled={isLoading}>
2312
+ * Set Up Recovery Module
2313
+ * </button>
2314
+ * {isLoading && <p>Setting up recovery module...</p>}
2315
+ * {isError && <p>Error: {error?.message}</p>}
2316
+ * {isSuccess && <p>Recovery module set up successfully. Hash: {data}</p>}
2317
+ * </div>
2318
+ * );
2319
+ * };
2320
+ * ```
2321
+ *
2322
+ * @returns An object containing:
2323
+ * - `setUpRecoveryModule`: A function to trigger the recovery module setup without waiting for the result.
2324
+ * - `setUpRecoveryModuleAsync`: A function to trigger the recovery module setup and wait for the result.
2325
+ * - `isLoading`: A boolean indicating if the setup is in progress.
2326
+ * - `isError`: A boolean indicating if an error occurred during setup.
2327
+ * - `error`: The error object if an error occurred, null otherwise.
2328
+ * - `isSuccess`: A boolean indicating if the setup was successful.
2329
+ * - `data`: The transaction hash (Hex) returned after successful setup.
2330
+ */
2331
+ declare function useSetUpRecovery(): UseSetUpRecoveryModuleReturn;
2332
+
2333
+ type UseIsRecoveryActiveProps = IsRecoveryActiveParams;
2334
+ type UseIsRecoveryActiveReturn = {
2335
+ data: IsRecoveryActiveReturnType | undefined;
2336
+ isLoading: boolean;
2337
+ isError: boolean;
2338
+ error: Error | null;
2339
+ };
2340
+ /**
2341
+ * A custom hook for checking if recovery is active for a smart account.
2342
+ *
2343
+ * This hook provides functionality to check if a delay module is deployed
2344
+ * and retrieve the guardian address for the smart account's recovery setup.
2345
+ *
2346
+ * @param {UseIsRecoveryActiveProps} props - The properties for the hook.
2347
+ * @param {string} [props.rpcUrl] - Optional RPC URL for the blockchain network.
2348
+ *
2349
+ * @example
2350
+ * ```tsx
2351
+ * import { useIsRecoveryActive } from "@/hooks/useIsRecoveryActive";
2352
+ *
2353
+ * export const RecoveryStatus = () => {
2354
+ * const { data, isLoading, isError, error } = useIsRecoveryActive({
2355
+ * rpcUrl: 'https://my-rpc-url.com',
2356
+ * });
2357
+ *
2358
+ * if (isLoading) return <p>Loading recovery status...</p>;
2359
+ * if (isError) return <p>Error: {error?.message}</p>;
2360
+ *
2361
+ * return (
2362
+ * <div>
2363
+ * <p>Recovery Module Deployed: {data?.isDelayModuleDeployed ? 'Yes' : 'No'}</p>
2364
+ * <p>Guardian Address: {data?.guardianAddress || 'Not set'}</p>
2365
+ * </div>
2366
+ * );
2367
+ * };
2368
+ * ```
2369
+ *
2370
+ * @returns An object containing:
2371
+ * - `data`: The result of the recovery status check, or undefined if not yet loaded.
2372
+ * - `isLoading`: A boolean indicating if the check is in progress.
2373
+ * - `isError`: A boolean indicating if an error occurred during the check.
2374
+ * - `error`: The error object if an error occurred, null otherwise.
2375
+ */
2376
+ declare function useIsRecoveryActive(props?: UseIsRecoveryActiveProps): UseIsRecoveryActiveReturn;
2377
+
2378
+ type UseGetRecoveryRequestProps = GetRecoveryRequestParams;
2379
+ type UseGetRecoveryRequestReturn = {
2380
+ data: RecoveryParamsResponse | undefined;
2381
+ isLoading: boolean;
2382
+ isError: boolean;
2383
+ error: Error | null;
2384
+ };
2385
+ /**
2386
+ * A custom hook for getting the recovery request for a smart account.
2387
+ *
2388
+ * This hook provides functionality to check if a recovery request is active
2389
+ * and retrieve the details of the recovery request if one exists.
2390
+ *
2391
+ * @param {UseGetRecoveryRequestProps} props - The properties for the hook.
2392
+ * @param {string} [props.rpcUrl] - Optional RPC URL for the blockchain network.
2393
+ * @param {UseQueryOptions} [queryOptions] - Optional configuration for the React Query hook.
2394
+ *
2395
+ * @example
2396
+ * ```tsx
2397
+ * import { useGetRecoveryRequest } from "@/hooks/useGetRecoveryRequest";
2398
+ *
2399
+ * export const RecoveryRequestStatus = () => {
2400
+ * const { data, isLoading, isError, error } = useGetRecoveryRequest({
2401
+ * rpcUrl: 'https://my-rpc-url.com',
2402
+ * });
2403
+ *
2404
+ * if (isLoading) return <p>Loading recovery request status...</p>;
2405
+ * if (isError) return <p>Error: {error?.message}</p>;
2406
+ *
2407
+ * return (
2408
+ * <div>
2409
+ * {data ? (
2410
+ * <>
2411
+ * <p>Recovery Request Active</p>
2412
+ * <p>New Owner: {data.newOwner}</p>
2413
+ * <p>Execution Time: {new Date(data.executionTime * 1000).toLocaleString()}</p>
2414
+ * </>
2415
+ * ) : (
2416
+ * <p>No active recovery request</p>
2417
+ * )}
2418
+ * </div>
2419
+ * );
2420
+ * };
2421
+ * ```
2422
+ *
2423
+ * @returns An object containing:
2424
+ * - `data`: The recovery request details, or undefined if no request is active or not yet loaded.
2425
+ * - `isLoading`: A boolean indicating if the check is in progress.
2426
+ * - `isError`: A boolean indicating if an error occurred during the check.
2427
+ * - `error`: The error object if an error occurred, null otherwise.
2428
+ * - `refetch`: A function to manually trigger a refetch of the recovery request status.
2429
+ */
2430
+ declare function useGetRecoveryRequest(props?: UseGetRecoveryRequestProps, queryOptions?: Omit<UseQueryOptions<RecoveryParamsResponse | undefined, Error>, "queryKey" | "queryFn">): UseGetRecoveryRequestReturn;
2431
+
2041
2432
  type ConnectConfig = createSafeSmartAccountParameters<ENTRYPOINT_ADDRESS_V07_TYPE> & {
2042
2433
  bundlerUrl: string;
2043
2434
  paymasterUrl?: string;
@@ -2048,4 +2439,4 @@ declare const ConnectProvider: <TConfig extends ConnectConfig, TQueryClient exte
2048
2439
  queryClient: TQueryClient;
2049
2440
  }) => React.JSX.Element;
2050
2441
 
2051
- export { ConnectProvider, type SendTransactionMutate, type SendTransactionMutateAsync, type SendTransactionWithSessionKeyMutate, type SendTransactionWithSessionKeyMutateAsync, type UseAddOwnerReturn, type UseAddSessionKeyReturn, type UseAddWhitelistDestinationReturn, type UseRemoveOwnerReturn, type UseRemoveWhitelistDestinationReturn, type UseRetrieveAccountAddressFromPasskeyOptions, type UseRevokeSessionKeyReturn, type VerifyMessageMutate, type VerifyMessageMutateAsync, type WriteContractMutate, type WriteContractMutateAsync, type WriteContractWithSessionKeyMutate, type WriteContractWithSessionKeyMutateAsync, useAccount, useAddOwner, useAddSessionKey, useAddWhitelistDestination, useConnect, useCreateNewSigner, useDisconnect, useGenerateQRCodeUrl, useGetEnrichedOwners, useGetGasPrice, useGetOwners, useGetSessionFromAddress, useIsAddressWhitelistDestination, useRemoveOwner, useRemoveWhitelistDestination, useRetrieveAccountAddressFromPasskeyId, useRetrieveAccountAddressFromPasskeys, useRevokeSessionKey, useSendTransaction, useSendTransactionWithSessionKey, useSerializeUrlWithSignerPayload, useSignMessage, useValidateAddDevice, useVerifyMessage, useWriteContract, useWriteContractWithSessionKey };
2442
+ export { ConnectProvider, type SendTransactionMutate, type SendTransactionMutateAsync, type SendTransactionWithSessionKeyMutate, type SendTransactionWithSessionKeyMutateAsync, type UseAddOwnerReturn, type UseAddSessionKeyReturn, type UseAddWhitelistDestinationReturn, type UseRemoveOwnerReturn, type UseRemoveWhitelistDestinationReturn, type UseRetrieveAccountAddressFromPasskeyOptions, type UseRevokeSessionKeyReturn, type VerifyMessageMutate, type VerifyMessageMutateAsync, type WriteContractMutate, type WriteContractMutateAsync, type WriteContractWithSessionKeyMutate, type WriteContractWithSessionKeyMutateAsync, useAccount, useAddOwner, useAddSessionKey, useAddWhitelistDestination, useConnect, useCreateNewSigner, useDisconnect, useGenerateQRCodeUrl, useGetEnrichedOwners, useGetGasPrice, useGetOwners, useGetRecoveryRequest, useGetSessionFromAddress, useIsAddressWhitelistDestination, useIsRecoveryActive, useRemoveOwner, useRemoveWhitelistDestination, useRetrieveAccountAddressFromPasskeyId, useRetrieveAccountAddressFromPasskeys, useRevokeSessionKey, useSendTransaction, useSendTransactionWithSessionKey, useSerializeUrlWithSignerPayload, useSetUpRecovery, useSignMessage, useValidateAddDevice, useVerifyMessage, useWriteContract, useWriteContractWithSessionKey };
package/dist/index.js CHANGED
@@ -1294,7 +1294,7 @@ var useWriteContract = (mutationProps) => {
1294
1294
  };
1295
1295
  };
1296
1296
 
1297
- // src/hooks/useSendTransactionWithSessionKey.ts
1297
+ // src/hooks/sessionKeys/useSendTransactionWithSessionKey.ts
1298
1298
  var useSendTransactionWithSessionKey = (mutationProps) => {
1299
1299
  const { smartAccountClient, queryClient } = useSmartAccount();
1300
1300
  const { mutate, mutateAsync, ...result } = useMutation(
@@ -1328,7 +1328,7 @@ var useSendTransactionWithSessionKey = (mutationProps) => {
1328
1328
  };
1329
1329
  };
1330
1330
 
1331
- // src/hooks/useWriteContractWithSessionKey.ts
1331
+ // src/hooks/sessionKeys/useWriteContractWithSessionKey.ts
1332
1332
  import { encodeFunctionData as encodeFunctionData2 } from "viem";
1333
1333
  var useWriteContractWithSessionKey = (mutationProps) => {
1334
1334
  const { smartAccountClient, queryClient } = useSmartAccount();
@@ -1464,7 +1464,7 @@ var useDisconnect = () => {
1464
1464
  };
1465
1465
  };
1466
1466
 
1467
- // src/hooks/useOwners.ts
1467
+ // src/hooks/owners/useOwners.ts
1468
1468
  var useAddOwner = (mutationProps) => {
1469
1469
  const { smartAccountClient, queryClient } = useSmartAccount();
1470
1470
  const { mutate, mutateAsync, ...result } = useMutation(
@@ -1550,7 +1550,7 @@ var useGetEnrichedOwners = (queryProps) => {
1550
1550
  );
1551
1551
  };
1552
1552
 
1553
- // src/hooks/useSessionKeys.ts
1553
+ // src/hooks/sessionKeys/useSessionKeys.ts
1554
1554
  var useAddSessionKey = (mutationProps) => {
1555
1555
  const { smartAccountClient, queryClient } = useSmartAccount();
1556
1556
  const { mutate, mutateAsync, ...result } = useMutation(
@@ -1705,7 +1705,7 @@ var useIsAddressWhitelistDestination = (sessionKey, targetAddress, queryProps) =
1705
1705
  );
1706
1706
  };
1707
1707
 
1708
- // src/hooks/useValidateAddDevice.ts
1708
+ // src/hooks/owners/useValidateAddDevice.ts
1709
1709
  var useValidateAddDevice = (mutationProps) => {
1710
1710
  const { smartAccountClient, queryClient } = useSmartAccount();
1711
1711
  const { mutate, mutateAsync, ...result } = useMutation(
@@ -2033,6 +2033,80 @@ function useSignMessage() {
2033
2033
  isError: result.isError
2034
2034
  };
2035
2035
  }
2036
+
2037
+ // src/hooks/recovery/useSetUpRecovery.ts
2038
+ function useSetUpRecovery() {
2039
+ const { smartAccountClient, queryClient } = useSmartAccount();
2040
+ const { mutate, mutateAsync, ...result } = useMutation(
2041
+ {
2042
+ mutationFn: async (variables) => {
2043
+ if (!smartAccountClient) {
2044
+ throw new Error("No smart account found");
2045
+ }
2046
+ return smartAccountClient.setUpRecoveryModule({
2047
+ passKeyName: variables.passKeyName,
2048
+ rpcUrl: variables.rpcUrl,
2049
+ webAuthnOptions: variables.webAuthnOptions,
2050
+ // biome-ignore lint/suspicious/noExplicitAny: TODO: remove any
2051
+ middleware: variables.middleware
2052
+ });
2053
+ }
2054
+ },
2055
+ queryClient
2056
+ );
2057
+ return {
2058
+ setUpRecoveryModule: mutate,
2059
+ setUpRecoveryModuleAsync: mutateAsync,
2060
+ isPending: result.isPending,
2061
+ isError: result.isError,
2062
+ error: result.error,
2063
+ isSuccess: result.isSuccess,
2064
+ data: result.data
2065
+ };
2066
+ }
2067
+
2068
+ // src/hooks/recovery/useIsRecoveryActive.ts
2069
+ function useIsRecoveryActive(props = {}) {
2070
+ const { smartAccountClient, queryClient } = useSmartAccount();
2071
+ return useQuery(
2072
+ {
2073
+ queryKey: ["isRecoveryActive", props.rpcUrl],
2074
+ queryFn: async () => {
2075
+ if (!smartAccountClient) {
2076
+ throw new Error("No smart account found");
2077
+ }
2078
+ return smartAccountClient.isRecoveryActive(props);
2079
+ },
2080
+ enabled: !!smartAccountClient
2081
+ },
2082
+ queryClient
2083
+ );
2084
+ }
2085
+
2086
+ // src/hooks/recovery/useGetRecoveryRequest.ts
2087
+ function useGetRecoveryRequest(props = {}, queryOptions) {
2088
+ const { smartAccountClient, queryClient } = useSmartAccount();
2089
+ const { data, isLoading, isError, error } = useQuery(
2090
+ {
2091
+ queryKey: ["getRecoveryRequest", props.rpcUrl],
2092
+ queryFn: async () => {
2093
+ if (!smartAccountClient) {
2094
+ throw new Error("No smart account found");
2095
+ }
2096
+ return smartAccountClient.getRecoveryRequest(props);
2097
+ },
2098
+ enabled: !!smartAccountClient,
2099
+ ...queryOptions
2100
+ },
2101
+ queryClient
2102
+ );
2103
+ return {
2104
+ data,
2105
+ isLoading,
2106
+ isError,
2107
+ error
2108
+ };
2109
+ }
2036
2110
  export {
2037
2111
  ConnectProvider,
2038
2112
  useAccount,
@@ -2046,8 +2120,10 @@ export {
2046
2120
  useGetEnrichedOwners,
2047
2121
  useGetGasPrice,
2048
2122
  useGetOwners,
2123
+ useGetRecoveryRequest,
2049
2124
  useGetSessionFromAddress,
2050
2125
  useIsAddressWhitelistDestination,
2126
+ useIsRecoveryActive,
2051
2127
  useRemoveOwner,
2052
2128
  useRemoveWhitelistDestination,
2053
2129
  useRetrieveAccountAddressFromPasskeyId,
@@ -2056,6 +2132,7 @@ export {
2056
2132
  useSendTransaction,
2057
2133
  useSendTransactionWithSessionKey,
2058
2134
  useSerializeUrlWithSignerPayload,
2135
+ useSetUpRecovery,
2059
2136
  useSignMessage,
2060
2137
  useValidateAddDevice,
2061
2138
  useVerifyMessage,
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "url": "https://twitter.com/slovaye"
8
8
  }
9
9
  ],
10
- "version": "0.0.1",
10
+ "version": "0.0.3",
11
11
  "description": "React hooks Connect 4337",
12
12
  "repository": "https://github.com/cometh-game/connect-sdk-4337.git",
13
13
  "keywords": [
@@ -58,7 +58,7 @@
58
58
  "typescript": "^5"
59
59
  },
60
60
  "dependencies": {
61
- "@cometh/connect-sdk-4337": "^0.1.1",
61
+ "@cometh/connect-sdk-4337": "^0.1.3",
62
62
  "permissionless": "^0.1.31"
63
63
  }
64
64
  }