@getpara/react-sdk-lite 2.16.0 → 2.17.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.
@@ -9,7 +9,7 @@ export declare const ALCHEMY_SMART_ACCOUNT_BASE_KEY = "PARA_ALCHEMY_SMART_ACCOUN
9
9
  */
10
10
  export declare const useAlchemySmartAccount: (params?: import("@getpara/aa-alchemy").AlchemySmartAccountConfig & {
11
11
  enabled?: boolean;
12
- }) => import("../types.js").UseSmartAccountResult<NonNullable<import("@getpara/viem-v2-integration").SmartAccount4337<{
12
+ }) => import("../types.js").UseSmartAccountResult<NonNullable<import("@getpara/viem-v2-integration/aa").SmartAccount4337<{
13
13
  [x: string]: unknown;
14
14
  account: import("@aa-sdk/core").SmartContractAccount | undefined;
15
15
  batch?: {
@@ -8357,7 +8357,7 @@ export declare const useAlchemySmartAccount: (params?: import("@getpara/aa-alche
8357
8357
  account: import("@aa-sdk/core").SmartContractAccount<string, keyof import("@aa-sdk/core").EntryPointRegistryBase<unknown>>;
8358
8358
  }) => import("viem").Address;
8359
8359
  } & import("@aa-sdk/core").BundlerActions & import("viem").PublicActions>;
8360
- }> | import("@getpara/viem-v2-integration").SmartAccount7702<{
8360
+ }> | import("@getpara/viem-v2-integration/aa").SmartAccount7702<{
8361
8361
  [x: string]: unknown;
8362
8362
  account: import("@aa-sdk/core").SmartContractAccount | undefined;
8363
8363
  batch?: {
@@ -9,7 +9,7 @@ export declare const BICONOMY_SMART_ACCOUNT_BASE_KEY = "PARA_BICONOMY_SMART_ACCO
9
9
  */
10
10
  export declare const useBiconomySmartAccount: (params?: import("@getpara/aa-biconomy").BiconomySmartAccountConfig & {
11
11
  enabled?: boolean;
12
- }) => import("../types.js").UseSmartAccountResult<NonNullable<import("@getpara/viem-v2-integration").SmartAccount4337<import("@biconomy/abstractjs").MeeActions & {
12
+ }) => import("../types.js").UseSmartAccountResult<NonNullable<import("@getpara/viem-v2-integration/aa").SmartAccount4337<import("@biconomy/abstractjs").MeeActions & {
13
13
  request: <T>(params: {
14
14
  path: string;
15
15
  method?: "GET" | "POST";
@@ -25,7 +25,7 @@ export declare const useBiconomySmartAccount: (params?: import("@getpara/aa-bico
25
25
  pollingInterval: number;
26
26
  account: import("@biconomy/abstractjs").MultichainSmartAccount;
27
27
  info: import("@biconomy/abstractjs").GetInfoPayload;
28
- }> | import("@getpara/viem-v2-integration").SmartAccount7702<import("@biconomy/abstractjs").MeeActions & {
28
+ }> | import("@getpara/viem-v2-integration/aa").SmartAccount7702<import("@biconomy/abstractjs").MeeActions & {
29
29
  request: <T>(params: {
30
30
  path: string;
31
31
  method?: "GET" | "POST";
@@ -8,4 +8,4 @@ export declare const CDP_SMART_ACCOUNT_BASE_KEY = "PARA_CDP_SMART_ACCOUNT";
8
8
  */
9
9
  export declare const useCDPSmartAccount: (params?: import("@getpara/aa-cdp").CDPSmartAccountConfig & {
10
10
  enabled?: boolean;
11
- }) => import("../types.js").UseSmartAccountResult<import("@getpara/viem-v2-integration").SmartAccount4337<import("viem/_types/account-abstraction/index.js").BundlerClient>>;
11
+ }) => import("../types.js").UseSmartAccountResult<import("@getpara/viem-v2-integration/aa").SmartAccount4337<import("viem/_types/account-abstraction/index.js").BundlerClient>>;
@@ -1,4 +1,4 @@
1
- import type { Hex } from 'viem';
1
+ import type { Hex, LocalAccount, WalletClient } from 'viem';
2
2
  import type { SmartAccountHookConfig, UseSmartAccountResult } from './types.js';
3
3
  /**
4
4
  * Factory that creates a React hook for a specific smart account provider.
@@ -7,6 +7,7 @@ import type { SmartAccountHookConfig, UseSmartAccountResult } from './types.js';
7
7
  export declare function createSmartAccountHook<TParams extends {
8
8
  address?: Hex;
9
9
  walletId?: string;
10
+ signer?: LocalAccount | WalletClient;
10
11
  }, TResult>(config: SmartAccountHookConfig<TParams, TResult>): (params?: TParams & {
11
12
  enabled?: boolean;
12
13
  }) => UseSmartAccountResult<TResult>;
@@ -6,35 +6,69 @@ import {
6
6
  __spreadValues
7
7
  } from "../chunk-MMUBH76A.js";
8
8
  import { useAccount, useClient, useWallet } from "../provider/index.js";
9
+ import { useStore } from "../provider/stores/useStore.js";
9
10
  import { useQuery } from "@tanstack/react-query";
11
+ import { useContext } from "react";
10
12
  function createSmartAccountHook(config) {
11
13
  return function useSmartAccount(params = {}) {
12
- var _b, _c, _d;
14
+ var _a, _b, _d, _e, _f, _g, _h, _i, _j;
13
15
  const para = useClient();
14
16
  const {
15
17
  isConnected,
16
18
  embedded: { userId }
17
19
  } = useAccount();
18
20
  const { data: wallet } = useWallet();
19
- const _a = params != null ? params : {}, { enabled = true } = _a, rest = __objRest(_a, ["enabled"]);
21
+ const evmContext = useStore((state) => state.evmContext);
22
+ const evmCtxValue = useContext(evmContext);
23
+ const noopUseAccount = () => void 0;
24
+ const noopUseWalletClient = () => ({
25
+ data: void 0,
26
+ isLoading: false
27
+ });
28
+ const useEvmAccount = (_a = evmCtxValue == null ? void 0 : evmCtxValue.useAccount) != null ? _a : noopUseAccount;
29
+ const useEvmWalletClient = (_b = evmCtxValue == null ? void 0 : evmCtxValue.useWalletClient) != null ? _b : noopUseWalletClient;
30
+ const evmAccount = useEvmAccount();
31
+ const { data: evmWalletClient, isLoading: isEvmWalletClientLoading } = useEvmWalletClient();
32
+ const _c = params != null ? params : {}, { enabled = true } = _c, rest = __objRest(_c, ["enabled"]);
20
33
  const configParams = rest;
21
- const contextAddress = (wallet == null ? void 0 : wallet.type) === "EVM" ? wallet == null ? void 0 : wallet.address : void 0;
34
+ const contextAddress = (wallet == null ? void 0 : wallet.type) === "EVM" && !(wallet == null ? void 0 : wallet.isExternal) ? wallet == null ? void 0 : wallet.address : void 0;
35
+ const addressParamIsExternal = (() => {
36
+ if (!para || !(configParams == null ? void 0 : configParams.address)) return false;
37
+ try {
38
+ const w = para.findWalletByAddress(configParams.address, { type: ["EVM"] });
39
+ return !!(w == null ? void 0 : w.isExternal);
40
+ } catch (e) {
41
+ return false;
42
+ }
43
+ })();
44
+ const hasEmbeddedWallet = !!contextAddress;
45
+ const externalEvmAddress = evmAccount == null ? void 0 : evmAccount.address;
46
+ const isPotentiallyExternal = !hasEmbeddedWallet && !!externalEvmAddress || addressParamIsExternal;
47
+ const autoExternalSigner = !(configParams == null ? void 0 : configParams.signer) && isPotentiallyExternal && evmWalletClient ? !addressParamIsExternal || (externalEvmAddress == null ? void 0 : externalEvmAddress.toLowerCase()) === ((_d = configParams == null ? void 0 : configParams.address) == null ? void 0 : _d.toLowerCase()) ? (
48
+ // wagmi's WalletClient type diverges from viem's — cast through unknown to bridge them
49
+ evmWalletClient
50
+ ) : void 0 : void 0;
51
+ const effectiveSigner = (_e = configParams == null ? void 0 : configParams.signer) != null ? _e : autoExternalSigner;
52
+ const signerAddress = effectiveSigner ? "address" in effectiveSigner ? effectiveSigner.address : (_f = effectiveSigner.account) == null ? void 0 : _f.address : void 0;
53
+ const hasSigner = !!effectiveSigner;
54
+ const isAwaitingExternalSigner = isPotentiallyExternal && !(configParams == null ? void 0 : configParams.signer) && isEvmWalletClientLoading;
22
55
  const queryResult = useQuery({
23
56
  queryKey: [
24
57
  config.queryKeyBase,
25
58
  isConnected,
26
59
  userId,
27
- (_d = (_c = (_b = configParams == null ? void 0 : configParams.address) != null ? _b : configParams == null ? void 0 : configParams.walletId) != null ? _c : contextAddress) != null ? _d : null,
60
+ (_j = (_i = (_h = (_g = configParams == null ? void 0 : configParams.address) != null ? _g : configParams == null ? void 0 : configParams.walletId) != null ? _h : contextAddress) != null ? _i : signerAddress) != null ? _j : null,
28
61
  ...config.getQueryKey(configParams != null ? configParams : {})
29
62
  ],
30
- enabled: isConnected && !!para && enabled,
63
+ // Allow the query to run if: Para embedded session is active, OR an external signer is available.
64
+ // Block while waiting for the external wallet client to load.
65
+ enabled: !isAwaitingExternalSigner && (isConnected || hasSigner) && !!para && enabled,
31
66
  queryFn: () => __async(this, null, function* () {
32
67
  var _a2;
33
- if (!isConnected || !para) {
34
- return null;
35
- }
36
- const address = (configParams == null ? void 0 : configParams.walletId) ? void 0 : (_a2 = configParams == null ? void 0 : configParams.address) != null ? _a2 : contextAddress;
37
- return config.createClient(__spreadProps(__spreadValues({}, configParams), { para, address }));
68
+ if (!isConnected && !hasSigner) return null;
69
+ if (!para) return null;
70
+ const address = hasSigner ? configParams == null ? void 0 : configParams.address : (configParams == null ? void 0 : configParams.walletId) ? void 0 : (_a2 = configParams == null ? void 0 : configParams.address) != null ? _a2 : contextAddress;
71
+ return config.createClient(__spreadProps(__spreadValues({}, configParams), { para, address, signer: effectiveSigner }));
38
72
  })
39
73
  });
40
74
  return __spreadProps(__spreadValues({}, queryResult), {
@@ -8,4 +8,4 @@ export declare const GELATO_SMART_ACCOUNT_BASE_KEY = "PARA_GELATO_SMART_ACCOUNT"
8
8
  */
9
9
  export declare const useGelatoSmartAccount: (params?: import("@getpara/aa-gelato").GelatoSmartAccountConfig & {
10
10
  enabled?: boolean;
11
- }) => import("../types.js").UseSmartAccountResult<import("@getpara/viem-v2-integration").SmartAccount7702<import("@gelatocloud/gasless").GelatoBundlerClient>>;
11
+ }) => import("../types.js").UseSmartAccountResult<import("@getpara/viem-v2-integration/aa").SmartAccount7702<import("@gelatocloud/gasless").GelatoBundlerClient>>;
@@ -9,7 +9,7 @@ export declare const PIMLICO_SMART_ACCOUNT_BASE_KEY = "PARA_PIMLICO_SMART_ACCOUN
9
9
  */
10
10
  export declare const usePimlicoSmartAccount: (params?: import("@getpara/aa-pimlico").PimlicoSmartAccountConfig & {
11
11
  enabled?: boolean;
12
- }) => import("../types.js").UseSmartAccountResult<NonNullable<import("@getpara/viem-v2-integration").SmartAccount4337<{
12
+ }) => import("../types.js").UseSmartAccountResult<NonNullable<import("@getpara/viem-v2-integration/aa").SmartAccount4337<{
13
13
  account: import("viem/_types/account-abstraction/index.js").SmartAccount | undefined;
14
14
  batch?: {
15
15
  multicall?: boolean | import("viem").Prettify<import("viem").MulticallBatchOptions> | undefined;
@@ -391,12 +391,12 @@ export declare const usePimlicoSmartAccount: (params?: import("@getpara/aa-pimli
391
391
  version: string;
392
392
  id: string;
393
393
  chainId: number;
394
+ atomic: boolean;
394
395
  capabilities?: {
395
396
  [key: string]: any;
396
397
  } | {
397
398
  [x: string]: any;
398
399
  } | undefined;
399
- atomic: boolean;
400
400
  receipts?: import("viem").WalletCallReceipt<bigint, "success" | "reverted">[] | undefined;
401
401
  statusCode: number;
402
402
  status: "pending" | "success" | "failure" | undefined;
@@ -422,7 +422,7 @@ export declare const usePimlicoSmartAccount: (params?: import("@getpara/aa-pimli
422
422
  paymaster: import("viem/_types/account-abstraction/index.js").BundlerClientConfig["paymaster"] | undefined;
423
423
  paymasterContext: import("viem/_types/account-abstraction/index.js").BundlerClientConfig["paymasterContext"] | undefined;
424
424
  userOperation: import("viem/_types/account-abstraction/index.js").BundlerClientConfig["userOperation"] | undefined;
425
- }> | import("@getpara/viem-v2-integration").SmartAccount7702<{
425
+ }> | import("@getpara/viem-v2-integration/aa").SmartAccount7702<{
426
426
  account: import("viem/_types/account-abstraction/index.js").SmartAccount | undefined;
427
427
  batch?: {
428
428
  multicall?: boolean | import("viem").Prettify<import("viem").MulticallBatchOptions> | undefined;
@@ -804,12 +804,12 @@ export declare const usePimlicoSmartAccount: (params?: import("@getpara/aa-pimli
804
804
  version: string;
805
805
  id: string;
806
806
  chainId: number;
807
+ atomic: boolean;
807
808
  capabilities?: {
808
809
  [key: string]: any;
809
810
  } | {
810
811
  [x: string]: any;
811
812
  } | undefined;
812
- atomic: boolean;
813
813
  receipts?: import("viem").WalletCallReceipt<bigint, "success" | "reverted">[] | undefined;
814
814
  statusCode: number;
815
815
  status: "pending" | "success" | "failure" | undefined;
@@ -9,4 +9,4 @@ export declare const PORTO_ACCOUNT_BASE_KEY = "PARA_PORTO_ACCOUNT";
9
9
  */
10
10
  export declare const usePortoSmartAccount: (params?: import("@getpara/aa-porto").PortoAccountConfig & {
11
11
  enabled?: boolean;
12
- }) => import("../types.js").UseSmartAccountResult<import("@getpara/viem-v2-integration").SmartAccount7702<any>>;
12
+ }) => import("../types.js").UseSmartAccountResult<import("@getpara/viem-v2-integration/aa").SmartAccount7702<any>>;
@@ -9,4 +9,4 @@ export declare const RHINESTONE_SMART_ACCOUNT_BASE_KEY = "PARA_RHINESTONE_SMART_
9
9
  */
10
10
  export declare const useRhinestoneSmartAccount: (params?: import("@getpara/aa-rhinestone").RhinestoneSmartAccountConfig & {
11
11
  enabled?: boolean;
12
- }) => import("../types.js").UseSmartAccountResult<import("@getpara/viem-v2-integration").SmartAccount4337<any>>;
12
+ }) => import("../types.js").UseSmartAccountResult<import("@getpara/viem-v2-integration/aa").SmartAccount4337<any>>;
@@ -9,4 +9,4 @@ export declare const SAFE_SMART_ACCOUNT_BASE_KEY = "PARA_SAFE_SMART_ACCOUNT";
9
9
  */
10
10
  export declare const useSafeSmartAccount: (params?: import("@getpara/aa-safe").SafeSmartAccountConfig & {
11
11
  enabled?: boolean;
12
- }) => import("../types.js").UseSmartAccountResult<import("@getpara/viem-v2-integration").SmartAccount4337<import("permissionless").SmartAccountClient>>;
12
+ }) => import("../types.js").UseSmartAccountResult<import("@getpara/viem-v2-integration/aa").SmartAccount4337<import("permissionless").SmartAccountClient>>;
@@ -9,4 +9,4 @@ export declare const THIRDWEB_SMART_ACCOUNT_BASE_KEY = "PARA_THIRDWEB_SMART_ACCO
9
9
  */
10
10
  export declare const useThirdwebSmartAccount: (params?: import("@getpara/aa-thirdweb").ThirdwebSmartAccountConfig & {
11
11
  enabled?: boolean;
12
- }) => import("../types.js").UseSmartAccountResult<NonNullable<import("@getpara/viem-v2-integration").SmartAccount4337<import("thirdweb/wallets").Account> | import("@getpara/viem-v2-integration").SmartAccount7702<import("thirdweb/wallets").Account> | null>>;
12
+ }) => import("../types.js").UseSmartAccountResult<NonNullable<import("@getpara/viem-v2-integration/aa").SmartAccount4337<import("thirdweb/wallets").Account> | import("@getpara/viem-v2-integration/aa").SmartAccount7702<import("thirdweb/wallets").Account> | null>>;
@@ -9,4 +9,4 @@ export declare const ZERODEV_SMART_ACCOUNT_BASE_KEY = "PARA_ZERODEV_SMART_ACCOUN
9
9
  */
10
10
  export declare const useZeroDevSmartAccount: (params?: import("@getpara/aa-zerodev").ZeroDevSmartAccountConfig & {
11
11
  enabled?: boolean;
12
- }) => import("../types.js").UseSmartAccountResult<NonNullable<import("@getpara/viem-v2-integration").SmartAccount4337<import("@zerodev/sdk").KernelAccountClient> | import("@getpara/viem-v2-integration").SmartAccount7702<import("@zerodev/sdk").KernelAccountClient> | null>>;
12
+ }) => import("../types.js").UseSmartAccountResult<NonNullable<import("@getpara/viem-v2-integration/aa").SmartAccount4337<import("@zerodev/sdk").KernelAccountClient> | import("@getpara/viem-v2-integration/aa").SmartAccount7702<import("@zerodev/sdk").KernelAccountClient> | null>>;
package/dist/cli/cli.mjs CHANGED
File without changes
package/package.json CHANGED
@@ -1,43 +1,44 @@
1
1
  {
2
2
  "name": "@getpara/react-sdk-lite",
3
- "version": "2.16.0",
3
+ "version": "2.17.0",
4
4
  "bin": {
5
5
  "setup-para": "dist/cli/cli.mjs"
6
6
  },
7
7
  "dependencies": {
8
- "@getpara/react-common": "2.16.0",
9
- "@getpara/react-components": "2.16.0",
10
- "@getpara/web-sdk": "2.16.0",
8
+ "@getpara/react-common": "2.17.0",
9
+ "@getpara/react-components": "2.17.0",
10
+ "@getpara/web-sdk": "2.17.0",
11
11
  "date-fns": "^3.6.0",
12
+ "detect-browser": "^5.3.0",
12
13
  "framer-motion": "^11.3.31",
13
14
  "libphonenumber-js": "^1.11.7",
14
15
  "socket.io-client": "^4.5.1",
15
- "styled-components": "^6.1.8",
16
+ "styled-components": "^6",
16
17
  "zustand": "^4.5.2",
17
18
  "zustand-sync-tabs": "^0.2.2"
18
19
  },
19
20
  "devDependencies": {
20
- "@getpara/aa-alchemy": "2.16.0",
21
- "@getpara/aa-biconomy": "2.16.0",
22
- "@getpara/aa-cdp": "2.16.0",
23
- "@getpara/aa-gelato": "2.16.0",
24
- "@getpara/aa-pimlico": "2.16.0",
25
- "@getpara/aa-porto": "2.16.0",
26
- "@getpara/aa-rhinestone": "2.16.0",
27
- "@getpara/aa-safe": "2.16.0",
28
- "@getpara/aa-thirdweb": "2.16.0",
29
- "@getpara/aa-zerodev": "2.16.0",
30
- "@getpara/cosmos-wallet-connectors": "2.16.0",
31
- "@getpara/evm-wallet-connectors": "2.16.0",
32
- "@getpara/solana-wallet-connectors": "2.16.0",
21
+ "@getpara/aa-alchemy": "2.17.0",
22
+ "@getpara/aa-biconomy": "2.17.0",
23
+ "@getpara/aa-cdp": "2.17.0",
24
+ "@getpara/aa-gelato": "2.17.0",
25
+ "@getpara/aa-pimlico": "2.17.0",
26
+ "@getpara/aa-porto": "2.17.0",
27
+ "@getpara/aa-rhinestone": "2.17.0",
28
+ "@getpara/aa-safe": "2.17.0",
29
+ "@getpara/aa-thirdweb": "2.17.0",
30
+ "@getpara/aa-zerodev": "2.17.0",
31
+ "@getpara/cosmos-wallet-connectors": "2.17.0",
32
+ "@getpara/evm-wallet-connectors": "2.17.0",
33
+ "@getpara/solana-wallet-connectors": "2.17.0",
33
34
  "@tanstack/react-query": "^5.74.0",
34
35
  "@testing-library/dom": "^10.4.0",
35
36
  "@testing-library/react": "^16.3.0",
36
37
  "@testing-library/react-hooks": "^8.0.1",
37
38
  "@testing-library/user-event": "^14.6.1",
38
39
  "@types/chrome": "^0.0.237",
39
- "@types/react": "^18.0.31",
40
- "@types/react-dom": "^18.2.7",
40
+ "@types/react": "^18.3.3",
41
+ "@types/react-dom": "^18.3.0",
41
42
  "typescript": "^5.8.3"
42
43
  },
43
44
  "exports": {
@@ -49,7 +50,7 @@
49
50
  "package.json",
50
51
  "styles.css"
51
52
  ],
52
- "gitHead": "fbe96a062b308d04105213378c12c38ee973c798",
53
+ "gitHead": "3ed1f835b97ae720f1ac747611296e3b86f61138",
53
54
  "main": "dist/index.js",
54
55
  "peerDependencies": {
55
56
  "@getpara/aa-alchemy": ">=2.15.0",