@getpara/react-sdk-lite 2.15.0 → 2.16.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 +16708 -0
- package/dist/aa/alchemy/hook.js +26 -0
- package/dist/aa/biconomy/hook.d.ts +44 -0
- package/dist/aa/biconomy/hook.js +26 -0
- package/dist/aa/cdp/hook.d.ts +11 -0
- package/dist/aa/cdp/hook.js +26 -0
- package/dist/aa/createSmartAccountHook.d.ts +12 -0
- package/dist/aa/createSmartAccountHook.js +47 -0
- package/dist/aa/gelato/hook.d.ts +11 -0
- package/dist/aa/gelato/hook.js +26 -0
- package/dist/aa/pimlico/hook.d.ts +838 -0
- package/dist/aa/pimlico/hook.js +26 -0
- package/dist/aa/porto/hook.d.ts +12 -0
- package/dist/aa/porto/hook.js +26 -0
- package/dist/aa/rhinestone/hook.d.ts +12 -0
- package/dist/aa/rhinestone/hook.js +26 -0
- package/dist/aa/safe/hook.d.ts +12 -0
- package/dist/aa/safe/hook.js +26 -0
- package/dist/aa/thirdweb/hook.d.ts +12 -0
- package/dist/aa/thirdweb/hook.js +26 -0
- package/dist/aa/types.d.ts +21 -0
- package/dist/aa/types.js +1 -0
- package/dist/aa/zerodev/hook.d.ts +12 -0
- package/dist/aa/zerodev/hook.js +26 -0
- package/dist/cli/cli.mjs +0 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +33 -1
- package/dist/modal/ParaModal.js +1 -1
- package/dist/provider/hooks/queries/useIsFullyLoggedIn.js +2 -1
- package/package.json +62 -9
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__async
|
|
4
|
+
} from "../../chunk-MMUBH76A.js";
|
|
5
|
+
import { createSmartAccountHook } from "../createSmartAccountHook.js";
|
|
6
|
+
const ALCHEMY_SMART_ACCOUNT_BASE_KEY = "PARA_ALCHEMY_SMART_ACCOUNT";
|
|
7
|
+
const useAlchemySmartAccount = createSmartAccountHook({
|
|
8
|
+
queryKeyBase: ALCHEMY_SMART_ACCOUNT_BASE_KEY,
|
|
9
|
+
getQueryKey: (p) => {
|
|
10
|
+
var _a;
|
|
11
|
+
return [p.apiKey, (_a = p.chain) == null ? void 0 : _a.id, p.rpcUrl, p.gasPolicyId, p.mode];
|
|
12
|
+
},
|
|
13
|
+
createClient: (params) => __async(void 0, null, function* () {
|
|
14
|
+
let mod;
|
|
15
|
+
try {
|
|
16
|
+
mod = yield import("@getpara/aa-alchemy");
|
|
17
|
+
} catch (e) {
|
|
18
|
+
throw new Error("[@getpara/react-sdk-lite] Please install @getpara/aa-alchemy to use useAlchemySmartAccount");
|
|
19
|
+
}
|
|
20
|
+
return mod.createAlchemySmartAccount(params);
|
|
21
|
+
})
|
|
22
|
+
});
|
|
23
|
+
export {
|
|
24
|
+
ALCHEMY_SMART_ACCOUNT_BASE_KEY,
|
|
25
|
+
useAlchemySmartAccount
|
|
26
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export declare const BICONOMY_SMART_ACCOUNT_BASE_KEY = "PARA_BICONOMY_SMART_ACCOUNT";
|
|
2
|
+
/**
|
|
3
|
+
* React hook to create and manage a Biconomy smart account.
|
|
4
|
+
*
|
|
5
|
+
* Supports both EIP-4337 and EIP-7702 modes. Transactions are executed via
|
|
6
|
+
* Biconomy's MEE (Multi-chain Execution Environment).
|
|
7
|
+
*
|
|
8
|
+
* Requires `@getpara/aa-biconomy` to be installed.
|
|
9
|
+
*/
|
|
10
|
+
export declare const useBiconomySmartAccount: (params?: import("@getpara/aa-biconomy").BiconomySmartAccountConfig & {
|
|
11
|
+
enabled?: boolean;
|
|
12
|
+
}) => import("../types.js").UseSmartAccountResult<NonNullable<import("@getpara/viem-v2-integration").SmartAccount4337<import("@biconomy/abstractjs").MeeActions & {
|
|
13
|
+
request: <T>(params: {
|
|
14
|
+
path: string;
|
|
15
|
+
method?: "GET" | "POST";
|
|
16
|
+
body?: object;
|
|
17
|
+
params?: Record<string, string>;
|
|
18
|
+
headers?: Record<string, string>;
|
|
19
|
+
}) => Promise<T>;
|
|
20
|
+
extend: <const client extends {
|
|
21
|
+
[x: string]: unknown;
|
|
22
|
+
request?: undefined;
|
|
23
|
+
extend?: undefined;
|
|
24
|
+
}, const extendedHttpClient extends import("@biconomy/abstractjs").HttpClient>(fn: (base: extendedHttpClient) => client) => client & extendedHttpClient;
|
|
25
|
+
pollingInterval: number;
|
|
26
|
+
account: import("@biconomy/abstractjs").MultichainSmartAccount;
|
|
27
|
+
info: import("@biconomy/abstractjs").GetInfoPayload;
|
|
28
|
+
}> | import("@getpara/viem-v2-integration").SmartAccount7702<import("@biconomy/abstractjs").MeeActions & {
|
|
29
|
+
request: <T>(params: {
|
|
30
|
+
path: string;
|
|
31
|
+
method?: "GET" | "POST";
|
|
32
|
+
body?: object;
|
|
33
|
+
params?: Record<string, string>;
|
|
34
|
+
headers?: Record<string, string>;
|
|
35
|
+
}) => Promise<T>;
|
|
36
|
+
extend: <const client extends {
|
|
37
|
+
[x: string]: unknown;
|
|
38
|
+
request?: undefined;
|
|
39
|
+
extend?: undefined;
|
|
40
|
+
}, const extendedHttpClient extends import("@biconomy/abstractjs").HttpClient>(fn: (base: extendedHttpClient) => client) => client & extendedHttpClient;
|
|
41
|
+
pollingInterval: number;
|
|
42
|
+
account: import("@biconomy/abstractjs").MultichainSmartAccount;
|
|
43
|
+
info: import("@biconomy/abstractjs").GetInfoPayload;
|
|
44
|
+
}> | null>>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__async
|
|
4
|
+
} from "../../chunk-MMUBH76A.js";
|
|
5
|
+
import { createSmartAccountHook } from "../createSmartAccountHook.js";
|
|
6
|
+
const BICONOMY_SMART_ACCOUNT_BASE_KEY = "PARA_BICONOMY_SMART_ACCOUNT";
|
|
7
|
+
const useBiconomySmartAccount = createSmartAccountHook({
|
|
8
|
+
queryKeyBase: BICONOMY_SMART_ACCOUNT_BASE_KEY,
|
|
9
|
+
getQueryKey: (p) => {
|
|
10
|
+
var _a;
|
|
11
|
+
return [(_a = p.chain) == null ? void 0 : _a.id, p.rpcUrl, p.meeUrl, p.apiKey, p.mode];
|
|
12
|
+
},
|
|
13
|
+
createClient: (params) => __async(void 0, null, function* () {
|
|
14
|
+
let mod;
|
|
15
|
+
try {
|
|
16
|
+
mod = yield import("@getpara/aa-biconomy");
|
|
17
|
+
} catch (e) {
|
|
18
|
+
throw new Error("[@getpara/react-sdk-lite] Please install @getpara/aa-biconomy to use useBiconomySmartAccount");
|
|
19
|
+
}
|
|
20
|
+
return mod.createBiconomySmartAccount(params);
|
|
21
|
+
})
|
|
22
|
+
});
|
|
23
|
+
export {
|
|
24
|
+
BICONOMY_SMART_ACCOUNT_BASE_KEY,
|
|
25
|
+
useBiconomySmartAccount
|
|
26
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const CDP_SMART_ACCOUNT_BASE_KEY = "PARA_CDP_SMART_ACCOUNT";
|
|
2
|
+
/**
|
|
3
|
+
* React hook to create and manage a Coinbase Developer Platform smart account.
|
|
4
|
+
*
|
|
5
|
+
* CDP operates in EIP-4337 mode only. Only supports Base and Base Sepolia.
|
|
6
|
+
*
|
|
7
|
+
* Requires `@getpara/aa-cdp` to be installed.
|
|
8
|
+
*/
|
|
9
|
+
export declare const useCDPSmartAccount: (params?: import("@getpara/aa-cdp").CDPSmartAccountConfig & {
|
|
10
|
+
enabled?: boolean;
|
|
11
|
+
}) => import("../types.js").UseSmartAccountResult<import("@getpara/viem-v2-integration").SmartAccount4337<import("viem/_types/account-abstraction/index.js").BundlerClient>>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__async
|
|
4
|
+
} from "../../chunk-MMUBH76A.js";
|
|
5
|
+
import { createSmartAccountHook } from "../createSmartAccountHook.js";
|
|
6
|
+
const CDP_SMART_ACCOUNT_BASE_KEY = "PARA_CDP_SMART_ACCOUNT";
|
|
7
|
+
const useCDPSmartAccount = createSmartAccountHook({
|
|
8
|
+
queryKeyBase: CDP_SMART_ACCOUNT_BASE_KEY,
|
|
9
|
+
getQueryKey: (p) => {
|
|
10
|
+
var _a;
|
|
11
|
+
return [(_a = p.chain) == null ? void 0 : _a.id, p.rpcUrl, p.rpcToken];
|
|
12
|
+
},
|
|
13
|
+
createClient: (params) => __async(void 0, null, function* () {
|
|
14
|
+
let mod;
|
|
15
|
+
try {
|
|
16
|
+
mod = yield import("@getpara/aa-cdp");
|
|
17
|
+
} catch (e) {
|
|
18
|
+
throw new Error("[@getpara/react-sdk-lite] Please install @getpara/aa-cdp to use useCDPSmartAccount");
|
|
19
|
+
}
|
|
20
|
+
return mod.createCDPSmartAccount(params);
|
|
21
|
+
})
|
|
22
|
+
});
|
|
23
|
+
export {
|
|
24
|
+
CDP_SMART_ACCOUNT_BASE_KEY,
|
|
25
|
+
useCDPSmartAccount
|
|
26
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Hex } from 'viem';
|
|
2
|
+
import type { SmartAccountHookConfig, UseSmartAccountResult } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Factory that creates a React hook for a specific smart account provider.
|
|
5
|
+
* Each provider hook uses React Query to manage async account creation.
|
|
6
|
+
*/
|
|
7
|
+
export declare function createSmartAccountHook<TParams extends {
|
|
8
|
+
address?: Hex;
|
|
9
|
+
walletId?: string;
|
|
10
|
+
}, TResult>(config: SmartAccountHookConfig<TParams, TResult>): (params?: TParams & {
|
|
11
|
+
enabled?: boolean;
|
|
12
|
+
}) => UseSmartAccountResult<TResult>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__async,
|
|
4
|
+
__objRest,
|
|
5
|
+
__spreadProps,
|
|
6
|
+
__spreadValues
|
|
7
|
+
} from "../chunk-MMUBH76A.js";
|
|
8
|
+
import { useAccount, useClient, useWallet } from "../provider/index.js";
|
|
9
|
+
import { useQuery } from "@tanstack/react-query";
|
|
10
|
+
function createSmartAccountHook(config) {
|
|
11
|
+
return function useSmartAccount(params = {}) {
|
|
12
|
+
var _b, _c, _d;
|
|
13
|
+
const para = useClient();
|
|
14
|
+
const {
|
|
15
|
+
isConnected,
|
|
16
|
+
embedded: { userId }
|
|
17
|
+
} = useAccount();
|
|
18
|
+
const { data: wallet } = useWallet();
|
|
19
|
+
const _a = params != null ? params : {}, { enabled = true } = _a, rest = __objRest(_a, ["enabled"]);
|
|
20
|
+
const configParams = rest;
|
|
21
|
+
const contextAddress = (wallet == null ? void 0 : wallet.type) === "EVM" ? wallet == null ? void 0 : wallet.address : void 0;
|
|
22
|
+
const queryResult = useQuery({
|
|
23
|
+
queryKey: [
|
|
24
|
+
config.queryKeyBase,
|
|
25
|
+
isConnected,
|
|
26
|
+
userId,
|
|
27
|
+
(_d = (_c = (_b = configParams == null ? void 0 : configParams.address) != null ? _b : configParams == null ? void 0 : configParams.walletId) != null ? _c : contextAddress) != null ? _d : null,
|
|
28
|
+
...config.getQueryKey(configParams != null ? configParams : {})
|
|
29
|
+
],
|
|
30
|
+
enabled: isConnected && !!para && enabled,
|
|
31
|
+
queryFn: () => __async(this, null, function* () {
|
|
32
|
+
var _a2;
|
|
33
|
+
if (!isConnected || !para) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
const address = (configParams == null ? void 0 : configParams.walletId) ? void 0 : (_a2 = configParams == null ? void 0 : configParams.address) != null ? _a2 : contextAddress;
|
|
37
|
+
return config.createClient(__spreadProps(__spreadValues({}, configParams), { para, address }));
|
|
38
|
+
})
|
|
39
|
+
});
|
|
40
|
+
return __spreadProps(__spreadValues({}, queryResult), {
|
|
41
|
+
smartAccount: queryResult.data
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export {
|
|
46
|
+
createSmartAccountHook
|
|
47
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const GELATO_SMART_ACCOUNT_BASE_KEY = "PARA_GELATO_SMART_ACCOUNT";
|
|
2
|
+
/**
|
|
3
|
+
* React hook to create and manage a Gelato smart account.
|
|
4
|
+
*
|
|
5
|
+
* Gelato operates in EIP-7702 mode only. Uses Gelato's relay for gas-sponsored transactions.
|
|
6
|
+
*
|
|
7
|
+
* Requires `@getpara/aa-gelato` to be installed.
|
|
8
|
+
*/
|
|
9
|
+
export declare const useGelatoSmartAccount: (params?: import("@getpara/aa-gelato").GelatoSmartAccountConfig & {
|
|
10
|
+
enabled?: boolean;
|
|
11
|
+
}) => import("../types.js").UseSmartAccountResult<import("@getpara/viem-v2-integration").SmartAccount7702<import("@gelatocloud/gasless").GelatoBundlerClient>>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__async
|
|
4
|
+
} from "../../chunk-MMUBH76A.js";
|
|
5
|
+
import { createSmartAccountHook } from "../createSmartAccountHook.js";
|
|
6
|
+
const GELATO_SMART_ACCOUNT_BASE_KEY = "PARA_GELATO_SMART_ACCOUNT";
|
|
7
|
+
const useGelatoSmartAccount = createSmartAccountHook({
|
|
8
|
+
queryKeyBase: GELATO_SMART_ACCOUNT_BASE_KEY,
|
|
9
|
+
getQueryKey: (p) => {
|
|
10
|
+
var _a;
|
|
11
|
+
return [p.apiKey, (_a = p.chain) == null ? void 0 : _a.id, p.rpcUrl];
|
|
12
|
+
},
|
|
13
|
+
createClient: (params) => __async(void 0, null, function* () {
|
|
14
|
+
let mod;
|
|
15
|
+
try {
|
|
16
|
+
mod = yield import("@getpara/aa-gelato");
|
|
17
|
+
} catch (e) {
|
|
18
|
+
throw new Error("[@getpara/react-sdk-lite] Please install @getpara/aa-gelato to use useGelatoSmartAccount");
|
|
19
|
+
}
|
|
20
|
+
return mod.createGelatoSmartAccount(params);
|
|
21
|
+
})
|
|
22
|
+
});
|
|
23
|
+
export {
|
|
24
|
+
GELATO_SMART_ACCOUNT_BASE_KEY,
|
|
25
|
+
useGelatoSmartAccount
|
|
26
|
+
};
|