@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.
- package/README.md +61 -21
- package/dist/esm/Provider.d.ts +71 -4
- package/dist/esm/Provider.js +109 -4
- package/dist/esm/Provider.js.map +1 -1
- package/dist/esm/hooks/internal/useEmbeddedWallet.d.ts +4 -3
- package/dist/esm/hooks/internal/useEmbeddedWallet.js +13 -5
- package/dist/esm/hooks/internal/useEmbeddedWallet.js.map +1 -1
- package/dist/esm/hooks/useAlchemyClient.d.ts +10 -5
- package/dist/esm/hooks/useAlchemyClient.js +36 -17
- package/dist/esm/hooks/useAlchemyClient.js.map +1 -1
- package/dist/esm/hooks/useAlchemyPrepareSwap.js +3 -6
- package/dist/esm/hooks/useAlchemyPrepareSwap.js.map +1 -1
- package/dist/esm/hooks/useAlchemySendTransaction.js +11 -9
- package/dist/esm/hooks/useAlchemySendTransaction.js.map +1 -1
- package/dist/esm/hooks/useAlchemySubmitSwap.js +1 -1
- package/dist/esm/hooks/useAlchemySubmitSwap.js.map +1 -1
- package/dist/esm/types.d.ts +6 -0
- package/dist/esm/types.js.map +1 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/types/Provider.d.ts +71 -4
- package/dist/types/Provider.d.ts.map +1 -1
- package/dist/types/hooks/internal/useEmbeddedWallet.d.ts +4 -3
- package/dist/types/hooks/internal/useEmbeddedWallet.d.ts.map +1 -1
- package/dist/types/hooks/useAlchemyClient.d.ts +10 -5
- package/dist/types/hooks/useAlchemyClient.d.ts.map +1 -1
- package/dist/types/hooks/useAlchemyPrepareSwap.d.ts.map +1 -1
- package/dist/types/hooks/useAlchemySendTransaction.d.ts.map +1 -1
- package/dist/types/types.d.ts +6 -0
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/types/version.d.ts.map +1 -1
- package/package.json +4 -17
- package/src/hooks/internal/useEmbeddedWallet.ts +20 -5
- package/src/hooks/useAlchemyClient.ts +61 -26
- package/src/hooks/useAlchemyPrepareSwap.ts +3 -6
- package/src/hooks/useAlchemySendTransaction.ts +16 -13
- package/src/hooks/useAlchemySubmitSwap.ts +1 -1
- package/src/types.ts +7 -0
- package/src/version.ts +1 -1
- package/dist/esm/adapters/react-native.d.ts +0 -6
- package/dist/esm/adapters/react-native.js +0 -46
- package/dist/esm/adapters/react-native.js.map +0 -1
- package/dist/esm/adapters/types.d.ts +0 -44
- package/dist/esm/adapters/types.js +0 -2
- package/dist/esm/adapters/types.js.map +0 -1
- package/dist/esm/adapters/web.d.ts +0 -6
- package/dist/esm/adapters/web.js +0 -50
- package/dist/esm/adapters/web.js.map +0 -1
- package/dist/esm/context/AlchemyContext.d.ts +0 -62
- package/dist/esm/context/AlchemyContext.js +0 -105
- package/dist/esm/context/AlchemyContext.js.map +0 -1
- package/dist/esm/providers/ReactNativeProvider.d.ts +0 -33
- package/dist/esm/providers/ReactNativeProvider.js +0 -37
- package/dist/esm/providers/ReactNativeProvider.js.map +0 -1
- package/dist/esm/providers/WebProvider.d.ts +0 -33
- package/dist/esm/providers/WebProvider.js +0 -37
- package/dist/esm/providers/WebProvider.js.map +0 -1
- package/dist/esm/react-native.d.ts +0 -11
- package/dist/esm/react-native.js +0 -13
- package/dist/esm/react-native.js.map +0 -1
- package/dist/types/adapters/react-native.d.ts +0 -7
- package/dist/types/adapters/react-native.d.ts.map +0 -1
- package/dist/types/adapters/types.d.ts +0 -45
- package/dist/types/adapters/types.d.ts.map +0 -1
- package/dist/types/adapters/web.d.ts +0 -7
- package/dist/types/adapters/web.d.ts.map +0 -1
- package/dist/types/context/AlchemyContext.d.ts +0 -63
- package/dist/types/context/AlchemyContext.d.ts.map +0 -1
- package/dist/types/providers/ReactNativeProvider.d.ts +0 -34
- package/dist/types/providers/ReactNativeProvider.d.ts.map +0 -1
- package/dist/types/providers/WebProvider.d.ts +0 -34
- package/dist/types/providers/WebProvider.d.ts.map +0 -1
- package/dist/types/react-native.d.ts +0 -12
- package/dist/types/react-native.d.ts.map +0 -1
- package/src/adapters/react-native.ts +0 -71
- package/src/adapters/types.ts +0 -56
- package/src/adapters/web.ts +0 -73
- package/src/react-native.ts +0 -29
package/src/adapters/web.ts
DELETED
|
@@ -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
|
-
}
|
package/src/react-native.ts
DELETED
|
@@ -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";
|