@getpara/react-sdk-lite 2.18.0 → 2.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/aa/hooks/alchemy.d.ts +15 -0
- package/dist/aa/hooks/alchemy.js +9 -0
- package/dist/aa/hooks/biconomy.d.ts +15 -0
- package/dist/aa/hooks/biconomy.js +9 -0
- package/dist/aa/hooks/cdp.d.ts +14 -0
- package/dist/aa/hooks/cdp.js +9 -0
- package/dist/aa/hooks/gelato.d.ts +14 -0
- package/dist/aa/hooks/gelato.js +9 -0
- package/dist/aa/hooks/pimlico.d.ts +15 -0
- package/dist/aa/hooks/pimlico.js +9 -0
- package/dist/aa/hooks/porto.d.ts +15 -0
- package/dist/aa/hooks/porto.js +9 -0
- package/dist/aa/hooks/rhinestone.d.ts +15 -0
- package/dist/aa/hooks/rhinestone.js +9 -0
- package/dist/aa/hooks/safe.d.ts +15 -0
- package/dist/aa/hooks/safe.js +9 -0
- package/dist/aa/hooks/thirdweb.d.ts +13 -0
- package/dist/aa/hooks/thirdweb.js +9 -0
- package/dist/aa/hooks/zerodev.d.ts +15 -0
- package/dist/aa/hooks/zerodev.js +9 -0
- package/dist/aa/useWagmiSignerEnhancer.d.ts +15 -0
- package/dist/aa/useWagmiSignerEnhancer.js +45 -0
- package/dist/index.d.ts +11 -12
- package/dist/index.js +10 -12
- package/dist/modal/ParaModal.js +1 -1
- package/dist/modal/components/Header/hooks/useStepTitle.d.ts +1 -1
- package/dist/modal/components/OnRampComponents/OnRampProviderButton.js +1 -1
- package/dist/modal/components/QuantityInput.js +1 -0
- package/dist/modal/components/SearchableButtonList.js +20 -11
- package/dist/modal/components/flows/account/AddFunds/AddFundsReceive.js +2 -1
- package/dist/modal/components/flows/account/AddFunds/AddFundsSettings.js +1 -0
- package/dist/modal/components/flows/account/Send/context.js +4 -4
- package/dist/modal/components/flows/account/Wallet/Wallet.js +5 -1
- package/dist/modal/constants/walletTypeConfig.js +2 -1
- package/dist/provider/ParaProviderMin.js +46 -54
- package/dist/provider/actions/index.d.ts +2 -34
- package/dist/provider/actions/index.js +43 -34
- package/dist/provider/hooks/mutations/index.d.ts +2 -29
- package/dist/provider/hooks/mutations/index.js +3 -58
- package/dist/provider/hooks/mutations/useAddAuthMethod.d.ts +2 -2
- package/dist/provider/hooks/mutations/useExportPrivateKey.d.ts +24 -4
- package/dist/provider/hooks/mutations/useExportPrivateKey.js +7 -2
- package/dist/provider/hooks/mutations/useSwitchWallets.d.ts +2 -2
- package/dist/provider/hooks/mutations/useVerifyNewAccount.d.ts +2 -2
- package/dist/provider/hooks/queries/index.d.ts +2 -2
- package/dist/provider/hooks/queries/index.js +2 -3
- package/dist/provider/hooks/queries/useAccount.d.ts +14 -69
- package/dist/provider/hooks/queries/useAccount.js +30 -136
- package/dist/provider/hooks/queries/useParaStatus.d.ts +7 -11
- package/dist/provider/hooks/queries/useParaStatus.js +9 -16
- package/dist/provider/hooks/queries/useProfileBalance.js +1 -1
- package/dist/provider/hooks/utils/useAutoSessionKeepAlive.js +14 -10
- package/dist/provider/hooks/utils/useEventListeners.js +1 -1
- package/dist/provider/hooks/utils/useWalletState.d.ts +1 -1
- package/dist/provider/index.d.ts +1 -0
- package/dist/provider/stores/getters.d.ts +1 -1
- package/dist/provider/utils/renameMutations.d.ts +4 -2
- package/package.json +19 -18
- package/dist/aa/alchemy/hook.d.ts +0 -16708
- package/dist/aa/alchemy/hook.js +0 -26
- package/dist/aa/biconomy/hook.d.ts +0 -44
- package/dist/aa/biconomy/hook.js +0 -26
- package/dist/aa/cdp/hook.d.ts +0 -11
- package/dist/aa/cdp/hook.js +0 -26
- package/dist/aa/createSmartAccountHook.d.ts +0 -13
- package/dist/aa/createSmartAccountHook.js +0 -81
- package/dist/aa/gelato/hook.d.ts +0 -11
- package/dist/aa/gelato/hook.js +0 -26
- package/dist/aa/pimlico/hook.d.ts +0 -838
- package/dist/aa/pimlico/hook.js +0 -26
- package/dist/aa/porto/hook.d.ts +0 -12
- package/dist/aa/porto/hook.js +0 -26
- package/dist/aa/rhinestone/hook.d.ts +0 -12
- package/dist/aa/rhinestone/hook.js +0 -26
- package/dist/aa/safe/hook.d.ts +0 -12
- package/dist/aa/safe/hook.js +0 -26
- package/dist/aa/thirdweb/hook.d.ts +0 -12
- package/dist/aa/thirdweb/hook.js +0 -26
- package/dist/aa/types.d.ts +0 -21
- package/dist/aa/types.js +0 -1
- package/dist/aa/zerodev/hook.d.ts +0 -12
- package/dist/aa/zerodev/hook.js +0 -26
- package/dist/modal/components/flows/account/AddFunds/MoonPayEmbed.d.ts +0 -2
- package/dist/modal/components/flows/account/AddFunds/MoonPayEmbed.js +0 -7
- package/dist/provider/actions/getEmbeddedAccount.d.ts +0 -27
- package/dist/provider/actions/getEmbeddedAccount.js +0 -66
- package/dist/provider/actions/getWallet.d.ts +0 -5
- package/dist/provider/actions/getWallet.js +0 -18
- package/dist/provider/hooks/mutations/useAuthenticateWithEmailOrPhone.d.ts +0 -34
- package/dist/provider/hooks/mutations/useAuthenticateWithEmailOrPhone.js +0 -28
- package/dist/provider/hooks/mutations/useAuthenticateWithOAuth.d.ts +0 -34
- package/dist/provider/hooks/mutations/useAuthenticateWithOAuth.js +0 -28
- package/dist/provider/hooks/mutations/useClaimPregenWallets.d.ts +0 -34
- package/dist/provider/hooks/mutations/useClaimPregenWallets.js +0 -31
- package/dist/provider/hooks/mutations/useCreateGuestWallets.d.ts +0 -34
- package/dist/provider/hooks/mutations/useCreateGuestWallets.js +0 -31
- package/dist/provider/hooks/mutations/useCreatePregenWallet.d.ts +0 -34
- package/dist/provider/hooks/mutations/useCreatePregenWallet.js +0 -31
- package/dist/provider/hooks/mutations/useCreatePregenWalletPerType.d.ts +0 -34
- package/dist/provider/hooks/mutations/useCreatePregenWalletPerType.js +0 -28
- package/dist/provider/hooks/mutations/useCreateWallet.d.ts +0 -34
- package/dist/provider/hooks/mutations/useCreateWallet.js +0 -31
- package/dist/provider/hooks/mutations/useCreateWalletPerType.d.ts +0 -34
- package/dist/provider/hooks/mutations/useCreateWalletPerType.js +0 -28
- package/dist/provider/hooks/mutations/useEnable2fa.d.ts +0 -34
- package/dist/provider/hooks/mutations/useEnable2fa.js +0 -28
- package/dist/provider/hooks/mutations/useHasPregenWallet.d.ts +0 -34
- package/dist/provider/hooks/mutations/useHasPregenWallet.js +0 -28
- package/dist/provider/hooks/mutations/useIssueJwt.d.ts +0 -34
- package/dist/provider/hooks/mutations/useIssueJwt.js +0 -28
- package/dist/provider/hooks/mutations/useKeepSessionAlive.d.ts +0 -33
- package/dist/provider/hooks/mutations/useKeepSessionAlive.js +0 -28
- package/dist/provider/hooks/mutations/useLoginExternalWallet.d.ts +0 -34
- package/dist/provider/hooks/mutations/useLoginExternalWallet.js +0 -31
- package/dist/provider/hooks/mutations/useLogout.d.ts +0 -34
- package/dist/provider/hooks/mutations/useLogout.js +0 -28
- package/dist/provider/hooks/mutations/useResendVerificationCode.d.ts +0 -34
- package/dist/provider/hooks/mutations/useResendVerificationCode.js +0 -31
- package/dist/provider/hooks/mutations/useSetup2fa.d.ts +0 -34
- package/dist/provider/hooks/mutations/useSetup2fa.js +0 -28
- package/dist/provider/hooks/mutations/useSignMessage.d.ts +0 -34
- package/dist/provider/hooks/mutations/useSignMessage.js +0 -28
- package/dist/provider/hooks/mutations/useSignTransaction.d.ts +0 -34
- package/dist/provider/hooks/mutations/useSignTransaction.js +0 -31
- package/dist/provider/hooks/mutations/useSignUpOrLogIn.d.ts +0 -34
- package/dist/provider/hooks/mutations/useSignUpOrLogIn.js +0 -31
- package/dist/provider/hooks/mutations/useUpdatePregenWalletIdentifier.d.ts +0 -34
- package/dist/provider/hooks/mutations/useUpdatePregenWalletIdentifier.js +0 -31
- package/dist/provider/hooks/mutations/useVerify2fa.d.ts +0 -34
- package/dist/provider/hooks/mutations/useVerify2fa.js +0 -28
- package/dist/provider/hooks/mutations/useVerifyExternalWallet.d.ts +0 -34
- package/dist/provider/hooks/mutations/useVerifyExternalWallet.js +0 -31
- package/dist/provider/hooks/mutations/useVerifyFarcaster.d.ts +0 -34
- package/dist/provider/hooks/mutations/useVerifyFarcaster.js +0 -31
- package/dist/provider/hooks/mutations/useVerifyOAuth.d.ts +0 -34
- package/dist/provider/hooks/mutations/useVerifyOAuth.js +0 -28
- package/dist/provider/hooks/mutations/useVerifyTelegram.d.ts +0 -34
- package/dist/provider/hooks/mutations/useVerifyTelegram.js +0 -28
- package/dist/provider/hooks/mutations/useWaitForLogin.d.ts +0 -34
- package/dist/provider/hooks/mutations/useWaitForLogin.js +0 -31
- package/dist/provider/hooks/mutations/useWaitForSignup.d.ts +0 -34
- package/dist/provider/hooks/mutations/useWaitForSignup.js +0 -28
- package/dist/provider/hooks/mutations/useWaitForWalletCreation.d.ts +0 -34
- package/dist/provider/hooks/mutations/useWaitForWalletCreation.js +0 -28
- package/dist/provider/hooks/queries/useIsFullyLoggedIn.d.ts +0 -8
- package/dist/provider/hooks/queries/useIsFullyLoggedIn.js +0 -29
- package/dist/provider/hooks/queries/useWallet.d.ts +0 -5
- package/dist/provider/hooks/queries/useWallet.js +0 -26
|
@@ -1,90 +1,35 @@
|
|
|
1
1
|
import { useContext } from 'react';
|
|
2
|
-
import { Account } from '../../actions/getEmbeddedAccount.js';
|
|
3
2
|
import type { CosmosExternalWalletContextType, UseAccountParameters as UseCosmosAccountParameters } from '@getpara/cosmos-wallet-connectors';
|
|
4
3
|
import type { EvmExternalWalletContextType } from '@getpara/evm-wallet-connectors';
|
|
5
4
|
import type { Adapter } from '@getpara/solana-wallet-connectors';
|
|
6
|
-
export declare const ACCOUNT_BASE_KEY = "PARA_ACCOUNT";
|
|
7
5
|
type EVMAccountType = ReturnType<ReturnType<typeof useContext<EvmExternalWalletContextType>>['useAccount']>;
|
|
8
6
|
type CosmosAccountType = Omit<ReturnType<ReturnType<typeof useContext<CosmosExternalWalletContextType>>['useAccount']>, 'reconnect'>;
|
|
9
7
|
type SolanaAccountType = Pick<Adapter, 'publicKey' | 'name' | 'icon' | 'readyState' | 'supportedTransactionVersions' | 'url'> & {
|
|
10
8
|
isConnected?: boolean;
|
|
11
9
|
isConnecting?: boolean;
|
|
12
10
|
};
|
|
13
|
-
type
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
*
|
|
18
|
-
* @property isConnected - Indicates whether there is a wallet connected (either embedded, external or both).
|
|
19
|
-
* @property isLoading - Indicates whether the account is currently loading.
|
|
20
|
-
* @property connectionType - The type of connection for the account:
|
|
21
|
-
* @property embedded - The embedded account object.
|
|
22
|
-
* @property external - An object containing connected external wallet account data:
|
|
23
|
-
* - `evm`: The connected EVM wallet account (if any).
|
|
24
|
-
* - `cosmos`: The connected Cosmos wallet account (if any), with the `reconnect` property omitted.
|
|
25
|
-
* - `solana`: The connected Solana wallet adapter, with only allowed properties included.
|
|
26
|
-
*/
|
|
27
|
-
export type UseAccountReturn = {
|
|
28
|
-
/**
|
|
29
|
-
* Indicates whether there is a wallet connected (either embedded, external or both).
|
|
30
|
-
*/
|
|
31
|
-
isConnected: boolean;
|
|
32
|
-
/**
|
|
33
|
-
* Indicates whether the account is currently loading.
|
|
34
|
-
*/
|
|
35
|
-
isLoading: boolean;
|
|
36
|
-
/**
|
|
37
|
-
* The type of connection for the account.
|
|
38
|
-
* - 'embedded': Only the embedded account is connected.
|
|
39
|
-
* - 'external': Only an external wallet is connected.
|
|
40
|
-
* - 'both': Both embedded and external wallets are connected.
|
|
41
|
-
* - 'none': No wallets are connected.
|
|
42
|
-
*/
|
|
43
|
-
connectionType: ConnectionType;
|
|
44
|
-
/**
|
|
45
|
-
* The embedded account object. Use this instead of the deprecated top-level properties.
|
|
46
|
-
*/
|
|
47
|
-
embedded: Omit<Account, 'isReady' | 'isFarcasterMiniApp' | 'isConnected' | 'isGuestMode'> & {
|
|
48
|
-
isConnected: boolean;
|
|
49
|
-
isGuestMode?: boolean;
|
|
50
|
-
};
|
|
51
|
-
/**
|
|
52
|
-
* Connected external wallet account data.
|
|
53
|
-
*/
|
|
54
|
-
external: {
|
|
55
|
-
/**
|
|
56
|
-
* The list of connected external networks, which can include 'evm', 'cosmos', and 'solana'.
|
|
57
|
-
*/
|
|
58
|
-
connectedNetworks: ExternalNetwork[];
|
|
59
|
-
/**
|
|
60
|
-
* The connected EVM wallet (if any), with only allowed properties included.
|
|
61
|
-
*/
|
|
62
|
-
evm: EVMAccountType;
|
|
63
|
-
/**
|
|
64
|
-
* The connected Cosmos wallet (if any), with only allowed properties included.
|
|
65
|
-
*/
|
|
66
|
-
cosmos: CosmosAccountType;
|
|
67
|
-
/**
|
|
68
|
-
* The connected Solana wallet (if any), with only allowed properties included.
|
|
69
|
-
*/
|
|
70
|
-
solana: SolanaAccountType;
|
|
71
|
-
};
|
|
11
|
+
export type ExternalAccounts = {
|
|
12
|
+
evm: EVMAccountType;
|
|
13
|
+
cosmos: CosmosAccountType;
|
|
14
|
+
solana: SolanaAccountType;
|
|
72
15
|
};
|
|
73
16
|
export type UseAccountParameters = {
|
|
74
17
|
cosmos?: UseCosmosAccountParameters;
|
|
75
18
|
};
|
|
19
|
+
export declare const ACCOUNT_BASE_KEY = "PARA_ACCOUNT";
|
|
76
20
|
/**
|
|
77
21
|
* React Query hook for retrieving the current embedded account and connected external wallets.
|
|
78
22
|
*
|
|
79
23
|
* @returns {UseAccountReturn}
|
|
80
|
-
* The account data object
|
|
24
|
+
* The account data object. Contains:
|
|
25
|
+
* - `isConnected`: whether any wallet is connected (embedded, external, or both).
|
|
26
|
+
* - `isLoading`: whether the account is currently loading.
|
|
27
|
+
* - `connectionType`: `'embedded'` | `'external'` | `'both'` | `'none'`.
|
|
28
|
+
* - `embedded`: the Para MPC account object.
|
|
29
|
+
* - `external`: connected external wallet data (EVM, Cosmos, Solana) plus `connectedNetworks`.
|
|
81
30
|
*
|
|
82
|
-
*
|
|
83
|
-
* - `isConnected`: Indicates whether there is a wallet connected (either embedded, external or both).
|
|
84
|
-
* - `isLoading`: Indicates whether the account is currently loading.
|
|
85
|
-
* - `connectionType`: The type of connection for the account:
|
|
86
|
-
* - `embedded`: The embedded account object.
|
|
87
|
-
* - `external`: Connected external wallet data (EVM, Cosmos, Solana).
|
|
31
|
+
* Extends the platform-agnostic base with wagmi/graz/solana-wallet-adapter support.
|
|
88
32
|
*/
|
|
89
|
-
export declare const useAccount: (
|
|
33
|
+
export declare const useAccount: () => import("@getpara/react-core/internal").UseAccountReturn<ExternalAccounts>;
|
|
34
|
+
export type UseAccountReturn = ReturnType<typeof useAccount>;
|
|
90
35
|
export {};
|
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
__objRest,
|
|
5
|
-
__spreadProps,
|
|
6
|
-
__spreadValues
|
|
3
|
+
__objRest
|
|
7
4
|
} from "../../../chunk-MMUBH76A.js";
|
|
8
|
-
import {
|
|
9
|
-
import { useInternalClient } from "../utils/useInternalClient.js";
|
|
10
|
-
import { useIsFullyLoggedIn } from "./useIsFullyLoggedIn.js";
|
|
5
|
+
import { useContext } from "react";
|
|
11
6
|
import { useStore } from "../../stores/useStore.js";
|
|
12
|
-
import {
|
|
13
|
-
import { getEmbeddedAccount } from "../../actions/getEmbeddedAccount.js";
|
|
14
|
-
const ACCOUNT_BASE_KEY = "PARA_ACCOUNT";
|
|
7
|
+
import { createAccountHook } from "@getpara/react-core/internal";
|
|
15
8
|
function pickSolanaAdapter(adapter) {
|
|
16
9
|
if (!adapter) return { isConnected: false };
|
|
17
10
|
const { connected, connecting, publicKey, name, icon, readyState, supportedTransactionVersions, url } = adapter;
|
|
@@ -31,145 +24,46 @@ function pickCosmosAccount(account) {
|
|
|
31
24
|
const _a = account, { reconnect: _ } = _a, rest = __objRest(_a, ["reconnect"]);
|
|
32
25
|
return rest;
|
|
33
26
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const useInvalidation = (connectionStates, queryKey) => {
|
|
37
|
-
const queryClient = useQueryClient();
|
|
38
|
-
useEffect(() => {
|
|
39
|
-
const connectionStateKey = `${connectionStates.evm}-${connectionStates.cosmos}-${connectionStates.solana}`;
|
|
40
|
-
if (connectionStateKey === lastConnectionState) {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
lastConnectionState = connectionStateKey;
|
|
44
|
-
if (invalidationTimeoutId) {
|
|
45
|
-
clearTimeout(invalidationTimeoutId);
|
|
46
|
-
}
|
|
47
|
-
invalidationTimeoutId = setTimeout(() => {
|
|
48
|
-
queryClient.invalidateQueries({ queryKey });
|
|
49
|
-
invalidationTimeoutId = null;
|
|
50
|
-
}, 0);
|
|
51
|
-
return () => {
|
|
52
|
-
if (invalidationTimeoutId) {
|
|
53
|
-
clearTimeout(invalidationTimeoutId);
|
|
54
|
-
invalidationTimeoutId = null;
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
}, [connectionStates, queryClient]);
|
|
58
|
-
};
|
|
59
|
-
const useAccount = ({ cosmos } = {}) => {
|
|
60
|
-
var _a, _b, _c, _d, _e, _f;
|
|
61
|
-
const client = useInternalClient();
|
|
62
|
-
const { data: isFullyLoggedIn, isSuccess, isLoading: isFullyLoggedInLoading } = useIsFullyLoggedIn();
|
|
27
|
+
function useExternalWallets() {
|
|
28
|
+
var _a, _b, _c;
|
|
63
29
|
const evmContext = useStore((state) => state.evmContext);
|
|
64
30
|
const { useAccount: useEvmAccount } = useContext(evmContext);
|
|
65
31
|
const evmAccount = useEvmAccount();
|
|
66
|
-
const evmQueryKeys = [evmAccount == null ? void 0 : evmAccount.addresses, evmAccount == null ? void 0 : evmAccount.chainId];
|
|
67
32
|
const cosmosContext = useStore((state) => state.cosmosContext);
|
|
68
33
|
const { useAccount: useCosmosAccount } = useContext(cosmosContext);
|
|
69
|
-
const cosmosAccount = useCosmosAccount(
|
|
70
|
-
const cosmosQueryKeys = [cosmosAccount == null ? void 0 : cosmosAccount.data];
|
|
34
|
+
const cosmosAccount = useCosmosAccount();
|
|
71
35
|
const solanaContext = useStore((state) => state.solanaContext);
|
|
72
36
|
const { useWallet: useSolanaWallet } = useContext(solanaContext);
|
|
73
37
|
const solanaWallet = useSolanaWallet();
|
|
74
|
-
const
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
38
|
+
const solanaAdapter = (_a = solanaWallet == null ? void 0 : solanaWallet.wallet) == null ? void 0 : _a.adapter;
|
|
39
|
+
const defaultEvm = {
|
|
40
|
+
address: void 0,
|
|
41
|
+
addresses: void 0,
|
|
42
|
+
chain: void 0,
|
|
43
|
+
chainId: void 0,
|
|
44
|
+
connector: void 0,
|
|
45
|
+
isConnected: false,
|
|
46
|
+
isReconnecting: false,
|
|
47
|
+
isConnecting: false,
|
|
48
|
+
isDisconnected: true,
|
|
49
|
+
status: "disconnected"
|
|
50
|
+
};
|
|
51
|
+
return {
|
|
52
|
+
queryKeys: [evmAccount == null ? void 0 : evmAccount.addresses, evmAccount == null ? void 0 : evmAccount.chainId, cosmosAccount == null ? void 0 : cosmosAccount.data, (_c = (_b = solanaWallet == null ? void 0 : solanaWallet.wallet) == null ? void 0 : _b.adapter) == null ? void 0 : _c.publicKey],
|
|
53
|
+
connections: {
|
|
88
54
|
evm: !!(evmAccount == null ? void 0 : evmAccount.isConnected),
|
|
89
55
|
cosmos: !!(cosmosAccount == null ? void 0 : cosmosAccount.isConnected),
|
|
90
|
-
solana: !!(
|
|
91
|
-
};
|
|
92
|
-
}, [!!(evmAccount == null ? void 0 : evmAccount.isConnected), !!(cosmosAccount == null ? void 0 : cosmosAccount.isConnected), !!((_f = (_e = solanaWallet == null ? void 0 : solanaWallet.wallet) == null ? void 0 : _e.adapter) == null ? void 0 : _f.connected)]);
|
|
93
|
-
useInvalidation(connectionStates, queryKey);
|
|
94
|
-
const { data, isLoading } = useQuery({
|
|
95
|
-
enabled: isSuccess && !!client,
|
|
96
|
-
queryKey,
|
|
97
|
-
queryFn: () => __async(void 0, null, function* () {
|
|
98
|
-
const paraAccount = yield getEmbeddedAccount(client, isFullyLoggedIn);
|
|
99
|
-
let connectionType = "none";
|
|
100
|
-
if (paraAccount.isConnected) {
|
|
101
|
-
connectionType = "embedded";
|
|
102
|
-
if (paraAccount.wallets.some((w) => w.isExternal)) {
|
|
103
|
-
connectionType = "both";
|
|
104
|
-
}
|
|
105
|
-
if (paraAccount.wallets.every((w) => w.isExternal) && ((evmAccount == null ? void 0 : evmAccount.isConnected) || (cosmosAccount == null ? void 0 : cosmosAccount.isConnected) || (solanaAdapter == null ? void 0 : solanaAdapter.connected))) {
|
|
106
|
-
connectionType = "external";
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
const isEmbeddedConnected = connectionType === "embedded" || connectionType === "both";
|
|
110
|
-
const connectedNetworks = [];
|
|
111
|
-
if (evmAccount == null ? void 0 : evmAccount.isConnected) {
|
|
112
|
-
connectedNetworks.push("evm");
|
|
113
|
-
}
|
|
114
|
-
if (cosmosAccount == null ? void 0 : cosmosAccount.isConnected) {
|
|
115
|
-
connectedNetworks.push("cosmos");
|
|
116
|
-
}
|
|
117
|
-
if (solanaAdapter == null ? void 0 : solanaAdapter.connected) {
|
|
118
|
-
connectedNetworks.push("solana");
|
|
119
|
-
}
|
|
120
|
-
return {
|
|
121
|
-
isConnected: paraAccount.isConnected,
|
|
122
|
-
connectionType,
|
|
123
|
-
embedded: __spreadProps(__spreadValues({}, paraAccount), { isConnected: isEmbeddedConnected }),
|
|
124
|
-
external: {
|
|
125
|
-
connectedNetworks,
|
|
126
|
-
evm: evmAccount != null ? evmAccount : {
|
|
127
|
-
address: void 0,
|
|
128
|
-
addresses: void 0,
|
|
129
|
-
chain: void 0,
|
|
130
|
-
chainId: void 0,
|
|
131
|
-
connector: void 0,
|
|
132
|
-
isConnected: false,
|
|
133
|
-
isReconnecting: false,
|
|
134
|
-
isConnecting: false,
|
|
135
|
-
isDisconnected: true,
|
|
136
|
-
status: "disconnected"
|
|
137
|
-
},
|
|
138
|
-
cosmos: pickCosmosAccount(cosmosAccount),
|
|
139
|
-
solana: pickSolanaAdapter(solanaAdapter)
|
|
140
|
-
}
|
|
141
|
-
};
|
|
142
|
-
})
|
|
143
|
-
});
|
|
144
|
-
const defaultResp = {
|
|
145
|
-
isConnected: false,
|
|
146
|
-
connectionType: "none",
|
|
147
|
-
isLoading,
|
|
148
|
-
embedded: {
|
|
149
|
-
isConnected: false
|
|
56
|
+
solana: !!(solanaAdapter == null ? void 0 : solanaAdapter.connected)
|
|
150
57
|
},
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
addresses: void 0,
|
|
156
|
-
chain: void 0,
|
|
157
|
-
chainId: void 0,
|
|
158
|
-
connector: void 0,
|
|
159
|
-
isConnected: false,
|
|
160
|
-
isReconnecting: false,
|
|
161
|
-
isConnecting: false,
|
|
162
|
-
isDisconnected: true,
|
|
163
|
-
status: "disconnected"
|
|
164
|
-
},
|
|
165
|
-
cosmos: { isConnected: false },
|
|
166
|
-
solana: { isConnected: false }
|
|
58
|
+
data: {
|
|
59
|
+
evm: evmAccount != null ? evmAccount : defaultEvm,
|
|
60
|
+
cosmos: pickCosmosAccount(cosmosAccount),
|
|
61
|
+
solana: pickSolanaAdapter(solanaAdapter)
|
|
167
62
|
}
|
|
168
63
|
};
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
};
|
|
64
|
+
}
|
|
65
|
+
const ACCOUNT_BASE_KEY = "PARA_ACCOUNT";
|
|
66
|
+
const useAccount = createAccountHook(useExternalWallets);
|
|
173
67
|
export {
|
|
174
68
|
ACCOUNT_BASE_KEY,
|
|
175
69
|
useAccount
|
|
@@ -1,16 +1,8 @@
|
|
|
1
|
-
export type ParaStatus = {
|
|
2
|
-
/**
|
|
3
|
-
* Indicates whether the client's first-time setup is complete.
|
|
4
|
-
*/
|
|
5
|
-
isReady: boolean;
|
|
6
|
-
/**
|
|
7
|
-
* Indicates whether the current application is a Farcaster Mini App.
|
|
8
|
-
*/
|
|
9
|
-
isFarcasterMiniApp: boolean;
|
|
10
|
-
};
|
|
11
1
|
/**
|
|
12
2
|
* Hook for retrieving the initial setup status of the Para client.
|
|
13
3
|
*
|
|
4
|
+
* Extends the platform-agnostic base with `isFarcasterMiniApp` from ParaWeb.
|
|
5
|
+
*
|
|
14
6
|
* @example
|
|
15
7
|
* const status = useParaStatus();
|
|
16
8
|
* if (status.isReady) {
|
|
@@ -18,4 +10,8 @@ export type ParaStatus = {
|
|
|
18
10
|
* // ...
|
|
19
11
|
* }
|
|
20
12
|
*/
|
|
21
|
-
export declare const useParaStatus: () =>
|
|
13
|
+
export declare const useParaStatus: () => import("@getpara/react-core/internal").ParaStatusBase & {
|
|
14
|
+
/** Whether the current application is a Farcaster Mini App. */
|
|
15
|
+
isFarcasterMiniApp: any;
|
|
16
|
+
};
|
|
17
|
+
export type ParaStatus = ReturnType<typeof useParaStatus>;
|
|
@@ -1,23 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../../../chunk-MMUBH76A.js";
|
|
3
|
-
import {
|
|
3
|
+
import { createParaStatusHook } from "@getpara/react-core/internal";
|
|
4
4
|
import { useInternalClient } from "../utils/useInternalClient.js";
|
|
5
|
-
|
|
6
|
-
var _a
|
|
5
|
+
function useFarcasterStatus() {
|
|
6
|
+
var _a;
|
|
7
7
|
const client = useInternalClient();
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
isReady: (_a2 = client == null ? void 0 : client.isReady) != null ? _a2 : false,
|
|
15
|
-
isFarcasterMiniApp: (_b2 = client == null ? void 0 : client.isFarcasterMiniApp) != null ? _b2 : false
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
return data != null ? data : { isReady: false, isFarcasterMiniApp: false };
|
|
20
|
-
};
|
|
8
|
+
return {
|
|
9
|
+
/** Whether the current application is a Farcaster Mini App. */
|
|
10
|
+
isFarcasterMiniApp: (_a = client == null ? void 0 : client.isFarcasterMiniApp) != null ? _a : false
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
const useParaStatus = createParaStatusHook(useFarcasterStatus);
|
|
21
14
|
export {
|
|
22
15
|
useParaStatus
|
|
23
16
|
};
|
|
@@ -8,7 +8,7 @@ import { useQuery } from "@tanstack/react-query";
|
|
|
8
8
|
import { useRef, useEffect, useMemo } from "react";
|
|
9
9
|
import { useStore } from "../../stores/useStore.js";
|
|
10
10
|
import { useInternalClient } from "../utils/useInternalClient.js";
|
|
11
|
-
import { useIsFullyLoggedIn } from "
|
|
11
|
+
import { useIsFullyLoggedIn } from "@getpara/react-core";
|
|
12
12
|
import { filterProfileBalance, formatCurrency } from "@getpara/shared";
|
|
13
13
|
const useProfileBalance = (options) => {
|
|
14
14
|
var _a, _b, _c;
|
|
@@ -3,28 +3,32 @@ import {
|
|
|
3
3
|
__async
|
|
4
4
|
} from "../../../chunk-MMUBH76A.js";
|
|
5
5
|
import { useEffect, useRef } from "react";
|
|
6
|
-
import {
|
|
6
|
+
import { useStore } from "../../stores/useStore.js";
|
|
7
|
+
import { logout, keepSessionAlive } from "../../actions/index.js";
|
|
7
8
|
import { useInternalClient } from "./useInternalClient.js";
|
|
8
9
|
const SESSION_CHECK_INTERVAL = 6e4;
|
|
9
10
|
const SESSION_REFRESH_THRESHOLD = 3e5;
|
|
10
11
|
const useAutoSessionKeepAlive = ({ disabled }) => {
|
|
11
12
|
const client = useInternalClient();
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
const corePhase = useStore((state) => {
|
|
14
|
+
var _a;
|
|
15
|
+
return (_a = state.paraState) == null ? void 0 : _a.corePhase;
|
|
16
|
+
});
|
|
17
|
+
const isConnected = corePhase === "authenticated" || corePhase === "guest_mode";
|
|
18
|
+
const isGuestMode = corePhase === "guest_mode";
|
|
15
19
|
const sessionCheckInterval = useRef(null);
|
|
16
20
|
useEffect(() => {
|
|
17
21
|
if (!client || disabled) {
|
|
18
22
|
clearSessionMonitoring();
|
|
19
23
|
return;
|
|
20
24
|
}
|
|
21
|
-
if (
|
|
25
|
+
if (isConnected && !isGuestMode && client.externalWalletConnectionType !== "CONNECTION_ONLY") {
|
|
22
26
|
setupSessionMonitoring();
|
|
23
27
|
} else {
|
|
24
28
|
clearSessionMonitoring();
|
|
25
29
|
}
|
|
26
30
|
return () => clearSessionMonitoring();
|
|
27
|
-
}, [client,
|
|
31
|
+
}, [client, isConnected, isGuestMode, disabled]);
|
|
28
32
|
const getSessionExpiry = () => __async(void 0, null, function* () {
|
|
29
33
|
try {
|
|
30
34
|
const sessionCookie = client == null ? void 0 : client.retrieveSessionCookie();
|
|
@@ -40,23 +44,23 @@ const useAutoSessionKeepAlive = ({ disabled }) => {
|
|
|
40
44
|
sessionCheckInterval.current = setInterval(() => __async(void 0, null, function* () {
|
|
41
45
|
const expiry = yield getSessionExpiry();
|
|
42
46
|
if (!expiry) {
|
|
43
|
-
yield
|
|
47
|
+
yield logout(client);
|
|
44
48
|
clearSessionMonitoring();
|
|
45
49
|
return;
|
|
46
50
|
}
|
|
47
51
|
const timeUntilExpiry = expiry.getTime() - Date.now();
|
|
48
52
|
if (timeUntilExpiry <= 0) {
|
|
49
|
-
yield
|
|
53
|
+
yield logout(client);
|
|
50
54
|
clearSessionMonitoring();
|
|
51
55
|
return;
|
|
52
56
|
}
|
|
53
57
|
if (timeUntilExpiry <= SESSION_REFRESH_THRESHOLD) {
|
|
54
58
|
try {
|
|
55
|
-
yield
|
|
59
|
+
yield keepSessionAlive(client);
|
|
56
60
|
setupSessionMonitoring();
|
|
57
61
|
} catch (err) {
|
|
58
62
|
console.error("Failed to keep session alive:", err);
|
|
59
|
-
yield
|
|
63
|
+
yield logout(client);
|
|
60
64
|
clearSessionMonitoring();
|
|
61
65
|
}
|
|
62
66
|
return;
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
ParaEvent
|
|
9
9
|
} from "@getpara/web-sdk";
|
|
10
10
|
import { ACCOUNT_BASE_KEY } from "../queries/useAccount.js";
|
|
11
|
-
import { WALLET_BASE_KEY } from "
|
|
11
|
+
import { WALLET_BASE_KEY } from "@getpara/react-core/internal";
|
|
12
12
|
import { WALLET_BALANCE_BASE_KEY } from "../queries/useWalletBalance.js";
|
|
13
13
|
import { useModalSessionStore } from "../../../modal/stores/index.js";
|
|
14
14
|
const useEventListeners = ({
|
|
@@ -5,7 +5,7 @@ import { TWalletType } from '@getpara/web-sdk';
|
|
|
5
5
|
export declare const useWalletState: () => {
|
|
6
6
|
selectedWallet: {
|
|
7
7
|
id: string | undefined;
|
|
8
|
-
type: "EVM" | "SOLANA" | "COSMOS" | undefined;
|
|
8
|
+
type: "EVM" | "SOLANA" | "COSMOS" | "STELLAR" | undefined;
|
|
9
9
|
address: string | undefined;
|
|
10
10
|
};
|
|
11
11
|
setSelectedWallet: ({ id, type }: {
|
package/dist/provider/index.d.ts
CHANGED
|
@@ -5,3 +5,4 @@ export * from './stores/getters.js';
|
|
|
5
5
|
export * from './stores/setters.js';
|
|
6
6
|
export * from './types/externalWalletProviders.js';
|
|
7
7
|
export * from './types/provider.js';
|
|
8
|
+
export { type CoreProviderConfig, type CoreCallbacks, type ParaStorageAdapter } from '@getpara/react-core';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const getClient: () => import("graz").ParaWeb | undefined;
|
|
2
2
|
export declare const getIsOpen: () => boolean;
|
|
3
3
|
export declare const getSelectedWalletId: () => string | undefined;
|
|
4
|
-
export declare const getSelectedWalletType: () => "EVM" | "SOLANA" | "COSMOS" | undefined;
|
|
4
|
+
export declare const getSelectedWalletType: () => "EVM" | "SOLANA" | "COSMOS" | "STELLAR" | undefined;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { DefaultError, UseMutateAsyncFunction, UseMutateFunction, UseMutationResult } from '@tanstack/react-query';
|
|
2
|
-
|
|
1
|
+
import type { DefaultError, UseMutateAsyncFunction, UseMutateFunction, UseMutationResult } from '@tanstack/react-query';
|
|
2
|
+
export type Compute<type> = {
|
|
3
|
+
[key in keyof type]: type[key];
|
|
4
|
+
} & unknown;
|
|
3
5
|
type RenamedMutationResult<TData, TError, TVariables, TContext, TName extends string> = Omit<UseMutationResult<TData, TError, TVariables, TContext>, 'mutate' | 'mutateAsync'> & {
|
|
4
6
|
[K in TName]: UseMutateFunction<TData, TError, TVariables, TContext>;
|
|
5
7
|
} & {
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/react-sdk-lite",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.20.0",
|
|
4
4
|
"bin": {
|
|
5
5
|
"setup-para": "dist/cli/cli.mjs"
|
|
6
6
|
},
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@getpara/react-common": "2.
|
|
9
|
-
"@getpara/react-components": "2.
|
|
10
|
-
"@getpara/
|
|
8
|
+
"@getpara/react-common": "2.20.0",
|
|
9
|
+
"@getpara/react-components": "2.20.0",
|
|
10
|
+
"@getpara/react-core": "2.20.0",
|
|
11
|
+
"@getpara/web-sdk": "2.20.0",
|
|
11
12
|
"date-fns": "^3.6.0",
|
|
12
13
|
"detect-browser": "^5.3.0",
|
|
13
14
|
"framer-motion": "^11.3.31",
|
|
@@ -18,19 +19,19 @@
|
|
|
18
19
|
"zustand-sync-tabs": "^0.2.2"
|
|
19
20
|
},
|
|
20
21
|
"devDependencies": {
|
|
21
|
-
"@getpara/aa-alchemy": "2.
|
|
22
|
-
"@getpara/aa-biconomy": "2.
|
|
23
|
-
"@getpara/aa-cdp": "2.
|
|
24
|
-
"@getpara/aa-gelato": "2.
|
|
25
|
-
"@getpara/aa-pimlico": "2.
|
|
26
|
-
"@getpara/aa-porto": "2.
|
|
27
|
-
"@getpara/aa-rhinestone": "2.
|
|
28
|
-
"@getpara/aa-safe": "2.
|
|
29
|
-
"@getpara/aa-thirdweb": "2.
|
|
30
|
-
"@getpara/aa-zerodev": "2.
|
|
31
|
-
"@getpara/cosmos-wallet-connectors": "2.
|
|
32
|
-
"@getpara/evm-wallet-connectors": "2.
|
|
33
|
-
"@getpara/solana-wallet-connectors": "2.
|
|
22
|
+
"@getpara/aa-alchemy": "2.20.0",
|
|
23
|
+
"@getpara/aa-biconomy": "2.20.0",
|
|
24
|
+
"@getpara/aa-cdp": "2.20.0",
|
|
25
|
+
"@getpara/aa-gelato": "2.20.0",
|
|
26
|
+
"@getpara/aa-pimlico": "2.20.0",
|
|
27
|
+
"@getpara/aa-porto": "2.20.0",
|
|
28
|
+
"@getpara/aa-rhinestone": "2.20.0",
|
|
29
|
+
"@getpara/aa-safe": "2.20.0",
|
|
30
|
+
"@getpara/aa-thirdweb": "2.20.0",
|
|
31
|
+
"@getpara/aa-zerodev": "2.20.0",
|
|
32
|
+
"@getpara/cosmos-wallet-connectors": "2.20.0",
|
|
33
|
+
"@getpara/evm-wallet-connectors": "2.20.0",
|
|
34
|
+
"@getpara/solana-wallet-connectors": "2.20.0",
|
|
34
35
|
"@tanstack/react-query": "^5.74.0",
|
|
35
36
|
"@testing-library/dom": "^10.4.0",
|
|
36
37
|
"@testing-library/react": "^16.3.0",
|
|
@@ -50,7 +51,7 @@
|
|
|
50
51
|
"package.json",
|
|
51
52
|
"styles.css"
|
|
52
53
|
],
|
|
53
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "a8443bcc4018864f5e582f238ade1bb3b4e121f4",
|
|
54
55
|
"main": "dist/index.js",
|
|
55
56
|
"peerDependencies": {
|
|
56
57
|
"@getpara/aa-alchemy": ">=2.15.0",
|