@account-kit/smart-contracts 4.0.0-alpha.1 → 4.0.0-alpha.11
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/cjs/plugindefs/multi-owner/config.js +16 -17
- package/dist/cjs/plugindefs/multi-owner/config.js.map +1 -1
- package/dist/cjs/plugindefs/multisig/config.js +15 -15
- package/dist/cjs/plugindefs/multisig/config.js.map +1 -1
- package/dist/cjs/plugindefs/session-key/config.js +17 -17
- package/dist/cjs/plugindefs/session-key/config.js.map +1 -1
- package/dist/cjs/src/index.d.ts +1 -1
- package/dist/cjs/src/index.js +4 -3
- package/dist/cjs/src/index.js.map +1 -1
- package/dist/cjs/src/light-account/accounts/account.d.ts +5 -6
- package/dist/cjs/src/light-account/accounts/account.js +3 -2
- package/dist/cjs/src/light-account/accounts/account.js.map +1 -1
- package/dist/cjs/src/light-account/accounts/base.d.ts +7 -6
- package/dist/cjs/src/light-account/accounts/base.js +8 -8
- package/dist/cjs/src/light-account/accounts/base.js.map +1 -1
- package/dist/cjs/src/light-account/accounts/multiOwner.d.ts +5 -5
- package/dist/cjs/src/light-account/accounts/multiOwner.js +3 -2
- package/dist/cjs/src/light-account/accounts/multiOwner.js.map +1 -1
- package/dist/cjs/src/light-account/clients/alchemyClient.d.ts +1 -1
- package/dist/cjs/src/light-account/clients/alchemyClient.js.map +1 -1
- package/dist/cjs/src/light-account/clients/client.d.ts +1 -2
- package/dist/cjs/src/light-account/clients/client.js +3 -3
- package/dist/cjs/src/light-account/clients/client.js.map +1 -1
- package/dist/cjs/src/light-account/clients/multiOwnerAlchemyClient.d.ts +2 -2
- package/dist/cjs/src/light-account/clients/multiOwnerAlchemyClient.js.map +1 -1
- package/dist/cjs/src/light-account/clients/multiOwnerLightAccount.d.ts +1 -2
- package/dist/cjs/src/light-account/clients/multiOwnerLightAccount.js +3 -3
- package/dist/cjs/src/light-account/clients/multiOwnerLightAccount.js.map +1 -1
- package/dist/cjs/src/light-account/decorators/lightAccount.js.map +1 -1
- package/dist/cjs/src/light-account/decorators/multiOwnerLightAccount.js.map +1 -1
- package/dist/cjs/src/light-account/types.d.ts +23 -31
- package/dist/cjs/src/light-account/types.js.map +1 -1
- package/dist/cjs/src/light-account/utils.d.ts +7 -10
- package/dist/cjs/src/light-account/utils.js +59 -87
- package/dist/cjs/src/light-account/utils.js.map +1 -1
- package/dist/cjs/src/msca/client/alchemyClient.d.ts +1 -1
- package/dist/cjs/src/msca/client/alchemyClient.js.map +1 -1
- package/dist/cjs/src/msca/client/client.d.ts +2 -6
- package/dist/cjs/src/msca/client/client.js +6 -6
- package/dist/cjs/src/msca/client/client.js.map +1 -1
- package/dist/cjs/src/msca/client/multiSigAlchemyClient.d.ts +1 -1
- package/dist/cjs/src/msca/client/multiSigAlchemyClient.js +1 -1
- package/dist/cjs/src/msca/client/multiSigAlchemyClient.js.map +1 -1
- package/dist/cjs/src/msca/plugins/multisig/middleware.js.map +1 -1
- package/dist/cjs/src/msca/plugins/multisig/utils/formatSignatures.js.map +1 -1
- package/dist/cjs/src/msca/plugins/multisig/utils/splitAggregatedSignature.d.ts +3 -2
- package/dist/cjs/src/msca/plugins/multisig/utils/splitAggregatedSignature.js.map +1 -1
- package/dist/cjs/src/msca/plugins/session-key/permissions.js.map +1 -1
- package/dist/cjs/src/msca/plugins/session-key/signer.js.map +1 -1
- package/dist/cjs/src/msca/utils.js +11 -10
- package/dist/cjs/src/msca/utils.js.map +1 -1
- package/dist/esm/plugindefs/multi-owner/config.js +1 -2
- package/dist/esm/plugindefs/multi-owner/config.js.map +1 -1
- package/dist/esm/plugindefs/multisig/config.js +1 -1
- package/dist/esm/plugindefs/multisig/config.js.map +1 -1
- package/dist/esm/plugindefs/session-key/config.js +1 -1
- package/dist/esm/plugindefs/session-key/config.js.map +1 -1
- package/dist/esm/src/index.d.ts +1 -1
- package/dist/esm/src/index.js +1 -1
- package/dist/esm/src/index.js.map +1 -1
- package/dist/esm/src/light-account/accounts/account.d.ts +5 -6
- package/dist/esm/src/light-account/accounts/account.js +3 -2
- package/dist/esm/src/light-account/accounts/account.js.map +1 -1
- package/dist/esm/src/light-account/accounts/base.d.ts +7 -6
- package/dist/esm/src/light-account/accounts/base.js +8 -8
- package/dist/esm/src/light-account/accounts/base.js.map +1 -1
- package/dist/esm/src/light-account/accounts/multiOwner.d.ts +5 -5
- package/dist/esm/src/light-account/accounts/multiOwner.js +4 -3
- package/dist/esm/src/light-account/accounts/multiOwner.js.map +1 -1
- package/dist/esm/src/light-account/clients/alchemyClient.d.ts +1 -1
- package/dist/esm/src/light-account/clients/alchemyClient.js.map +1 -1
- package/dist/esm/src/light-account/clients/client.d.ts +1 -2
- package/dist/esm/src/light-account/clients/client.js +3 -3
- package/dist/esm/src/light-account/clients/client.js.map +1 -1
- package/dist/esm/src/light-account/clients/multiOwnerAlchemyClient.d.ts +2 -2
- package/dist/esm/src/light-account/clients/multiOwnerAlchemyClient.js.map +1 -1
- package/dist/esm/src/light-account/clients/multiOwnerLightAccount.d.ts +1 -2
- package/dist/esm/src/light-account/clients/multiOwnerLightAccount.js +3 -3
- package/dist/esm/src/light-account/clients/multiOwnerLightAccount.js.map +1 -1
- package/dist/esm/src/light-account/decorators/lightAccount.js.map +1 -1
- package/dist/esm/src/light-account/decorators/multiOwnerLightAccount.js.map +1 -1
- package/dist/esm/src/light-account/types.d.ts +23 -31
- package/dist/esm/src/light-account/types.js.map +1 -1
- package/dist/esm/src/light-account/utils.d.ts +7 -10
- package/dist/esm/src/light-account/utils.js +57 -84
- package/dist/esm/src/light-account/utils.js.map +1 -1
- package/dist/esm/src/msca/client/alchemyClient.d.ts +1 -1
- package/dist/esm/src/msca/client/alchemyClient.js.map +1 -1
- package/dist/esm/src/msca/client/client.d.ts +2 -6
- package/dist/esm/src/msca/client/client.js +6 -6
- package/dist/esm/src/msca/client/client.js.map +1 -1
- package/dist/esm/src/msca/client/multiSigAlchemyClient.d.ts +1 -1
- package/dist/esm/src/msca/client/multiSigAlchemyClient.js +1 -1
- package/dist/esm/src/msca/client/multiSigAlchemyClient.js.map +1 -1
- package/dist/esm/src/msca/plugins/multisig/middleware.js.map +1 -1
- package/dist/esm/src/msca/plugins/multisig/utils/formatSignatures.js.map +1 -1
- package/dist/esm/src/msca/plugins/multisig/utils/splitAggregatedSignature.d.ts +3 -2
- package/dist/esm/src/msca/plugins/multisig/utils/splitAggregatedSignature.js.map +1 -1
- package/dist/esm/src/msca/plugins/session-key/permissions.js.map +1 -1
- package/dist/esm/src/msca/plugins/session-key/signer.js.map +1 -1
- package/dist/esm/src/msca/utils.js +2 -1
- package/dist/esm/src/msca/utils.js.map +1 -1
- package/dist/types/plugindefs/multi-owner/config.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/light-account/accounts/account.d.ts +5 -6
- package/dist/types/src/light-account/accounts/account.d.ts.map +1 -1
- package/dist/types/src/light-account/accounts/base.d.ts +7 -6
- package/dist/types/src/light-account/accounts/base.d.ts.map +1 -1
- package/dist/types/src/light-account/accounts/multiOwner.d.ts +5 -5
- package/dist/types/src/light-account/accounts/multiOwner.d.ts.map +1 -1
- package/dist/types/src/light-account/clients/alchemyClient.d.ts +1 -1
- package/dist/types/src/light-account/clients/alchemyClient.d.ts.map +1 -1
- package/dist/types/src/light-account/clients/client.d.ts +1 -2
- package/dist/types/src/light-account/clients/client.d.ts.map +1 -1
- package/dist/types/src/light-account/clients/multiOwnerAlchemyClient.d.ts +2 -2
- package/dist/types/src/light-account/clients/multiOwnerAlchemyClient.d.ts.map +1 -1
- package/dist/types/src/light-account/clients/multiOwnerLightAccount.d.ts +1 -2
- package/dist/types/src/light-account/clients/multiOwnerLightAccount.d.ts.map +1 -1
- package/dist/types/src/light-account/decorators/lightAccount.d.ts +1 -1
- package/dist/types/src/light-account/decorators/multiOwnerLightAccount.d.ts +1 -1
- package/dist/types/src/light-account/types.d.ts +23 -118
- package/dist/types/src/light-account/types.d.ts.map +1 -1
- package/dist/types/src/light-account/utils.d.ts +19 -48
- package/dist/types/src/light-account/utils.d.ts.map +1 -1
- package/dist/types/src/msca/client/alchemyClient.d.ts +1 -1
- package/dist/types/src/msca/client/alchemyClient.d.ts.map +1 -1
- package/dist/types/src/msca/client/client.d.ts +2 -6
- package/dist/types/src/msca/client/client.d.ts.map +1 -1
- package/dist/types/src/msca/client/multiSigAlchemyClient.d.ts +1 -1
- package/dist/types/src/msca/client/multiSigAlchemyClient.d.ts.map +1 -1
- package/dist/types/src/msca/plugins/multisig/middleware.d.ts +6 -6
- package/dist/types/src/msca/plugins/multisig/utils/formatSignatures.d.ts +3 -3
- package/dist/types/src/msca/plugins/multisig/utils/splitAggregatedSignature.d.ts +13 -12
- package/dist/types/src/msca/plugins/multisig/utils/splitAggregatedSignature.d.ts.map +1 -1
- package/dist/types/src/msca/plugins/session-key/permissions.d.ts +147 -1
- package/dist/types/src/msca/plugins/session-key/permissions.d.ts.map +1 -1
- package/dist/types/src/msca/plugins/session-key/signer.d.ts +71 -1
- package/dist/types/src/msca/plugins/session-key/signer.d.ts.map +1 -1
- package/dist/types/src/msca/utils.d.ts +6 -6
- package/dist/types/src/msca/utils.d.ts.map +1 -1
- package/package.json +7 -6
- package/plugindefs/multi-owner/config.ts +1 -2
- package/plugindefs/multisig/config.ts +1 -1
- package/plugindefs/session-key/config.ts +1 -1
- package/src/index.ts +2 -1
- package/src/light-account/accounts/account.ts +24 -45
- package/src/light-account/accounts/base.ts +39 -68
- package/src/light-account/accounts/multiOwner.ts +29 -43
- package/src/light-account/clients/alchemyClient.ts +2 -2
- package/src/light-account/clients/client.ts +8 -13
- package/src/light-account/clients/multiOwnerAlchemyClient.ts +3 -3
- package/src/light-account/clients/multiOwnerLightAccount.ts +11 -13
- package/src/light-account/decorators/lightAccount.ts +1 -1
- package/src/light-account/decorators/multiOwnerLightAccount.ts +1 -1
- package/src/light-account/types.ts +31 -188
- package/src/light-account/utils.ts +91 -246
- package/src/msca/client/alchemyClient.ts +2 -2
- package/src/msca/client/client.ts +24 -36
- package/src/msca/client/multiSigAlchemyClient.ts +5 -5
- package/src/msca/plugins/multisig/middleware.ts +6 -6
- package/src/msca/plugins/multisig/utils/formatSignatures.ts +3 -3
- package/src/msca/plugins/multisig/utils/splitAggregatedSignature.ts +15 -12
- package/src/msca/plugins/session-key/permissions.ts +147 -1
- package/src/msca/plugins/session-key/signer.ts +71 -1
- package/src/msca/utils.ts +15 -13
- package/dist/cjs/src/light-account/e2e-tests/constants.d.ts +0 -6
- package/dist/cjs/src/light-account/e2e-tests/constants.js +0 -10
- package/dist/cjs/src/light-account/e2e-tests/constants.js.map +0 -1
- package/dist/cjs/src/light-account/schema.d.ts +0 -21
- package/dist/cjs/src/light-account/schema.js +0 -30
- package/dist/cjs/src/light-account/schema.js.map +0 -1
- package/dist/esm/src/light-account/e2e-tests/constants.d.ts +0 -6
- package/dist/esm/src/light-account/e2e-tests/constants.js +0 -7
- package/dist/esm/src/light-account/e2e-tests/constants.js.map +0 -1
- package/dist/esm/src/light-account/schema.d.ts +0 -21
- package/dist/esm/src/light-account/schema.js +0 -27
- package/dist/esm/src/light-account/schema.js.map +0 -1
- package/dist/types/src/light-account/e2e-tests/constants.d.ts +0 -7
- package/dist/types/src/light-account/e2e-tests/constants.d.ts.map +0 -1
- package/dist/types/src/light-account/schema.d.ts +0 -22
- package/dist/types/src/light-account/schema.d.ts.map +0 -1
- package/src/light-account/e2e-tests/constants.ts +0 -8
- package/src/light-account/schema.ts +0 -39
|
@@ -23,11 +23,9 @@ import {
|
|
|
23
23
|
type Transport,
|
|
24
24
|
} from "viem";
|
|
25
25
|
import type {
|
|
26
|
-
|
|
27
|
-
GetEntryPointForLightAccountVersion,
|
|
28
|
-
GetLightAccountVersion,
|
|
26
|
+
LightAccountEntryPointVersion,
|
|
29
27
|
LightAccountType,
|
|
30
|
-
|
|
28
|
+
LightAccountVersion,
|
|
31
29
|
} from "../types.js";
|
|
32
30
|
import { AccountVersionRegistry } from "../utils.js";
|
|
33
31
|
|
|
@@ -40,91 +38,60 @@ enum SignatureType {
|
|
|
40
38
|
export type LightAccountBase<
|
|
41
39
|
TSigner extends SmartAccountSigner = SmartAccountSigner,
|
|
42
40
|
TLightAccountType extends LightAccountType = LightAccountType,
|
|
43
|
-
TLightAccountVersion extends
|
|
44
|
-
TEntryPointVersion extends GetEntryPointForLightAccountVersion<
|
|
45
|
-
TLightAccountType,
|
|
46
|
-
TLightAccountVersion
|
|
47
|
-
> = GetEntryPointForLightAccountVersion<
|
|
48
|
-
TLightAccountType,
|
|
49
|
-
TLightAccountVersion
|
|
50
|
-
>
|
|
41
|
+
TLightAccountVersion extends LightAccountVersion<TLightAccountType> = LightAccountVersion<TLightAccountType>
|
|
51
42
|
> = SmartContractAccountWithSigner<
|
|
52
43
|
TLightAccountType,
|
|
53
44
|
TSigner,
|
|
54
|
-
|
|
45
|
+
LightAccountEntryPointVersion<TLightAccountType, TLightAccountVersion>
|
|
55
46
|
> & {
|
|
56
47
|
getLightAccountVersion: () => TLightAccountVersion;
|
|
57
48
|
};
|
|
58
49
|
|
|
59
50
|
//#region CreateLightAccountBaseParams
|
|
60
51
|
export type CreateLightAccountBaseParams<
|
|
52
|
+
TLightAccountType extends LightAccountType,
|
|
53
|
+
TLightAccountVersion extends LightAccountVersion<TLightAccountType> = LightAccountVersion<TLightAccountType>,
|
|
61
54
|
TTransport extends Transport = Transport,
|
|
62
|
-
TSigner extends SmartAccountSigner = SmartAccountSigner
|
|
63
|
-
TLightAccountType extends LightAccountType = LightAccountType,
|
|
64
|
-
TLightAccountVersion extends GetLightAccountVersion<TLightAccountType> = GetLightAccountVersion<TLightAccountType>,
|
|
65
|
-
TEntryPointVersion extends GetEntryPointForLightAccountVersion<
|
|
66
|
-
TLightAccountType,
|
|
67
|
-
TLightAccountVersion
|
|
68
|
-
> = GetEntryPointForLightAccountVersion<
|
|
69
|
-
TLightAccountType,
|
|
70
|
-
TLightAccountVersion
|
|
71
|
-
>
|
|
55
|
+
TSigner extends SmartAccountSigner = SmartAccountSigner
|
|
72
56
|
> = Pick<
|
|
73
|
-
ToSmartContractAccountParams<
|
|
74
|
-
TLightAccountType,
|
|
75
|
-
TTransport,
|
|
76
|
-
Chain,
|
|
77
|
-
TEntryPointVersion
|
|
78
|
-
>,
|
|
57
|
+
ToSmartContractAccountParams<TLightAccountType, TTransport, Chain>,
|
|
79
58
|
"transport" | "chain" | "getAccountInitCode"
|
|
80
59
|
> & {
|
|
81
60
|
abi: Abi;
|
|
82
61
|
signer: TSigner;
|
|
83
62
|
accountAddress: Address;
|
|
84
|
-
|
|
85
|
-
|
|
63
|
+
type: TLightAccountType;
|
|
64
|
+
version: TLightAccountVersion;
|
|
65
|
+
entryPoint: EntryPointDef<
|
|
66
|
+
LightAccountEntryPointVersion<TLightAccountType, TLightAccountVersion>,
|
|
67
|
+
Chain
|
|
68
|
+
>;
|
|
86
69
|
};
|
|
87
70
|
//#endregion CreateLightAccountBaseParams
|
|
88
71
|
|
|
89
72
|
export async function createLightAccountBase<
|
|
73
|
+
TLightAccountType extends LightAccountType,
|
|
74
|
+
TLightAccountVersion extends LightAccountVersion<TLightAccountType>,
|
|
90
75
|
TTransport extends Transport = Transport,
|
|
91
|
-
TSigner extends SmartAccountSigner = SmartAccountSigner
|
|
92
|
-
|
|
93
|
-
TLightAccountVersion extends GetLightAccountVersion<TLightAccountType> = GetLightAccountVersion<TLightAccountType>,
|
|
94
|
-
TEntryPointVersion extends GetEntryPointForLightAccountVersion<
|
|
95
|
-
TLightAccountType,
|
|
96
|
-
TLightAccountVersion
|
|
97
|
-
> = GetEntryPointForLightAccountVersion<
|
|
98
|
-
TLightAccountType,
|
|
99
|
-
TLightAccountVersion
|
|
100
|
-
>
|
|
101
|
-
>(
|
|
102
|
-
config: CreateLightAccountBaseParams<
|
|
103
|
-
TTransport,
|
|
104
|
-
TSigner,
|
|
105
|
-
TLightAccountType,
|
|
106
|
-
TLightAccountVersion,
|
|
107
|
-
TEntryPointVersion
|
|
108
|
-
>
|
|
109
|
-
): Promise<
|
|
110
|
-
LightAccountBase<
|
|
111
|
-
TSigner,
|
|
112
|
-
TLightAccountType,
|
|
113
|
-
TLightAccountVersion,
|
|
114
|
-
TEntryPointVersion
|
|
115
|
-
>
|
|
116
|
-
>;
|
|
117
|
-
|
|
118
|
-
export async function createLightAccountBase({
|
|
76
|
+
TSigner extends SmartAccountSigner = SmartAccountSigner
|
|
77
|
+
>({
|
|
119
78
|
transport,
|
|
120
79
|
chain,
|
|
121
80
|
signer,
|
|
122
81
|
abi,
|
|
123
|
-
version
|
|
82
|
+
version,
|
|
83
|
+
type,
|
|
124
84
|
entryPoint,
|
|
125
85
|
accountAddress,
|
|
126
86
|
getAccountInitCode,
|
|
127
|
-
}: CreateLightAccountBaseParams
|
|
87
|
+
}: CreateLightAccountBaseParams<
|
|
88
|
+
TLightAccountType,
|
|
89
|
+
TLightAccountVersion,
|
|
90
|
+
TTransport,
|
|
91
|
+
TSigner
|
|
92
|
+
>): Promise<
|
|
93
|
+
LightAccountBase<TSigner, TLightAccountType, TLightAccountVersion>
|
|
94
|
+
> {
|
|
128
95
|
const client = createBundlerClient({
|
|
129
96
|
transport,
|
|
130
97
|
chain,
|
|
@@ -149,7 +116,9 @@ export async function createLightAccountBase({
|
|
|
149
116
|
|
|
150
117
|
const implementationAddresses = Object.values(
|
|
151
118
|
AccountVersionRegistry[type]
|
|
152
|
-
).map(
|
|
119
|
+
).map(
|
|
120
|
+
(x) => x.addresses.overrides?.[chain.id]?.impl ?? x.addresses.default.impl
|
|
121
|
+
);
|
|
153
122
|
|
|
154
123
|
// only upgrade undeployed accounts (storage 0) or deployed light accounts, error otherwise
|
|
155
124
|
if (
|
|
@@ -157,7 +126,9 @@ export async function createLightAccountBase({
|
|
|
157
126
|
!implementationAddresses.some((x) => x === trim(storage))
|
|
158
127
|
) {
|
|
159
128
|
throw new Error(
|
|
160
|
-
`could not determine if smart account implementation is ${type} ${
|
|
129
|
+
`could not determine if smart account implementation is ${type} ${String(
|
|
130
|
+
version
|
|
131
|
+
)}`
|
|
161
132
|
);
|
|
162
133
|
}
|
|
163
134
|
|
|
@@ -234,7 +205,7 @@ export async function createLightAccountBase({
|
|
|
234
205
|
case "v1.0.1":
|
|
235
206
|
return signer.signMessage(message);
|
|
236
207
|
case "v1.0.2":
|
|
237
|
-
throw new Error(`${type} ${version} doesn't support 1271`);
|
|
208
|
+
throw new Error(`${type} ${String(version)} doesn't support 1271`);
|
|
238
209
|
case "v1.1.0":
|
|
239
210
|
return signWith1271WrapperV1(hashMessage(message));
|
|
240
211
|
case "v2.0.0":
|
|
@@ -242,7 +213,7 @@ export async function createLightAccountBase({
|
|
|
242
213
|
// TODO: handle case where signer is an SCA.
|
|
243
214
|
return concat([SignatureType.EOA, signature]);
|
|
244
215
|
default:
|
|
245
|
-
throw new Error(`Unknown version ${type} of ${version}`);
|
|
216
|
+
throw new Error(`Unknown version ${type} of ${String(version)}`);
|
|
246
217
|
}
|
|
247
218
|
},
|
|
248
219
|
async signTypedData(params) {
|
|
@@ -253,7 +224,7 @@ export async function createLightAccountBase({
|
|
|
253
224
|
);
|
|
254
225
|
case "v1.0.2":
|
|
255
226
|
throw new Error(
|
|
256
|
-
`Version ${version} of LightAccount doesn't support 1271`
|
|
227
|
+
`Version ${String(version)} of LightAccount doesn't support 1271`
|
|
257
228
|
);
|
|
258
229
|
case "v1.1.0":
|
|
259
230
|
return signWith1271WrapperV1(hashTypedData(params));
|
|
@@ -262,7 +233,7 @@ export async function createLightAccountBase({
|
|
|
262
233
|
// TODO: handle case where signer is an SCA.
|
|
263
234
|
return concat([SignatureType.EOA, signature]);
|
|
264
235
|
default:
|
|
265
|
-
throw new Error(`Unknown version ${version} of LightAccount`);
|
|
236
|
+
throw new Error(`Unknown version ${String(version)} of LightAccount`);
|
|
266
237
|
}
|
|
267
238
|
},
|
|
268
239
|
getDummySignature: (): Hex => {
|
|
@@ -276,7 +247,7 @@ export async function createLightAccountBase({
|
|
|
276
247
|
case "v2.0.0":
|
|
277
248
|
return concat([SignatureType.EOA, signature]);
|
|
278
249
|
default:
|
|
279
|
-
throw new Error(`Unknown version ${type} of ${version}`);
|
|
250
|
+
throw new Error(`Unknown version ${type} of ${String(version)}`);
|
|
280
251
|
}
|
|
281
252
|
},
|
|
282
253
|
encodeUpgradeToAndCall,
|
|
@@ -17,11 +17,10 @@ import {
|
|
|
17
17
|
import { MultiOwnerLightAccountAbi } from "../abis/MultiOwnerLightAccountAbi.js";
|
|
18
18
|
import { MultiOwnerLightAccountFactoryAbi } from "../abis/MultiOwnerLightAccountFactoryAbi.js";
|
|
19
19
|
import type {
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
LightAccountEntryPointVersion,
|
|
21
|
+
LightAccountVersion,
|
|
22
22
|
} from "../types.js";
|
|
23
23
|
import {
|
|
24
|
-
AccountVersionRegistry,
|
|
25
24
|
defaultLightAccountVersion,
|
|
26
25
|
getDefaultMultiOwnerLightAccountFactoryAddress,
|
|
27
26
|
} from "../utils.js";
|
|
@@ -33,19 +32,11 @@ import {
|
|
|
33
32
|
|
|
34
33
|
export type MultiOwnerLightAccount<
|
|
35
34
|
TSigner extends SmartAccountSigner = SmartAccountSigner,
|
|
36
|
-
TLightAccountVersion extends
|
|
37
|
-
TEntryPointVersion extends GetEntryPointForLightAccountVersion<
|
|
38
|
-
"MultiOwnerLightAccount",
|
|
39
|
-
TLightAccountVersion
|
|
40
|
-
> = GetEntryPointForLightAccountVersion<
|
|
41
|
-
"MultiOwnerLightAccount",
|
|
42
|
-
TLightAccountVersion
|
|
43
|
-
>
|
|
35
|
+
TLightAccountVersion extends LightAccountVersion<"MultiOwnerLightAccount"> = LightAccountVersion<"MultiOwnerLightAccount">
|
|
44
36
|
> = LightAccountBase<
|
|
45
37
|
TSigner,
|
|
46
38
|
"MultiOwnerLightAccount",
|
|
47
|
-
TLightAccountVersion
|
|
48
|
-
TEntryPointVersion
|
|
39
|
+
TLightAccountVersion
|
|
49
40
|
> & {
|
|
50
41
|
encodeUpdateOwners: (
|
|
51
42
|
ownersToAdd: Address[],
|
|
@@ -57,54 +48,47 @@ export type MultiOwnerLightAccount<
|
|
|
57
48
|
export type CreateMultiOwnerLightAccountParams<
|
|
58
49
|
TTransport extends Transport = Transport,
|
|
59
50
|
TSigner extends SmartAccountSigner = SmartAccountSigner,
|
|
60
|
-
TLightAccountVersion extends
|
|
61
|
-
TEntryPointVersion extends GetEntryPointForLightAccountVersion<
|
|
62
|
-
"MultiOwnerLightAccount",
|
|
63
|
-
TLightAccountVersion
|
|
64
|
-
> = GetEntryPointForLightAccountVersion<
|
|
65
|
-
"MultiOwnerLightAccount",
|
|
66
|
-
TLightAccountVersion
|
|
67
|
-
>
|
|
51
|
+
TLightAccountVersion extends LightAccountVersion<"MultiOwnerLightAccount"> = LightAccountVersion<"MultiOwnerLightAccount">
|
|
68
52
|
> = Omit<
|
|
69
53
|
CreateLightAccountBaseParams<
|
|
70
|
-
TTransport,
|
|
71
|
-
TSigner,
|
|
72
54
|
"MultiOwnerLightAccount",
|
|
73
55
|
TLightAccountVersion,
|
|
74
|
-
|
|
56
|
+
TTransport,
|
|
57
|
+
TSigner
|
|
75
58
|
>,
|
|
76
|
-
|
|
59
|
+
| "getAccountInitCode"
|
|
60
|
+
| "entryPoint"
|
|
61
|
+
| "version"
|
|
62
|
+
| "abi"
|
|
63
|
+
| "accountAddress"
|
|
64
|
+
| "type"
|
|
77
65
|
> & {
|
|
78
66
|
salt?: bigint;
|
|
79
67
|
initCode?: Hex;
|
|
80
68
|
accountAddress?: Address;
|
|
81
69
|
factoryAddress?: Address;
|
|
82
70
|
version?: TLightAccountVersion;
|
|
83
|
-
entryPoint?: EntryPointDef<
|
|
71
|
+
entryPoint?: EntryPointDef<
|
|
72
|
+
LightAccountEntryPointVersion<
|
|
73
|
+
"MultiOwnerLightAccount",
|
|
74
|
+
TLightAccountVersion
|
|
75
|
+
>,
|
|
76
|
+
Chain
|
|
77
|
+
>;
|
|
84
78
|
owners?: Address[];
|
|
85
79
|
};
|
|
86
80
|
|
|
87
81
|
export async function createMultiOwnerLightAccount<
|
|
88
82
|
TTransport extends Transport = Transport,
|
|
89
83
|
TSigner extends SmartAccountSigner = SmartAccountSigner,
|
|
90
|
-
TLightAccountVersion extends
|
|
91
|
-
TEntryPointVersion extends GetEntryPointForLightAccountVersion<
|
|
92
|
-
"MultiOwnerLightAccount",
|
|
93
|
-
TLightAccountVersion
|
|
94
|
-
> = GetEntryPointForLightAccountVersion<
|
|
95
|
-
"MultiOwnerLightAccount",
|
|
96
|
-
TLightAccountVersion
|
|
97
|
-
>
|
|
84
|
+
TLightAccountVersion extends LightAccountVersion<"MultiOwnerLightAccount"> = LightAccountVersion<"MultiOwnerLightAccount">
|
|
98
85
|
>(
|
|
99
86
|
config: CreateMultiOwnerLightAccountParams<
|
|
100
87
|
TTransport,
|
|
101
88
|
TSigner,
|
|
102
|
-
TLightAccountVersion
|
|
103
|
-
TEntryPointVersion
|
|
89
|
+
TLightAccountVersion
|
|
104
90
|
>
|
|
105
|
-
): Promise<
|
|
106
|
-
MultiOwnerLightAccount<TSigner, TLightAccountVersion, TEntryPointVersion>
|
|
107
|
-
>;
|
|
91
|
+
): Promise<MultiOwnerLightAccount<TSigner, TLightAccountVersion>>;
|
|
108
92
|
|
|
109
93
|
/**
|
|
110
94
|
* Creates a multi-owner light account using the provided parameters, including transport, chain, signer, initialization code, version, account address, factory address, salt, and owners. Ensures the owners list is deduplicated, ordered, and valid.
|
|
@@ -131,7 +115,7 @@ export async function createMultiOwnerLightAccount({
|
|
|
131
115
|
chain,
|
|
132
116
|
signer,
|
|
133
117
|
initCode,
|
|
134
|
-
version = defaultLightAccountVersion(
|
|
118
|
+
version = defaultLightAccountVersion(),
|
|
135
119
|
entryPoint = getEntryPoint(chain, {
|
|
136
120
|
version: "0.7.0",
|
|
137
121
|
}),
|
|
@@ -181,15 +165,17 @@ export async function createMultiOwnerLightAccount({
|
|
|
181
165
|
});
|
|
182
166
|
|
|
183
167
|
const account = await createLightAccountBase<
|
|
168
|
+
"MultiOwnerLightAccount",
|
|
169
|
+
LightAccountVersion<"MultiOwnerLightAccount">,
|
|
184
170
|
Transport,
|
|
185
|
-
SmartAccountSigner
|
|
186
|
-
"MultiOwnerLightAccount"
|
|
171
|
+
SmartAccountSigner
|
|
187
172
|
>({
|
|
188
173
|
transport,
|
|
189
174
|
chain,
|
|
190
175
|
signer,
|
|
191
176
|
abi: MultiOwnerLightAccountAbi,
|
|
192
|
-
version
|
|
177
|
+
version,
|
|
178
|
+
type: "MultiOwnerLightAccount",
|
|
193
179
|
entryPoint,
|
|
194
180
|
accountAddress: address,
|
|
195
181
|
getAccountInitCode,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { HttpTransport, SmartAccountSigner } from "@aa-sdk/core";
|
|
1
2
|
import {
|
|
2
3
|
AlchemyProviderConfigSchema,
|
|
3
4
|
createAlchemyPublicRpcClient,
|
|
@@ -12,7 +13,6 @@ import {
|
|
|
12
13
|
type LightAccount,
|
|
13
14
|
type LightAccountClientActions,
|
|
14
15
|
} from "@account-kit/smart-contracts";
|
|
15
|
-
import type { HttpTransport, SmartAccountSigner } from "@aa-sdk/core";
|
|
16
16
|
import { custom, type Chain, type CustomTransport, type Transport } from "viem";
|
|
17
17
|
|
|
18
18
|
export type AlchemyLightAccountClientConfig<
|
|
@@ -45,7 +45,7 @@ export async function createLightAccountAlchemyClient<
|
|
|
45
45
|
* @example
|
|
46
46
|
* ```ts
|
|
47
47
|
* import { createLightAccountAlchemyClient } from "@account-kit/smart-contracts";
|
|
48
|
-
* import { sepolia } from "@account-kit/infra
|
|
48
|
+
* import { sepolia } from "@account-kit/infra";
|
|
49
49
|
* import { LocalAccountSigner } from "@aa-sdk/core";
|
|
50
50
|
* import { generatePrivateKey } from "viem"
|
|
51
51
|
*
|
|
@@ -24,14 +24,11 @@ export type CreateLightAccountClientParams<
|
|
|
24
24
|
> = {
|
|
25
25
|
transport: CreateLightAccountParams<TTransport, TSigner>["transport"];
|
|
26
26
|
chain: CreateLightAccountParams<TTransport, TSigner>["chain"];
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
} & Omit<CreateLightAccountParams<TTransport, TSigner>, "transport" | "chain"> &
|
|
28
|
+
Omit<
|
|
29
|
+
SmartAccountClientConfig<TTransport, TChain>,
|
|
30
|
+
"transport" | "account" | "chain"
|
|
30
31
|
>;
|
|
31
|
-
} & Omit<
|
|
32
|
-
SmartAccountClientConfig<TTransport, TChain>,
|
|
33
|
-
"transport" | "account" | "chain"
|
|
34
|
-
>;
|
|
35
32
|
|
|
36
33
|
export function createLightAccountClient<
|
|
37
34
|
TChain extends Chain | undefined = Chain | undefined,
|
|
@@ -61,9 +58,7 @@ export function createLightAccountClient<
|
|
|
61
58
|
* const account = await createLightAccountClient({
|
|
62
59
|
* chain: sepolia,
|
|
63
60
|
* transport: http("RPC_URL"),
|
|
64
|
-
*
|
|
65
|
-
* signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())
|
|
66
|
-
* }
|
|
61
|
+
* signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())
|
|
67
62
|
* });
|
|
68
63
|
* ```
|
|
69
64
|
*
|
|
@@ -73,16 +68,16 @@ export function createLightAccountClient<
|
|
|
73
68
|
export async function createLightAccountClient(
|
|
74
69
|
params: CreateLightAccountClientParams
|
|
75
70
|
): Promise<SmartAccountClient> {
|
|
76
|
-
const {
|
|
71
|
+
const { transport, chain } = params;
|
|
77
72
|
|
|
78
73
|
const lightAccount = await createLightAccount({
|
|
79
|
-
...
|
|
74
|
+
...params,
|
|
80
75
|
transport,
|
|
81
76
|
chain,
|
|
82
77
|
});
|
|
83
78
|
|
|
84
79
|
return createSmartAccountClient({
|
|
85
|
-
...
|
|
80
|
+
...params,
|
|
86
81
|
transport,
|
|
87
82
|
chain: chain,
|
|
88
83
|
account: lightAccount,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { HttpTransport, SmartAccountSigner } from "@aa-sdk/core";
|
|
1
2
|
import {
|
|
2
3
|
AlchemyProviderConfigSchema,
|
|
3
4
|
createAlchemyPublicRpcClient,
|
|
@@ -12,14 +13,13 @@ import {
|
|
|
12
13
|
type MultiOwnerLightAccount,
|
|
13
14
|
type MultiOwnerLightAccountClientActions,
|
|
14
15
|
} from "@account-kit/smart-contracts";
|
|
15
|
-
import type { HttpTransport, SmartAccountSigner } from "@aa-sdk/core";
|
|
16
16
|
import { custom, type Chain, type CustomTransport, type Transport } from "viem";
|
|
17
17
|
|
|
18
18
|
export type AlchemyMultiOwnerLightAccountClientConfig<
|
|
19
19
|
TSigner extends SmartAccountSigner = SmartAccountSigner
|
|
20
20
|
> = Omit<
|
|
21
21
|
CreateMultiOwnerLightAccountParams<HttpTransport, TSigner>,
|
|
22
|
-
"transport" | "chain"
|
|
22
|
+
"transport" | "chain" | "type"
|
|
23
23
|
> &
|
|
24
24
|
Omit<
|
|
25
25
|
AlchemySmartAccountClientConfig<
|
|
@@ -49,7 +49,7 @@ export async function createMultiOwnerLightAccountAlchemyClient<
|
|
|
49
49
|
* @example
|
|
50
50
|
* ```ts
|
|
51
51
|
* import { createMultiOwnerLightAccountAlchemyClient } from "@account-kit/smart-contracts";
|
|
52
|
-
* import { sepolia } from "@account-kit/infra
|
|
52
|
+
* import { sepolia } from "@account-kit/infra";
|
|
53
53
|
* import { LocalAccountSigner } from "@aa-sdk/core";
|
|
54
54
|
* import { generatePrivateKey } from "viem"
|
|
55
55
|
*
|
|
@@ -27,14 +27,14 @@ export type CreateMultiOwnerLightAccountClientParams<
|
|
|
27
27
|
TSigner
|
|
28
28
|
>["transport"];
|
|
29
29
|
chain: CreateMultiOwnerLightAccountParams<TTransport, TSigner>["chain"];
|
|
30
|
-
account: Omit<
|
|
31
|
-
CreateMultiOwnerLightAccountParams<TTransport, TSigner>,
|
|
32
|
-
"transport" | "chain"
|
|
33
|
-
>;
|
|
34
30
|
} & Omit<
|
|
35
|
-
|
|
36
|
-
"transport" | "
|
|
37
|
-
|
|
31
|
+
CreateMultiOwnerLightAccountParams<TTransport, TSigner>,
|
|
32
|
+
"transport" | "chain"
|
|
33
|
+
> &
|
|
34
|
+
Omit<
|
|
35
|
+
SmartAccountClientConfig<TTransport, TChain>,
|
|
36
|
+
"transport" | "account" | "chain"
|
|
37
|
+
>;
|
|
38
38
|
|
|
39
39
|
export function createMultiOwnerLightAccountClient<
|
|
40
40
|
TChain extends Chain | undefined = Chain | undefined,
|
|
@@ -67,9 +67,7 @@ export function createMultiOwnerLightAccountClient<
|
|
|
67
67
|
* const account = await createMultiOwnerLightAccountClient({
|
|
68
68
|
* chain: sepolia,
|
|
69
69
|
* transport: http("RPC_URL"),
|
|
70
|
-
*
|
|
71
|
-
* signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())
|
|
72
|
-
* }
|
|
70
|
+
* signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())
|
|
73
71
|
* });
|
|
74
72
|
* ```
|
|
75
73
|
*
|
|
@@ -79,16 +77,16 @@ export function createMultiOwnerLightAccountClient<
|
|
|
79
77
|
export async function createMultiOwnerLightAccountClient(
|
|
80
78
|
params: CreateMultiOwnerLightAccountClientParams
|
|
81
79
|
): Promise<SmartAccountClient> {
|
|
82
|
-
const {
|
|
80
|
+
const { transport, chain } = params;
|
|
83
81
|
|
|
84
82
|
const lightAccount = await createMultiOwnerLightAccount({
|
|
85
|
-
...
|
|
83
|
+
...params,
|
|
86
84
|
transport,
|
|
87
85
|
chain,
|
|
88
86
|
});
|
|
89
87
|
|
|
90
88
|
return createSmartAccountClient({
|
|
91
|
-
...
|
|
89
|
+
...params,
|
|
92
90
|
transport,
|
|
93
91
|
chain: chain,
|
|
94
92
|
account: lightAccount,
|
|
@@ -24,7 +24,7 @@ export type LightAccountClientActions<
|
|
|
24
24
|
* ```ts
|
|
25
25
|
* import { lightAccountClientActions, createLightAccount } from "@account-kit/smart-contracts";
|
|
26
26
|
* import { createAlchemySmartAccountClient } from "@account-kit/infra";
|
|
27
|
-
* import { sepolia } from "@account-kit/infra
|
|
27
|
+
* import { sepolia } from "@account-kit/infra";
|
|
28
28
|
*
|
|
29
29
|
* const smartAccountClient = createAlchemySmartAccountClient({
|
|
30
30
|
* account: await createLightAccount(...),
|
|
@@ -24,7 +24,7 @@ export type MultiOwnerLightAccountClientActions<
|
|
|
24
24
|
* ```ts
|
|
25
25
|
* import { multiOwnerLightAccountClientActions, createMultiOwnerLightAccount } from "@account-kit/smart-contracts";
|
|
26
26
|
* import { createAlchemySmartAccountClient } from "@account-kit/infra";
|
|
27
|
-
* import { sepolia } from "@account-kit/infra
|
|
27
|
+
* import { sepolia } from "@account-kit/infra";
|
|
28
28
|
*
|
|
29
29
|
* const smartAccountClient = createAlchemySmartAccountClient({
|
|
30
30
|
* account: await createMultiOwnerLightAccount(...),
|