@account-kit/privy-integration 4.73.0 → 4.73.1-alpha.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/dist/esm/Provider.d.ts +4 -61
- package/dist/esm/Provider.js +4 -99
- package/dist/esm/Provider.js.map +1 -1
- package/dist/esm/adapters/react-native.d.ts +6 -0
- package/dist/esm/adapters/react-native.js +46 -0
- package/dist/esm/adapters/react-native.js.map +1 -0
- package/dist/esm/adapters/types.d.ts +44 -0
- package/dist/esm/adapters/types.js +2 -0
- package/dist/esm/adapters/types.js.map +1 -0
- package/dist/esm/adapters/web.d.ts +6 -0
- package/dist/esm/adapters/web.js +50 -0
- package/dist/esm/adapters/web.js.map +1 -0
- package/dist/esm/context/AlchemyContext.d.ts +62 -0
- package/dist/esm/context/AlchemyContext.js +105 -0
- package/dist/esm/context/AlchemyContext.js.map +1 -0
- package/dist/esm/hooks/internal/useEmbeddedWallet.d.ts +3 -4
- package/dist/esm/hooks/internal/useEmbeddedWallet.js +5 -13
- package/dist/esm/hooks/internal/useEmbeddedWallet.js.map +1 -1
- package/dist/esm/hooks/useAlchemyClient.js +13 -20
- package/dist/esm/hooks/useAlchemyClient.js.map +1 -1
- package/dist/esm/providers/ReactNativeProvider.d.ts +33 -0
- package/dist/esm/providers/ReactNativeProvider.js +37 -0
- package/dist/esm/providers/ReactNativeProvider.js.map +1 -0
- package/dist/esm/providers/WebProvider.d.ts +33 -0
- package/dist/esm/providers/WebProvider.js +37 -0
- package/dist/esm/providers/WebProvider.js.map +1 -0
- package/dist/esm/react-native.d.ts +11 -0
- package/dist/esm/react-native.js +13 -0
- package/dist/esm/react-native.js.map +1 -0
- 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 +4 -61
- package/dist/types/Provider.d.ts.map +1 -1
- package/dist/types/adapters/react-native.d.ts +7 -0
- package/dist/types/adapters/react-native.d.ts.map +1 -0
- package/dist/types/adapters/types.d.ts +45 -0
- package/dist/types/adapters/types.d.ts.map +1 -0
- package/dist/types/adapters/web.d.ts +7 -0
- package/dist/types/adapters/web.d.ts.map +1 -0
- package/dist/types/context/AlchemyContext.d.ts +63 -0
- package/dist/types/context/AlchemyContext.d.ts.map +1 -0
- package/dist/types/hooks/internal/useEmbeddedWallet.d.ts +3 -4
- package/dist/types/hooks/internal/useEmbeddedWallet.d.ts.map +1 -1
- package/dist/types/hooks/useAlchemyClient.d.ts.map +1 -1
- package/dist/types/providers/ReactNativeProvider.d.ts +34 -0
- package/dist/types/providers/ReactNativeProvider.d.ts.map +1 -0
- package/dist/types/providers/WebProvider.d.ts +34 -0
- package/dist/types/providers/WebProvider.d.ts.map +1 -0
- package/dist/types/react-native.d.ts +12 -0
- package/dist/types/react-native.d.ts.map +1 -0
- package/dist/types/version.d.ts +1 -1
- package/dist/types/version.d.ts.map +1 -1
- package/package.json +17 -4
- package/src/adapters/react-native.ts +71 -0
- package/src/adapters/types.ts +56 -0
- package/src/adapters/web.ts +73 -0
- package/src/hooks/internal/useEmbeddedWallet.ts +5 -20
- package/src/hooks/useAlchemyClient.ts +17 -32
- package/src/react-native.ts +29 -0
- package/src/version.ts +1 -1
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { useCallback } from "react";
|
|
2
|
-
import { WalletClientSigner, ConnectionConfigSchema
|
|
3
|
-
import { createWalletClient, custom
|
|
4
|
-
import { useSign7702Authorization } from "@privy-io/react-auth";
|
|
2
|
+
import { WalletClientSigner, ConnectionConfigSchema } from "@aa-sdk/core";
|
|
3
|
+
import { createWalletClient, custom } from "viem";
|
|
5
4
|
import { createSmartWalletClient, } from "@account-kit/wallet-client";
|
|
6
5
|
import { alchemy } from "@account-kit/infra";
|
|
7
|
-
import { useAlchemyConfig, useClientCache } from "../
|
|
6
|
+
import { useAlchemyConfig, useClientCache, useAdapter, } from "../context/AlchemyContext.js";
|
|
8
7
|
import { getChain } from "../util/getChain.js";
|
|
9
8
|
import { useEmbeddedWallet } from "./internal/useEmbeddedWallet.js";
|
|
10
9
|
/**
|
|
@@ -21,7 +20,8 @@ import { useEmbeddedWallet } from "./internal/useEmbeddedWallet.js";
|
|
|
21
20
|
* ```
|
|
22
21
|
*/
|
|
23
22
|
export function useAlchemyClient() {
|
|
24
|
-
const
|
|
23
|
+
const adapter = useAdapter();
|
|
24
|
+
const signAuthorizationFn = adapter.useAuthorizationSigner?.() || null;
|
|
25
25
|
const config = useAlchemyConfig();
|
|
26
26
|
const cache = useClientCache();
|
|
27
27
|
const getEmbeddedWallet = useEmbeddedWallet();
|
|
@@ -65,20 +65,13 @@ export function useAlchemyClient() {
|
|
|
65
65
|
chain,
|
|
66
66
|
transport: custom(provider),
|
|
67
67
|
}), "privy");
|
|
68
|
-
// Extend signer with EIP-7702 authorization support
|
|
69
|
-
const signer =
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
});
|
|
76
|
-
return {
|
|
77
|
-
...unsignedAuth,
|
|
78
|
-
...signature,
|
|
79
|
-
};
|
|
80
|
-
},
|
|
81
|
-
};
|
|
68
|
+
// Extend signer with EIP-7702 authorization support (if available)
|
|
69
|
+
const signer = signAuthorizationFn
|
|
70
|
+
? {
|
|
71
|
+
...baseSigner,
|
|
72
|
+
signAuthorization: signAuthorizationFn,
|
|
73
|
+
}
|
|
74
|
+
: baseSigner;
|
|
82
75
|
// Determine transport configuration using schema validation
|
|
83
76
|
// This properly handles combinations like rpcUrl + jwt together
|
|
84
77
|
const transportConfig = ConnectionConfigSchema.parse({
|
|
@@ -107,7 +100,7 @@ export function useAlchemyClient() {
|
|
|
107
100
|
}, [
|
|
108
101
|
getEmbeddedWallet,
|
|
109
102
|
getEmbeddedWalletChain,
|
|
110
|
-
|
|
103
|
+
signAuthorizationFn,
|
|
111
104
|
config.apiKey,
|
|
112
105
|
config.jwt,
|
|
113
106
|
config.rpcUrl,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAlchemyClient.js","sourceRoot":"","sources":["../../../src/hooks/useAlchemyClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,
|
|
1
|
+
{"version":3,"file":"useAlchemyClient.js","sourceRoot":"","sources":["../../../src/hooks/useAlchemyClient.ts"],"names":[],"mappings":"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","sourcesContent":["import { useCallback } from \"react\";\nimport { WalletClientSigner, ConnectionConfigSchema } from \"@aa-sdk/core\";\nimport { createWalletClient, custom, type Address } from \"viem\";\nimport {\n createSmartWalletClient,\n type SmartWalletClient,\n} from \"@account-kit/wallet-client\";\nimport { alchemy } from \"@account-kit/infra\";\nimport {\n useAlchemyConfig,\n useClientCache,\n useAdapter,\n} from \"../context/AlchemyContext.js\";\nimport { getChain } from \"../util/getChain.js\";\nimport { useEmbeddedWallet } from \"./internal/useEmbeddedWallet.js\";\n\n/**\n * Hook to get and memoize a SmartWalletClient instance\n * The client is cached in the AlchemyProvider context (React tree scoped)\n * Automatically clears cache on logout via the provider\n *\n * @returns {{ getClient: () => Promise<SmartWalletClient> }} Object containing the smart wallet client getter\n *\n * @example\n * ```tsx\n * const { getClient } = useAlchemyClient();\n * const smartWalletClient = await getClient();\n * ```\n */\nexport function useAlchemyClient() {\n const adapter = useAdapter();\n const signAuthorizationFn = adapter.useAuthorizationSigner?.() || null;\n const config = useAlchemyConfig();\n const cache = useClientCache();\n const getEmbeddedWallet = useEmbeddedWallet();\n\n const getEmbeddedWalletChain = useCallback(() => {\n const embedded = getEmbeddedWallet();\n // Handle CAIP-2 format like \"eip155:1\"\n const chainIdStr = embedded.chainId?.toString();\n\n if (!chainIdStr) {\n throw new Error(\n \"Embedded wallet chainId is not set. Please ensure the wallet is connected to a network.\",\n );\n }\n\n const numericChainId = chainIdStr.includes(\":\")\n ? chainIdStr.split(\":\")[1]\n : chainIdStr;\n\n const parsedChainId = Number(numericChainId);\n\n if (isNaN(parsedChainId)) {\n throw new Error(\n `Failed to parse chainId from embedded wallet. Received: ${chainIdStr}`,\n );\n }\n\n return getChain(parsedChainId);\n }, [getEmbeddedWallet]);\n\n const getClient = useCallback(async (): Promise<SmartWalletClient> => {\n const embeddedWallet = getEmbeddedWallet();\n const chain = getEmbeddedWalletChain();\n\n // Generate a cache key based on configuration and wallet address\n const currentCacheKey = JSON.stringify({\n address: embeddedWallet.address,\n chainId: chain.id,\n apiKey: config.apiKey,\n jwt: config.jwt,\n rpcUrl: config.rpcUrl,\n policyId: config.policyId,\n });\n\n // Return cached client if configuration hasn't changed\n if (cache.client && cache.cacheKey === currentCacheKey) {\n return cache.client;\n }\n\n // Configuration changed or no cache exists, create new client\n const provider = await embeddedWallet.getEthereumProvider();\n\n // Create base signer from Privy wallet\n const baseSigner = new WalletClientSigner(\n createWalletClient({\n account: embeddedWallet.address as Address,\n chain,\n transport: custom(provider),\n }),\n \"privy\",\n );\n\n // Extend signer with EIP-7702 authorization support (if available)\n const signer = signAuthorizationFn\n ? {\n ...baseSigner,\n signAuthorization: signAuthorizationFn,\n }\n : baseSigner;\n\n // Determine transport configuration using schema validation\n // This properly handles combinations like rpcUrl + jwt together\n const transportConfig = ConnectionConfigSchema.parse({\n rpcUrl: config.rpcUrl,\n apiKey: config.apiKey,\n jwt: config.jwt,\n });\n\n const transport = alchemy(transportConfig);\n\n transport.updateHeaders({\n \"X-Alchemy-Client-Breadcrumb\": \"privyIntegrationSdk\",\n });\n\n // Create and cache the smart wallet client in provider context\n cache.client = createSmartWalletClient({\n chain,\n transport,\n signer,\n policyIds: config.policyId\n ? Array.isArray(config.policyId)\n ? config.policyId\n : [config.policyId]\n : undefined,\n });\n\n // Store the cache key\n cache.cacheKey = currentCacheKey;\n\n return cache.client;\n }, [\n getEmbeddedWallet,\n getEmbeddedWalletChain,\n signAuthorizationFn,\n config.apiKey,\n config.jwt,\n config.rpcUrl,\n config.policyId,\n cache,\n ]);\n\n return { getClient };\n}\n"]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { PropsWithChildren } from "react";
|
|
2
|
+
import type { AlchemyProviderConfig } from "../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Provider component for React Native (Expo) applications
|
|
5
|
+
* Must be nested INSIDE PrivyProvider from @privy-io/expo
|
|
6
|
+
*
|
|
7
|
+
* @param {PropsWithChildren<AlchemyProviderConfig>} props - Component props
|
|
8
|
+
* @param {React.ReactNode} props.children - React children to wrap with Alchemy configuration
|
|
9
|
+
* @param {string} [props.apiKey] - Your Alchemy API key
|
|
10
|
+
* @param {string} [props.jwt] - JWT token for authentication
|
|
11
|
+
* @param {string} [props.rpcUrl] - Custom RPC URL for EVM chains
|
|
12
|
+
* @param {string} [props.solanaRpcUrl] - Custom RPC URL for Solana
|
|
13
|
+
* @param {string | string[]} [props.policyId] - Gas Manager policy ID(s) for EVM chains
|
|
14
|
+
* @param {string | string[]} [props.solanaPolicyId] - Gas Manager policy ID(s) for Solana
|
|
15
|
+
* @param {boolean} [props.disableSponsorship] - Set to true to disable sponsorship by default (default: false)
|
|
16
|
+
* @returns {JSX.Element} Provider component
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* import { PrivyProvider } from '@privy-io/expo';
|
|
21
|
+
* import { AlchemyProvider } from '@account-kit/privy-integration/react-native';
|
|
22
|
+
*
|
|
23
|
+
* <PrivyProvider appId="..." clientId="...">
|
|
24
|
+
* <AlchemyProvider
|
|
25
|
+
* apiKey="your-alchemy-api-key"
|
|
26
|
+
* policyId="your-gas-policy-id"
|
|
27
|
+
* >
|
|
28
|
+
* <YourApp />
|
|
29
|
+
* </AlchemyProvider>
|
|
30
|
+
* </PrivyProvider>
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare function AlchemyProvider({ children, ...config }: PropsWithChildren<AlchemyProviderConfig>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { AlchemyContextProvider } from "../context/AlchemyContext.js";
|
|
3
|
+
import { reactNativeAdapter } from "../adapters/react-native.js";
|
|
4
|
+
/**
|
|
5
|
+
* Provider component for React Native (Expo) applications
|
|
6
|
+
* Must be nested INSIDE PrivyProvider from @privy-io/expo
|
|
7
|
+
*
|
|
8
|
+
* @param {PropsWithChildren<AlchemyProviderConfig>} props - Component props
|
|
9
|
+
* @param {React.ReactNode} props.children - React children to wrap with Alchemy configuration
|
|
10
|
+
* @param {string} [props.apiKey] - Your Alchemy API key
|
|
11
|
+
* @param {string} [props.jwt] - JWT token for authentication
|
|
12
|
+
* @param {string} [props.rpcUrl] - Custom RPC URL for EVM chains
|
|
13
|
+
* @param {string} [props.solanaRpcUrl] - Custom RPC URL for Solana
|
|
14
|
+
* @param {string | string[]} [props.policyId] - Gas Manager policy ID(s) for EVM chains
|
|
15
|
+
* @param {string | string[]} [props.solanaPolicyId] - Gas Manager policy ID(s) for Solana
|
|
16
|
+
* @param {boolean} [props.disableSponsorship] - Set to true to disable sponsorship by default (default: false)
|
|
17
|
+
* @returns {JSX.Element} Provider component
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* import { PrivyProvider } from '@privy-io/expo';
|
|
22
|
+
* import { AlchemyProvider } from '@account-kit/privy-integration/react-native';
|
|
23
|
+
*
|
|
24
|
+
* <PrivyProvider appId="..." clientId="...">
|
|
25
|
+
* <AlchemyProvider
|
|
26
|
+
* apiKey="your-alchemy-api-key"
|
|
27
|
+
* policyId="your-gas-policy-id"
|
|
28
|
+
* >
|
|
29
|
+
* <YourApp />
|
|
30
|
+
* </AlchemyProvider>
|
|
31
|
+
* </PrivyProvider>
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export function AlchemyProvider({ children, ...config }) {
|
|
35
|
+
return (_jsx(AlchemyContextProvider, { config: config, adapter: reactNativeAdapter, children: children }));
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=ReactNativeProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReactNativeProvider.js","sourceRoot":"","sources":["../../../src/providers/ReactNativeProvider.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAGjE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,UAAU,eAAe,CAAC,EAC9B,QAAQ,EACR,GAAG,MAAM,EACgC;IACzC,OAAO,CACL,KAAC,sBAAsB,IAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,YAChE,QAAQ,GACc,CAC1B,CAAC;AACJ,CAAC","sourcesContent":["import type { PropsWithChildren } from \"react\";\nimport { AlchemyContextProvider } from \"../context/AlchemyContext.js\";\nimport { reactNativeAdapter } from \"../adapters/react-native.js\";\nimport type { AlchemyProviderConfig } from \"../types.js\";\n\n/**\n * Provider component for React Native (Expo) applications\n * Must be nested INSIDE PrivyProvider from @privy-io/expo\n *\n * @param {PropsWithChildren<AlchemyProviderConfig>} props - Component props\n * @param {React.ReactNode} props.children - React children to wrap with Alchemy configuration\n * @param {string} [props.apiKey] - Your Alchemy API key\n * @param {string} [props.jwt] - JWT token for authentication\n * @param {string} [props.rpcUrl] - Custom RPC URL for EVM chains\n * @param {string} [props.solanaRpcUrl] - Custom RPC URL for Solana\n * @param {string | string[]} [props.policyId] - Gas Manager policy ID(s) for EVM chains\n * @param {string | string[]} [props.solanaPolicyId] - Gas Manager policy ID(s) for Solana\n * @param {boolean} [props.disableSponsorship] - Set to true to disable sponsorship by default (default: false)\n * @returns {JSX.Element} Provider component\n *\n * @example\n * ```tsx\n * import { PrivyProvider } from '@privy-io/expo';\n * import { AlchemyProvider } from '@account-kit/privy-integration/react-native';\n *\n * <PrivyProvider appId=\"...\" clientId=\"...\">\n * <AlchemyProvider\n * apiKey=\"your-alchemy-api-key\"\n * policyId=\"your-gas-policy-id\"\n * >\n * <YourApp />\n * </AlchemyProvider>\n * </PrivyProvider>\n * ```\n */\nexport function AlchemyProvider({\n children,\n ...config\n}: PropsWithChildren<AlchemyProviderConfig>) {\n return (\n <AlchemyContextProvider config={config} adapter={reactNativeAdapter}>\n {children}\n </AlchemyContextProvider>\n );\n}\n"]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { PropsWithChildren } from "react";
|
|
2
|
+
import type { AlchemyProviderConfig } from "../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Provider component for React web applications
|
|
5
|
+
* Must be nested INSIDE PrivyProvider from @privy-io/react-auth
|
|
6
|
+
*
|
|
7
|
+
* @param {PropsWithChildren<AlchemyProviderConfig>} props - Component props
|
|
8
|
+
* @param {React.ReactNode} props.children - React children to wrap with Alchemy configuration
|
|
9
|
+
* @param {string} [props.apiKey] - Your Alchemy API key
|
|
10
|
+
* @param {string} [props.jwt] - JWT token for authentication
|
|
11
|
+
* @param {string} [props.rpcUrl] - Custom RPC URL for EVM chains
|
|
12
|
+
* @param {string} [props.solanaRpcUrl] - Custom RPC URL for Solana
|
|
13
|
+
* @param {string | string[]} [props.policyId] - Gas Manager policy ID(s) for EVM chains
|
|
14
|
+
* @param {string | string[]} [props.solanaPolicyId] - Gas Manager policy ID(s) for Solana
|
|
15
|
+
* @param {boolean} [props.disableSponsorship] - Set to true to disable sponsorship by default (default: false)
|
|
16
|
+
* @returns {JSX.Element} Provider component
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* import { PrivyProvider } from '@privy-io/react-auth';
|
|
21
|
+
* import { AlchemyProvider } from '@account-kit/privy-integration';
|
|
22
|
+
*
|
|
23
|
+
* <PrivyProvider appId="...">
|
|
24
|
+
* <AlchemyProvider
|
|
25
|
+
* apiKey="your-alchemy-api-key"
|
|
26
|
+
* policyId="your-gas-policy-id"
|
|
27
|
+
* >
|
|
28
|
+
* <YourApp />
|
|
29
|
+
* </AlchemyProvider>
|
|
30
|
+
* </PrivyProvider>
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare function AlchemyProvider({ children, ...config }: PropsWithChildren<AlchemyProviderConfig>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { AlchemyContextProvider } from "../context/AlchemyContext.js";
|
|
3
|
+
import { webAdapter } from "../adapters/web.js";
|
|
4
|
+
/**
|
|
5
|
+
* Provider component for React web applications
|
|
6
|
+
* Must be nested INSIDE PrivyProvider from @privy-io/react-auth
|
|
7
|
+
*
|
|
8
|
+
* @param {PropsWithChildren<AlchemyProviderConfig>} props - Component props
|
|
9
|
+
* @param {React.ReactNode} props.children - React children to wrap with Alchemy configuration
|
|
10
|
+
* @param {string} [props.apiKey] - Your Alchemy API key
|
|
11
|
+
* @param {string} [props.jwt] - JWT token for authentication
|
|
12
|
+
* @param {string} [props.rpcUrl] - Custom RPC URL for EVM chains
|
|
13
|
+
* @param {string} [props.solanaRpcUrl] - Custom RPC URL for Solana
|
|
14
|
+
* @param {string | string[]} [props.policyId] - Gas Manager policy ID(s) for EVM chains
|
|
15
|
+
* @param {string | string[]} [props.solanaPolicyId] - Gas Manager policy ID(s) for Solana
|
|
16
|
+
* @param {boolean} [props.disableSponsorship] - Set to true to disable sponsorship by default (default: false)
|
|
17
|
+
* @returns {JSX.Element} Provider component
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* import { PrivyProvider } from '@privy-io/react-auth';
|
|
22
|
+
* import { AlchemyProvider } from '@account-kit/privy-integration';
|
|
23
|
+
*
|
|
24
|
+
* <PrivyProvider appId="...">
|
|
25
|
+
* <AlchemyProvider
|
|
26
|
+
* apiKey="your-alchemy-api-key"
|
|
27
|
+
* policyId="your-gas-policy-id"
|
|
28
|
+
* >
|
|
29
|
+
* <YourApp />
|
|
30
|
+
* </AlchemyProvider>
|
|
31
|
+
* </PrivyProvider>
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export function AlchemyProvider({ children, ...config }) {
|
|
35
|
+
return (_jsx(AlchemyContextProvider, { config: config, adapter: webAdapter, children: children }));
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=WebProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebProvider.js","sourceRoot":"","sources":["../../../src/providers/WebProvider.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,UAAU,eAAe,CAAC,EAC9B,QAAQ,EACR,GAAG,MAAM,EACgC;IACzC,OAAO,CACL,KAAC,sBAAsB,IAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,YACxD,QAAQ,GACc,CAC1B,CAAC;AACJ,CAAC","sourcesContent":["import type { PropsWithChildren } from \"react\";\nimport { AlchemyContextProvider } from \"../context/AlchemyContext.js\";\nimport { webAdapter } from \"../adapters/web.js\";\nimport type { AlchemyProviderConfig } from \"../types.js\";\n\n/**\n * Provider component for React web applications\n * Must be nested INSIDE PrivyProvider from @privy-io/react-auth\n *\n * @param {PropsWithChildren<AlchemyProviderConfig>} props - Component props\n * @param {React.ReactNode} props.children - React children to wrap with Alchemy configuration\n * @param {string} [props.apiKey] - Your Alchemy API key\n * @param {string} [props.jwt] - JWT token for authentication\n * @param {string} [props.rpcUrl] - Custom RPC URL for EVM chains\n * @param {string} [props.solanaRpcUrl] - Custom RPC URL for Solana\n * @param {string | string[]} [props.policyId] - Gas Manager policy ID(s) for EVM chains\n * @param {string | string[]} [props.solanaPolicyId] - Gas Manager policy ID(s) for Solana\n * @param {boolean} [props.disableSponsorship] - Set to true to disable sponsorship by default (default: false)\n * @returns {JSX.Element} Provider component\n *\n * @example\n * ```tsx\n * import { PrivyProvider } from '@privy-io/react-auth';\n * import { AlchemyProvider } from '@account-kit/privy-integration';\n *\n * <PrivyProvider appId=\"...\">\n * <AlchemyProvider\n * apiKey=\"your-alchemy-api-key\"\n * policyId=\"your-gas-policy-id\"\n * >\n * <YourApp />\n * </AlchemyProvider>\n * </PrivyProvider>\n * ```\n */\nexport function AlchemyProvider({\n children,\n ...config\n}: PropsWithChildren<AlchemyProviderConfig>) {\n return (\n <AlchemyContextProvider config={config} adapter={webAdapter}>\n {children}\n </AlchemyContextProvider>\n );\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* React Native (Expo) entry point
|
|
3
|
+
* Import from '@account-kit/privy-integration/react-native' in Expo apps
|
|
4
|
+
*/
|
|
5
|
+
export { AlchemyProvider } from "./providers/ReactNativeProvider.js";
|
|
6
|
+
export { useAlchemyConfig } from "./context/AlchemyContext.js";
|
|
7
|
+
export { useAlchemyClient } from "./hooks/useAlchemyClient.js";
|
|
8
|
+
export { useAlchemySendTransaction } from "./hooks/useAlchemySendTransaction.js";
|
|
9
|
+
export { useAlchemyPrepareSwap } from "./hooks/useAlchemyPrepareSwap.js";
|
|
10
|
+
export { useAlchemySubmitSwap } from "./hooks/useAlchemySubmitSwap.js";
|
|
11
|
+
export type { AlchemyProviderConfig, UnsignedTransactionRequest, SendTransactionOptions, SendTransactionResult, UseSendTransactionResult, PrepareSwapRequest, PrepareSwapResult, UsePrepareSwapResult, SubmitSwapResult, UseSubmitSwapResult, SwapQuote, } from "./types.js";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* React Native (Expo) entry point
|
|
3
|
+
* Import from '@account-kit/privy-integration/react-native' in Expo apps
|
|
4
|
+
*/
|
|
5
|
+
// Provider
|
|
6
|
+
export { AlchemyProvider } from "./providers/ReactNativeProvider.js";
|
|
7
|
+
export { useAlchemyConfig } from "./context/AlchemyContext.js";
|
|
8
|
+
// Hooks
|
|
9
|
+
export { useAlchemyClient } from "./hooks/useAlchemyClient.js";
|
|
10
|
+
export { useAlchemySendTransaction } from "./hooks/useAlchemySendTransaction.js";
|
|
11
|
+
export { useAlchemyPrepareSwap } from "./hooks/useAlchemyPrepareSwap.js";
|
|
12
|
+
export { useAlchemySubmitSwap } from "./hooks/useAlchemySubmitSwap.js";
|
|
13
|
+
//# sourceMappingURL=react-native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react-native.js","sourceRoot":"","sources":["../../src/react-native.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,WAAW;AACX,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D,QAAQ;AACR,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC","sourcesContent":["/**\n * React Native (Expo) entry point\n * Import from '@account-kit/privy-integration/react-native' in Expo apps\n */\n\n// Provider\nexport { AlchemyProvider } from \"./providers/ReactNativeProvider.js\";\nexport { useAlchemyConfig } from \"./context/AlchemyContext.js\";\n\n// Hooks\nexport { useAlchemyClient } from \"./hooks/useAlchemyClient.js\";\nexport { useAlchemySendTransaction } from \"./hooks/useAlchemySendTransaction.js\";\nexport { useAlchemyPrepareSwap } from \"./hooks/useAlchemyPrepareSwap.js\";\nexport { useAlchemySubmitSwap } from \"./hooks/useAlchemySubmitSwap.js\";\n\n// Types\nexport type {\n AlchemyProviderConfig,\n UnsignedTransactionRequest,\n SendTransactionOptions,\n SendTransactionResult,\n UseSendTransactionResult,\n PrepareSwapRequest,\n PrepareSwapResult,\n UsePrepareSwapResult,\n SubmitSwapResult,\n UseSubmitSwapResult,\n SwapQuote,\n} from \"./types.js\";\n"]}
|
package/dist/esm/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "4.73.0";
|
|
1
|
+
export declare const VERSION = "4.73.1-alpha.0";
|
package/dist/esm/version.js
CHANGED
package/dist/esm/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,yBAAyB;AACzB,MAAM,CAAC,MAAM,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,yBAAyB;AACzB,MAAM,CAAC,MAAM,OAAO,GAAG,gBAAgB,CAAC","sourcesContent":["// This file is autogenerated by inject-version.ts. Any changes will be\n// overwritten on commit!\nexport const VERSION = \"4.73.1-alpha.0\";\n"]}
|
package/dist/types/Provider.d.ts
CHANGED
|
@@ -1,64 +1,7 @@
|
|
|
1
|
-
import { type PropsWithChildren } from "react";
|
|
2
|
-
import type { SmartWalletClient } from "@account-kit/wallet-client";
|
|
3
|
-
import type { AlchemyProviderConfig } from "./types.js";
|
|
4
1
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* @internal
|
|
2
|
+
* Web-specific exports
|
|
3
|
+
* Re-exports the web provider and hooks for React applications
|
|
8
4
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
cacheKey: string | null;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Provider component that configures Alchemy infrastructure for transaction handling
|
|
15
|
-
* Must be nested INSIDE PrivyProvider to access authentication state
|
|
16
|
-
* Automatically manages client cache lifecycle and resets on logout
|
|
17
|
-
*
|
|
18
|
-
* @param {PropsWithChildren<AlchemyProviderConfig>} props - Component props
|
|
19
|
-
* @param {React.ReactNode} props.children - React children to wrap with Alchemy configuration
|
|
20
|
-
* @param {string} [props.apiKey] - Your Alchemy API key
|
|
21
|
-
* @param {string} [props.jwt] - JWT token for authentication
|
|
22
|
-
* @param {string} [props.rpcUrl] - Custom RPC URL for EVM chains
|
|
23
|
-
* @param {string} [props.solanaRpcUrl] - Custom RPC URL for Solana
|
|
24
|
-
* @param {string | string[]} [props.policyId] - Gas Manager policy ID(s) for EVM chains
|
|
25
|
-
* @param {string | string[]} [props.solanaPolicyId] - Gas Manager policy ID(s) for Solana
|
|
26
|
-
* @param {boolean} [props.disableSponsorship] - Set to true to disable sponsorship by default (default: false)
|
|
27
|
-
* @returns {JSX.Element} Provider component
|
|
28
|
-
*
|
|
29
|
-
* @example
|
|
30
|
-
* ```tsx
|
|
31
|
-
* <PrivyProvider appId="...">
|
|
32
|
-
* <AlchemyProvider
|
|
33
|
-
* apiKey="your-alchemy-api-key"
|
|
34
|
-
* policyId="your-gas-policy-id"
|
|
35
|
-
* >
|
|
36
|
-
* <YourApp />
|
|
37
|
-
* </AlchemyProvider>
|
|
38
|
-
* </PrivyProvider>
|
|
39
|
-
* ```
|
|
40
|
-
*/
|
|
41
|
-
export declare function AlchemyProvider({ children, ...config }: PropsWithChildren<AlchemyProviderConfig>): import("react/jsx-runtime").JSX.Element;
|
|
42
|
-
/**
|
|
43
|
-
* Hook to access Alchemy provider configuration
|
|
44
|
-
* Must be used within an <AlchemyProvider> component
|
|
45
|
-
*
|
|
46
|
-
* @returns {AlchemyProviderConfig} The current Alchemy configuration
|
|
47
|
-
* @throws {Error} If used outside of AlchemyProvider
|
|
48
|
-
*
|
|
49
|
-
* @example
|
|
50
|
-
* ```tsx
|
|
51
|
-
* const config = useAlchemyConfig();
|
|
52
|
-
* console.log('Policy ID:', config.policyId);
|
|
53
|
-
* ```
|
|
54
|
-
*/
|
|
55
|
-
export declare function useAlchemyConfig(): AlchemyProviderConfig;
|
|
56
|
-
/**
|
|
57
|
-
* Hook to access the client cache (internal use only)
|
|
58
|
-
*
|
|
59
|
-
* @internal
|
|
60
|
-
* @returns {ClientCache} The client cache object
|
|
61
|
-
*/
|
|
62
|
-
export declare function useClientCache(): ClientCache;
|
|
63
|
-
export {};
|
|
5
|
+
export { AlchemyProvider } from "./providers/WebProvider.js";
|
|
6
|
+
export { useAlchemyConfig } from "./context/AlchemyContext.js";
|
|
64
7
|
//# sourceMappingURL=Provider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../src/Provider.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../src/Provider.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PrivyAdapter } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* React Native (Expo) adapter for @privy-io/expo
|
|
4
|
+
* Implements platform-specific hooks for React Native applications
|
|
5
|
+
*/
|
|
6
|
+
export declare const reactNativeAdapter: PrivyAdapter;
|
|
7
|
+
//# sourceMappingURL=react-native.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react-native.d.ts","sourceRoot":"","sources":["../../../src/adapters/react-native.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAkC,MAAM,YAAY,CAAC;AAY/E;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,YA2BhC,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { Address, Authorization } from "viem";
|
|
2
|
+
import type { AuthorizationRequest } from "@aa-sdk/core";
|
|
3
|
+
/**
|
|
4
|
+
* Platform-agnostic embedded wallet interface
|
|
5
|
+
* Abstracts differences between @privy-io/react-auth and @privy-io/expo
|
|
6
|
+
*/
|
|
7
|
+
export interface EmbeddedWallet {
|
|
8
|
+
/** Wallet address */
|
|
9
|
+
address: Address;
|
|
10
|
+
/** Chain ID (may be CAIP-2 format like "eip155:1" or numeric) */
|
|
11
|
+
chainId: string | number;
|
|
12
|
+
/** Get EVM provider for the wallet */
|
|
13
|
+
getEthereumProvider(): Promise<any>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Platform-agnostic Privy auth state
|
|
17
|
+
*/
|
|
18
|
+
export interface PrivyAuthState {
|
|
19
|
+
/** Whether user is authenticated */
|
|
20
|
+
authenticated: boolean;
|
|
21
|
+
/** User object (platform-specific, used for cache invalidation) */
|
|
22
|
+
user: any;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Adapter interface that each platform must implement
|
|
26
|
+
* Provides platform-specific Privy functionality
|
|
27
|
+
*/
|
|
28
|
+
export interface PrivyAdapter {
|
|
29
|
+
/**
|
|
30
|
+
* Hook to get embedded wallet
|
|
31
|
+
* Must be called as a React hook (follows rules of hooks)
|
|
32
|
+
*/
|
|
33
|
+
useEmbeddedWallet(): () => EmbeddedWallet;
|
|
34
|
+
/**
|
|
35
|
+
* Hook to get Privy authentication state
|
|
36
|
+
* Must be called as a React hook (follows rules of hooks)
|
|
37
|
+
*/
|
|
38
|
+
usePrivyAuth(): PrivyAuthState;
|
|
39
|
+
/**
|
|
40
|
+
* Hook to get EIP-7702 authorization signer (optional, web only)
|
|
41
|
+
* Must be called as a React hook (follows rules of hooks)
|
|
42
|
+
*/
|
|
43
|
+
useAuthorizationSigner?(): ((auth: AuthorizationRequest<number>) => Promise<Authorization<number, true>>) | null;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/adapters/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AACnD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEzD;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,qBAAqB;IACrB,OAAO,EAAE,OAAO,CAAC;IAEjB,iEAAiE;IACjE,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;IAEzB,sCAAsC;IACtC,mBAAmB,IAAI,OAAO,CAAC,GAAG,CAAC,CAAC;CACrC;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,oCAAoC;IACpC,aAAa,EAAE,OAAO,CAAC;IAEvB,mEAAmE;IACnE,IAAI,EAAE,GAAG,CAAC;CACX;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,iBAAiB,IAAI,MAAM,cAAc,CAAC;IAE1C;;;OAGG;IACH,YAAY,IAAI,cAAc,CAAC;IAE/B;;;OAGG;IACH,sBAAsB,CAAC,IACnB,CAAC,CACC,IAAI,EAAE,oBAAoB,CAAC,MAAM,CAAC,KAC/B,OAAO,CAAC,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,GAC1C,IAAI,CAAC;CACV"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web.d.ts","sourceRoot":"","sources":["../../../src/adapters/web.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,YAAY,EAAkC,MAAM,YAAY,CAAC;AAE/E;;;GAGG;AACH,eAAO,MAAM,UAAU,EAAE,YA2CxB,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { type PropsWithChildren } from "react";
|
|
2
|
+
import type { SmartWalletClient } from "@account-kit/wallet-client";
|
|
3
|
+
import type { AlchemyProviderConfig } from "../types.js";
|
|
4
|
+
import type { PrivyAdapter } from "../adapters/types.js";
|
|
5
|
+
/**
|
|
6
|
+
* Client cache stored in React tree (similar to QueryClient in React Query)
|
|
7
|
+
*
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
interface ClientCache {
|
|
11
|
+
client: SmartWalletClient | null;
|
|
12
|
+
cacheKey: string | null;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Props for AlchemyContextProvider
|
|
16
|
+
*/
|
|
17
|
+
interface AlchemyContextProviderProps extends PropsWithChildren {
|
|
18
|
+
config: AlchemyProviderConfig;
|
|
19
|
+
adapter: PrivyAdapter;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Internal provider component that manages Alchemy context
|
|
23
|
+
* Used by both web and React Native providers
|
|
24
|
+
*
|
|
25
|
+
* @internal
|
|
26
|
+
* @param {AlchemyContextProviderProps} props - Component props
|
|
27
|
+
* @param {React.ReactNode} props.children - React children to wrap with context
|
|
28
|
+
* @param {AlchemyProviderConfig} props.config - Alchemy configuration
|
|
29
|
+
* @param {PrivyAdapter} props.adapter - Platform adapter
|
|
30
|
+
* @returns {JSX.Element} Context provider component
|
|
31
|
+
*/
|
|
32
|
+
export declare function AlchemyContextProvider({ children, config, adapter, }: AlchemyContextProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
33
|
+
/**
|
|
34
|
+
* Hook to access Alchemy provider configuration
|
|
35
|
+
* Must be used within an <AlchemyProvider> component
|
|
36
|
+
*
|
|
37
|
+
* @returns {AlchemyProviderConfig} The current Alchemy configuration
|
|
38
|
+
* @throws {Error} If used outside of AlchemyProvider
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```tsx
|
|
42
|
+
* const config = useAlchemyConfig();
|
|
43
|
+
* console.log('Policy ID:', config.policyId);
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export declare function useAlchemyConfig(): AlchemyProviderConfig;
|
|
47
|
+
/**
|
|
48
|
+
* Hook to access the platform adapter
|
|
49
|
+
* Must be used within an <AlchemyProvider> component
|
|
50
|
+
*
|
|
51
|
+
* @internal
|
|
52
|
+
* @returns {PrivyAdapter} The platform adapter
|
|
53
|
+
*/
|
|
54
|
+
export declare function useAdapter(): PrivyAdapter;
|
|
55
|
+
/**
|
|
56
|
+
* Hook to access the client cache (internal use only)
|
|
57
|
+
*
|
|
58
|
+
* @internal
|
|
59
|
+
* @returns {ClientCache} The client cache object
|
|
60
|
+
*/
|
|
61
|
+
export declare function useClientCache(): ClientCache;
|
|
62
|
+
export {};
|
|
63
|
+
//# sourceMappingURL=AlchemyContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AlchemyContext.d.ts","sourceRoot":"","sources":["../../../src/context/AlchemyContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,iBAAiB,EAKvB,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAYzD;;;;GAIG;AACH,UAAU,WAAW;IACnB,MAAM,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACjC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAID;;GAEG;AACH,UAAU,2BAA4B,SAAQ,iBAAiB;IAC7D,MAAM,EAAE,qBAAqB,CAAC;IAC9B,OAAO,EAAE,YAAY,CAAC;CACvB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,QAAQ,EACR,MAAM,EACN,OAAO,GACR,EAAE,2BAA2B,2CAmD7B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,IAAI,qBAAqB,CAMxD;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,IAAI,YAAY,CAQzC;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,IAAI,WAAW,CAQ5C"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { type ConnectedWallet as PrivyWallet } from "@privy-io/react-auth";
|
|
2
1
|
/**
|
|
3
2
|
* Internal hook to get the Privy embedded wallet
|
|
4
|
-
*
|
|
3
|
+
* Uses the platform adapter to abstract differences between web and React Native
|
|
5
4
|
*
|
|
6
5
|
* @internal
|
|
7
|
-
* @returns {() =>
|
|
6
|
+
* @returns {() => EmbeddedWallet} Function that returns the embedded wallet
|
|
8
7
|
* @throws {Error} If embedded wallet is not found
|
|
9
8
|
*/
|
|
10
|
-
export declare function useEmbeddedWallet(): () =>
|
|
9
|
+
export declare function useEmbeddedWallet(): () => import("../../adapters/types.js").EmbeddedWallet;
|
|
11
10
|
//# sourceMappingURL=useEmbeddedWallet.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEmbeddedWallet.d.ts","sourceRoot":"","sources":["../../../../src/hooks/internal/useEmbeddedWallet.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useEmbeddedWallet.d.ts","sourceRoot":"","sources":["../../../../src/hooks/internal/useEmbeddedWallet.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,2DAGhC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAlchemyClient.d.ts","sourceRoot":"","sources":["../../../src/hooks/useAlchemyClient.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useAlchemyClient.d.ts","sourceRoot":"","sources":["../../../src/hooks/useAlchemyClient.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,4BAA4B,CAAC;AAUpC;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB;qBAiCU,OAAO,CAAC,iBAAiB,CAAC;EAkFnE"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { PropsWithChildren } from "react";
|
|
2
|
+
import type { AlchemyProviderConfig } from "../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Provider component for React Native (Expo) applications
|
|
5
|
+
* Must be nested INSIDE PrivyProvider from @privy-io/expo
|
|
6
|
+
*
|
|
7
|
+
* @param {PropsWithChildren<AlchemyProviderConfig>} props - Component props
|
|
8
|
+
* @param {React.ReactNode} props.children - React children to wrap with Alchemy configuration
|
|
9
|
+
* @param {string} [props.apiKey] - Your Alchemy API key
|
|
10
|
+
* @param {string} [props.jwt] - JWT token for authentication
|
|
11
|
+
* @param {string} [props.rpcUrl] - Custom RPC URL for EVM chains
|
|
12
|
+
* @param {string} [props.solanaRpcUrl] - Custom RPC URL for Solana
|
|
13
|
+
* @param {string | string[]} [props.policyId] - Gas Manager policy ID(s) for EVM chains
|
|
14
|
+
* @param {string | string[]} [props.solanaPolicyId] - Gas Manager policy ID(s) for Solana
|
|
15
|
+
* @param {boolean} [props.disableSponsorship] - Set to true to disable sponsorship by default (default: false)
|
|
16
|
+
* @returns {JSX.Element} Provider component
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* import { PrivyProvider } from '@privy-io/expo';
|
|
21
|
+
* import { AlchemyProvider } from '@account-kit/privy-integration/react-native';
|
|
22
|
+
*
|
|
23
|
+
* <PrivyProvider appId="..." clientId="...">
|
|
24
|
+
* <AlchemyProvider
|
|
25
|
+
* apiKey="your-alchemy-api-key"
|
|
26
|
+
* policyId="your-gas-policy-id"
|
|
27
|
+
* >
|
|
28
|
+
* <YourApp />
|
|
29
|
+
* </AlchemyProvider>
|
|
30
|
+
* </PrivyProvider>
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare function AlchemyProvider({ children, ...config }: PropsWithChildren<AlchemyProviderConfig>): import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
//# sourceMappingURL=ReactNativeProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReactNativeProvider.d.ts","sourceRoot":"","sources":["../../../src/providers/ReactNativeProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAG/C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAEzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,EACR,GAAG,MAAM,EACV,EAAE,iBAAiB,CAAC,qBAAqB,CAAC,2CAM1C"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { PropsWithChildren } from "react";
|
|
2
|
+
import type { AlchemyProviderConfig } from "../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Provider component for React web applications
|
|
5
|
+
* Must be nested INSIDE PrivyProvider from @privy-io/react-auth
|
|
6
|
+
*
|
|
7
|
+
* @param {PropsWithChildren<AlchemyProviderConfig>} props - Component props
|
|
8
|
+
* @param {React.ReactNode} props.children - React children to wrap with Alchemy configuration
|
|
9
|
+
* @param {string} [props.apiKey] - Your Alchemy API key
|
|
10
|
+
* @param {string} [props.jwt] - JWT token for authentication
|
|
11
|
+
* @param {string} [props.rpcUrl] - Custom RPC URL for EVM chains
|
|
12
|
+
* @param {string} [props.solanaRpcUrl] - Custom RPC URL for Solana
|
|
13
|
+
* @param {string | string[]} [props.policyId] - Gas Manager policy ID(s) for EVM chains
|
|
14
|
+
* @param {string | string[]} [props.solanaPolicyId] - Gas Manager policy ID(s) for Solana
|
|
15
|
+
* @param {boolean} [props.disableSponsorship] - Set to true to disable sponsorship by default (default: false)
|
|
16
|
+
* @returns {JSX.Element} Provider component
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* import { PrivyProvider } from '@privy-io/react-auth';
|
|
21
|
+
* import { AlchemyProvider } from '@account-kit/privy-integration';
|
|
22
|
+
*
|
|
23
|
+
* <PrivyProvider appId="...">
|
|
24
|
+
* <AlchemyProvider
|
|
25
|
+
* apiKey="your-alchemy-api-key"
|
|
26
|
+
* policyId="your-gas-policy-id"
|
|
27
|
+
* >
|
|
28
|
+
* <YourApp />
|
|
29
|
+
* </AlchemyProvider>
|
|
30
|
+
* </PrivyProvider>
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare function AlchemyProvider({ children, ...config }: PropsWithChildren<AlchemyProviderConfig>): import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
//# sourceMappingURL=WebProvider.d.ts.map
|