@account-kit/privy-integration 4.75.4 → 4.75.5-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 -71
- package/dist/esm/Provider.js +4 -109
- package/dist/esm/Provider.js.map +1 -1
- package/dist/esm/Provider.native.d.ts +6 -0
- package/dist/esm/Provider.native.js +13 -0
- package/dist/esm/Provider.native.js.map +1 -0
- package/dist/esm/adapters/react-native.d.ts +6 -0
- package/dist/esm/adapters/react-native.js +132 -0
- package/dist/esm/adapters/react-native.js.map +1 -0
- package/dist/esm/adapters/types.d.ts +56 -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 +70 -0
- package/dist/esm/adapters/web.js.map +1 -0
- package/dist/esm/adapters/web.native.d.ts +5 -0
- package/dist/esm/adapters/web.native.js +6 -0
- package/dist/esm/adapters/web.native.js.map +1 -0
- package/dist/esm/context/AlchemyContext.d.ts +71 -0
- package/dist/esm/context/AlchemyContext.js +115 -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 +6 -13
- package/dist/esm/hooks/internal/useEmbeddedWallet.js.map +1 -1
- package/dist/esm/hooks/useAlchemyClient.js +17 -24
- package/dist/esm/hooks/useAlchemyClient.js.map +1 -1
- package/dist/esm/hooks/useAlchemySendTransaction.js +1 -1
- package/dist/esm/hooks/useAlchemySendTransaction.js.map +1 -1
- package/dist/esm/hooks/useAlchemySolanaTransaction.js +1 -1
- package/dist/esm/hooks/useAlchemySolanaTransaction.js.map +1 -1
- package/dist/esm/providers/ReactNativeProvider.d.ts +37 -0
- package/dist/esm/providers/ReactNativeProvider.js +41 -0
- package/dist/esm/providers/ReactNativeProvider.js.map +1 -0
- package/dist/esm/providers/WebProvider.d.ts +37 -0
- package/dist/esm/providers/WebProvider.js +41 -0
- package/dist/esm/providers/WebProvider.js.map +1 -0
- package/dist/esm/providers/WebProvider.native.d.ts +5 -0
- package/dist/esm/providers/WebProvider.native.js +9 -0
- package/dist/esm/providers/WebProvider.native.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/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 +4 -71
- package/dist/types/Provider.d.ts.map +1 -1
- package/dist/types/Provider.native.d.ts +7 -0
- package/dist/types/Provider.native.d.ts.map +1 -0
- 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 +57 -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/adapters/web.native.d.ts +6 -0
- package/dist/types/adapters/web.native.d.ts.map +1 -0
- package/dist/types/context/AlchemyContext.d.ts +72 -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 +38 -0
- package/dist/types/providers/ReactNativeProvider.d.ts.map +1 -0
- package/dist/types/providers/WebProvider.d.ts +38 -0
- package/dist/types/providers/WebProvider.d.ts.map +1 -0
- package/dist/types/providers/WebProvider.native.d.ts +6 -0
- package/dist/types/providers/WebProvider.native.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/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 +27 -4
- package/src/Provider.native.tsx +18 -0
- package/src/Provider.tsx +6 -0
- package/src/adapters/react-native.ts +202 -0
- package/src/adapters/types.ts +71 -0
- package/src/adapters/web.native.ts +6 -0
- package/src/adapters/web.ts +107 -0
- package/src/context/AlchemyContext.tsx +185 -0
- package/src/hooks/internal/useEmbeddedWallet.ts +6 -20
- package/src/hooks/useAlchemyClient.ts +24 -38
- package/src/hooks/useAlchemySendTransaction.ts +1 -1
- package/src/hooks/useAlchemySolanaTransaction.ts +1 -1
- package/src/providers/ReactNativeProvider.tsx +49 -0
- package/src/providers/WebProvider.native.tsx +11 -0
- package/src/providers/WebProvider.tsx +49 -0
- package/src/react-native.ts +29 -0
- package/src/types.ts +7 -0
- package/src/version.ts +1 -1
|
@@ -0,0 +1,41 @@
|
|
|
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
|
+
* @param {'eip7702' | 'owner'} [props.accountAuthMode] - Authorization mode for EVM smart accounts (default: 'eip7702')
|
|
18
|
+
* @param {string} [props.walletAddress] - Optional: Specify which wallet address to use (defaults to first wallet in array)
|
|
19
|
+
* @returns {JSX.Element} Provider component
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* import { PrivyProvider } from '@privy-io/expo';
|
|
24
|
+
* import { AlchemyProvider } from '@account-kit/privy-integration/react-native';
|
|
25
|
+
*
|
|
26
|
+
* <PrivyProvider appId="..." clientId="...">
|
|
27
|
+
* <AlchemyProvider
|
|
28
|
+
* apiKey="your-alchemy-api-key"
|
|
29
|
+
* policyId="your-gas-policy-id"
|
|
30
|
+
* accountAuthMode="eip7702"
|
|
31
|
+
* walletAddress="0x123..." // Optional: specify which wallet to use
|
|
32
|
+
* >
|
|
33
|
+
* <YourApp />
|
|
34
|
+
* </AlchemyProvider>
|
|
35
|
+
* </PrivyProvider>
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export function AlchemyProvider({ children, ...config }) {
|
|
39
|
+
return (_jsx(AlchemyContextProvider, { config: config, adapter: reactNativeAdapter, children: children }));
|
|
40
|
+
}
|
|
41
|
+
//# 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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;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 * @param {'eip7702' | 'owner'} [props.accountAuthMode] - Authorization mode for EVM smart accounts (default: 'eip7702')\n * @param {string} [props.walletAddress] - Optional: Specify which wallet address to use (defaults to first wallet in array)\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 * accountAuthMode=\"eip7702\"\n * walletAddress=\"0x123...\" // Optional: specify which wallet to use\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,37 @@
|
|
|
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
|
+
* @param {'eip7702' | 'owner'} [props.accountAuthMode] - Authorization mode for EVM smart accounts (default: 'eip7702')
|
|
17
|
+
* @param {string} [props.walletAddress] - Optional: Specify which wallet address to use (defaults to first embedded wallet)
|
|
18
|
+
* @returns {JSX.Element} Provider component
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* import { PrivyProvider } from '@privy-io/react-auth';
|
|
23
|
+
* import { AlchemyProvider } from '@account-kit/privy-integration';
|
|
24
|
+
*
|
|
25
|
+
* <PrivyProvider appId="...">
|
|
26
|
+
* <AlchemyProvider
|
|
27
|
+
* apiKey="your-alchemy-api-key"
|
|
28
|
+
* policyId="your-gas-policy-id"
|
|
29
|
+
* accountAuthMode="eip7702"
|
|
30
|
+
* walletAddress="0x123..." // Optional: specify which wallet to use
|
|
31
|
+
* >
|
|
32
|
+
* <YourApp />
|
|
33
|
+
* </AlchemyProvider>
|
|
34
|
+
* </PrivyProvider>
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare function AlchemyProvider({ children, ...config }: PropsWithChildren<AlchemyProviderConfig>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,41 @@
|
|
|
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
|
+
* @param {'eip7702' | 'owner'} [props.accountAuthMode] - Authorization mode for EVM smart accounts (default: 'eip7702')
|
|
18
|
+
* @param {string} [props.walletAddress] - Optional: Specify which wallet address to use (defaults to first embedded wallet)
|
|
19
|
+
* @returns {JSX.Element} Provider component
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* import { PrivyProvider } from '@privy-io/react-auth';
|
|
24
|
+
* import { AlchemyProvider } from '@account-kit/privy-integration';
|
|
25
|
+
*
|
|
26
|
+
* <PrivyProvider appId="...">
|
|
27
|
+
* <AlchemyProvider
|
|
28
|
+
* apiKey="your-alchemy-api-key"
|
|
29
|
+
* policyId="your-gas-policy-id"
|
|
30
|
+
* accountAuthMode="eip7702"
|
|
31
|
+
* walletAddress="0x123..." // Optional: specify which wallet to use
|
|
32
|
+
* >
|
|
33
|
+
* <YourApp />
|
|
34
|
+
* </AlchemyProvider>
|
|
35
|
+
* </PrivyProvider>
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export function AlchemyProvider({ children, ...config }) {
|
|
39
|
+
return (_jsx(AlchemyContextProvider, { config: config, adapter: webAdapter, children: children }));
|
|
40
|
+
}
|
|
41
|
+
//# 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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;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 * @param {'eip7702' | 'owner'} [props.accountAuthMode] - Authorization mode for EVM smart accounts (default: 'eip7702')\n * @param {string} [props.walletAddress] - Optional: Specify which wallet address to use (defaults to first embedded wallet)\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 * accountAuthMode=\"eip7702\"\n * walletAddress=\"0x123...\" // Optional: specify which wallet to use\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,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* React Native stub for WebProvider
|
|
3
|
+
* This file prevents Metro from importing web-specific code
|
|
4
|
+
*/
|
|
5
|
+
export function AlchemyProvider() {
|
|
6
|
+
throw new Error("This module requires @privy-io/react-auth which is not available in React Native. " +
|
|
7
|
+
'Import from "@account-kit/privy-integration/react-native" instead.');
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=WebProvider.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebProvider.native.js","sourceRoot":"","sources":["../../../src/providers/WebProvider.native.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,UAAU,eAAe;IAC7B,MAAM,IAAI,KAAK,CACb,oFAAoF;QAClF,oEAAoE,CACvE,CAAC;AACJ,CAAC","sourcesContent":["/**\n * React Native stub for WebProvider\n * This file prevents Metro from importing web-specific code\n */\n\nexport function AlchemyProvider() {\n throw new Error(\n \"This module requires @privy-io/react-auth which is not available in React Native. \" +\n 'Import from \"@account-kit/privy-integration/react-native\" instead.',\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/types.d.ts
CHANGED
|
@@ -24,6 +24,12 @@ export type AlchemyProviderConfig = z.infer<typeof ConnectionConfigSchema> & {
|
|
|
24
24
|
* Default: false (sponsorship enabled when policyId is provided)
|
|
25
25
|
*/
|
|
26
26
|
disableSponsorship?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Optional: Specify which wallet address to use
|
|
29
|
+
* - If provided, will use the wallet matching this address
|
|
30
|
+
* - If not provided, defaults to the first embedded wallet (web) or first wallet in array (React Native)
|
|
31
|
+
*/
|
|
32
|
+
walletAddress?: string;
|
|
27
33
|
};
|
|
28
34
|
/**
|
|
29
35
|
* Unsigned transaction request
|
package/dist/esm/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC","sourcesContent":["import type { Address, Hash, Hex } from \"viem\";\nimport type { swapActions } from \"@account-kit/wallet-client/experimental\";\nimport { ConnectionConfigSchema } from \"@aa-sdk/core\";\nimport type { z } from \"zod\";\n\n/**\n * Configuration for the Alchemy provider\n * Uses ConnectionConfigSchema to ensure valid transport configuration\n */\nexport type AlchemyProviderConfig = z.infer<typeof ConnectionConfigSchema> & {\n /** Policy ID(s) for EVM gas sponsorship */\n policyId?: string | string[];\n\n /** Policy ID(s) for Solana gas sponsorship */\n solanaPolicyId?: string | string[];\n\n /** Solana RPC URL (separate from EVM rpcUrl) */\n solanaRpcUrl?: string;\n\n /**\n * How EVM smart account calls should be authorized.\n * - 'eip7702' (default): delegated authorization via EIP-7702.\n * - 'owner': sign as the account owner (Privy embedded wallet), no 7702.\n */\n accountAuthMode?: \"eip7702\" | \"owner\";\n\n /**\n * Set to true to disable gas sponsorship by default\n * Default: false (sponsorship enabled when policyId is provided)\n */\n disableSponsorship?: boolean;\n};\n\n/**\n * Unsigned transaction request\n */\nexport interface UnsignedTransactionRequest {\n /** Recipient address */\n to: Address;\n\n /** Transaction data (calldata) */\n data?: Hex;\n\n /** Transaction value - accepts string | number | bigint */\n value?: string | number | bigint;\n}\n\n/**\n * Options for sending a transaction\n */\nexport interface SendTransactionOptions {\n /**\n * Set to true to disable sponsorship for this specific transaction\n * Default: false (follows provider's disableSponsorship setting)\n */\n disableSponsorship?: boolean;\n}\n\n/**\n * Result of a successful transaction\n */\nexport interface SendTransactionResult {\n /** EVM transaction hash (first receipt hash) */\n txnHash: Hash;\n}\n\n/**\n * Hook result for sending transactions\n */\nexport interface UseSendTransactionResult {\n /** Whether the transaction is currently being sent */\n isLoading: boolean;\n\n /** Error if transaction failed */\n error: Error | null;\n\n /** Transaction result if successful */\n data: SendTransactionResult | null;\n\n /** Reset the hook state */\n reset(): void;\n\n /** Send a single transaction or batch of transactions */\n sendTransaction(\n input: UnsignedTransactionRequest | UnsignedTransactionRequest[],\n options?: SendTransactionOptions,\n ): Promise<SendTransactionResult>;\n}\n\n/**\n * Request parameters for preparing a swap\n * Derived directly from the SDK to ensure type safety\n *\n * Note: Provide either `fromAmount` OR `minimumToAmount`, not both.\n * - Use `fromAmount` to specify exact amount to swap FROM\n * - Use `minimumToAmount` to specify minimum amount to receive TO\n */\nexport type PrepareSwapRequest = Parameters<\n ReturnType<typeof swapActions>[\"requestQuoteV0\"]\n>[0];\n\n/**\n * Response from requestQuoteV0\n * Derived directly from the SDK to ensure type safety\n */\nexport type RequestQuoteV0Result = Awaited<\n ReturnType<ReturnType<typeof swapActions>[\"requestQuoteV0\"]>\n>;\n\n/**\n * Swap quote information extracted from prepared swap calls\n * Derived directly from the SDK response\n */\nexport type SwapQuote = NonNullable<RequestQuoteV0Result[\"quote\"]>;\n\n/**\n * Result of preparing a swap (full response from requestQuoteV0)\n * Contains quote and prepared calls ready for signing\n */\nexport type PrepareSwapResult = Extract<\n RequestQuoteV0Result,\n { rawCalls?: false | undefined }\n>;\n\n/**\n * Hook result for preparing swaps\n */\nexport interface UsePrepareSwapResult {\n /** Whether the swap is being prepared */\n isLoading: boolean;\n\n /** Error if preparation failed */\n error: Error | null;\n\n /** Prepared swap data if successful */\n data: PrepareSwapResult | null;\n\n /** Reset the hook state */\n reset(): void;\n\n /** Request a swap quote and prepare calls */\n prepareSwap(request: PrepareSwapRequest): Promise<PrepareSwapResult>;\n}\n\n/**\n * Result of submitting a swap\n * Simplified wrapper that extracts the transaction hash\n */\nexport interface SubmitSwapResult {\n /** Transaction hash of the swap */\n txnHash: Hash;\n}\n\n/**\n * Hook result for submitting swaps\n */\nexport interface UseSubmitSwapResult {\n /** Whether the swap is being submitted */\n isLoading: boolean;\n\n /** Error if submission failed */\n error: Error | null;\n\n /** Swap submission result if successful */\n data: SubmitSwapResult | null;\n\n /** Reset the hook state */\n reset(): void;\n\n /** Sign and submit prepared swap calls */\n submitSwap(preparedSwap: PrepareSwapResult): Promise<SubmitSwapResult>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC","sourcesContent":["import type { Address, Hash, Hex } from \"viem\";\nimport type { swapActions } from \"@account-kit/wallet-client/experimental\";\nimport { ConnectionConfigSchema } from \"@aa-sdk/core\";\nimport type { z } from \"zod\";\n\n/**\n * Configuration for the Alchemy provider\n * Uses ConnectionConfigSchema to ensure valid transport configuration\n */\nexport type AlchemyProviderConfig = z.infer<typeof ConnectionConfigSchema> & {\n /** Policy ID(s) for EVM gas sponsorship */\n policyId?: string | string[];\n\n /** Policy ID(s) for Solana gas sponsorship */\n solanaPolicyId?: string | string[];\n\n /** Solana RPC URL (separate from EVM rpcUrl) */\n solanaRpcUrl?: string;\n\n /**\n * How EVM smart account calls should be authorized.\n * - 'eip7702' (default): delegated authorization via EIP-7702.\n * - 'owner': sign as the account owner (Privy embedded wallet), no 7702.\n */\n accountAuthMode?: \"eip7702\" | \"owner\";\n\n /**\n * Set to true to disable gas sponsorship by default\n * Default: false (sponsorship enabled when policyId is provided)\n */\n disableSponsorship?: boolean;\n\n /**\n * Optional: Specify which wallet address to use\n * - If provided, will use the wallet matching this address\n * - If not provided, defaults to the first embedded wallet (web) or first wallet in array (React Native)\n */\n walletAddress?: string;\n};\n\n/**\n * Unsigned transaction request\n */\nexport interface UnsignedTransactionRequest {\n /** Recipient address */\n to: Address;\n\n /** Transaction data (calldata) */\n data?: Hex;\n\n /** Transaction value - accepts string | number | bigint */\n value?: string | number | bigint;\n}\n\n/**\n * Options for sending a transaction\n */\nexport interface SendTransactionOptions {\n /**\n * Set to true to disable sponsorship for this specific transaction\n * Default: false (follows provider's disableSponsorship setting)\n */\n disableSponsorship?: boolean;\n}\n\n/**\n * Result of a successful transaction\n */\nexport interface SendTransactionResult {\n /** EVM transaction hash (first receipt hash) */\n txnHash: Hash;\n}\n\n/**\n * Hook result for sending transactions\n */\nexport interface UseSendTransactionResult {\n /** Whether the transaction is currently being sent */\n isLoading: boolean;\n\n /** Error if transaction failed */\n error: Error | null;\n\n /** Transaction result if successful */\n data: SendTransactionResult | null;\n\n /** Reset the hook state */\n reset(): void;\n\n /** Send a single transaction or batch of transactions */\n sendTransaction(\n input: UnsignedTransactionRequest | UnsignedTransactionRequest[],\n options?: SendTransactionOptions,\n ): Promise<SendTransactionResult>;\n}\n\n/**\n * Request parameters for preparing a swap\n * Derived directly from the SDK to ensure type safety\n *\n * Note: Provide either `fromAmount` OR `minimumToAmount`, not both.\n * - Use `fromAmount` to specify exact amount to swap FROM\n * - Use `minimumToAmount` to specify minimum amount to receive TO\n */\nexport type PrepareSwapRequest = Parameters<\n ReturnType<typeof swapActions>[\"requestQuoteV0\"]\n>[0];\n\n/**\n * Response from requestQuoteV0\n * Derived directly from the SDK to ensure type safety\n */\nexport type RequestQuoteV0Result = Awaited<\n ReturnType<ReturnType<typeof swapActions>[\"requestQuoteV0\"]>\n>;\n\n/**\n * Swap quote information extracted from prepared swap calls\n * Derived directly from the SDK response\n */\nexport type SwapQuote = NonNullable<RequestQuoteV0Result[\"quote\"]>;\n\n/**\n * Result of preparing a swap (full response from requestQuoteV0)\n * Contains quote and prepared calls ready for signing\n */\nexport type PrepareSwapResult = Extract<\n RequestQuoteV0Result,\n { rawCalls?: false | undefined }\n>;\n\n/**\n * Hook result for preparing swaps\n */\nexport interface UsePrepareSwapResult {\n /** Whether the swap is being prepared */\n isLoading: boolean;\n\n /** Error if preparation failed */\n error: Error | null;\n\n /** Prepared swap data if successful */\n data: PrepareSwapResult | null;\n\n /** Reset the hook state */\n reset(): void;\n\n /** Request a swap quote and prepare calls */\n prepareSwap(request: PrepareSwapRequest): Promise<PrepareSwapResult>;\n}\n\n/**\n * Result of submitting a swap\n * Simplified wrapper that extracts the transaction hash\n */\nexport interface SubmitSwapResult {\n /** Transaction hash of the swap */\n txnHash: Hash;\n}\n\n/**\n * Hook result for submitting swaps\n */\nexport interface UseSubmitSwapResult {\n /** Whether the swap is being submitted */\n isLoading: boolean;\n\n /** Error if submission failed */\n error: Error | null;\n\n /** Swap submission result if successful */\n data: SubmitSwapResult | null;\n\n /** Reset the hook state */\n reset(): void;\n\n /** Sign and submit prepared swap calls */\n submitSwap(preparedSwap: PrepareSwapResult): Promise<SubmitSwapResult>;\n}\n"]}
|
package/dist/esm/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "4.75.
|
|
1
|
+
export declare const VERSION = "4.75.5-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.75.5-alpha.0\";\n"]}
|
package/dist/types/Provider.d.ts
CHANGED
|
@@ -1,74 +1,7 @@
|
|
|
1
|
-
import { type PropsWithChildren } from "react";
|
|
2
|
-
import type { SmartWalletClient } from "@account-kit/wallet-client";
|
|
3
|
-
import type { SmartContractAccount } from "@aa-sdk/core";
|
|
4
|
-
import type { AlchemyProviderConfig } from "./types.js";
|
|
5
1
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* @internal
|
|
2
|
+
* Web-specific exports
|
|
3
|
+
* Re-exports the web provider and hooks for React applications
|
|
9
4
|
*/
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
* Client cache stored in React tree (similar to QueryClient in React Query)
|
|
13
|
-
*
|
|
14
|
-
* @internal
|
|
15
|
-
*/
|
|
16
|
-
interface ClientCache {
|
|
17
|
-
client: SmartWalletClient | null;
|
|
18
|
-
account: SmartContractAccount | null;
|
|
19
|
-
cacheKey: string | null;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Provider component that configures Alchemy infrastructure for transaction handling
|
|
23
|
-
* Must be nested INSIDE PrivyProvider to access authentication state
|
|
24
|
-
* Automatically manages client cache lifecycle and resets on logout
|
|
25
|
-
*
|
|
26
|
-
* @param {PropsWithChildren<AlchemyProviderConfig>} props - Component props
|
|
27
|
-
* @param {React.ReactNode} props.children - React children to wrap with Alchemy configuration
|
|
28
|
-
* @param {string} [props.apiKey] - Your Alchemy API key
|
|
29
|
-
* @param {string} [props.jwt] - JWT token for authentication
|
|
30
|
-
* @param {string} [props.rpcUrl] - Custom RPC URL for EVM chains
|
|
31
|
-
* @param {string} [props.solanaRpcUrl] - Custom RPC URL for Solana
|
|
32
|
-
* @param {string | string[]} [props.policyId] - Gas Manager policy ID(s) for EVM chains
|
|
33
|
-
* @param {string | string[]} [props.solanaPolicyId] - Gas Manager policy ID(s) for Solana
|
|
34
|
-
* @param {boolean} [props.disableSponsorship] - Set to true to disable sponsorship by default (default: false)
|
|
35
|
-
* @param {'eip7702' | 'owner'} [props.accountAuthMode] - Authorization mode for EVM smart accounts (default: 'eip7702')
|
|
36
|
-
* @returns {JSX.Element} Provider component
|
|
37
|
-
*
|
|
38
|
-
* @example
|
|
39
|
-
* ```tsx
|
|
40
|
-
* <PrivyProvider appId="...">
|
|
41
|
-
* <AlchemyProvider
|
|
42
|
-
* apiKey="your-alchemy-api-key"
|
|
43
|
-
* policyId="your-gas-policy-id"
|
|
44
|
-
* >
|
|
45
|
-
* <YourApp />
|
|
46
|
-
* </AlchemyProvider>
|
|
47
|
-
* </PrivyProvider>
|
|
48
|
-
* ```
|
|
49
|
-
*/
|
|
50
|
-
export declare function AlchemyProvider({ children, accountAuthMode, ...config }: PropsWithChildren<AlchemyProviderConfig>): import("react/jsx-runtime").JSX.Element;
|
|
51
|
-
/**
|
|
52
|
-
* Hook to access Alchemy provider configuration
|
|
53
|
-
* Must be used within an <AlchemyProvider> component
|
|
54
|
-
*
|
|
55
|
-
* @returns {NormalizedAlchemyConfig} The current Alchemy configuration with defaults applied
|
|
56
|
-
* @throws {Error} If used outside of AlchemyProvider
|
|
57
|
-
*
|
|
58
|
-
* @example
|
|
59
|
-
* ```tsx
|
|
60
|
-
* const config = useAlchemyConfig();
|
|
61
|
-
* console.log('Policy ID:', config.policyId);
|
|
62
|
-
* console.log('Auth Mode:', config.accountAuthMode); // Always defined
|
|
63
|
-
* ```
|
|
64
|
-
*/
|
|
65
|
-
export declare function useAlchemyConfig(): NormalizedAlchemyConfig;
|
|
66
|
-
/**
|
|
67
|
-
* Hook to access the client cache (internal use only)
|
|
68
|
-
*
|
|
69
|
-
* @internal
|
|
70
|
-
* @returns {ClientCache} The client cache object
|
|
71
|
-
*/
|
|
72
|
-
export declare function useClientCache(): ClientCache;
|
|
73
|
-
export {};
|
|
5
|
+
export { AlchemyProvider } from "./providers/WebProvider.js";
|
|
6
|
+
export { useAlchemyConfig } from "./context/AlchemyContext.js";
|
|
74
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 @@
|
|
|
1
|
+
{"version":3,"file":"Provider.native.d.ts","sourceRoot":"","sources":["../../src/Provider.native.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,wBAAgB,eAAe,SAK9B;AAED,wBAAgB,gBAAgB,SAK/B"}
|
|
@@ -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":"AAUA,OAAO,KAAK,EAAE,YAAY,EAAkC,MAAM,YAAY,CAAC;AAY/E;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,YAoIhC,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
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 as a string (may be CAIP-2 format like "eip155:1" or numeric string like "1") */
|
|
11
|
+
chainId: string;
|
|
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
|
+
* @param preferredAddress - Optional address to find a specific wallet
|
|
34
|
+
*/
|
|
35
|
+
useEmbeddedWallet(preferredAddress?: string): () => EmbeddedWallet;
|
|
36
|
+
/**
|
|
37
|
+
* Hook to get Privy authentication state
|
|
38
|
+
* Must be called as a React hook (follows rules of hooks)
|
|
39
|
+
*/
|
|
40
|
+
usePrivyAuth(): PrivyAuthState;
|
|
41
|
+
/**
|
|
42
|
+
* Hook to get current wallet address (for cache invalidation)
|
|
43
|
+
* Returns undefined if no wallet is available
|
|
44
|
+
* Must be called as a React hook (follows rules of hooks)
|
|
45
|
+
*
|
|
46
|
+
* @param preferredAddress - Optional address to find a specific wallet
|
|
47
|
+
*/
|
|
48
|
+
useWalletAddress(preferredAddress?: string): string | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Hook to get EIP-7702 authorization signer (optional, web only)
|
|
51
|
+
* Must be called as a React hook (follows rules of hooks)
|
|
52
|
+
*
|
|
53
|
+
* @param preferredAddress - Optional address to find a specific wallet
|
|
54
|
+
*/
|
|
55
|
+
useAuthorizationSigner?(preferredAddress?: string): ((auth: AuthorizationRequest<number>) => Promise<Authorization<number, true>>) | null;
|
|
56
|
+
}
|
|
57
|
+
//# 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,6FAA6F;IAC7F,OAAO,EAAE,MAAM,CAAC;IAEhB,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;;;;;OAKG;IACH,iBAAiB,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,cAAc,CAAC;IAEnE;;;OAGG;IACH,YAAY,IAAI,cAAc,CAAC;IAE/B;;;;;;OAMG;IACH,gBAAgB,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IAEhE;;;;;OAKG;IACH,sBAAsB,CAAC,CACrB,gBAAgB,CAAC,EAAE,MAAM,GAEvB,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,YA6ExB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web.native.d.ts","sourceRoot":"","sources":["../../../src/adapters/web.native.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,eAAO,MAAM,UAAU,MAAO,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { type PropsWithChildren } from "react";
|
|
2
|
+
import type { SmartWalletClient } from "@account-kit/wallet-client";
|
|
3
|
+
import type { SmartContractAccount } from "@aa-sdk/core";
|
|
4
|
+
import type { AlchemyProviderConfig } from "../types.js";
|
|
5
|
+
import type { PrivyAdapter } from "../adapters/types.js";
|
|
6
|
+
/**
|
|
7
|
+
* Normalized config with defaults applied
|
|
8
|
+
*
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export type NormalizedAlchemyConfig = AlchemyProviderConfig & Required<Pick<AlchemyProviderConfig, "accountAuthMode">>;
|
|
12
|
+
/**
|
|
13
|
+
* Client cache stored in React tree (similar to QueryClient in React Query)
|
|
14
|
+
*
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
interface ClientCache {
|
|
18
|
+
client: SmartWalletClient | null;
|
|
19
|
+
account: SmartContractAccount | null;
|
|
20
|
+
cacheKey: string | null;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Props for AlchemyContextProvider
|
|
24
|
+
*/
|
|
25
|
+
interface AlchemyContextProviderProps extends PropsWithChildren {
|
|
26
|
+
config: AlchemyProviderConfig;
|
|
27
|
+
adapter: PrivyAdapter;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Internal provider component that manages Alchemy context
|
|
31
|
+
* Used by both web and React Native providers
|
|
32
|
+
*
|
|
33
|
+
* @internal
|
|
34
|
+
* @param {AlchemyContextProviderProps} props - Component props
|
|
35
|
+
* @param {React.ReactNode} props.children - React children to wrap with context
|
|
36
|
+
* @param {AlchemyProviderConfig} props.config - Alchemy configuration
|
|
37
|
+
* @param {PrivyAdapter} props.adapter - Platform adapter
|
|
38
|
+
* @returns {JSX.Element} Context provider component
|
|
39
|
+
*/
|
|
40
|
+
export declare function AlchemyContextProvider({ children, config, adapter, }: AlchemyContextProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
41
|
+
/**
|
|
42
|
+
* Hook to access Alchemy provider configuration
|
|
43
|
+
* Must be used within an <AlchemyProvider> component
|
|
44
|
+
*
|
|
45
|
+
* @returns {NormalizedAlchemyConfig} The current Alchemy configuration with defaults applied
|
|
46
|
+
* @throws {Error} If used outside of AlchemyProvider
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```tsx
|
|
50
|
+
* const config = useAlchemyConfig();
|
|
51
|
+
* console.log('Policy ID:', config.policyId);
|
|
52
|
+
* console.log('Auth Mode:', config.accountAuthMode); // Always defined
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export declare function useAlchemyConfig(): NormalizedAlchemyConfig;
|
|
56
|
+
/**
|
|
57
|
+
* Hook to access the platform adapter
|
|
58
|
+
* Must be used within an <AlchemyProvider> component
|
|
59
|
+
*
|
|
60
|
+
* @internal
|
|
61
|
+
* @returns {PrivyAdapter} The platform adapter
|
|
62
|
+
*/
|
|
63
|
+
export declare function useAdapter(): PrivyAdapter;
|
|
64
|
+
/**
|
|
65
|
+
* Hook to access the client cache (internal use only)
|
|
66
|
+
*
|
|
67
|
+
* @internal
|
|
68
|
+
* @returns {ClientCache} The client cache object
|
|
69
|
+
*/
|
|
70
|
+
export declare function useClientCache(): ClientCache;
|
|
71
|
+
export {};
|
|
72
|
+
//# 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,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD;;;;GAIG;AACH,MAAM,MAAM,uBAAuB,GAAG,qBAAqB,GACzD,QAAQ,CAAC,IAAI,CAAC,qBAAqB,EAAE,iBAAiB,CAAC,CAAC,CAAC;AAc3D;;;;GAIG;AACH,UAAU,WAAW;IACnB,MAAM,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACjC,OAAO,EAAE,oBAAoB,GAAG,IAAI,CAAC;IACrC,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,2CA6D7B;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,IAAI,uBAAuB,CAM1D;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,2DAIhC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAlchemyClient.d.ts","sourceRoot":"","sources":["../../../src/hooks/useAlchemyClient.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"useAlchemyClient.d.ts","sourceRoot":"","sources":["../../../src/hooks/useAlchemyClient.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,oBAAoB,EAC1B,MAAM,cAAc,CAAC;AAEtB,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,4BAA4B,CAAC;AAUpC,MAAM,MAAM,mBAAmB,GAAG;IAChC,MAAM,EAAE,iBAAiB,CAAC;IAC1B,OAAO,EAAE,oBAAoB,CAAC;CAC/B,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB;qBAQU,OAAO,CAAC,mBAAmB,CAAC;EAuHrE"}
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
* @param {'eip7702' | 'owner'} [props.accountAuthMode] - Authorization mode for EVM smart accounts (default: 'eip7702')
|
|
17
|
+
* @param {string} [props.walletAddress] - Optional: Specify which wallet address to use (defaults to first wallet in array)
|
|
18
|
+
* @returns {JSX.Element} Provider component
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* import { PrivyProvider } from '@privy-io/expo';
|
|
23
|
+
* import { AlchemyProvider } from '@account-kit/privy-integration/react-native';
|
|
24
|
+
*
|
|
25
|
+
* <PrivyProvider appId="..." clientId="...">
|
|
26
|
+
* <AlchemyProvider
|
|
27
|
+
* apiKey="your-alchemy-api-key"
|
|
28
|
+
* policyId="your-gas-policy-id"
|
|
29
|
+
* accountAuthMode="eip7702"
|
|
30
|
+
* walletAddress="0x123..." // Optional: specify which wallet to use
|
|
31
|
+
* >
|
|
32
|
+
* <YourApp />
|
|
33
|
+
* </AlchemyProvider>
|
|
34
|
+
* </PrivyProvider>
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare function AlchemyProvider({ children, ...config }: PropsWithChildren<AlchemyProviderConfig>): import("react/jsx-runtime").JSX.Element;
|
|
38
|
+
//# 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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,EACR,GAAG,MAAM,EACV,EAAE,iBAAiB,CAAC,qBAAqB,CAAC,2CAM1C"}
|