@account-kit/smart-contracts 4.0.0-beta.7 → 4.0.0-beta.9
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/esm/src/light-account/clients/alchemyClient.d.ts +3 -3
- package/dist/esm/src/light-account/clients/alchemyClient.js +10 -13
- package/dist/esm/src/light-account/clients/alchemyClient.js.map +1 -1
- package/dist/esm/src/light-account/clients/multiOwnerAlchemyClient.d.ts +3 -3
- package/dist/esm/src/light-account/clients/multiOwnerAlchemyClient.js +13 -14
- package/dist/esm/src/light-account/clients/multiOwnerAlchemyClient.js.map +1 -1
- package/dist/esm/src/msca/client/alchemyClient.d.ts +3 -3
- package/dist/esm/src/msca/client/alchemyClient.js +8 -12
- package/dist/esm/src/msca/client/alchemyClient.js.map +1 -1
- package/dist/esm/src/msca/client/multiSigAlchemyClient.d.ts +3 -3
- package/dist/esm/src/msca/client/multiSigAlchemyClient.js +7 -11
- package/dist/esm/src/msca/client/multiSigAlchemyClient.js.map +1 -1
- package/dist/esm/src/msca/plugins/multi-owner/plugin.js.map +1 -1
- package/dist/esm/src/msca/plugins/multisig/plugin.js.map +1 -1
- package/dist/esm/src/msca/plugins/session-key/plugin.js.map +1 -1
- package/dist/types/src/light-account/clients/alchemyClient.d.ts +3 -3
- package/dist/types/src/light-account/clients/alchemyClient.d.ts.map +1 -1
- package/dist/types/src/light-account/clients/multiOwnerAlchemyClient.d.ts +3 -3
- package/dist/types/src/light-account/clients/multiOwnerAlchemyClient.d.ts.map +1 -1
- package/dist/types/src/msca/client/alchemyClient.d.ts +3 -3
- package/dist/types/src/msca/client/alchemyClient.d.ts.map +1 -1
- package/dist/types/src/msca/client/multiSigAlchemyClient.d.ts +3 -3
- package/dist/types/src/msca/client/multiSigAlchemyClient.d.ts.map +1 -1
- package/dist/types/src/msca/plugins/multi-owner/plugin.d.ts.map +1 -1
- package/dist/types/src/msca/plugins/multisig/plugin.d.ts.map +1 -1
- package/dist/types/src/msca/plugins/session-key/plugin.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/light-account/clients/alchemyClient.ts +17 -26
- package/src/light-account/clients/multiOwnerAlchemyClient.ts +20 -28
- package/src/msca/client/alchemyClient.ts +10 -25
- package/src/msca/client/multiSigAlchemyClient.ts +8 -29
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import type { HttpTransport, SmartAccountSigner } from "@aa-sdk/core";
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
createAlchemyPublicRpcClient,
|
|
5
|
-
createAlchemySmartAccountClientFromExisting,
|
|
3
|
+
createAlchemySmartAccountClient,
|
|
6
4
|
type AlchemySmartAccountClient,
|
|
7
5
|
type AlchemySmartAccountClientConfig,
|
|
8
6
|
} from "@account-kit/infra";
|
|
@@ -13,16 +11,13 @@ import {
|
|
|
13
11
|
type LightAccount,
|
|
14
12
|
type LightAccountClientActions,
|
|
15
13
|
} from "@account-kit/smart-contracts";
|
|
16
|
-
import {
|
|
14
|
+
import { type Chain } from "viem";
|
|
17
15
|
|
|
18
16
|
export type AlchemyLightAccountClientConfig<
|
|
19
17
|
TSigner extends SmartAccountSigner = SmartAccountSigner
|
|
20
|
-
> = Omit<
|
|
21
|
-
CreateLightAccountParams<HttpTransport, TSigner>,
|
|
22
|
-
"transport" | "chain"
|
|
23
|
-
> &
|
|
18
|
+
> = Omit<CreateLightAccountParams<HttpTransport, TSigner>, "transport"> &
|
|
24
19
|
Omit<
|
|
25
|
-
AlchemySmartAccountClientConfig<
|
|
20
|
+
AlchemySmartAccountClientConfig<Chain, LightAccount<TSigner>>,
|
|
26
21
|
"account"
|
|
27
22
|
>;
|
|
28
23
|
|
|
@@ -32,7 +27,6 @@ export async function createLightAccountAlchemyClient<
|
|
|
32
27
|
params: AlchemyLightAccountClientConfig<TSigner>
|
|
33
28
|
): Promise<
|
|
34
29
|
AlchemySmartAccountClient<
|
|
35
|
-
CustomTransport,
|
|
36
30
|
Chain | undefined,
|
|
37
31
|
LightAccount<TSigner>,
|
|
38
32
|
LightAccountClientActions<TSigner>
|
|
@@ -45,12 +39,12 @@ export async function createLightAccountAlchemyClient<
|
|
|
45
39
|
* @example
|
|
46
40
|
* ```ts
|
|
47
41
|
* import { createLightAccountAlchemyClient } from "@account-kit/smart-contracts";
|
|
48
|
-
* import { sepolia } from "@account-kit/infra";
|
|
42
|
+
* import { sepolia, alchemy } from "@account-kit/infra";
|
|
49
43
|
* import { LocalAccountSigner } from "@aa-sdk/core";
|
|
50
44
|
* import { generatePrivateKey } from "viem"
|
|
51
45
|
*
|
|
52
46
|
* const lightAccountClient = await createLightAccountAlchemyClient({
|
|
53
|
-
* apiKey: "your-api-key",
|
|
47
|
+
* transport: alchemy({ apiKey: "your-api-key" }),
|
|
54
48
|
* chain: sepolia,
|
|
55
49
|
* signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())
|
|
56
50
|
* });
|
|
@@ -59,25 +53,22 @@ export async function createLightAccountAlchemyClient<
|
|
|
59
53
|
* @param {AlchemyLightAccountClientConfig} config The configuration for setting up the Alchemy Light Account Client
|
|
60
54
|
* @returns {Promise<AlchemySmartAccountClient>} A promise that resolves to an `AlchemySmartAccountClient` object containing the created client
|
|
61
55
|
*/
|
|
62
|
-
export async function createLightAccountAlchemyClient(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
const client = createAlchemyPublicRpcClient({
|
|
69
|
-
chain,
|
|
70
|
-
connectionConfig,
|
|
71
|
-
});
|
|
72
|
-
|
|
56
|
+
export async function createLightAccountAlchemyClient({
|
|
57
|
+
opts,
|
|
58
|
+
transport,
|
|
59
|
+
chain,
|
|
60
|
+
...config
|
|
61
|
+
}: AlchemyLightAccountClientConfig): Promise<AlchemySmartAccountClient> {
|
|
73
62
|
const account = await createLightAccount({
|
|
74
|
-
transport: custom(client),
|
|
75
63
|
...config,
|
|
64
|
+
transport,
|
|
65
|
+
chain,
|
|
76
66
|
});
|
|
77
67
|
|
|
78
|
-
return
|
|
68
|
+
return createAlchemySmartAccountClient({
|
|
79
69
|
...config,
|
|
80
|
-
|
|
70
|
+
transport,
|
|
71
|
+
chain,
|
|
81
72
|
account,
|
|
82
73
|
opts,
|
|
83
74
|
}).extend(lightAccountClientActions);
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import type { HttpTransport, SmartAccountSigner } from "@aa-sdk/core";
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
createAlchemyPublicRpcClient,
|
|
5
|
-
createAlchemySmartAccountClientFromExisting,
|
|
3
|
+
createAlchemySmartAccountClient,
|
|
6
4
|
type AlchemySmartAccountClient,
|
|
7
5
|
type AlchemySmartAccountClientConfig,
|
|
8
6
|
} from "@account-kit/infra";
|
|
@@ -13,20 +11,16 @@ import {
|
|
|
13
11
|
type MultiOwnerLightAccount,
|
|
14
12
|
type MultiOwnerLightAccountClientActions,
|
|
15
13
|
} from "@account-kit/smart-contracts";
|
|
16
|
-
import {
|
|
14
|
+
import { type Chain } from "viem";
|
|
17
15
|
|
|
18
16
|
export type AlchemyMultiOwnerLightAccountClientConfig<
|
|
19
17
|
TSigner extends SmartAccountSigner = SmartAccountSigner
|
|
20
18
|
> = Omit<
|
|
21
19
|
CreateMultiOwnerLightAccountParams<HttpTransport, TSigner>,
|
|
22
|
-
"transport" | "
|
|
20
|
+
"transport" | "type"
|
|
23
21
|
> &
|
|
24
22
|
Omit<
|
|
25
|
-
AlchemySmartAccountClientConfig<
|
|
26
|
-
Transport,
|
|
27
|
-
Chain,
|
|
28
|
-
MultiOwnerLightAccount<TSigner>
|
|
29
|
-
>,
|
|
23
|
+
AlchemySmartAccountClientConfig<Chain, MultiOwnerLightAccount<TSigner>>,
|
|
30
24
|
"account"
|
|
31
25
|
>;
|
|
32
26
|
|
|
@@ -36,7 +30,6 @@ export async function createMultiOwnerLightAccountAlchemyClient<
|
|
|
36
30
|
params: AlchemyMultiOwnerLightAccountClientConfig<TSigner>
|
|
37
31
|
): Promise<
|
|
38
32
|
AlchemySmartAccountClient<
|
|
39
|
-
CustomTransport,
|
|
40
33
|
Chain | undefined,
|
|
41
34
|
MultiOwnerLightAccount<TSigner>,
|
|
42
35
|
MultiOwnerLightAccountClientActions<TSigner>
|
|
@@ -49,13 +42,15 @@ export async function createMultiOwnerLightAccountAlchemyClient<
|
|
|
49
42
|
* @example
|
|
50
43
|
* ```ts
|
|
51
44
|
* import { createMultiOwnerLightAccountAlchemyClient } from "@account-kit/smart-contracts";
|
|
52
|
-
* import { sepolia } from "@account-kit/infra";
|
|
45
|
+
* import { sepolia, alchemy } from "@account-kit/infra";
|
|
53
46
|
* import { LocalAccountSigner } from "@aa-sdk/core";
|
|
54
47
|
* import { generatePrivateKey } from "viem"
|
|
55
48
|
*
|
|
56
49
|
* const lightAccountClient = await createMultiOwnerLightAccountAlchemyClient({
|
|
57
|
-
*
|
|
58
|
-
*
|
|
50
|
+
* transport: alchemy({
|
|
51
|
+
* apiKey: "your-api-key",
|
|
52
|
+
* }),
|
|
53
|
+
* chain: sepolia
|
|
59
54
|
* signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())
|
|
60
55
|
* });
|
|
61
56
|
* ```
|
|
@@ -63,25 +58,22 @@ export async function createMultiOwnerLightAccountAlchemyClient<
|
|
|
63
58
|
* @param {AlchemyMultiOwnerLightAccountClientConfig} config The configuration for creating the Alchemy client
|
|
64
59
|
* @returns {Promise<AlchemySmartAccountClient>} A promise that resolves to an `AlchemySmartAccountClient` object containing the created account information and methods
|
|
65
60
|
*/
|
|
66
|
-
export async function createMultiOwnerLightAccountAlchemyClient(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
const client = createAlchemyPublicRpcClient({
|
|
73
|
-
chain,
|
|
74
|
-
connectionConfig,
|
|
75
|
-
});
|
|
76
|
-
|
|
61
|
+
export async function createMultiOwnerLightAccountAlchemyClient({
|
|
62
|
+
opts,
|
|
63
|
+
transport,
|
|
64
|
+
chain,
|
|
65
|
+
...config
|
|
66
|
+
}: AlchemyMultiOwnerLightAccountClientConfig): Promise<AlchemySmartAccountClient> {
|
|
77
67
|
const account = await createMultiOwnerLightAccount({
|
|
78
|
-
transport: custom(client),
|
|
79
68
|
...config,
|
|
69
|
+
transport,
|
|
70
|
+
chain,
|
|
80
71
|
});
|
|
81
72
|
|
|
82
|
-
return
|
|
73
|
+
return createAlchemySmartAccountClient({
|
|
83
74
|
...config,
|
|
84
|
-
|
|
75
|
+
transport,
|
|
76
|
+
chain,
|
|
85
77
|
account,
|
|
86
78
|
opts,
|
|
87
79
|
}).extend(multiOwnerLightAccountClientActions);
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import type { SmartAccountSigner } from "@aa-sdk/core";
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
createAlchemyPublicRpcClient,
|
|
5
|
-
createAlchemySmartAccountClientFromExisting,
|
|
3
|
+
createAlchemySmartAccountClient,
|
|
6
4
|
type AlchemySmartAccountClient,
|
|
7
5
|
type AlchemySmartAccountClientConfig,
|
|
8
6
|
} from "@account-kit/infra";
|
|
@@ -18,22 +16,16 @@ import {
|
|
|
18
16
|
type MultiOwnerPluginActions,
|
|
19
17
|
type PluginManagerActions,
|
|
20
18
|
} from "@account-kit/smart-contracts";
|
|
21
|
-
import {
|
|
22
|
-
custom,
|
|
23
|
-
type Chain,
|
|
24
|
-
type CustomTransport,
|
|
25
|
-
type HttpTransport,
|
|
26
|
-
type Transport,
|
|
27
|
-
} from "viem";
|
|
19
|
+
import { type Chain, type HttpTransport } from "viem";
|
|
28
20
|
|
|
29
21
|
export type AlchemyModularAccountClientConfig<
|
|
30
22
|
TSigner extends SmartAccountSigner = SmartAccountSigner
|
|
31
23
|
> = Omit<
|
|
32
24
|
CreateMultiOwnerModularAccountParams<HttpTransport, TSigner>,
|
|
33
|
-
"transport"
|
|
25
|
+
"transport"
|
|
34
26
|
> &
|
|
35
27
|
Omit<
|
|
36
|
-
AlchemySmartAccountClientConfig<
|
|
28
|
+
AlchemySmartAccountClientConfig<Chain, LightAccount<TSigner>>,
|
|
37
29
|
"account"
|
|
38
30
|
>;
|
|
39
31
|
|
|
@@ -43,7 +35,6 @@ export function createModularAccountAlchemyClient<
|
|
|
43
35
|
params: AlchemyModularAccountClientConfig<TSigner>
|
|
44
36
|
): Promise<
|
|
45
37
|
AlchemySmartAccountClient<
|
|
46
|
-
CustomTransport,
|
|
47
38
|
Chain | undefined,
|
|
48
39
|
MultiOwnerModularAccount<TSigner>,
|
|
49
40
|
MultiOwnerPluginActions<MultiOwnerModularAccount<TSigner>> &
|
|
@@ -58,12 +49,12 @@ export function createModularAccountAlchemyClient<
|
|
|
58
49
|
* @example
|
|
59
50
|
* ```ts
|
|
60
51
|
* import { createModularAccountAlchemyClient } from "@account-kit/smart-contracts";
|
|
61
|
-
* import { sepolia } from "@account-kit/infra";
|
|
52
|
+
* import { sepolia, alchemy } from "@account-kit/infra";
|
|
62
53
|
* import { LocalAccountSigner } from "@aa-sdk/core";
|
|
63
54
|
* import { generatePrivateKey } from "viem"
|
|
64
55
|
*
|
|
65
56
|
* const alchemyAccountClient = await createModularAccountAlchemyClient({
|
|
66
|
-
* apiKey: "your-api-key",
|
|
57
|
+
* transport: alchemy({ apiKey: "your-api-key" }),
|
|
67
58
|
* chain: sepolia,
|
|
68
59
|
* signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())
|
|
69
60
|
* });
|
|
@@ -75,22 +66,16 @@ export function createModularAccountAlchemyClient<
|
|
|
75
66
|
export async function createModularAccountAlchemyClient(
|
|
76
67
|
config: AlchemyModularAccountClientConfig
|
|
77
68
|
): Promise<AlchemySmartAccountClient> {
|
|
78
|
-
const { chain, opts
|
|
79
|
-
AlchemyProviderConfigSchema.parse(config);
|
|
80
|
-
|
|
81
|
-
const client = createAlchemyPublicRpcClient({
|
|
82
|
-
chain,
|
|
83
|
-
connectionConfig,
|
|
84
|
-
});
|
|
69
|
+
const { transport, chain, opts } = config;
|
|
85
70
|
|
|
86
71
|
const account = await createMultiOwnerModularAccount({
|
|
87
|
-
transport: custom(client),
|
|
88
72
|
...config,
|
|
73
|
+
transport,
|
|
74
|
+
chain,
|
|
89
75
|
});
|
|
90
76
|
|
|
91
|
-
return
|
|
77
|
+
return createAlchemySmartAccountClient({
|
|
92
78
|
...config,
|
|
93
|
-
client,
|
|
94
79
|
account,
|
|
95
80
|
opts,
|
|
96
81
|
})
|
|
@@ -3,9 +3,7 @@ import {
|
|
|
3
3
|
type SmartAccountSigner,
|
|
4
4
|
} from "@aa-sdk/core";
|
|
5
5
|
import {
|
|
6
|
-
|
|
7
|
-
createAlchemyPublicRpcClient,
|
|
8
|
-
createAlchemySmartAccountClientFromExisting,
|
|
6
|
+
createAlchemySmartAccountClient,
|
|
9
7
|
type AlchemySmartAccountClient,
|
|
10
8
|
type AlchemySmartAccountClientConfig,
|
|
11
9
|
} from "@account-kit/infra";
|
|
@@ -23,13 +21,7 @@ import {
|
|
|
23
21
|
type MultisigUserOperationContext,
|
|
24
22
|
type PluginManagerActions,
|
|
25
23
|
} from "@account-kit/smart-contracts";
|
|
26
|
-
import {
|
|
27
|
-
custom,
|
|
28
|
-
type Chain,
|
|
29
|
-
type CustomTransport,
|
|
30
|
-
type HttpTransport,
|
|
31
|
-
type Transport,
|
|
32
|
-
} from "viem";
|
|
24
|
+
import { type Chain, type HttpTransport } from "viem";
|
|
33
25
|
|
|
34
26
|
// todo: this file seems somewhat duplicated with ./modularAccountClient.ts, but that file has some multi-owner specific fields. Is there a way to refactor these two to de-dupe?
|
|
35
27
|
|
|
@@ -37,11 +29,10 @@ export type AlchemyMultisigAccountClientConfig<
|
|
|
37
29
|
TSigner extends SmartAccountSigner = SmartAccountSigner
|
|
38
30
|
> = Omit<
|
|
39
31
|
CreateMultisigModularAccountParams<HttpTransport, TSigner>,
|
|
40
|
-
"transport"
|
|
32
|
+
"transport"
|
|
41
33
|
> &
|
|
42
34
|
Omit<
|
|
43
35
|
AlchemySmartAccountClientConfig<
|
|
44
|
-
Transport,
|
|
45
36
|
Chain,
|
|
46
37
|
LightAccount<TSigner>,
|
|
47
38
|
MultisigUserOperationContext
|
|
@@ -55,7 +46,6 @@ export function createMultisigAccountAlchemyClient<
|
|
|
55
46
|
params: AlchemyMultisigAccountClientConfig<TSigner>
|
|
56
47
|
): Promise<
|
|
57
48
|
AlchemySmartAccountClient<
|
|
58
|
-
CustomTransport,
|
|
59
49
|
Chain | undefined,
|
|
60
50
|
MultisigModularAccount<TSigner>,
|
|
61
51
|
MultisigPluginActions<MultisigModularAccount<TSigner>> &
|
|
@@ -76,7 +66,7 @@ export function createMultisigAccountAlchemyClient<
|
|
|
76
66
|
* import { generatePrivateKey } from "viem"
|
|
77
67
|
*
|
|
78
68
|
* const alchemyAccountClient = await createMultisigAccountAlchemyClient({
|
|
79
|
-
* apiKey: "your-api-key",
|
|
69
|
+
* transport: alchemy({ apiKey: "your-api-key" }),
|
|
80
70
|
* chain: sepolia,
|
|
81
71
|
* signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey()),
|
|
82
72
|
* owners: [...], // other owners on the account
|
|
@@ -91,7 +81,6 @@ export async function createMultisigAccountAlchemyClient(
|
|
|
91
81
|
config: AlchemyMultisigAccountClientConfig
|
|
92
82
|
): Promise<
|
|
93
83
|
AlchemySmartAccountClient<
|
|
94
|
-
Transport,
|
|
95
84
|
Chain | undefined,
|
|
96
85
|
MultisigModularAccount<SmartAccountSigner>,
|
|
97
86
|
MultisigPluginActions<MultisigModularAccount<SmartAccountSigner>> &
|
|
@@ -100,26 +89,16 @@ export async function createMultisigAccountAlchemyClient(
|
|
|
100
89
|
MultisigUserOperationContext
|
|
101
90
|
>
|
|
102
91
|
> {
|
|
103
|
-
const {
|
|
104
|
-
AlchemyProviderConfigSchema.parse(config);
|
|
105
|
-
|
|
106
|
-
const client = createAlchemyPublicRpcClient({
|
|
107
|
-
chain,
|
|
108
|
-
connectionConfig,
|
|
109
|
-
});
|
|
92
|
+
const { transport, opts, chain } = config;
|
|
110
93
|
|
|
111
94
|
const account = await createMultisigModularAccount({
|
|
112
|
-
transport: custom(client),
|
|
113
95
|
...config,
|
|
96
|
+
transport,
|
|
97
|
+
chain,
|
|
114
98
|
});
|
|
115
99
|
|
|
116
|
-
return
|
|
117
|
-
Chain | undefined,
|
|
118
|
-
MultisigModularAccount<SmartAccountSigner>,
|
|
119
|
-
MultisigUserOperationContext
|
|
120
|
-
>({
|
|
100
|
+
return createAlchemySmartAccountClient({
|
|
121
101
|
...config,
|
|
122
|
-
client,
|
|
123
102
|
account,
|
|
124
103
|
opts,
|
|
125
104
|
signUserOperation: multisigSignatureMiddleware,
|