@account-kit/privy-integration 4.73.1-alpha.0 → 4.74.0

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.
Files changed (80) hide show
  1. package/README.md +61 -21
  2. package/dist/esm/Provider.d.ts +71 -4
  3. package/dist/esm/Provider.js +109 -4
  4. package/dist/esm/Provider.js.map +1 -1
  5. package/dist/esm/hooks/internal/useEmbeddedWallet.d.ts +4 -3
  6. package/dist/esm/hooks/internal/useEmbeddedWallet.js +13 -5
  7. package/dist/esm/hooks/internal/useEmbeddedWallet.js.map +1 -1
  8. package/dist/esm/hooks/useAlchemyClient.d.ts +10 -5
  9. package/dist/esm/hooks/useAlchemyClient.js +36 -17
  10. package/dist/esm/hooks/useAlchemyClient.js.map +1 -1
  11. package/dist/esm/hooks/useAlchemyPrepareSwap.js +3 -6
  12. package/dist/esm/hooks/useAlchemyPrepareSwap.js.map +1 -1
  13. package/dist/esm/hooks/useAlchemySendTransaction.js +11 -9
  14. package/dist/esm/hooks/useAlchemySendTransaction.js.map +1 -1
  15. package/dist/esm/hooks/useAlchemySubmitSwap.js +1 -1
  16. package/dist/esm/hooks/useAlchemySubmitSwap.js.map +1 -1
  17. package/dist/esm/types.d.ts +6 -0
  18. package/dist/esm/types.js.map +1 -1
  19. package/dist/esm/version.d.ts +1 -1
  20. package/dist/esm/version.js +1 -1
  21. package/dist/esm/version.js.map +1 -1
  22. package/dist/types/Provider.d.ts +71 -4
  23. package/dist/types/Provider.d.ts.map +1 -1
  24. package/dist/types/hooks/internal/useEmbeddedWallet.d.ts +4 -3
  25. package/dist/types/hooks/internal/useEmbeddedWallet.d.ts.map +1 -1
  26. package/dist/types/hooks/useAlchemyClient.d.ts +10 -5
  27. package/dist/types/hooks/useAlchemyClient.d.ts.map +1 -1
  28. package/dist/types/hooks/useAlchemyPrepareSwap.d.ts.map +1 -1
  29. package/dist/types/hooks/useAlchemySendTransaction.d.ts.map +1 -1
  30. package/dist/types/types.d.ts +6 -0
  31. package/dist/types/types.d.ts.map +1 -1
  32. package/dist/types/version.d.ts +1 -1
  33. package/dist/types/version.d.ts.map +1 -1
  34. package/package.json +4 -17
  35. package/src/hooks/internal/useEmbeddedWallet.ts +20 -5
  36. package/src/hooks/useAlchemyClient.ts +61 -26
  37. package/src/hooks/useAlchemyPrepareSwap.ts +3 -6
  38. package/src/hooks/useAlchemySendTransaction.ts +16 -13
  39. package/src/hooks/useAlchemySubmitSwap.ts +1 -1
  40. package/src/types.ts +7 -0
  41. package/src/version.ts +1 -1
  42. package/dist/esm/adapters/react-native.d.ts +0 -6
  43. package/dist/esm/adapters/react-native.js +0 -46
  44. package/dist/esm/adapters/react-native.js.map +0 -1
  45. package/dist/esm/adapters/types.d.ts +0 -44
  46. package/dist/esm/adapters/types.js +0 -2
  47. package/dist/esm/adapters/types.js.map +0 -1
  48. package/dist/esm/adapters/web.d.ts +0 -6
  49. package/dist/esm/adapters/web.js +0 -50
  50. package/dist/esm/adapters/web.js.map +0 -1
  51. package/dist/esm/context/AlchemyContext.d.ts +0 -62
  52. package/dist/esm/context/AlchemyContext.js +0 -105
  53. package/dist/esm/context/AlchemyContext.js.map +0 -1
  54. package/dist/esm/providers/ReactNativeProvider.d.ts +0 -33
  55. package/dist/esm/providers/ReactNativeProvider.js +0 -37
  56. package/dist/esm/providers/ReactNativeProvider.js.map +0 -1
  57. package/dist/esm/providers/WebProvider.d.ts +0 -33
  58. package/dist/esm/providers/WebProvider.js +0 -37
  59. package/dist/esm/providers/WebProvider.js.map +0 -1
  60. package/dist/esm/react-native.d.ts +0 -11
  61. package/dist/esm/react-native.js +0 -13
  62. package/dist/esm/react-native.js.map +0 -1
  63. package/dist/types/adapters/react-native.d.ts +0 -7
  64. package/dist/types/adapters/react-native.d.ts.map +0 -1
  65. package/dist/types/adapters/types.d.ts +0 -45
  66. package/dist/types/adapters/types.d.ts.map +0 -1
  67. package/dist/types/adapters/web.d.ts +0 -7
  68. package/dist/types/adapters/web.d.ts.map +0 -1
  69. package/dist/types/context/AlchemyContext.d.ts +0 -63
  70. package/dist/types/context/AlchemyContext.d.ts.map +0 -1
  71. package/dist/types/providers/ReactNativeProvider.d.ts +0 -34
  72. package/dist/types/providers/ReactNativeProvider.d.ts.map +0 -1
  73. package/dist/types/providers/WebProvider.d.ts +0 -34
  74. package/dist/types/providers/WebProvider.d.ts.map +0 -1
  75. package/dist/types/react-native.d.ts +0 -12
  76. package/dist/types/react-native.d.ts.map +0 -1
  77. package/src/adapters/react-native.ts +0 -71
  78. package/src/adapters/types.ts +0 -56
  79. package/src/adapters/web.ts +0 -73
  80. package/src/react-native.ts +0 -29
@@ -1,73 +0,0 @@
1
- import { useCallback } from "react";
2
- import {
3
- useWallets,
4
- usePrivy,
5
- useSign7702Authorization,
6
- type ConnectedWallet as PrivyWallet,
7
- } from "@privy-io/react-auth";
8
- import type { Authorization } from "viem";
9
- import type { AuthorizationRequest } from "@aa-sdk/core";
10
- import type { PrivyAdapter, EmbeddedWallet, PrivyAuthState } from "./types.js";
11
-
12
- /**
13
- * Web adapter for @privy-io/react-auth
14
- * Implements platform-specific hooks for React web applications
15
- */
16
- export const webAdapter: PrivyAdapter = {
17
- useEmbeddedWallet() {
18
- const { wallets } = useWallets();
19
-
20
- const getEmbeddedWallet = useCallback((): EmbeddedWallet => {
21
- const embedded = wallets.find((w) => w.walletClientType === "privy");
22
- if (!embedded) {
23
- throw new Error(
24
- "Privy embedded wallet not found. Please ensure the user is authenticated.",
25
- );
26
- }
27
-
28
- return adaptWebWallet(embedded);
29
- }, [wallets]);
30
-
31
- return getEmbeddedWallet;
32
- },
33
-
34
- usePrivyAuth(): PrivyAuthState {
35
- const { user } = usePrivy();
36
- return { authenticated: !!user, user };
37
- },
38
-
39
- useAuthorizationSigner() {
40
- const { signAuthorization } = useSign7702Authorization();
41
-
42
- return useCallback(
43
- async (
44
- unsignedAuth: AuthorizationRequest<number>,
45
- ): Promise<Authorization<number, true>> => {
46
- const signature = await signAuthorization({
47
- ...unsignedAuth,
48
- contractAddress: unsignedAuth.address ?? unsignedAuth.contractAddress,
49
- });
50
-
51
- return {
52
- ...unsignedAuth,
53
- ...signature,
54
- };
55
- },
56
- [signAuthorization],
57
- );
58
- },
59
- };
60
-
61
- /**
62
- * Adapts a Privy web wallet to the common EmbeddedWallet interface
63
- *
64
- * @param {PrivyWallet} wallet - The Privy web wallet to adapt
65
- * @returns {EmbeddedWallet} The adapted wallet following the common interface
66
- */
67
- function adaptWebWallet(wallet: PrivyWallet): EmbeddedWallet {
68
- return {
69
- address: wallet.address as `0x${string}`,
70
- chainId: wallet.chainId || "1",
71
- getEthereumProvider: () => wallet.getEthereumProvider(),
72
- };
73
- }
@@ -1,29 +0,0 @@
1
- /**
2
- * React Native (Expo) entry point
3
- * Import from '@account-kit/privy-integration/react-native' in Expo apps
4
- */
5
-
6
- // Provider
7
- export { AlchemyProvider } from "./providers/ReactNativeProvider.js";
8
- export { useAlchemyConfig } from "./context/AlchemyContext.js";
9
-
10
- // Hooks
11
- export { useAlchemyClient } from "./hooks/useAlchemyClient.js";
12
- export { useAlchemySendTransaction } from "./hooks/useAlchemySendTransaction.js";
13
- export { useAlchemyPrepareSwap } from "./hooks/useAlchemyPrepareSwap.js";
14
- export { useAlchemySubmitSwap } from "./hooks/useAlchemySubmitSwap.js";
15
-
16
- // Types
17
- export type {
18
- AlchemyProviderConfig,
19
- UnsignedTransactionRequest,
20
- SendTransactionOptions,
21
- SendTransactionResult,
22
- UseSendTransactionResult,
23
- PrepareSwapRequest,
24
- PrepareSwapResult,
25
- UsePrepareSwapResult,
26
- SubmitSwapResult,
27
- UseSubmitSwapResult,
28
- SwapQuote,
29
- } from "./types.js";