@getpara/react-core 3.20.0 → 3.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/chains/evm/ethers/mutations.js +10 -1
  2. package/dist/chains/evm/ethers/useParaEthersSigner.d.ts +2 -2
  3. package/dist/chains/evm/ethers/useParaEthersSigner.js +11 -3
  4. package/dist/chains/evm/viem/isSameEvmAddress.d.ts +1 -0
  5. package/dist/chains/evm/viem/isSameEvmAddress.js +6 -0
  6. package/dist/chains/evm/viem/mutations.js +6 -12
  7. package/dist/chains/evm/viem/useParaViemAccount.js +13 -9
  8. package/dist/chains/evm/viem/useParaViemClient.d.ts +2 -1
  9. package/dist/chains/evm/viem/useParaViemClient.js +22 -8
  10. package/dist/chains/solana/types.d.ts +3 -3
  11. package/dist/chains/solana/useParaSolanaSigner.js +4 -1
  12. package/dist/chains/stellar/mutations.js +2 -4
  13. package/dist/chains/sui/mutations.js +2 -4
  14. package/dist/chains/sui/suiClientKey.d.ts +2 -0
  15. package/dist/chains/sui/suiClientKey.js +5 -0
  16. package/dist/chains/sui/useParaSuiMultiSigSigner.d.ts +5 -3
  17. package/dist/chains/sui/useParaSuiMultiSigSigner.js +14 -3
  18. package/dist/chains/sui/useParaSuiSigner.d.ts +10 -3
  19. package/dist/chains/sui/useParaSuiSigner.js +13 -3
  20. package/dist/provider/ParaProviderCore.js +21 -6
  21. package/dist/provider/actions/getEmbeddedAccount.d.ts +2 -2
  22. package/dist/provider/actions/getWallet.d.ts +6 -0
  23. package/dist/provider/actions/index.d.ts +3 -3
  24. package/dist/provider/hooks/index.d.ts +0 -1
  25. package/dist/provider/hooks/index.js +0 -1
  26. package/dist/provider/hooks/mutations/useEnrollMfa.d.ts +26 -24
  27. package/dist/provider/hooks/mutations/useEnrollMfa.js +6 -3
  28. package/dist/provider/hooks/permissions/utils.js +2 -7
  29. package/dist/provider/hooks/queries/createAccountHook.d.ts +2 -2
  30. package/dist/provider/hooks/queries/createAccountHook.js +19 -7
  31. package/dist/provider/hooks/queries/useWallet.d.ts +7 -0
  32. package/dist/provider/index.d.ts +1 -0
  33. package/dist/provider/utils/objectIdentity.d.ts +1 -0
  34. package/dist/provider/utils/objectIdentity.js +15 -0
  35. package/package.json +177 -15
  36. package/dist/provider/hooks/aa/index.d.ts +0 -12
  37. package/dist/provider/hooks/aa/index.js +0 -48
@@ -1,7 +1,7 @@
1
1
  import type ParaCore from '@getpara/core-sdk';
2
- import type { SignUpOrLogInParams, SignUpOrLogInResponse, WaitForLoginParams, WaitForLoginResponse, WaitForSignupParams, WaitForWalletCreationParams, WaitForWalletCreationResponse, VerifyOAuthProcessParams, OAuthResponse, VerifyFarcasterParams, VerifyTelegramParams, LoginExternalWalletParams, LoginExternalWalletResponse, VerifyExternalWalletParams, VerifyExternalWalletResponse, Setup2faResponse, Enable2faParams, Verify2faParams, Verify2faResponse, EnrollMfaResponse, VerifyMfaParams, VerifyMfaResult, LogoutParams, ResendVerificationCodeParams, ResendVerificationCodeResponse, CreateWalletParams, CreateWalletResponse, CreateWalletPerTypeParams, CreateWalletPerTypeResponse, CreatePregenWalletParams, CreatePregenWalletResponse, CreatePregenWalletPerTypeParams, CreatePregenWalletPerTypeResponse, ClaimPregenWalletsParams, ClaimPregenWalletsResponse, HasPregenWalletParams, UpdatePregenWalletIdentifierParams, CreateGuestWalletsResponse, SignMessageParams, SignTransactionParams, FullSignatureRes, GetWalletBalanceParams, IssueJwtParams, IssueJwtResponse, GetLinkedAccountsParams, GetLinkedAccountsResponse, GetAuthFactorsResponse, AddAuthFactorParams, AddAuthFactorResponse, AddOAuthFactorParams, AddOAuthFactorResponse, AddExternalWalletFactorParams, AddExternalWalletFactorResponse, ContinueAuthFactorLinkParams, ContinueAuthFactorLinkResponse, UnlinkAuthFactorParams, AddCredentialParams, ExportPrivateKeyParams, ExportPrivateKeyResponse, RequestFaucetParams, RequestFaucetResponse, AuthenticateWithEmailOrPhoneParams, AuthenticateWithEmailOrPhoneResponse, AuthenticateWithOAuthParams, AuthenticateWithOAuthResponse, AuthenticateWithCustomOAuthParams, AuthenticateWithCustomOAuthResponse } from '@getpara/core-sdk';
2
+ import type { SignUpOrLogInParams, SignUpOrLogInResponse, WaitForLoginParams, WaitForLoginResponse, WaitForSignupParams, WaitForWalletCreationParams, WaitForWalletCreationResponse, VerifyOAuthProcessParams, OAuthResponse, VerifyFarcasterParams, VerifyTelegramParams, LoginExternalWalletParams, LoginExternalWalletResponse, VerifyExternalWalletParams, VerifyExternalWalletResponse, Setup2faResponse, Enable2faParams, Verify2faParams, Verify2faResponse, TwoFactorEnrollResponse, VerifyMfaParams, EnrollMfaParams, VerifyMfaResult, LogoutParams, ResendVerificationCodeParams, ResendVerificationCodeResponse, CreateWalletParams, CreateWalletResponse, CreateWalletPerTypeParams, CreateWalletPerTypeResponse, CreatePregenWalletParams, CreatePregenWalletResponse, CreatePregenWalletPerTypeParams, CreatePregenWalletPerTypeResponse, ClaimPregenWalletsParams, ClaimPregenWalletsResponse, HasPregenWalletParams, UpdatePregenWalletIdentifierParams, CreateGuestWalletsResponse, SignMessageParams, SignTransactionParams, FullSignatureRes, GetWalletBalanceParams, IssueJwtParams, IssueJwtResponse, GetLinkedAccountsParams, GetLinkedAccountsResponse, GetAuthFactorsResponse, AddAuthFactorParams, AddAuthFactorResponse, AddOAuthFactorParams, AddOAuthFactorResponse, AddExternalWalletFactorParams, AddExternalWalletFactorResponse, ContinueAuthFactorLinkParams, ContinueAuthFactorLinkResponse, UnlinkAuthFactorParams, AddCredentialParams, ExportPrivateKeyParams, ExportPrivateKeyResponse, RequestFaucetParams, RequestFaucetResponse, AuthenticateWithEmailOrPhoneParams, AuthenticateWithEmailOrPhoneResponse, AuthenticateWithOAuthParams, AuthenticateWithOAuthResponse, AuthenticateWithCustomOAuthParams, AuthenticateWithCustomOAuthResponse } from '@getpara/core-sdk';
3
3
  export { generateCoreAction, type CoreAction } from './utils.js';
4
- export { getEmbeddedAccount, type Account } from './getEmbeddedAccount.js';
4
+ export { getEmbeddedAccount, type EmbeddedAccount } from './getEmbeddedAccount.js';
5
5
  export { getWallet } from './getWallet.js';
6
6
  export declare const signUpOrLogIn: (para?: ParaCore, args?: SignUpOrLogInParams) => Promise<SignUpOrLogInResponse>;
7
7
  export declare const verifyNewAccount: import("./utils.js").CoreAction<"verifyNewAccount">;
@@ -16,7 +16,7 @@ export declare const verifyExternalWallet: (para?: ParaCore, args?: VerifyExtern
16
16
  export declare const setup2fa: (para?: ParaCore) => Promise<Setup2faResponse>;
17
17
  export declare const enable2fa: (para?: ParaCore, args?: Enable2faParams) => Promise<void>;
18
18
  export declare const verify2fa: (para?: ParaCore, args?: Verify2faParams) => Promise<Verify2faResponse>;
19
- export declare const enrollMfa: (para?: ParaCore) => Promise<EnrollMfaResponse>;
19
+ export declare const enrollMfa: (para?: ParaCore, args?: EnrollMfaParams) => Promise<TwoFactorEnrollResponse>;
20
20
  export declare const verifyMfa: (para?: ParaCore, args?: VerifyMfaParams) => Promise<VerifyMfaResult>;
21
21
  export declare const keepSessionAlive: (para?: ParaCore) => Promise<boolean>;
22
22
  export declare const logout: (para?: ParaCore, args?: LogoutParams) => Promise<void>;
@@ -1,4 +1,3 @@
1
1
  export * from './utils/index.js';
2
2
  export * from './queries/index.js';
3
3
  export * from './mutations/index.js';
4
- export * from './aa/index.js';
@@ -1,4 +1,3 @@
1
1
  export * from "./utils/index.js";
2
2
  export * from "./queries/index.js";
3
3
  export * from "./mutations/index.js";
4
- export * from "./aa/index.js";
@@ -1,11 +1,13 @@
1
- import type { EnrollMfaResponse } from '@getpara/core-sdk';
1
+ import type { TwoFactorEnrollResponse } from '@getpara/core-sdk';
2
2
  export declare const ENROLL_MFA_KEY = "ENROLL_MFA";
3
3
  /**
4
4
  * React hook for the `enrollMfa` mutation — login-time 2FA enrollment (ENG-6906).
5
5
  *
6
- * Enrolls a TOTP second factor for the current session and returns the otpauth
7
- * `uri` (render as a QR) plus one-time `backupCodes` (show the user exactly once).
8
- * Distinct from `useSetup2fa`, which configures the recovery-gating 2FA.
6
+ * With no args enrolls a TOTP second factor for the current session and returns the otpauth
7
+ * `uri` (render as a QR) plus one-time `backupCodes` (show the user exactly once). A credential
8
+ * second factor (passkey / password / PIN — enclave-custodied accounts only) passes its
9
+ * method-tagged body; a passkey is two calls (`{ method:'passkey' }` → challenge, then the
10
+ * registration over it). Distinct from `useSetup2fa`, which configures the recovery-gating 2FA.
9
11
  *
10
12
  * Returns a mutation result object with all standard fields from `useMutation`, except:
11
13
  * - `mutate` and `mutateAsync` are replaced by:
@@ -25,71 +27,71 @@ export declare const useEnrollMfa: () => {
25
27
  isPending: false;
26
28
  isSuccess: false;
27
29
  status: "idle";
28
- mutate: import("@tanstack/react-query").UseMutateFunction<EnrollMfaResponse, Error, void, unknown>;
30
+ mutate: import("@tanstack/react-query").UseMutateFunction<TwoFactorEnrollResponse, Error, import("@getpara/user-management-client").TwoFactorEnrollBody, unknown>;
29
31
  reset: () => void;
30
32
  context: unknown;
31
33
  failureCount: number;
32
34
  failureReason: Error;
33
35
  isPaused: boolean;
34
36
  submittedAt: number;
35
- mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<EnrollMfaResponse, Error, void, unknown>;
36
- enrollMfa: import("@tanstack/react-query").UseMutateFunction<EnrollMfaResponse, Error, void, unknown>;
37
- enrollMfaAsync: import("@tanstack/react-query").UseMutateAsyncFunction<EnrollMfaResponse, Error, void, unknown>;
37
+ mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<TwoFactorEnrollResponse, Error, import("@getpara/user-management-client").TwoFactorEnrollBody, unknown>;
38
+ enrollMfa: import("@tanstack/react-query").UseMutateFunction<TwoFactorEnrollResponse, Error, import("@getpara/user-management-client").TwoFactorEnrollBody, unknown>;
39
+ enrollMfaAsync: import("@tanstack/react-query").UseMutateAsyncFunction<TwoFactorEnrollResponse, Error, import("@getpara/user-management-client").TwoFactorEnrollBody, unknown>;
38
40
  } | {
39
41
  data: undefined;
40
- variables: void;
42
+ variables: import("@getpara/user-management-client").TwoFactorEnrollBody;
41
43
  error: null;
42
44
  isError: false;
43
45
  isIdle: false;
44
46
  isPending: true;
45
47
  isSuccess: false;
46
48
  status: "pending";
47
- mutate: import("@tanstack/react-query").UseMutateFunction<EnrollMfaResponse, Error, void, unknown>;
49
+ mutate: import("@tanstack/react-query").UseMutateFunction<TwoFactorEnrollResponse, Error, import("@getpara/user-management-client").TwoFactorEnrollBody, unknown>;
48
50
  reset: () => void;
49
51
  context: unknown;
50
52
  failureCount: number;
51
53
  failureReason: Error;
52
54
  isPaused: boolean;
53
55
  submittedAt: number;
54
- mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<EnrollMfaResponse, Error, void, unknown>;
55
- enrollMfa: import("@tanstack/react-query").UseMutateFunction<EnrollMfaResponse, Error, void, unknown>;
56
- enrollMfaAsync: import("@tanstack/react-query").UseMutateAsyncFunction<EnrollMfaResponse, Error, void, unknown>;
56
+ mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<TwoFactorEnrollResponse, Error, import("@getpara/user-management-client").TwoFactorEnrollBody, unknown>;
57
+ enrollMfa: import("@tanstack/react-query").UseMutateFunction<TwoFactorEnrollResponse, Error, import("@getpara/user-management-client").TwoFactorEnrollBody, unknown>;
58
+ enrollMfaAsync: import("@tanstack/react-query").UseMutateAsyncFunction<TwoFactorEnrollResponse, Error, import("@getpara/user-management-client").TwoFactorEnrollBody, unknown>;
57
59
  } | {
58
60
  data: undefined;
59
61
  error: Error;
60
- variables: void;
62
+ variables: import("@getpara/user-management-client").TwoFactorEnrollBody;
61
63
  isError: true;
62
64
  isIdle: false;
63
65
  isPending: false;
64
66
  isSuccess: false;
65
67
  status: "error";
66
- mutate: import("@tanstack/react-query").UseMutateFunction<EnrollMfaResponse, Error, void, unknown>;
68
+ mutate: import("@tanstack/react-query").UseMutateFunction<TwoFactorEnrollResponse, Error, import("@getpara/user-management-client").TwoFactorEnrollBody, unknown>;
67
69
  reset: () => void;
68
70
  context: unknown;
69
71
  failureCount: number;
70
72
  failureReason: Error;
71
73
  isPaused: boolean;
72
74
  submittedAt: number;
73
- mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<EnrollMfaResponse, Error, void, unknown>;
74
- enrollMfa: import("@tanstack/react-query").UseMutateFunction<EnrollMfaResponse, Error, void, unknown>;
75
- enrollMfaAsync: import("@tanstack/react-query").UseMutateAsyncFunction<EnrollMfaResponse, Error, void, unknown>;
75
+ mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<TwoFactorEnrollResponse, Error, import("@getpara/user-management-client").TwoFactorEnrollBody, unknown>;
76
+ enrollMfa: import("@tanstack/react-query").UseMutateFunction<TwoFactorEnrollResponse, Error, import("@getpara/user-management-client").TwoFactorEnrollBody, unknown>;
77
+ enrollMfaAsync: import("@tanstack/react-query").UseMutateAsyncFunction<TwoFactorEnrollResponse, Error, import("@getpara/user-management-client").TwoFactorEnrollBody, unknown>;
76
78
  } | {
77
- data: EnrollMfaResponse;
79
+ data: TwoFactorEnrollResponse;
78
80
  error: null;
79
- variables: void;
81
+ variables: import("@getpara/user-management-client").TwoFactorEnrollBody;
80
82
  isError: false;
81
83
  isIdle: false;
82
84
  isPending: false;
83
85
  isSuccess: true;
84
86
  status: "success";
85
- mutate: import("@tanstack/react-query").UseMutateFunction<EnrollMfaResponse, Error, void, unknown>;
87
+ mutate: import("@tanstack/react-query").UseMutateFunction<TwoFactorEnrollResponse, Error, import("@getpara/user-management-client").TwoFactorEnrollBody, unknown>;
86
88
  reset: () => void;
87
89
  context: unknown;
88
90
  failureCount: number;
89
91
  failureReason: Error;
90
92
  isPaused: boolean;
91
93
  submittedAt: number;
92
- mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<EnrollMfaResponse, Error, void, unknown>;
93
- enrollMfa: import("@tanstack/react-query").UseMutateFunction<EnrollMfaResponse, Error, void, unknown>;
94
- enrollMfaAsync: import("@tanstack/react-query").UseMutateAsyncFunction<EnrollMfaResponse, Error, void, unknown>;
94
+ mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<TwoFactorEnrollResponse, Error, import("@getpara/user-management-client").TwoFactorEnrollBody, unknown>;
95
+ enrollMfa: import("@tanstack/react-query").UseMutateFunction<TwoFactorEnrollResponse, Error, import("@getpara/user-management-client").TwoFactorEnrollBody, unknown>;
96
+ enrollMfaAsync: import("@tanstack/react-query").UseMutateAsyncFunction<TwoFactorEnrollResponse, Error, import("@getpara/user-management-client").TwoFactorEnrollBody, unknown>;
95
97
  };
@@ -27,11 +27,14 @@ const useEnrollMfa = () => {
27
27
  const para = useClient();
28
28
  const mutation = useMutation({
29
29
  mutationKey: [ENROLL_MFA_KEY],
30
- mutationFn: () => __async(null, null, function* () {
31
- return enrollMfa(para);
30
+ mutationFn: (args) => __async(null, null, function* () {
31
+ return enrollMfa(para, args);
32
32
  })
33
33
  });
34
- return renameMutations(mutation, "enrollMfa");
34
+ return renameMutations(
35
+ mutation,
36
+ "enrollMfa"
37
+ );
35
38
  };
36
39
  export {
37
40
  ENROLL_MFA_KEY,
@@ -22,14 +22,9 @@ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
22
22
  import { useClient } from "../utils/useClient.js";
23
23
  import { useIsFullyLoggedIn } from "../queries/useIsFullyLoggedIn.js";
24
24
  import { renameMutations } from "../../utils/renameMutations.js";
25
+ import { createObjectIdentity } from "../../utils/objectIdentity.js";
25
26
  const PERMISSIONS_KEY = "PARA_PERMISSIONS";
26
- const clients = /* @__PURE__ */ new WeakMap();
27
- let nextClientId = 0;
28
- function clientKey(client) {
29
- if (!client) return null;
30
- if (!clients.has(client)) clients.set(client, ++nextClientId);
31
- return clients.get(client);
32
- }
27
+ const clientKey = createObjectIdentity();
33
28
  function usePermissionsQuery(method, args, read, isPublic = false) {
34
29
  const client = useClient();
35
30
  const { data: loggedIn } = useIsFullyLoggedIn();
@@ -1,4 +1,4 @@
1
- import { type Account } from '../../actions/getEmbeddedAccount.js';
1
+ import { type EmbeddedAccount } from '../../actions/getEmbeddedAccount.js';
2
2
  export declare const ACCOUNT_BASE_KEY = "PARA_ACCOUNT";
3
3
  export type ConnectionType = 'embedded' | 'external' | 'both' | 'none';
4
4
  /**
@@ -28,7 +28,7 @@ export interface UseAccountReturn<TExternal = Record<string, unknown>> {
28
28
  */
29
29
  connectionType: ConnectionType;
30
30
  /** The embedded Para account. Use this instead of deprecated top-level properties. */
31
- embedded: Omit<Account, 'isReady' | 'isFarcasterMiniApp' | 'isConnected' | 'isGuestMode'> & {
31
+ embedded: Omit<EmbeddedAccount, 'isReady' | 'isFarcasterMiniApp' | 'isConnected' | 'isGuestMode'> & {
32
32
  isConnected: boolean;
33
33
  isGuestMode?: boolean;
34
34
  };
@@ -44,6 +44,14 @@ import { useIsFullyLoggedIn } from "./useIsFullyLoggedIn.js";
44
44
  import { useCoreStore } from "../../stores/CoreStoreContext.js";
45
45
  import { getEmbeddedAccount } from "../../actions/getEmbeddedAccount.js";
46
46
  const ACCOUNT_BASE_KEY = "PARA_ACCOUNT";
47
+ const ACCOUNT_IDENTITY_KEY_LENGTH = 3;
48
+ function isSameAccountIdentity(previousKey, nextKey) {
49
+ if (!previousKey) return false;
50
+ for (let index = 0; index < ACCOUNT_IDENTITY_KEY_LENGTH; index += 1) {
51
+ if (previousKey[index] !== nextKey[index]) return false;
52
+ }
53
+ return true;
54
+ }
47
55
  function useInvalidation(connections, queryKey) {
48
56
  const queryClient = useQueryClient();
49
57
  const lastConnectionStateRef = useRef(null);
@@ -92,18 +100,22 @@ function createAccountHook(useExternalWallets) {
92
100
  const { data, isLoading } = useQuery({
93
101
  enabled: isSuccess && !!client && !isFullyLoggedInLoading,
94
102
  queryKey,
103
+ // Connector state participates in the key. Keep the last valid account
104
+ // mounted while a replacement key resolves so active actions are not lost.
105
+ placeholderData: (previousData, previousQuery) => isSameAccountIdentity(previousQuery == null ? void 0 : previousQuery.queryKey, queryKey) ? previousData : void 0,
95
106
  queryFn: () => __async(null, null, function* () {
107
+ var _a2;
96
108
  const paraAccount = yield getEmbeddedAccount(client, isEmbeddedReady);
97
109
  let connectionType = "none";
98
110
  const hasExternalConnection = Object.values(external.connections).some(Boolean);
111
+ const wallets = (_a2 = paraAccount.wallets) != null ? _a2 : [];
112
+ const hasExternalWallet = wallets.some((w) => "isExternal" in w && w.isExternal);
113
+ const hasEmbeddedWallet = wallets.some((w) => !("isExternal" in w) || !w.isExternal);
99
114
  if (paraAccount.isConnected) {
100
- connectionType = "embedded";
101
- if (paraAccount.wallets.some((w) => "isExternal" in w && w.isExternal)) {
102
- connectionType = "both";
103
- }
104
- if (paraAccount.wallets.every((w) => "isExternal" in w && w.isExternal) && hasExternalConnection) {
105
- connectionType = "external";
106
- }
115
+ if (hasEmbeddedWallet && hasExternalWallet) connectionType = "both";
116
+ else if (hasEmbeddedWallet) connectionType = "embedded";
117
+ else if (hasExternalWallet || hasExternalConnection) connectionType = "external";
118
+ else connectionType = "embedded";
107
119
  }
108
120
  const isEmbeddedConnected = connectionType === "embedded" || connectionType === "both";
109
121
  const connectedNetworks = Object.entries(external.connections).filter(([, connected]) => connected).map(([network]) => network);
@@ -0,0 +1,7 @@
1
+ import { type UseQueryResult } from '@tanstack/react-query';
2
+ import { getWallet } from '../../actions/getWallet.js';
3
+ export declare const WALLET_BASE_KEY = "PARA_WALLET";
4
+ /**
5
+ * Hook for retrieving the selected wallet.
6
+ */
7
+ export declare const useWallet: () => UseQueryResult<Awaited<ReturnType<typeof getWallet>>>;
@@ -1,5 +1,6 @@
1
1
  export { ParaProviderCore, type ParaProviderBaseProps, type ParaProviderCoreProps, type ParaClientConfig, type ParaClientConfigWithFactory, type CoreProviderConfig, type CoreCallbacks, type ParaCallbackEvent, } from './ParaProviderCore.js';
2
2
  export * from './stores/index.js';
3
3
  export * from './hooks/index.js';
4
+ export type { Account } from './hooks/index.js';
4
5
  export * from './actions/index.js';
5
6
  export { renameMutations, type Compute } from './utils/renameMutations.js';
@@ -0,0 +1 @@
1
+ export declare function createObjectIdentity<T extends object>(): (value: T | null | undefined) => number | null;
@@ -0,0 +1,15 @@
1
+ function createObjectIdentity() {
2
+ const identities = /* @__PURE__ */ new WeakMap();
3
+ let nextIdentity = 0;
4
+ return function identify(value) {
5
+ if (!value) return null;
6
+ const existingIdentity = identities.get(value);
7
+ if (existingIdentity !== void 0) return existingIdentity;
8
+ const identity = ++nextIdentity;
9
+ identities.set(value, identity);
10
+ return identity;
11
+ };
12
+ }
13
+ export {
14
+ createObjectIdentity
15
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getpara/react-core",
3
- "version": "3.20.0",
3
+ "version": "3.22.0",
4
4
  "description": "Platform-agnostic ParaProvider, hooks, and store for Para SDK",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -16,6 +16,50 @@
16
16
  "types": "./dist/provider/index.d.ts",
17
17
  "import": "./dist/provider/index.js"
18
18
  },
19
+ "./internal/aa/types": {
20
+ "types": "./dist/provider/hooks/aa/types.d.ts",
21
+ "import": "./dist/provider/hooks/aa/types.js"
22
+ },
23
+ "./internal/aa/alchemy": {
24
+ "types": "./dist/provider/hooks/aa/alchemy.d.ts",
25
+ "import": "./dist/provider/hooks/aa/alchemy.js"
26
+ },
27
+ "./internal/aa/biconomy": {
28
+ "types": "./dist/provider/hooks/aa/biconomy.d.ts",
29
+ "import": "./dist/provider/hooks/aa/biconomy.js"
30
+ },
31
+ "./internal/aa/cdp": {
32
+ "types": "./dist/provider/hooks/aa/cdp.d.ts",
33
+ "import": "./dist/provider/hooks/aa/cdp.js"
34
+ },
35
+ "./internal/aa/gelato": {
36
+ "types": "./dist/provider/hooks/aa/gelato.d.ts",
37
+ "import": "./dist/provider/hooks/aa/gelato.js"
38
+ },
39
+ "./internal/aa/pimlico": {
40
+ "types": "./dist/provider/hooks/aa/pimlico.d.ts",
41
+ "import": "./dist/provider/hooks/aa/pimlico.js"
42
+ },
43
+ "./internal/aa/porto": {
44
+ "types": "./dist/provider/hooks/aa/porto.d.ts",
45
+ "import": "./dist/provider/hooks/aa/porto.js"
46
+ },
47
+ "./internal/aa/rhinestone": {
48
+ "types": "./dist/provider/hooks/aa/rhinestone.d.ts",
49
+ "import": "./dist/provider/hooks/aa/rhinestone.js"
50
+ },
51
+ "./internal/aa/safe": {
52
+ "types": "./dist/provider/hooks/aa/safe.d.ts",
53
+ "import": "./dist/provider/hooks/aa/safe.js"
54
+ },
55
+ "./internal/aa/thirdweb": {
56
+ "types": "./dist/provider/hooks/aa/thirdweb.d.ts",
57
+ "import": "./dist/provider/hooks/aa/thirdweb.js"
58
+ },
59
+ "./internal/aa/zerodev": {
60
+ "types": "./dist/provider/hooks/aa/zerodev.d.ts",
61
+ "import": "./dist/provider/hooks/aa/zerodev.js"
62
+ },
19
63
  "./mutations": {
20
64
  "types": "./dist/mutations.d.ts",
21
65
  "import": "./dist/mutations.js"
@@ -54,6 +98,39 @@
54
98
  "internal": [
55
99
  "./dist/provider/index.d.ts"
56
100
  ],
101
+ "internal/aa/types": [
102
+ "./dist/provider/hooks/aa/types.d.ts"
103
+ ],
104
+ "internal/aa/alchemy": [
105
+ "./dist/provider/hooks/aa/alchemy.d.ts"
106
+ ],
107
+ "internal/aa/biconomy": [
108
+ "./dist/provider/hooks/aa/biconomy.d.ts"
109
+ ],
110
+ "internal/aa/cdp": [
111
+ "./dist/provider/hooks/aa/cdp.d.ts"
112
+ ],
113
+ "internal/aa/gelato": [
114
+ "./dist/provider/hooks/aa/gelato.d.ts"
115
+ ],
116
+ "internal/aa/pimlico": [
117
+ "./dist/provider/hooks/aa/pimlico.d.ts"
118
+ ],
119
+ "internal/aa/porto": [
120
+ "./dist/provider/hooks/aa/porto.d.ts"
121
+ ],
122
+ "internal/aa/rhinestone": [
123
+ "./dist/provider/hooks/aa/rhinestone.d.ts"
124
+ ],
125
+ "internal/aa/safe": [
126
+ "./dist/provider/hooks/aa/safe.d.ts"
127
+ ],
128
+ "internal/aa/thirdweb": [
129
+ "./dist/provider/hooks/aa/thirdweb.d.ts"
130
+ ],
131
+ "internal/aa/zerodev": [
132
+ "./dist/provider/hooks/aa/zerodev.d.ts"
133
+ ],
57
134
  "mutations": [
58
135
  "./dist/mutations.d.ts"
59
136
  ],
@@ -85,48 +162,116 @@
85
162
  "package.json"
86
163
  ],
87
164
  "scripts": {
88
- "build": "rm -rf dist && node ./scripts/build.mjs; tsc --emitDeclarationOnly || true",
89
- "test": "vitest run"
165
+ "build": "rm -rf dist && node ./scripts/build.mjs && yarn build:types",
166
+ "test": "vitest run --coverage",
167
+ "build:types": "tsc --emitDeclarationOnly",
168
+ "typecheck": "tsc --noEmit"
90
169
  },
91
170
  "dependencies": {
92
- "@getpara/core-sdk": "3.20.0",
171
+ "@getpara/core-sdk": "3.22.0",
93
172
  "zustand": "^5.0.0"
94
173
  },
95
174
  "devDependencies": {
96
- "@cosmjs/amino": "^0.32.0",
97
- "@cosmjs/proto-signing": "^0.32.0",
98
- "@getpara/cosmjs-v0-integration": "3.20.0",
99
- "@getpara/ethers-v6-integration": "3.20.0",
100
- "@getpara/solana-signers-v2-integration": "3.20.0",
101
- "@getpara/stellar-sdk-v14-integration": "3.20.0",
102
- "@getpara/sui-sdk-integration": "3.20.0",
103
- "@getpara/viem-v2-integration": "3.20.0",
175
+ "@cosmjs/amino": "^0.32.4",
176
+ "@cosmjs/proto-signing": "^0.32.4",
177
+ "@cosmjs/stargate": "^0.32.4",
178
+ "@getpara/aa-alchemy": "3.22.0",
179
+ "@getpara/aa-biconomy": "3.22.0",
180
+ "@getpara/aa-cdp": "3.22.0",
181
+ "@getpara/aa-gelato": "3.22.0",
182
+ "@getpara/aa-pimlico": "3.22.0",
183
+ "@getpara/aa-porto": "3.22.0",
184
+ "@getpara/aa-rhinestone": "3.22.0",
185
+ "@getpara/aa-safe": "3.22.0",
186
+ "@getpara/aa-thirdweb": "3.22.0",
187
+ "@getpara/aa-zerodev": "3.22.0",
188
+ "@getpara/cosmjs-v0-integration": "3.22.0",
189
+ "@getpara/ethers-v6-integration": "3.22.0",
190
+ "@getpara/solana-signers-v2-integration": "3.22.0",
191
+ "@getpara/stellar-sdk-v14-integration": "3.22.0",
192
+ "@getpara/sui-sdk-integration": "3.22.0",
193
+ "@getpara/viem-v2-integration": "3.22.0",
194
+ "@mysten/sui": "^2.0.0",
195
+ "@solana/keys": "^2.2.1",
104
196
  "@solana/signers": "^2.0.0",
197
+ "@stellar/stellar-sdk": "^14.0.0",
105
198
  "@tanstack/react-query": "^5.74.0",
106
199
  "@testing-library/dom": "^10.4.0",
107
200
  "@testing-library/react": "^16.3.0",
108
201
  "@types/react": "^18.3.3",
109
202
  "esbuild": "^0.28.1",
203
+ "ethers": "^6.13.5",
110
204
  "glob": "^11.0.2",
111
205
  "jsdom": "^25.0.0",
112
206
  "react": "^18.3.1",
113
207
  "react-dom": "^18.3.1",
114
208
  "typescript": "^5.8.3",
115
- "viem": "2.42.1",
209
+ "viem": "^2.39.0",
116
210
  "vitest": "^3.0.0"
117
211
  },
118
212
  "peerDependencies": {
213
+ "@cosmjs/amino": ">=0.32.4",
214
+ "@cosmjs/proto-signing": ">=0.32.4",
215
+ "@getpara/aa-alchemy": ">=2.15.0",
216
+ "@getpara/aa-biconomy": ">=2.15.0",
217
+ "@getpara/aa-cdp": ">=2.15.0",
218
+ "@getpara/aa-gelato": ">=2.15.0",
219
+ "@getpara/aa-pimlico": ">=2.15.0",
220
+ "@getpara/aa-porto": ">=2.15.0",
221
+ "@getpara/aa-rhinestone": ">=2.15.0",
222
+ "@getpara/aa-safe": ">=2.15.0",
223
+ "@getpara/aa-thirdweb": ">=2.15.0",
224
+ "@getpara/aa-zerodev": ">=2.15.0",
119
225
  "@getpara/cosmjs-v0-integration": ">=2",
120
226
  "@getpara/ethers-v6-integration": ">=2",
121
227
  "@getpara/solana-signers-v2-integration": ">=2",
122
228
  "@getpara/stellar-sdk-v14-integration": ">=2",
123
229
  "@getpara/sui-sdk-integration": ">=2",
124
230
  "@getpara/viem-v2-integration": ">=2",
231
+ "@solana/signers": ">=2.0.0",
232
+ "@stellar/stellar-sdk": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0",
125
233
  "@tanstack/react-query": ">=5",
234
+ "ethers": "^6.0.0",
126
235
  "react": ">=18",
127
- "viem": ">=2"
236
+ "viem": "^2.0.0"
128
237
  },
129
238
  "peerDependenciesMeta": {
239
+ "@cosmjs/amino": {
240
+ "optional": true
241
+ },
242
+ "@cosmjs/proto-signing": {
243
+ "optional": true
244
+ },
245
+ "@getpara/aa-alchemy": {
246
+ "optional": true
247
+ },
248
+ "@getpara/aa-biconomy": {
249
+ "optional": true
250
+ },
251
+ "@getpara/aa-cdp": {
252
+ "optional": true
253
+ },
254
+ "@getpara/aa-gelato": {
255
+ "optional": true
256
+ },
257
+ "@getpara/aa-pimlico": {
258
+ "optional": true
259
+ },
260
+ "@getpara/aa-porto": {
261
+ "optional": true
262
+ },
263
+ "@getpara/aa-rhinestone": {
264
+ "optional": true
265
+ },
266
+ "@getpara/aa-safe": {
267
+ "optional": true
268
+ },
269
+ "@getpara/aa-thirdweb": {
270
+ "optional": true
271
+ },
272
+ "@getpara/aa-zerodev": {
273
+ "optional": true
274
+ },
130
275
  "@getpara/cosmjs-v0-integration": {
131
276
  "optional": true
132
277
  },
@@ -144,7 +289,24 @@
144
289
  },
145
290
  "@getpara/viem-v2-integration": {
146
291
  "optional": true
292
+ },
293
+ "@solana/signers": {
294
+ "optional": true
295
+ },
296
+ "@stellar/stellar-sdk": {
297
+ "optional": true
298
+ },
299
+ "ethers": {
300
+ "optional": true
301
+ },
302
+ "viem": {
303
+ "optional": true
147
304
  }
148
305
  },
149
- "gitHead": "0a7224c678bc2b172bd41cce75637a8783869a93"
306
+ "nx": {
307
+ "implicitDependencies": [
308
+ "@getpara/aa-*"
309
+ ]
310
+ },
311
+ "gitHead": "4ca50a0fc70e11370595f16daad0f1ac4da0edbc"
150
312
  }
@@ -1,12 +0,0 @@
1
- export { createSmartAccountHook } from './createSmartAccountHook.js';
2
- export type { SmartAccountHookConfig, SmartAccountEnhancement, UseSmartAccountResult } from './types.js';
3
- export { useAlchemySmartAccount, createAlchemySmartAccountHook, ALCHEMY_SMART_ACCOUNT_BASE_KEY } from './alchemy.js';
4
- export { useBiconomySmartAccount, createBiconomySmartAccountHook, BICONOMY_SMART_ACCOUNT_BASE_KEY } from './biconomy.js';
5
- export { useCDPSmartAccount, createCDPSmartAccountHook, CDP_SMART_ACCOUNT_BASE_KEY } from './cdp.js';
6
- export { useGelatoSmartAccount, createGelatoSmartAccountHook, GELATO_SMART_ACCOUNT_BASE_KEY } from './gelato.js';
7
- export { usePimlicoSmartAccount, createPimlicoSmartAccountHook, PIMLICO_SMART_ACCOUNT_BASE_KEY } from './pimlico.js';
8
- export { usePortoSmartAccount, createPortoSmartAccountHook, PORTO_ACCOUNT_BASE_KEY } from './porto.js';
9
- export { useRhinestoneSmartAccount, createRhinestoneSmartAccountHook, RHINESTONE_SMART_ACCOUNT_BASE_KEY, } from './rhinestone.js';
10
- export { useSafeSmartAccount, createSafeSmartAccountHook, SAFE_SMART_ACCOUNT_BASE_KEY } from './safe.js';
11
- export { useThirdwebSmartAccount, createThirdwebSmartAccountHook, THIRDWEB_SMART_ACCOUNT_BASE_KEY } from './thirdweb.js';
12
- export { useZeroDevSmartAccount, createZeroDevSmartAccountHook, ZERODEV_SMART_ACCOUNT_BASE_KEY } from './zerodev.js';
@@ -1,48 +0,0 @@
1
- import { createSmartAccountHook } from "./createSmartAccountHook.js";
2
- import { useAlchemySmartAccount, createAlchemySmartAccountHook, ALCHEMY_SMART_ACCOUNT_BASE_KEY } from "./alchemy.js";
3
- import { useBiconomySmartAccount, createBiconomySmartAccountHook, BICONOMY_SMART_ACCOUNT_BASE_KEY } from "./biconomy.js";
4
- import { useCDPSmartAccount, createCDPSmartAccountHook, CDP_SMART_ACCOUNT_BASE_KEY } from "./cdp.js";
5
- import { useGelatoSmartAccount, createGelatoSmartAccountHook, GELATO_SMART_ACCOUNT_BASE_KEY } from "./gelato.js";
6
- import { usePimlicoSmartAccount, createPimlicoSmartAccountHook, PIMLICO_SMART_ACCOUNT_BASE_KEY } from "./pimlico.js";
7
- import { usePortoSmartAccount, createPortoSmartAccountHook, PORTO_ACCOUNT_BASE_KEY } from "./porto.js";
8
- import {
9
- useRhinestoneSmartAccount,
10
- createRhinestoneSmartAccountHook,
11
- RHINESTONE_SMART_ACCOUNT_BASE_KEY
12
- } from "./rhinestone.js";
13
- import { useSafeSmartAccount, createSafeSmartAccountHook, SAFE_SMART_ACCOUNT_BASE_KEY } from "./safe.js";
14
- import { useThirdwebSmartAccount, createThirdwebSmartAccountHook, THIRDWEB_SMART_ACCOUNT_BASE_KEY } from "./thirdweb.js";
15
- import { useZeroDevSmartAccount, createZeroDevSmartAccountHook, ZERODEV_SMART_ACCOUNT_BASE_KEY } from "./zerodev.js";
16
- export {
17
- ALCHEMY_SMART_ACCOUNT_BASE_KEY,
18
- BICONOMY_SMART_ACCOUNT_BASE_KEY,
19
- CDP_SMART_ACCOUNT_BASE_KEY,
20
- GELATO_SMART_ACCOUNT_BASE_KEY,
21
- PIMLICO_SMART_ACCOUNT_BASE_KEY,
22
- PORTO_ACCOUNT_BASE_KEY,
23
- RHINESTONE_SMART_ACCOUNT_BASE_KEY,
24
- SAFE_SMART_ACCOUNT_BASE_KEY,
25
- THIRDWEB_SMART_ACCOUNT_BASE_KEY,
26
- ZERODEV_SMART_ACCOUNT_BASE_KEY,
27
- createAlchemySmartAccountHook,
28
- createBiconomySmartAccountHook,
29
- createCDPSmartAccountHook,
30
- createGelatoSmartAccountHook,
31
- createPimlicoSmartAccountHook,
32
- createPortoSmartAccountHook,
33
- createRhinestoneSmartAccountHook,
34
- createSafeSmartAccountHook,
35
- createSmartAccountHook,
36
- createThirdwebSmartAccountHook,
37
- createZeroDevSmartAccountHook,
38
- useAlchemySmartAccount,
39
- useBiconomySmartAccount,
40
- useCDPSmartAccount,
41
- useGelatoSmartAccount,
42
- usePimlicoSmartAccount,
43
- usePortoSmartAccount,
44
- useRhinestoneSmartAccount,
45
- useSafeSmartAccount,
46
- useThirdwebSmartAccount,
47
- useZeroDevSmartAccount
48
- };