@cometh/connect-react-hooks 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -1875,7 +1875,7 @@ var useCreateNewSigner = (apiKey, baseUrl) => {
1875
1875
  (params = {}) => {
1876
1876
  setIsPending(true);
1877
1877
  setError(null);
1878
- createNewSigner(apiKey, baseUrl, params).then((signer) => {
1878
+ createNewSigner({ apiKey, baseUrl, params }).then((signer) => {
1879
1879
  queryClient?.invalidateQueries({ queryKey: ["signer"] });
1880
1880
  return signer;
1881
1881
  }).catch((e) => {
@@ -1892,7 +1892,11 @@ var useCreateNewSigner = (apiKey, baseUrl) => {
1892
1892
  setIsPending(true);
1893
1893
  setError(null);
1894
1894
  try {
1895
- const signer = await createNewSigner(apiKey, baseUrl, params);
1895
+ const signer = await createNewSigner({
1896
+ apiKey,
1897
+ baseUrl,
1898
+ params
1899
+ });
1896
1900
  queryClient?.invalidateQueries({ queryKey: ["signer"] });
1897
1901
  return signer;
1898
1902
  } catch (e) {
@@ -1903,7 +1907,7 @@ var useCreateNewSigner = (apiKey, baseUrl) => {
1903
1907
  setIsPending(false);
1904
1908
  }
1905
1909
  },
1906
- [apiKey, baseUrl, queryClient]
1910
+ [apiKey, queryClient]
1907
1911
  );
1908
1912
  return {
1909
1913
  createSigner,
@@ -2107,12 +2111,42 @@ function useGetRecoveryRequest(props = {}, queryOptions) {
2107
2111
  error
2108
2112
  };
2109
2113
  }
2114
+
2115
+ // src/hooks/recovery/useCancelRecoveryRequest.ts
2116
+ function useCancelRecoveryRequest() {
2117
+ const { smartAccountClient, queryClient } = useSmartAccount();
2118
+ const { mutate, mutateAsync, ...result } = useMutation(
2119
+ {
2120
+ mutationFn: async (variables) => {
2121
+ if (!smartAccountClient) {
2122
+ throw new Error("No smart account found");
2123
+ }
2124
+ return smartAccountClient.cancelRecoveryRequest({
2125
+ rpcUrl: variables.rpcUrl,
2126
+ // biome-ignore lint/suspicious/noExplicitAny: TODO: remove any
2127
+ middleware: variables.middleware
2128
+ });
2129
+ }
2130
+ },
2131
+ queryClient
2132
+ );
2133
+ return {
2134
+ cancelRecoveryRequest: mutate,
2135
+ cancelRecoveryRequestAsync: mutateAsync,
2136
+ isPending: result.isPending,
2137
+ isError: result.isError,
2138
+ error: result.error,
2139
+ isSuccess: result.isSuccess,
2140
+ data: result.data
2141
+ };
2142
+ }
2110
2143
  export {
2111
2144
  ConnectProvider,
2112
2145
  useAccount,
2113
2146
  useAddOwner,
2114
2147
  useAddSessionKey,
2115
2148
  useAddWhitelistDestination,
2149
+ useCancelRecoveryRequest,
2116
2150
  useConnect,
2117
2151
  useCreateNewSigner,
2118
2152
  useDisconnect,
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "url": "https://twitter.com/slovaye"
8
8
  }
9
9
  ],
10
- "version": "0.0.4",
10
+ "version": "0.0.5",
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.4",
62
- "permissionless": "^0.1.31"
61
+ "@cometh/connect-sdk-4337": "0.1.5",
62
+ "permissionless": "0.1.31"
63
63
  }
64
64
  }