@getpara/react-sdk-lite 2.16.0 → 2.18.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/alchemy/hook.d.ts +2 -2
- package/dist/aa/biconomy/hook.d.ts +2 -2
- package/dist/aa/cdp/hook.d.ts +1 -1
- package/dist/aa/createSmartAccountHook.d.ts +2 -1
- package/dist/aa/createSmartAccountHook.js +44 -10
- package/dist/aa/gelato/hook.d.ts +1 -1
- package/dist/aa/pimlico/hook.d.ts +4 -4
- package/dist/aa/porto/hook.d.ts +1 -1
- package/dist/aa/rhinestone/hook.d.ts +1 -1
- package/dist/aa/safe/hook.d.ts +1 -1
- package/dist/aa/thirdweb/hook.d.ts +1 -1
- package/dist/aa/zerodev/hook.d.ts +1 -1
- package/dist/modal/ParaModal.js +5 -3
- package/dist/modal/components/flows/account/AccountProvider/AccountProvider.js +35 -42
- package/dist/provider/providers/ExternalWalletProvider.js +2 -0
- package/package.json +22 -21
|
@@ -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";
|
package/dist/aa/cdp/hook.d.ts
CHANGED
|
@@ -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,
|
|
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
|
|
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
|
-
(
|
|
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
|
-
|
|
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
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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), {
|
package/dist/aa/gelato/hook.d.ts
CHANGED
|
@@ -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;
|
package/dist/aa/porto/hook.d.ts
CHANGED
|
@@ -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>>;
|
package/dist/aa/safe/hook.d.ts
CHANGED
|
@@ -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/modal/ParaModal.js
CHANGED
|
@@ -99,7 +99,7 @@ const ParaModal = forwardRef((props, ref) => {
|
|
|
99
99
|
onClose,
|
|
100
100
|
defaultAuthIdentifier
|
|
101
101
|
}), rest),
|
|
102
|
-
reactSdkVersion: "2.
|
|
102
|
+
reactSdkVersion: "2.18.0"
|
|
103
103
|
});
|
|
104
104
|
} catch (e) {
|
|
105
105
|
}
|
|
@@ -218,8 +218,10 @@ const ParaModal = forwardRef((props, ref) => {
|
|
|
218
218
|
setIsModalMounted(true);
|
|
219
219
|
};
|
|
220
220
|
const handleModalExited = () => __async(void 0, null, function* () {
|
|
221
|
-
|
|
222
|
-
|
|
221
|
+
if (isModalMounted) {
|
|
222
|
+
setIsModalMounted(false);
|
|
223
|
+
goBack();
|
|
224
|
+
}
|
|
223
225
|
});
|
|
224
226
|
useEffect(() => {
|
|
225
227
|
var _a2;
|
|
@@ -12,7 +12,7 @@ import { useGoBack } from "../../../../hooks/useGoBack.js";
|
|
|
12
12
|
import { useWalletState } from "../../../../../provider/index.js";
|
|
13
13
|
import { DEFAULTS } from "../../../../constants/defaults.js";
|
|
14
14
|
const AccountProvider = ({ children }) => {
|
|
15
|
-
const {
|
|
15
|
+
const { switchWalletsAsync: mutateSwitchWalletsAsync } = useSwitchWallets();
|
|
16
16
|
const { goBack } = useGoBack();
|
|
17
17
|
const { updateSelectedWallet } = useWalletState();
|
|
18
18
|
const refs = useStore((state) => state.refs);
|
|
@@ -42,55 +42,48 @@ const AccountProvider = ({ children }) => {
|
|
|
42
42
|
refs.poll.current = {
|
|
43
43
|
action: "login",
|
|
44
44
|
timeout: window == null ? void 0 : window.setTimeout(() => __async(void 0, null, function* () {
|
|
45
|
-
|
|
46
|
-
{
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
if (
|
|
54
|
-
|
|
55
|
-
goBack();
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
return isCanceled;
|
|
59
|
-
},
|
|
60
|
-
onPoll: () => {
|
|
61
|
-
var _a;
|
|
62
|
-
const currentView = store.getState().accountView;
|
|
63
|
-
if (currentView === "ACCOUNT_SWITCH_WALLETS" || currentView === "ACCOUNT_SWITCH_WALLETS_IFRAME") {
|
|
64
|
-
if (((_a = refs.popupWindow.current) == null ? void 0 : _a.closed) && ["ACCOUNT_SWITCH_WALLETS", "ACCOUNT_SWITCH_WALLETS_IFRAME"].includes(currentView)) {
|
|
65
|
-
refs.popupWindow.current = null;
|
|
66
|
-
goBack();
|
|
67
|
-
}
|
|
45
|
+
mutateSwitchWalletsAsync({
|
|
46
|
+
isCanceled: () => {
|
|
47
|
+
var _a, _b;
|
|
48
|
+
const currentView = store.getState().accountView;
|
|
49
|
+
const exitedSteps = !!currentView && !["ACCOUNT_SWITCH_WALLETS", "ACCOUNT_SWITCH_WALLETS_IFRAME"].includes(currentView);
|
|
50
|
+
const popupClosed = (_b = (_a = refs.popupWindow.current) == null ? void 0 : _a.closed) != null ? _b : false;
|
|
51
|
+
const isCanceled = exitedSteps || popupClosed;
|
|
52
|
+
if (isCanceled) {
|
|
53
|
+
if (popupClosed && (currentView === "ACCOUNT_SWITCH_WALLETS" || currentView === "ACCOUNT_SWITCH_WALLETS_IFRAME")) {
|
|
54
|
+
goBack();
|
|
68
55
|
}
|
|
69
56
|
}
|
|
57
|
+
return isCanceled;
|
|
70
58
|
},
|
|
71
|
-
{
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
59
|
+
onPoll: () => {
|
|
60
|
+
var _a;
|
|
61
|
+
const currentView = store.getState().accountView;
|
|
62
|
+
if (currentView === "ACCOUNT_SWITCH_WALLETS" || currentView === "ACCOUNT_SWITCH_WALLETS_IFRAME") {
|
|
63
|
+
if (((_a = refs.popupWindow.current) == null ? void 0 : _a.closed) && ["ACCOUNT_SWITCH_WALLETS", "ACCOUNT_SWITCH_WALLETS_IFRAME"].includes(currentView)) {
|
|
76
64
|
refs.popupWindow.current = null;
|
|
77
|
-
}, 500);
|
|
78
|
-
}),
|
|
79
|
-
onError: () => {
|
|
80
|
-
const currentView = store.getState().accountView;
|
|
81
|
-
if (currentView === "ACCOUNT_SWITCH_WALLETS") {
|
|
82
65
|
goBack();
|
|
83
66
|
}
|
|
84
|
-
},
|
|
85
|
-
onSettled: () => {
|
|
86
|
-
var _a;
|
|
87
|
-
setIsSwitchWalletsPending(false);
|
|
88
|
-
window == null ? void 0 : window.clearTimeout((_a = refs.poll.current) == null ? void 0 : _a.timeout);
|
|
89
|
-
refs.poll.current = null;
|
|
90
|
-
refs.popupWindow.current = null;
|
|
91
67
|
}
|
|
92
68
|
}
|
|
93
|
-
)
|
|
69
|
+
}).then(() => __async(void 0, null, function* () {
|
|
70
|
+
yield updateSelectedWallet();
|
|
71
|
+
setTimeout(() => {
|
|
72
|
+
setAccountView("ACCOUNT_PROFILE");
|
|
73
|
+
refs.popupWindow.current = null;
|
|
74
|
+
}, 500);
|
|
75
|
+
})).catch(() => {
|
|
76
|
+
const currentView = store.getState().accountView;
|
|
77
|
+
if (currentView === "ACCOUNT_SWITCH_WALLETS") {
|
|
78
|
+
goBack();
|
|
79
|
+
}
|
|
80
|
+
}).finally(() => {
|
|
81
|
+
var _a;
|
|
82
|
+
setIsSwitchWalletsPending(false);
|
|
83
|
+
window == null ? void 0 : window.clearTimeout((_a = refs.poll.current) == null ? void 0 : _a.timeout);
|
|
84
|
+
refs.poll.current = null;
|
|
85
|
+
refs.popupWindow.current = null;
|
|
86
|
+
});
|
|
94
87
|
}), DEFAULTS.LOGGIN_POLLING_DELAY_MS)
|
|
95
88
|
};
|
|
96
89
|
}
|
package/package.json
CHANGED
|
@@ -1,43 +1,44 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/react-sdk-lite",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.18.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/web-sdk": "2.
|
|
8
|
+
"@getpara/react-common": "2.18.0",
|
|
9
|
+
"@getpara/react-components": "2.18.0",
|
|
10
|
+
"@getpara/web-sdk": "2.18.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
|
|
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.
|
|
21
|
-
"@getpara/aa-biconomy": "2.
|
|
22
|
-
"@getpara/aa-cdp": "2.
|
|
23
|
-
"@getpara/aa-gelato": "2.
|
|
24
|
-
"@getpara/aa-pimlico": "2.
|
|
25
|
-
"@getpara/aa-porto": "2.
|
|
26
|
-
"@getpara/aa-rhinestone": "2.
|
|
27
|
-
"@getpara/aa-safe": "2.
|
|
28
|
-
"@getpara/aa-thirdweb": "2.
|
|
29
|
-
"@getpara/aa-zerodev": "2.
|
|
30
|
-
"@getpara/cosmos-wallet-connectors": "2.
|
|
31
|
-
"@getpara/evm-wallet-connectors": "2.
|
|
32
|
-
"@getpara/solana-wallet-connectors": "2.
|
|
21
|
+
"@getpara/aa-alchemy": "2.18.0",
|
|
22
|
+
"@getpara/aa-biconomy": "2.18.0",
|
|
23
|
+
"@getpara/aa-cdp": "2.18.0",
|
|
24
|
+
"@getpara/aa-gelato": "2.18.0",
|
|
25
|
+
"@getpara/aa-pimlico": "2.18.0",
|
|
26
|
+
"@getpara/aa-porto": "2.18.0",
|
|
27
|
+
"@getpara/aa-rhinestone": "2.18.0",
|
|
28
|
+
"@getpara/aa-safe": "2.18.0",
|
|
29
|
+
"@getpara/aa-thirdweb": "2.18.0",
|
|
30
|
+
"@getpara/aa-zerodev": "2.18.0",
|
|
31
|
+
"@getpara/cosmos-wallet-connectors": "2.18.0",
|
|
32
|
+
"@getpara/evm-wallet-connectors": "2.18.0",
|
|
33
|
+
"@getpara/solana-wallet-connectors": "2.18.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.
|
|
40
|
-
"@types/react-dom": "^18.
|
|
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": "
|
|
53
|
+
"gitHead": "4481f6f4e108e682d14c74d4433696141c47fc58",
|
|
53
54
|
"main": "dist/index.js",
|
|
54
55
|
"peerDependencies": {
|
|
55
56
|
"@getpara/aa-alchemy": ">=2.15.0",
|