@getpara/react-core 3.12.0-dev.0 → 3.12.0-dev.2

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.
@@ -6,9 +6,7 @@ export declare const ALCHEMY_SMART_ACCOUNT_BASE_KEY = "PARA_ALCHEMY_SMART_ACCOUN
6
6
  * Factory that creates a `useAlchemySmartAccount` hook with an optional enhancer.
7
7
  * Pass `useWagmiSignerEnhancer` on web to support external wallet signers.
8
8
  */
9
- export declare const createAlchemySmartAccountHook: (useEnhancer?: (params: UseAlchemySmartAccountParams) => SmartAccountEnhancement) => (params?: import("@getpara/aa-alchemy").AlchemySmartAccountConfig & {
10
- enabled?: boolean;
11
- }) => import("./types.js").UseSmartAccountResult<SmartAccount>;
9
+ export declare const createAlchemySmartAccountHook: (useEnhancer?: (params: UseAlchemySmartAccountParams) => SmartAccountEnhancement) => (params?: any) => import("./types.js").UseSmartAccountResult<SmartAccount>;
12
10
  /**
13
11
  * React / React Native hook to create and manage an Alchemy smart account.
14
12
  *
@@ -17,6 +15,4 @@ export declare const createAlchemySmartAccountHook: (useEnhancer?: (params: UseA
17
15
  *
18
16
  * Requires `@getpara/aa-alchemy` to be installed.
19
17
  */
20
- export declare const useAlchemySmartAccount: (params?: import("@getpara/aa-alchemy").AlchemySmartAccountConfig & {
21
- enabled?: boolean;
22
- }) => import("./types.js").UseSmartAccountResult<SmartAccount>;
18
+ export declare const useAlchemySmartAccount: (params?: any) => import("./types.js").UseSmartAccountResult<SmartAccount>;
@@ -6,9 +6,7 @@ export declare const BICONOMY_SMART_ACCOUNT_BASE_KEY = "PARA_BICONOMY_SMART_ACCO
6
6
  * Factory that creates a `useBiconomySmartAccount` hook with an optional enhancer.
7
7
  * Pass `useWagmiSignerEnhancer` on web to support external wallet signers.
8
8
  */
9
- export declare const createBiconomySmartAccountHook: (useEnhancer?: (params: UseBiconomySmartAccountParams) => SmartAccountEnhancement) => (params?: import("@getpara/aa-biconomy").BiconomySmartAccountConfig & {
10
- enabled?: boolean;
11
- }) => import("./types.js").UseSmartAccountResult<SmartAccount>;
9
+ export declare const createBiconomySmartAccountHook: (useEnhancer?: (params: UseBiconomySmartAccountParams) => SmartAccountEnhancement) => (params?: any) => import("./types.js").UseSmartAccountResult<SmartAccount>;
12
10
  /**
13
11
  * React / React Native hook to create and manage a Biconomy smart account.
14
12
  *
@@ -17,6 +15,4 @@ export declare const createBiconomySmartAccountHook: (useEnhancer?: (params: Use
17
15
  *
18
16
  * Requires `@getpara/aa-biconomy` to be installed.
19
17
  */
20
- export declare const useBiconomySmartAccount: (params?: import("@getpara/aa-biconomy").BiconomySmartAccountConfig & {
21
- enabled?: boolean;
22
- }) => import("./types.js").UseSmartAccountResult<SmartAccount>;
18
+ export declare const useBiconomySmartAccount: (params?: any) => import("./types.js").UseSmartAccountResult<SmartAccount>;
@@ -6,9 +6,7 @@ export declare const CDP_SMART_ACCOUNT_BASE_KEY = "PARA_CDP_SMART_ACCOUNT";
6
6
  * Factory that creates a `useCDPSmartAccount` hook with an optional enhancer.
7
7
  * Pass `useWagmiSignerEnhancer` on web to support external wallet signers.
8
8
  */
9
- export declare const createCDPSmartAccountHook: (useEnhancer?: (params: UseCDPSmartAccountParams) => SmartAccountEnhancement) => (params?: import("@getpara/aa-cdp").CDPSmartAccountConfig & {
10
- enabled?: boolean;
11
- }) => import("./types.js").UseSmartAccountResult<SmartAccount>;
9
+ export declare const createCDPSmartAccountHook: (useEnhancer?: (params: UseCDPSmartAccountParams) => SmartAccountEnhancement) => (params?: any) => import("./types.js").UseSmartAccountResult<SmartAccount>;
12
10
  /**
13
11
  * React / React Native hook to create and manage a Coinbase Developer Platform smart account.
14
12
  *
@@ -16,6 +14,4 @@ export declare const createCDPSmartAccountHook: (useEnhancer?: (params: UseCDPSm
16
14
  *
17
15
  * Requires `@getpara/aa-cdp` to be installed.
18
16
  */
19
- export declare const useCDPSmartAccount: (params?: import("@getpara/aa-cdp").CDPSmartAccountConfig & {
20
- enabled?: boolean;
21
- }) => import("./types.js").UseSmartAccountResult<SmartAccount>;
17
+ export declare const useCDPSmartAccount: (params?: any) => import("./types.js").UseSmartAccountResult<SmartAccount>;
@@ -6,9 +6,7 @@ export declare const GELATO_SMART_ACCOUNT_BASE_KEY = "PARA_GELATO_SMART_ACCOUNT"
6
6
  * Factory that creates a `useGelatoSmartAccount` hook with an optional enhancer.
7
7
  * Pass `useWagmiSignerEnhancer` on web to support external wallet signers.
8
8
  */
9
- export declare const createGelatoSmartAccountHook: (useEnhancer?: (params: UseGelatoSmartAccountParams) => SmartAccountEnhancement) => (params?: import("@getpara/aa-gelato").GelatoSmartAccountConfig & {
10
- enabled?: boolean;
11
- }) => import("./types.js").UseSmartAccountResult<SmartAccount>;
9
+ export declare const createGelatoSmartAccountHook: (useEnhancer?: (params: UseGelatoSmartAccountParams) => SmartAccountEnhancement) => (params?: any) => import("./types.js").UseSmartAccountResult<SmartAccount>;
12
10
  /**
13
11
  * React / React Native hook to create and manage a Gelato smart account.
14
12
  *
@@ -16,6 +14,4 @@ export declare const createGelatoSmartAccountHook: (useEnhancer?: (params: UseGe
16
14
  *
17
15
  * Requires `@getpara/aa-gelato` to be installed.
18
16
  */
19
- export declare const useGelatoSmartAccount: (params?: import("@getpara/aa-gelato").GelatoSmartAccountConfig & {
20
- enabled?: boolean;
21
- }) => import("./types.js").UseSmartAccountResult<SmartAccount>;
17
+ export declare const useGelatoSmartAccount: (params?: any) => import("./types.js").UseSmartAccountResult<SmartAccount>;
@@ -6,9 +6,7 @@ export declare const PORTO_ACCOUNT_BASE_KEY = "PARA_PORTO_ACCOUNT";
6
6
  * Factory that creates a `usePortoSmartAccount` hook with an optional enhancer.
7
7
  * Pass `useWagmiSignerEnhancer` on web to support external wallet signers.
8
8
  */
9
- export declare const createPortoSmartAccountHook: (useEnhancer?: (params: UsePortoSmartAccountParams) => SmartAccountEnhancement) => (params?: import("@getpara/aa-porto").PortoAccountConfig & {
10
- enabled?: boolean;
11
- }) => import("./types.js").UseSmartAccountResult<SmartAccount>;
9
+ export declare const createPortoSmartAccountHook: (useEnhancer?: (params: UsePortoSmartAccountParams) => SmartAccountEnhancement) => (params?: any) => import("./types.js").UseSmartAccountResult<SmartAccount>;
12
10
  /**
13
11
  * React / React Native hook to create and manage a Porto smart account.
14
12
  *
@@ -17,6 +15,4 @@ export declare const createPortoSmartAccountHook: (useEnhancer?: (params: UsePor
17
15
  *
18
16
  * Requires `@getpara/aa-porto` to be installed.
19
17
  */
20
- export declare const usePortoSmartAccount: (params?: import("@getpara/aa-porto").PortoAccountConfig & {
21
- enabled?: boolean;
22
- }) => import("./types.js").UseSmartAccountResult<SmartAccount>;
18
+ export declare const usePortoSmartAccount: (params?: any) => import("./types.js").UseSmartAccountResult<SmartAccount>;
@@ -6,9 +6,7 @@ export declare const RHINESTONE_SMART_ACCOUNT_BASE_KEY = "PARA_RHINESTONE_SMART_
6
6
  * Factory that creates a `useRhinestoneSmartAccount` hook with an optional enhancer.
7
7
  * Pass `useWagmiSignerEnhancer` on web to support external wallet signers.
8
8
  */
9
- export declare const createRhinestoneSmartAccountHook: (useEnhancer?: (params: UseRhinestoneSmartAccountParams) => SmartAccountEnhancement) => (params?: import("@getpara/aa-rhinestone").RhinestoneSmartAccountConfig & {
10
- enabled?: boolean;
11
- }) => import("./types.js").UseSmartAccountResult<SmartAccount>;
9
+ export declare const createRhinestoneSmartAccountHook: (useEnhancer?: (params: UseRhinestoneSmartAccountParams) => SmartAccountEnhancement) => (params?: any) => import("./types.js").UseSmartAccountResult<SmartAccount>;
12
10
  /**
13
11
  * React / React Native hook to create and manage a Rhinestone smart account.
14
12
  *
@@ -17,6 +15,4 @@ export declare const createRhinestoneSmartAccountHook: (useEnhancer?: (params: U
17
15
  *
18
16
  * Requires `@getpara/aa-rhinestone` to be installed.
19
17
  */
20
- export declare const useRhinestoneSmartAccount: (params?: import("@getpara/aa-rhinestone").RhinestoneSmartAccountConfig & {
21
- enabled?: boolean;
22
- }) => import("./types.js").UseSmartAccountResult<SmartAccount>;
18
+ export declare const useRhinestoneSmartAccount: (params?: any) => import("./types.js").UseSmartAccountResult<SmartAccount>;
@@ -6,9 +6,7 @@ export declare const SAFE_SMART_ACCOUNT_BASE_KEY = "PARA_SAFE_SMART_ACCOUNT";
6
6
  * Factory that creates a `useSafeSmartAccount` hook with an optional enhancer.
7
7
  * Pass `useWagmiSignerEnhancer` on web to support external wallet signers.
8
8
  */
9
- export declare const createSafeSmartAccountHook: (useEnhancer?: (params: UseSafeSmartAccountParams) => SmartAccountEnhancement) => (params?: import("@getpara/aa-safe").SafeSmartAccountConfig & {
10
- enabled?: boolean;
11
- }) => import("./types.js").UseSmartAccountResult<SmartAccount>;
9
+ export declare const createSafeSmartAccountHook: (useEnhancer?: (params: UseSafeSmartAccountParams) => SmartAccountEnhancement) => (params?: any) => import("./types.js").UseSmartAccountResult<SmartAccount>;
12
10
  /**
13
11
  * React / React Native hook to create and manage a Safe smart account.
14
12
  *
@@ -17,6 +15,4 @@ export declare const createSafeSmartAccountHook: (useEnhancer?: (params: UseSafe
17
15
  *
18
16
  * Requires `@getpara/aa-safe` to be installed.
19
17
  */
20
- export declare const useSafeSmartAccount: (params?: import("@getpara/aa-safe").SafeSmartAccountConfig & {
21
- enabled?: boolean;
22
- }) => import("./types.js").UseSmartAccountResult<SmartAccount>;
18
+ export declare const useSafeSmartAccount: (params?: any) => import("./types.js").UseSmartAccountResult<SmartAccount>;
@@ -6,9 +6,7 @@ export declare const THIRDWEB_SMART_ACCOUNT_BASE_KEY = "PARA_THIRDWEB_SMART_ACCO
6
6
  * Factory that creates a `useThirdwebSmartAccount` hook with an optional enhancer.
7
7
  * Pass `useWagmiSignerEnhancer` on web to support external wallet signers.
8
8
  */
9
- export declare const createThirdwebSmartAccountHook: (useEnhancer?: (params: UseThirdwebSmartAccountParams) => SmartAccountEnhancement) => (params?: import("@getpara/aa-thirdweb").ThirdwebSmartAccountConfig & {
10
- enabled?: boolean;
11
- }) => import("./types.js").UseSmartAccountResult<SmartAccount>;
9
+ export declare const createThirdwebSmartAccountHook: (useEnhancer?: (params: UseThirdwebSmartAccountParams) => SmartAccountEnhancement) => (params?: any) => import("./types.js").UseSmartAccountResult<SmartAccount>;
12
10
  /**
13
11
  * React / React Native hook to create and manage a Thirdweb smart account.
14
12
  *
@@ -17,6 +15,4 @@ export declare const createThirdwebSmartAccountHook: (useEnhancer?: (params: Use
17
15
  *
18
16
  * Requires `@getpara/aa-thirdweb` to be installed.
19
17
  */
20
- export declare const useThirdwebSmartAccount: (params?: import("@getpara/aa-thirdweb").ThirdwebSmartAccountConfig & {
21
- enabled?: boolean;
22
- }) => import("./types.js").UseSmartAccountResult<SmartAccount>;
18
+ export declare const useThirdwebSmartAccount: (params?: any) => import("./types.js").UseSmartAccountResult<SmartAccount>;
@@ -6,9 +6,7 @@ export declare const ZERODEV_SMART_ACCOUNT_BASE_KEY = "PARA_ZERODEV_SMART_ACCOUN
6
6
  * Factory that creates a `useZeroDevSmartAccount` hook with an optional enhancer.
7
7
  * Pass `useWagmiSignerEnhancer` on web to support external wallet signers.
8
8
  */
9
- export declare const createZeroDevSmartAccountHook: (useEnhancer?: (params: UseZeroDevSmartAccountParams) => SmartAccountEnhancement) => (params?: import("@getpara/aa-zerodev").ZeroDevSmartAccountConfig & {
10
- enabled?: boolean;
11
- }) => import("./types.js").UseSmartAccountResult<SmartAccount>;
9
+ export declare const createZeroDevSmartAccountHook: (useEnhancer?: (params: UseZeroDevSmartAccountParams) => SmartAccountEnhancement) => (params?: any) => import("./types.js").UseSmartAccountResult<SmartAccount>;
12
10
  /**
13
11
  * React / React Native hook to create and manage a ZeroDev smart account.
14
12
  *
@@ -17,6 +15,4 @@ export declare const createZeroDevSmartAccountHook: (useEnhancer?: (params: UseZ
17
15
  *
18
16
  * Requires `@getpara/aa-zerodev` to be installed.
19
17
  */
20
- export declare const useZeroDevSmartAccount: (params?: import("@getpara/aa-zerodev").ZeroDevSmartAccountConfig & {
21
- enabled?: boolean;
22
- }) => import("./types.js").UseSmartAccountResult<SmartAccount>;
18
+ export declare const useZeroDevSmartAccount: (params?: any) => import("./types.js").UseSmartAccountResult<SmartAccount>;
@@ -41,6 +41,7 @@ import { useQuery, useQueryClient } from "@tanstack/react-query";
41
41
  import { useEffect, useMemo, useRef } from "react";
42
42
  import { useClient } from "../utils/useClient.js";
43
43
  import { useIsFullyLoggedIn } from "./useIsFullyLoggedIn.js";
44
+ import { useCoreStore } from "../../stores/CoreStoreContext.js";
44
45
  import { getEmbeddedAccount } from "../../actions/getEmbeddedAccount.js";
45
46
  const ACCOUNT_BASE_KEY = "PARA_ACCOUNT";
46
47
  function useInvalidation(connections, queryKey) {
@@ -73,12 +74,18 @@ function createAccountHook(useExternalWallets) {
73
74
  var _a, _b;
74
75
  const client = useClient();
75
76
  const { data: isFullyLoggedIn, isSuccess, isLoading: isFullyLoggedInLoading } = useIsFullyLoggedIn();
77
+ const corePhase = useCoreStore((state) => {
78
+ var _a2;
79
+ return (_a2 = state.paraState) == null ? void 0 : _a2.corePhase;
80
+ });
81
+ const isSettled = corePhase === "authenticated" || corePhase === "guest_mode";
82
+ const isEmbeddedReady = isFullyLoggedIn && isSettled;
76
83
  const external = (_a = useExternalWallets == null ? void 0 : useExternalWallets()) != null ? _a : {
77
84
  queryKeys: [],
78
85
  connections: {},
79
86
  data: {}
80
87
  };
81
- const queryKey = [ACCOUNT_BASE_KEY, isFullyLoggedIn != null ? isFullyLoggedIn : null, (_b = client == null ? void 0 : client.userId) != null ? _b : null, ...external.queryKeys];
88
+ const queryKey = [ACCOUNT_BASE_KEY, isEmbeddedReady != null ? isEmbeddedReady : null, (_b = client == null ? void 0 : client.userId) != null ? _b : null, ...external.queryKeys];
82
89
  const connectionsKey = JSON.stringify(external.connections);
83
90
  const connections = useMemo(() => external.connections, [connectionsKey]);
84
91
  useInvalidation(connections, queryKey);
@@ -86,7 +93,7 @@ function createAccountHook(useExternalWallets) {
86
93
  enabled: isSuccess && !!client && !isFullyLoggedInLoading,
87
94
  queryKey,
88
95
  queryFn: () => __async(null, null, function* () {
89
- const paraAccount = yield getEmbeddedAccount(client, isFullyLoggedIn);
96
+ const paraAccount = yield getEmbeddedAccount(client, isEmbeddedReady);
90
97
  let connectionType = "none";
91
98
  const hasExternalConnection = Object.values(external.connections).some(Boolean);
92
99
  if (paraAccount.isConnected) {
@@ -22,7 +22,21 @@ import { useQuery } from "@tanstack/react-query";
22
22
  import { useClient } from "../utils/useClient.js";
23
23
  import { useCoreStore } from "../../stores/CoreStoreContext.js";
24
24
  const IS_FULLY_LOGGED_IN_BASE_KEY = "PARA_FULLY_LOGGED_IN";
25
- const FULL_LOGIN_RETRY_DELAY_MS = 1100;
25
+ const FULL_LOGIN_RETRY_DELAYS_MS = [1100, 2e3, 4e3, 8e3];
26
+ const waitForRetry = (delayMs, signal) => new Promise((resolve) => {
27
+ const timeoutId = setTimeout(onComplete, delayMs);
28
+ function onComplete() {
29
+ signal.removeEventListener("abort", onAbort);
30
+ resolve(true);
31
+ }
32
+ function onAbort() {
33
+ clearTimeout(timeoutId);
34
+ signal.removeEventListener("abort", onAbort);
35
+ resolve(false);
36
+ }
37
+ signal.addEventListener("abort", onAbort, { once: true });
38
+ if (signal.aborted) onAbort();
39
+ });
26
40
  const useIsFullyLoggedIn = () => {
27
41
  var _a;
28
42
  const client = useClient();
@@ -38,12 +52,16 @@ const useIsFullyLoggedIn = () => {
38
52
  return useQuery({
39
53
  enabled: isReady && !!client,
40
54
  queryKey: [IS_FULLY_LOGGED_IN_BASE_KEY, phaseKey, (_a = client == null ? void 0 : client.userId) != null ? _a : null],
41
- queryFn: () => __async(null, null, function* () {
55
+ queryFn: (_0) => __async(null, [_0], function* ({ signal }) {
42
56
  var _a2, _b;
43
- const isFullyLoggedIn = (_a2 = yield client == null ? void 0 : client.isFullyLoggedIn()) != null ? _a2 : false;
57
+ let isFullyLoggedIn = (_a2 = yield client == null ? void 0 : client.isFullyLoggedIn()) != null ? _a2 : false;
44
58
  if (isFullyLoggedIn || phaseKey !== "authenticated") return isFullyLoggedIn;
45
- yield new Promise((resolve) => setTimeout(resolve, FULL_LOGIN_RETRY_DELAY_MS));
46
- return (_b = yield client == null ? void 0 : client.isFullyLoggedIn()) != null ? _b : false;
59
+ for (const delayMs of FULL_LOGIN_RETRY_DELAYS_MS) {
60
+ if (!(yield waitForRetry(delayMs, signal))) return false;
61
+ isFullyLoggedIn = (_b = yield client == null ? void 0 : client.isFullyLoggedIn()) != null ? _b : false;
62
+ if (isFullyLoggedIn) return true;
63
+ }
64
+ return false;
47
65
  })
48
66
  });
49
67
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getpara/react-core",
3
- "version": "3.12.0-dev.0",
3
+ "version": "3.12.0-dev.2",
4
4
  "description": "Platform-agnostic ParaProvider, hooks, and store for Para SDK",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -89,18 +89,18 @@
89
89
  "test": "vitest run"
90
90
  },
91
91
  "dependencies": {
92
- "@getpara/core-sdk": "3.10.0",
92
+ "@getpara/core-sdk": "3.12.0-dev.2",
93
93
  "zustand": "^5.0.0"
94
94
  },
95
95
  "devDependencies": {
96
96
  "@cosmjs/amino": "^0.32.0",
97
97
  "@cosmjs/proto-signing": "^0.32.0",
98
- "@getpara/cosmjs-v0-integration": "3.10.0",
99
- "@getpara/ethers-v6-integration": "3.10.0",
100
- "@getpara/solana-signers-v2-integration": "3.10.0",
101
- "@getpara/stellar-sdk-v14-integration": "3.10.0",
102
- "@getpara/sui-sdk-integration": "3.10.0",
103
- "@getpara/viem-v2-integration": "3.10.0",
98
+ "@getpara/cosmjs-v0-integration": "3.11.0",
99
+ "@getpara/ethers-v6-integration": "3.11.0",
100
+ "@getpara/solana-signers-v2-integration": "3.11.0",
101
+ "@getpara/stellar-sdk-v14-integration": "3.11.0",
102
+ "@getpara/sui-sdk-integration": "3.11.0",
103
+ "@getpara/viem-v2-integration": "3.11.0",
104
104
  "@solana/signers": "^2.0.0",
105
105
  "@tanstack/react-query": "^5.74.0",
106
106
  "@testing-library/dom": "^10.4.0",