@getpara/react-sdk-lite 2.20.0 → 2.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/aa/hooks/alchemy.d.ts +5 -2
  2. package/dist/aa/hooks/biconomy.d.ts +5 -2
  3. package/dist/aa/hooks/cdp.d.ts +5 -2
  4. package/dist/aa/hooks/gelato.d.ts +5 -2
  5. package/dist/aa/hooks/pimlico.d.ts +5 -2
  6. package/dist/aa/hooks/porto.d.ts +5 -2
  7. package/dist/aa/hooks/rhinestone.d.ts +5 -2
  8. package/dist/aa/hooks/safe.d.ts +5 -2
  9. package/dist/aa/hooks/thirdweb.d.ts +6 -1
  10. package/dist/aa/hooks/zerodev.d.ts +5 -2
  11. package/dist/chains/cosmos.d.ts +62 -0
  12. package/dist/chains/cosmos.js +10 -0
  13. package/dist/chains/evm.d.ts +74 -0
  14. package/dist/chains/evm.js +14 -0
  15. package/dist/chains/solana.d.ts +33 -0
  16. package/dist/chains/solana.js +8 -0
  17. package/dist/chains/stellar.d.ts +2 -0
  18. package/dist/chains/stellar.js +14 -0
  19. package/dist/chains/useGrazEnhancer.d.ts +7 -0
  20. package/dist/chains/useGrazEnhancer.js +28 -0
  21. package/dist/chains/useSolanaWalletEnhancer.d.ts +7 -0
  22. package/dist/chains/useSolanaWalletEnhancer.js +53 -0
  23. package/dist/chains/useWagmiEthersEnhancer.d.ts +7 -0
  24. package/dist/chains/useWagmiEthersEnhancer.js +67 -0
  25. package/dist/chains/useWagmiViemEnhancer.d.ts +7 -0
  26. package/dist/chains/useWagmiViemEnhancer.js +56 -0
  27. package/dist/modal/ParaModal.js +1 -1
  28. package/dist/modal/components/shared/ConnectExternalWallet/ConnectExternalWallet.js +27 -22
  29. package/dist/provider/ParaProviderMin.js +119 -112
  30. package/dist/provider/hooks/mutations/useAddAuthMethod.d.ts +1 -1
  31. package/dist/provider/hooks/mutations/useExportPrivateKey.d.ts +1 -1
  32. package/dist/provider/hooks/mutations/useSwitchWallets.d.ts +1 -1
  33. package/dist/provider/hooks/mutations/useVerifyNewAccount.d.ts +1 -1
  34. package/dist/provider/providers/ExternalWalletProvider.d.ts +1 -0
  35. package/dist/provider/providers/ExternalWalletProvider.js +21 -2
  36. package/dist/provider/types/provider.d.ts +8 -53
  37. package/package.json +52 -20
@@ -1,4 +1,7 @@
1
1
  import { ALCHEMY_SMART_ACCOUNT_BASE_KEY } from '@getpara/react-core/internal';
2
+ import type { UseSmartAccountResult } from '@getpara/react-core/internal';
3
+ import type { SmartAccount } from '@getpara/viem-v2-integration/aa';
4
+ import type { UseAlchemySmartAccountParams } from '@getpara/aa-alchemy';
2
5
  export { ALCHEMY_SMART_ACCOUNT_BASE_KEY };
3
6
  /**
4
7
  * React / React Native hook to create and manage an Alchemy smart account.
@@ -10,6 +13,6 @@ export { ALCHEMY_SMART_ACCOUNT_BASE_KEY };
10
13
  * On web, automatically detects connected external wallets (MetaMask, etc.) via wagmi
11
14
  * and uses them as the signer when no Para embedded wallet is active.
12
15
  */
13
- export declare const useAlchemySmartAccount: (params?: import("@getpara/aa-alchemy").AlchemySmartAccountConfig & {
16
+ export declare const useAlchemySmartAccount: (params?: UseAlchemySmartAccountParams & {
14
17
  enabled?: boolean;
15
- }) => import("@getpara/react-core/internal").UseSmartAccountResult<import("@getpara/aa-alchemy").SmartAccount>;
18
+ }) => UseSmartAccountResult<SmartAccount>;
@@ -1,4 +1,7 @@
1
1
  import { BICONOMY_SMART_ACCOUNT_BASE_KEY } from '@getpara/react-core/internal';
2
+ import type { UseSmartAccountResult } from '@getpara/react-core/internal';
3
+ import type { SmartAccount } from '@getpara/viem-v2-integration/aa';
4
+ import type { UseBiconomySmartAccountParams } from '@getpara/aa-biconomy';
2
5
  export { BICONOMY_SMART_ACCOUNT_BASE_KEY };
3
6
  /**
4
7
  * React / React Native hook to create and manage a Biconomy smart account.
@@ -10,6 +13,6 @@ export { BICONOMY_SMART_ACCOUNT_BASE_KEY };
10
13
  * On web, automatically detects connected external wallets (MetaMask, etc.) via wagmi
11
14
  * and uses them as the signer when no Para embedded wallet is active.
12
15
  */
13
- export declare const useBiconomySmartAccount: (params?: import("@getpara/aa-biconomy").BiconomySmartAccountConfig & {
16
+ export declare const useBiconomySmartAccount: (params?: UseBiconomySmartAccountParams & {
14
17
  enabled?: boolean;
15
- }) => import("@getpara/react-core/internal").UseSmartAccountResult<import("@getpara/aa-alchemy").SmartAccount>;
18
+ }) => UseSmartAccountResult<SmartAccount>;
@@ -1,4 +1,7 @@
1
1
  import { CDP_SMART_ACCOUNT_BASE_KEY } from '@getpara/react-core/internal';
2
+ import type { UseSmartAccountResult } from '@getpara/react-core/internal';
3
+ import type { SmartAccount } from '@getpara/viem-v2-integration/aa';
4
+ import type { UseCDPSmartAccountParams } from '@getpara/aa-cdp';
2
5
  export { CDP_SMART_ACCOUNT_BASE_KEY };
3
6
  /**
4
7
  * React / React Native hook to create and manage a Coinbase Developer Platform smart account.
@@ -9,6 +12,6 @@ export { CDP_SMART_ACCOUNT_BASE_KEY };
9
12
  * On web, automatically detects connected external wallets (MetaMask, etc.) via wagmi
10
13
  * and uses them as the signer when no Para embedded wallet is active.
11
14
  */
12
- export declare const useCDPSmartAccount: (params?: import("@getpara/aa-cdp").CDPSmartAccountConfig & {
15
+ export declare const useCDPSmartAccount: (params?: UseCDPSmartAccountParams & {
13
16
  enabled?: boolean;
14
- }) => import("@getpara/react-core/internal").UseSmartAccountResult<import("@getpara/aa-alchemy").SmartAccount>;
17
+ }) => UseSmartAccountResult<SmartAccount>;
@@ -1,4 +1,7 @@
1
1
  import { GELATO_SMART_ACCOUNT_BASE_KEY } from '@getpara/react-core/internal';
2
+ import type { UseSmartAccountResult } from '@getpara/react-core/internal';
3
+ import type { SmartAccount } from '@getpara/viem-v2-integration/aa';
4
+ import type { UseGelatoSmartAccountParams } from '@getpara/aa-gelato';
2
5
  export { GELATO_SMART_ACCOUNT_BASE_KEY };
3
6
  /**
4
7
  * React / React Native hook to create and manage a Gelato smart account.
@@ -9,6 +12,6 @@ export { GELATO_SMART_ACCOUNT_BASE_KEY };
9
12
  * On web, automatically detects connected external wallets (MetaMask, etc.) via wagmi
10
13
  * and uses them as the signer when no Para embedded wallet is active.
11
14
  */
12
- export declare const useGelatoSmartAccount: (params?: import("@getpara/aa-gelato").GelatoSmartAccountConfig & {
15
+ export declare const useGelatoSmartAccount: (params?: UseGelatoSmartAccountParams & {
13
16
  enabled?: boolean;
14
- }) => import("@getpara/react-core/internal").UseSmartAccountResult<import("@getpara/aa-alchemy").SmartAccount>;
17
+ }) => UseSmartAccountResult<SmartAccount>;
@@ -1,4 +1,7 @@
1
1
  import { PIMLICO_SMART_ACCOUNT_BASE_KEY } from '@getpara/react-core/internal';
2
+ import type { UseSmartAccountResult } from '@getpara/react-core/internal';
3
+ import type { SmartAccount } from '@getpara/viem-v2-integration/aa';
4
+ import type { UsePimlicoSmartAccountParams } from '@getpara/aa-pimlico';
2
5
  export { PIMLICO_SMART_ACCOUNT_BASE_KEY };
3
6
  /**
4
7
  * React / React Native hook to create and manage a Pimlico smart account.
@@ -10,6 +13,6 @@ export { PIMLICO_SMART_ACCOUNT_BASE_KEY };
10
13
  * On web, automatically detects connected external wallets (MetaMask, etc.) via wagmi
11
14
  * and uses them as the signer when no Para embedded wallet is active.
12
15
  */
13
- export declare const usePimlicoSmartAccount: (params?: import("@getpara/aa-pimlico").PimlicoSmartAccountConfig & {
16
+ export declare const usePimlicoSmartAccount: (params?: UsePimlicoSmartAccountParams & {
14
17
  enabled?: boolean;
15
- }) => import("@getpara/react-core/internal").UseSmartAccountResult<import("@getpara/aa-alchemy").SmartAccount>;
18
+ }) => UseSmartAccountResult<SmartAccount>;
@@ -1,4 +1,7 @@
1
1
  import { PORTO_ACCOUNT_BASE_KEY } from '@getpara/react-core/internal';
2
+ import type { UseSmartAccountResult } from '@getpara/react-core/internal';
3
+ import type { SmartAccount } from '@getpara/viem-v2-integration/aa';
4
+ import type { UsePortoSmartAccountParams } from '@getpara/aa-porto';
2
5
  export { PORTO_ACCOUNT_BASE_KEY };
3
6
  /**
4
7
  * React / React Native hook to create and manage a Porto smart account.
@@ -10,6 +13,6 @@ export { PORTO_ACCOUNT_BASE_KEY };
10
13
  * On web, automatically detects connected external wallets (MetaMask, etc.) via wagmi
11
14
  * and uses them as the signer when no Para embedded wallet is active.
12
15
  */
13
- export declare const usePortoSmartAccount: (params?: import("@getpara/aa-porto").PortoAccountConfig & {
16
+ export declare const usePortoSmartAccount: (params?: UsePortoSmartAccountParams & {
14
17
  enabled?: boolean;
15
- }) => import("@getpara/react-core/internal").UseSmartAccountResult<import("@getpara/aa-alchemy").SmartAccount>;
18
+ }) => UseSmartAccountResult<SmartAccount>;
@@ -1,4 +1,7 @@
1
1
  import { RHINESTONE_SMART_ACCOUNT_BASE_KEY } from '@getpara/react-core/internal';
2
+ import type { UseSmartAccountResult } from '@getpara/react-core/internal';
3
+ import type { SmartAccount } from '@getpara/viem-v2-integration/aa';
4
+ import type { UseRhinestoneSmartAccountParams } from '@getpara/aa-rhinestone';
2
5
  export { RHINESTONE_SMART_ACCOUNT_BASE_KEY };
3
6
  /**
4
7
  * React / React Native hook to create and manage a Rhinestone smart account.
@@ -10,6 +13,6 @@ export { RHINESTONE_SMART_ACCOUNT_BASE_KEY };
10
13
  * On web, automatically detects connected external wallets (MetaMask, etc.) via wagmi
11
14
  * and uses them as the signer when no Para embedded wallet is active.
12
15
  */
13
- export declare const useRhinestoneSmartAccount: (params?: import("@getpara/aa-rhinestone").RhinestoneSmartAccountConfig & {
16
+ export declare const useRhinestoneSmartAccount: (params?: UseRhinestoneSmartAccountParams & {
14
17
  enabled?: boolean;
15
- }) => import("@getpara/react-core/internal").UseSmartAccountResult<import("@getpara/aa-alchemy").SmartAccount>;
18
+ }) => UseSmartAccountResult<SmartAccount>;
@@ -1,4 +1,7 @@
1
1
  import { SAFE_SMART_ACCOUNT_BASE_KEY } from '@getpara/react-core/internal';
2
+ import type { UseSmartAccountResult } from '@getpara/react-core/internal';
3
+ import type { SmartAccount } from '@getpara/viem-v2-integration/aa';
4
+ import type { UseSafeSmartAccountParams } from '@getpara/aa-safe';
2
5
  export { SAFE_SMART_ACCOUNT_BASE_KEY };
3
6
  /**
4
7
  * React / React Native hook to create and manage a Safe smart account.
@@ -10,6 +13,6 @@ export { SAFE_SMART_ACCOUNT_BASE_KEY };
10
13
  * On web, automatically detects connected external wallets (MetaMask, etc.) via wagmi
11
14
  * and uses them as the signer when no Para embedded wallet is active.
12
15
  */
13
- export declare const useSafeSmartAccount: (params?: import("@getpara/aa-safe").SafeSmartAccountConfig & {
16
+ export declare const useSafeSmartAccount: (params?: UseSafeSmartAccountParams & {
14
17
  enabled?: boolean;
15
- }) => import("@getpara/react-core/internal").UseSmartAccountResult<import("@getpara/aa-alchemy").SmartAccount>;
18
+ }) => UseSmartAccountResult<SmartAccount>;
@@ -1,4 +1,7 @@
1
1
  import { THIRDWEB_SMART_ACCOUNT_BASE_KEY } from '@getpara/react-core/internal';
2
+ import type { UseSmartAccountResult } from '@getpara/react-core/internal';
3
+ import type { SmartAccount } from '@getpara/viem-v2-integration/aa';
4
+ import type { UseThirdwebSmartAccountParams } from '@getpara/aa-thirdweb';
2
5
  export { THIRDWEB_SMART_ACCOUNT_BASE_KEY };
3
6
  /**
4
7
  * React / React Native hook to create and manage a Thirdweb smart account.
@@ -10,4 +13,6 @@ export { THIRDWEB_SMART_ACCOUNT_BASE_KEY };
10
13
  * On web, automatically detects connected external wallets (MetaMask, etc.) via wagmi
11
14
  * and uses them as the signer when no Para embedded wallet is active.
12
15
  */
13
- export declare const useThirdwebSmartAccount: (params?: any) => import("@getpara/react-core/internal").UseSmartAccountResult<import("@getpara/aa-alchemy").SmartAccount>;
16
+ export declare const useThirdwebSmartAccount: (params?: UseThirdwebSmartAccountParams & {
17
+ enabled?: boolean;
18
+ }) => UseSmartAccountResult<SmartAccount>;
@@ -1,4 +1,7 @@
1
1
  import { ZERODEV_SMART_ACCOUNT_BASE_KEY } from '@getpara/react-core/internal';
2
+ import type { UseSmartAccountResult } from '@getpara/react-core/internal';
3
+ import type { SmartAccount } from '@getpara/viem-v2-integration/aa';
4
+ import type { UseZeroDevSmartAccountParams } from '@getpara/aa-zerodev';
2
5
  export { ZERODEV_SMART_ACCOUNT_BASE_KEY };
3
6
  /**
4
7
  * React / React Native hook to create and manage a ZeroDev smart account.
@@ -10,6 +13,6 @@ export { ZERODEV_SMART_ACCOUNT_BASE_KEY };
10
13
  * On web, automatically detects connected external wallets (MetaMask, etc.) via wagmi
11
14
  * and uses them as the signer when no Para embedded wallet is active.
12
15
  */
13
- export declare const useZeroDevSmartAccount: (params?: import("@getpara/aa-zerodev").ZeroDevSmartAccountConfig & {
16
+ export declare const useZeroDevSmartAccount: (params?: UseZeroDevSmartAccountParams & {
14
17
  enabled?: boolean;
15
- }) => import("@getpara/react-core/internal").UseSmartAccountResult<import("@getpara/aa-alchemy").SmartAccount>;
18
+ }) => UseSmartAccountResult<SmartAccount>;
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Returns a CosmJS `OfflineDirectSigner` for the user's Cosmos wallet.
3
+ * Supports both embedded Para wallets and external wallets.
4
+ *
5
+ * If the user has multiple Cosmos wallets, pass `address` or `walletId` to select one.
6
+ * When omitted, the active wallet from `useWalletState` is used automatically.
7
+ *
8
+ * @example
9
+ * ```tsx
10
+ * import { useParaCosmjsProtoSigner } from "@getpara/react-sdk";
11
+ * import { SigningStargateClient } from "@cosmjs/stargate";
12
+ *
13
+ * function SignDirect() {
14
+ * const { protoSigner, isLoading } = useParaCosmjsProtoSigner();
15
+ *
16
+ * const handleSign = async () => {
17
+ * if (!protoSigner) return;
18
+ * const client = await SigningStargateClient.connectWithSigner(rpcUrl, protoSigner);
19
+ * const result = await protoSigner.signDirect(protoSigner.address, signDoc);
20
+ * console.log(result);
21
+ * };
22
+ *
23
+ * if (isLoading) return <p>Loading...</p>;
24
+ * return <button onClick={handleSign}>Sign</button>;
25
+ * }
26
+ * ```
27
+ *
28
+ */
29
+ export declare const useParaCosmjsProtoSigner: ({ address, prefix, walletId, messageSigningTimeoutMs, }?: import("@getpara/react-core/dist/chains/types.js").WalletSelector & {
30
+ prefix?: string;
31
+ messageSigningTimeoutMs?: number;
32
+ }) => import("@getpara/react-core/dist/chains/cosmos/useParaCosmjsProtoSigner.js").UseParaCosmjsProtoSignerReturn;
33
+ /**
34
+ * Returns a CosmJS `OfflineAminoSigner` for the user's Cosmos wallet.
35
+ * Supports both embedded Para wallets and external wallets.
36
+ *
37
+ * If the user has multiple Cosmos wallets, pass `address` or `walletId` to select one.
38
+ * When omitted, the active wallet from `useWalletState` is used automatically.
39
+ *
40
+ * @example
41
+ * ```tsx
42
+ * import { useParaCosmjsAminoSigner } from "@getpara/react-sdk";
43
+ *
44
+ * function SignAmino() {
45
+ * const { aminoSigner, isLoading } = useParaCosmjsAminoSigner();
46
+ *
47
+ * const handleSign = async () => {
48
+ * if (!aminoSigner) return;
49
+ * const result = await aminoSigner.signAmino(aminoSigner.address, signDoc);
50
+ * console.log(result);
51
+ * };
52
+ *
53
+ * if (isLoading) return <p>Loading...</p>;
54
+ * return <button onClick={handleSign}>Sign</button>;
55
+ * }
56
+ * ```
57
+ *
58
+ */
59
+ export declare const useParaCosmjsAminoSigner: ({ address, prefix, walletId, messageSigningTimeoutMs, }?: import("@getpara/react-core/dist/chains/types.js").WalletSelector & {
60
+ prefix?: string;
61
+ messageSigningTimeoutMs?: number;
62
+ }) => import("@getpara/react-core/dist/chains/cosmos/useParaCosmjsAminoSigner.js").UseParaCosmjsAminoSignerReturn;
@@ -0,0 +1,10 @@
1
+ "use client";
2
+ import "../chunk-MMUBH76A.js";
3
+ import { createParaCosmjsProtoSignerHook, createParaCosmjsAminoSignerHook } from "@getpara/react-core/cosmos";
4
+ import { useGrazEnhancer } from "./useGrazEnhancer.js";
5
+ const useParaCosmjsProtoSigner = createParaCosmjsProtoSignerHook(useGrazEnhancer);
6
+ const useParaCosmjsAminoSigner = createParaCosmjsAminoSignerHook(useGrazEnhancer);
7
+ export {
8
+ useParaCosmjsAminoSigner,
9
+ useParaCosmjsProtoSigner
10
+ };
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Returns a viem `WalletClient` for the user's EVM wallet.
3
+ * Supports both embedded Para wallets and external wallets.
4
+ *
5
+ * If the user has multiple EVM wallets, pass `address` or `walletId` to select one.
6
+ * When omitted, the active wallet from `useWalletState` is used automatically.
7
+ *
8
+ * @example
9
+ * ```tsx
10
+ * import { useParaViemClient } from "@getpara/react-sdk";
11
+ * import { sepolia } from "viem/chains";
12
+ * import { http } from "viem";
13
+ *
14
+ * function SignMessage() {
15
+ * const { viemClient, isLoading } = useParaViemClient({
16
+ * walletClientConfig: { chain: sepolia, transport: http() },
17
+ * });
18
+ *
19
+ * const handleSign = async () => {
20
+ * if (!viemClient) return;
21
+ * const signature = await viemClient.signMessage({ message: "Hello" });
22
+ * console.log(signature);
23
+ * };
24
+ *
25
+ * if (isLoading) return <p>Loading...</p>;
26
+ * return <button onClick={handleSign}>Sign Message</button>;
27
+ * }
28
+ * ```
29
+ *
30
+ */
31
+ export declare const useParaViemClient: (params: import("@getpara/react-core/dist/chains/types.js").WalletSelector & {
32
+ walletClientConfig: Omit<import("viem").WalletClientConfig, "account">;
33
+ }) => import("@getpara/react-core/dist/chains/evm/viem/useParaViemClient.js").UseParaViemClientReturn;
34
+ /**
35
+ * Returns a viem `LocalAccount` for the user's EVM wallet.
36
+ * Supports both embedded Para wallets and external wallets.
37
+ *
38
+ * If the user has multiple EVM wallets, pass `address` or `walletId` to select one.
39
+ * When omitted, the active wallet from `useWalletState` is used automatically.
40
+ *
41
+ * @example
42
+ * ```tsx
43
+ * import { useParaViemAccount } from "@getpara/react-sdk";
44
+ *
45
+ * function WalletAddress() {
46
+ * const { viemAccount, isLoading } = useParaViemAccount();
47
+ * if (isLoading) return <p>Loading...</p>;
48
+ * return <p>{viemAccount?.address ?? "No wallet"}</p>;
49
+ * }
50
+ * ```
51
+ *
52
+ */
53
+ export declare const useParaViemAccount: ({ address, walletId }?: import("@getpara/react-core/dist/chains/types.js").WalletSelector) => import("@getpara/react-core/dist/chains/evm/viem/useParaViemAccount.js").UseParaViemAccountReturn;
54
+ /**
55
+ * Returns an ethers.js `Signer` for the user's EVM wallet.
56
+ * Supports both embedded Para wallets and external wallets (via wagmi → BrowserProvider).
57
+ *
58
+ * @example
59
+ * ```tsx
60
+ * import { useParaEthersSigner } from "@getpara/react-sdk";
61
+ * import { JsonRpcProvider } from "ethers";
62
+ *
63
+ * const provider = new JsonRpcProvider("https://ethereum-sepolia-rpc.publicnode.com");
64
+ *
65
+ * function SignWithEthers() {
66
+ * const { ethersSigner, isLoading } = useParaEthersSigner({ provider });
67
+ * // ethersSigner works with both embedded and external wallets
68
+ * }
69
+ * ```
70
+ */
71
+ export declare const useParaEthersSigner: ({ address, walletId, provider, messageSigningTimeoutMs, }?: import("@getpara/react-core/dist/chains/types.js").WalletSelector & {
72
+ provider?: unknown;
73
+ messageSigningTimeoutMs?: number;
74
+ }) => import("@getpara/react-core/dist/chains/evm/ethers/useParaEthersSigner.js").UseParaEthersSignerReturn;
@@ -0,0 +1,14 @@
1
+ "use client";
2
+ import "../chunk-MMUBH76A.js";
3
+ import { createParaViemClientHook, createParaViemAccountHook } from "@getpara/react-core/evm/viem";
4
+ import { createParaEthersSignerHook } from "@getpara/react-core/evm/ethers";
5
+ import { useWagmiViemEnhancer } from "./useWagmiViemEnhancer.js";
6
+ import { useWagmiEthersEnhancer } from "./useWagmiEthersEnhancer.js";
7
+ const useParaViemClient = createParaViemClientHook(useWagmiViemEnhancer);
8
+ const useParaViemAccount = createParaViemAccountHook(useWagmiViemEnhancer);
9
+ const useParaEthersSigner = createParaEthersSignerHook(useWagmiEthersEnhancer);
10
+ export {
11
+ useParaEthersSigner,
12
+ useParaViemAccount,
13
+ useParaViemClient
14
+ };
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Returns a Solana signer for the user's Solana wallet.
3
+ * Supports both embedded Para wallets and external wallets.
4
+ *
5
+ * If the user has multiple Solana wallets, pass `address` or `walletId` to select one.
6
+ * When omitted, the active wallet from `useWalletState` is used automatically.
7
+ *
8
+ * @example
9
+ * ```tsx
10
+ * import { useParaSolanaSigner } from "@getpara/react-sdk";
11
+ * import { createSolanaRpc } from "@solana/kit";
12
+ *
13
+ * const rpc = createSolanaRpc("https://api.mainnet-beta.solana.com");
14
+ *
15
+ * function SignMessage() {
16
+ * const { solanaSigner, isLoading } = useParaSolanaSigner({ rpc });
17
+ *
18
+ * const handleSign = async () => {
19
+ * if (!solanaSigner) return;
20
+ * const message = new TextEncoder().encode("Hello");
21
+ * const [signatures] = await solanaSigner.signMessages([{ content: message, signatures: {} }]);
22
+ * console.log(signatures);
23
+ * };
24
+ *
25
+ * if (isLoading) return <p>Loading...</p>;
26
+ * return <button onClick={handleSign}>Sign Message</button>;
27
+ * }
28
+ * ```
29
+ *
30
+ */
31
+ export declare const useParaSolanaSigner: ({ address, walletId, rpc }: import("@getpara/react-core/dist/chains/types.js").WalletSelector & {
32
+ rpc: import("@getpara/solana-signers-v2-integration").ParaSignerParams["rpc"];
33
+ }) => import("@getpara/react-core/dist/chains/solana/useParaSolanaSigner.js").UseParaSolanaSignerReturn;
@@ -0,0 +1,8 @@
1
+ "use client";
2
+ import "../chunk-MMUBH76A.js";
3
+ import { createParaSolanaSignerHook } from "@getpara/react-core/solana";
4
+ import { useSolanaWalletEnhancer } from "./useSolanaWalletEnhancer.js";
5
+ const useParaSolanaSigner = createParaSolanaSignerHook(useSolanaWalletEnhancer);
6
+ export {
7
+ useParaSolanaSigner
8
+ };
@@ -0,0 +1,2 @@
1
+ export { useParaStellarSigner, STELLAR_SIGNER_BASE_KEY, useParaStellarSignTransaction, STELLAR_SIGN_TRANSACTION_KEY, } from '@getpara/react-core/stellar';
2
+ export type { StellarEnhancement } from '@getpara/react-core/stellar';
@@ -0,0 +1,14 @@
1
+ "use client";
2
+ import "../chunk-MMUBH76A.js";
3
+ import {
4
+ useParaStellarSigner,
5
+ STELLAR_SIGNER_BASE_KEY,
6
+ useParaStellarSignTransaction,
7
+ STELLAR_SIGN_TRANSACTION_KEY
8
+ } from "@getpara/react-core/stellar";
9
+ export {
10
+ STELLAR_SIGNER_BASE_KEY,
11
+ STELLAR_SIGN_TRANSACTION_KEY,
12
+ useParaStellarSignTransaction,
13
+ useParaStellarSigner
14
+ };
@@ -0,0 +1,7 @@
1
+ import type { CosmosEnhancement } from '@getpara/react-core/cosmos';
2
+ /**
3
+ * Graz-based enhancer for Cosmos chain hooks (useParaCosmjsProtoSigner, useParaCosmjsAminoSigner).
4
+ * When an external Cosmos wallet is connected via graz/Keplr, provides the external wallet's
5
+ * offline signers so the chain hooks return them instead of creating a Para signer.
6
+ */
7
+ export declare function useGrazEnhancer(): CosmosEnhancement;
@@ -0,0 +1,28 @@
1
+ "use client";
2
+ import "../chunk-MMUBH76A.js";
3
+ import { useContext } from "react";
4
+ import { useStore } from "../provider/stores/useStore.js";
5
+ function useGrazEnhancer() {
6
+ var _a, _b;
7
+ const cosmosContext = useStore((state) => state.cosmosContext);
8
+ const ctxValue = useContext(cosmosContext);
9
+ const noopUseAccount = () => void 0;
10
+ const useCosmosAccount = (_a = ctxValue == null ? void 0 : ctxValue.useAccount) != null ? _a : noopUseAccount;
11
+ const account = useCosmosAccount();
12
+ const acct = account;
13
+ const isExternalConnected = !!(acct == null ? void 0 : acct.bech32Address);
14
+ const noopUseOfflineSigners = () => ({
15
+ data: void 0
16
+ });
17
+ const useOfflineSigners = (_b = ctxValue == null ? void 0 : ctxValue.useOfflineSigners) != null ? _b : noopUseOfflineSigners;
18
+ const { data: signersRecord } = useOfflineSigners();
19
+ const signers = signersRecord ? Object.values(signersRecord)[0] : void 0;
20
+ return {
21
+ protoSigner: isExternalConnected && signers ? signers.offlineSigner : null,
22
+ aminoSigner: isExternalConnected && signers ? signers.offlineSignerAmino : null,
23
+ isLoading: isExternalConnected && !signers
24
+ };
25
+ }
26
+ export {
27
+ useGrazEnhancer
28
+ };
@@ -0,0 +1,7 @@
1
+ import type { SolanaEnhancement } from '@getpara/react-core/solana';
2
+ /**
3
+ * Solana wallet adapter enhancer for Solana chain hooks (useParaSolanaSigner).
4
+ * When an external Solana wallet is connected (e.g. Phantom via wallet-adapter),
5
+ * provides a wrapped signer that implements the same interface as ParaSolanaSigner.
6
+ */
7
+ export declare function useSolanaWalletEnhancer(): SolanaEnhancement;
@@ -0,0 +1,53 @@
1
+ "use client";
2
+ import {
3
+ __async
4
+ } from "../chunk-MMUBH76A.js";
5
+ import { useContext, useMemo } from "react";
6
+ import { useStore } from "../provider/stores/useStore.js";
7
+ function wrapWalletAdapter(wallet) {
8
+ const address = wallet.publicKey.toBase58();
9
+ return {
10
+ address,
11
+ // MessagePartialSigner
12
+ signMessages(messages) {
13
+ return __async(this, null, function* () {
14
+ const results = [];
15
+ for (const msg of messages) {
16
+ const sig = yield wallet.signMessage(msg.content);
17
+ results.push({ [address]: sig });
18
+ }
19
+ return results;
20
+ });
21
+ },
22
+ // TransactionPartialSigner
23
+ signTransactions(transactions, _config) {
24
+ return __async(this, null, function* () {
25
+ if (wallet.signAllTransactions) {
26
+ return wallet.signAllTransactions(transactions);
27
+ }
28
+ return Promise.all(transactions.map((tx) => wallet.signTransaction(tx)));
29
+ });
30
+ }
31
+ };
32
+ }
33
+ function useSolanaWalletEnhancer() {
34
+ var _a, _b;
35
+ const solanaContext = useStore((state) => state.solanaContext);
36
+ const ctxValue = useContext(solanaContext);
37
+ const noopUseWallet = () => void 0;
38
+ const useSolanaWallet = (_a = ctxValue == null ? void 0 : ctxValue.useWallet) != null ? _a : noopUseWallet;
39
+ const wallet = useSolanaWallet();
40
+ const w = wallet;
41
+ const isExternalConnected = !!(w == null ? void 0 : w.connected) && !!(w == null ? void 0 : w.publicKey);
42
+ const wrappedSigner = useMemo(
43
+ () => isExternalConnected ? wrapWalletAdapter(wallet) : null,
44
+ [isExternalConnected, (_b = w == null ? void 0 : w.publicKey) == null ? void 0 : _b.toBase58()]
45
+ );
46
+ return {
47
+ signer: wrappedSigner,
48
+ isLoading: false
49
+ };
50
+ }
51
+ export {
52
+ useSolanaWalletEnhancer
53
+ };
@@ -0,0 +1,7 @@
1
+ import type { EthersEnhancement } from '@getpara/react-core/evm/ethers';
2
+ /**
3
+ * Wagmi-based enhancer for the ethers chain hooks (useParaEthersSigner).
4
+ * When an external EVM wallet is connected via wagmi, converts the wagmi
5
+ * walletClient into an ethers Signer via BrowserProvider.
6
+ */
7
+ export declare function useWagmiEthersEnhancer(): EthersEnhancement;
@@ -0,0 +1,67 @@
1
+ "use client";
2
+ import {
3
+ __async
4
+ } from "../chunk-MMUBH76A.js";
5
+ import { useCallback, useContext, useEffect, useState } from "react";
6
+ import { useStore } from "../provider/stores/useStore.js";
7
+ import { getWagmiConfig } from "@getpara/evm-wallet-connectors";
8
+ function walletClientToSigner(walletClient) {
9
+ return __async(this, null, function* () {
10
+ const { BrowserProvider } = yield import("ethers");
11
+ const provider = new BrowserProvider(walletClient.transport);
12
+ return provider.getSigner();
13
+ });
14
+ }
15
+ function useWagmiEthersEnhancer() {
16
+ var _a, _b;
17
+ const evmContext = useStore((state) => state.evmContext);
18
+ const evmCtxValue = useContext(evmContext);
19
+ const noopUseAccount = () => void 0;
20
+ const noopUseWalletClient = () => ({
21
+ data: void 0,
22
+ isLoading: false
23
+ });
24
+ const useEvmAccount = (_a = evmCtxValue == null ? void 0 : evmCtxValue.useAccount) != null ? _a : noopUseAccount;
25
+ const useEvmWalletClient = (_b = evmCtxValue == null ? void 0 : evmCtxValue.useWalletClient) != null ? _b : noopUseWalletClient;
26
+ const evmAccount = useEvmAccount();
27
+ const { data: evmWalletClient, isLoading: isWalletClientLoading } = useEvmWalletClient();
28
+ const externalAddress = evmAccount == null ? void 0 : evmAccount.address;
29
+ const isExternalConnected = !!externalAddress;
30
+ const [signer, setSigner] = useState(null);
31
+ const [isConverting, setIsConverting] = useState(false);
32
+ useEffect(() => {
33
+ if (!isExternalConnected || !evmWalletClient) {
34
+ setSigner(null);
35
+ return;
36
+ }
37
+ setIsConverting(true);
38
+ walletClientToSigner(evmWalletClient).then(setSigner).catch(() => setSigner(null)).finally(() => setIsConverting(false));
39
+ }, [isExternalConnected, evmWalletClient]);
40
+ const getSignerForAddress = useCallback((address) => __async(this, null, function* () {
41
+ try {
42
+ const config = getWagmiConfig();
43
+ if (!config) return null;
44
+ const { getConnectorClient } = yield import("@wagmi/core");
45
+ for (const connection of config.state.connections.values()) {
46
+ if (connection.accounts.some((a) => a.toLowerCase() === address.toLowerCase())) {
47
+ const client = yield getConnectorClient(config, {
48
+ connector: connection.connector,
49
+ account: address
50
+ });
51
+ return walletClientToSigner(client);
52
+ }
53
+ }
54
+ return null;
55
+ } catch (e) {
56
+ return null;
57
+ }
58
+ }), []);
59
+ return {
60
+ signer: isExternalConnected ? signer : null,
61
+ isLoading: isExternalConnected && (isWalletClientLoading || isConverting),
62
+ getSignerForAddress
63
+ };
64
+ }
65
+ export {
66
+ useWagmiEthersEnhancer
67
+ };
@@ -0,0 +1,7 @@
1
+ import type { ViemEnhancement } from '@getpara/react-core/evm/viem';
2
+ /**
3
+ * Wagmi-based enhancer for the chain hooks (useParaViemClient, useParaViemAccount).
4
+ * When an external EVM wallet is connected via wagmi, provides the walletClient
5
+ * so the viem hooks use it directly instead of creating a Para-backed client.
6
+ */
7
+ export declare function useWagmiViemEnhancer(): ViemEnhancement;
@@ -0,0 +1,56 @@
1
+ "use client";
2
+ import {
3
+ __async
4
+ } from "../chunk-MMUBH76A.js";
5
+ import { useCallback, useContext } from "react";
6
+ import { useStore } from "../provider/stores/useStore.js";
7
+ import { getWagmiConfig } from "@getpara/evm-wallet-connectors";
8
+ import { createWalletClient, custom } from "viem";
9
+ function useWagmiViemEnhancer() {
10
+ var _a, _b;
11
+ const evmContext = useStore((state) => state.evmContext);
12
+ const evmCtxValue = useContext(evmContext);
13
+ const noopUseAccount = () => void 0;
14
+ const noopUseWalletClient = () => ({
15
+ data: void 0,
16
+ isLoading: false
17
+ });
18
+ const useEvmAccount = (_a = evmCtxValue == null ? void 0 : evmCtxValue.useAccount) != null ? _a : noopUseAccount;
19
+ const useEvmWalletClient = (_b = evmCtxValue == null ? void 0 : evmCtxValue.useWalletClient) != null ? _b : noopUseWalletClient;
20
+ const evmAccount = useEvmAccount();
21
+ const { data: evmWalletClient, isLoading: isWalletClientLoading } = useEvmWalletClient();
22
+ const externalAddress = evmAccount == null ? void 0 : evmAccount.address;
23
+ const isExternalConnected = !!externalAddress;
24
+ const getWalletClientForAddress = useCallback((address) => __async(this, null, function* () {
25
+ try {
26
+ const config = getWagmiConfig();
27
+ if (!config) return null;
28
+ const { getConnectorClient } = yield import("@wagmi/core");
29
+ for (const connection of config.state.connections.values()) {
30
+ if (connection.accounts.some((a) => a.toLowerCase() === address.toLowerCase())) {
31
+ const connectorClient = yield getConnectorClient(config, {
32
+ connector: connection.connector,
33
+ account: address
34
+ });
35
+ return createWalletClient({
36
+ account: connectorClient.account,
37
+ chain: connectorClient.chain,
38
+ transport: custom(connectorClient.transport)
39
+ });
40
+ }
41
+ }
42
+ return null;
43
+ } catch (e) {
44
+ return null;
45
+ }
46
+ }), []);
47
+ return {
48
+ address: isExternalConnected ? externalAddress : void 0,
49
+ walletClient: isExternalConnected ? evmWalletClient : null,
50
+ isLoading: isExternalConnected && isWalletClientLoading,
51
+ getWalletClientForAddress
52
+ };
53
+ }
54
+ export {
55
+ useWagmiViemEnhancer
56
+ };