@account-kit/wallet-client 0.1.0-alpha.6 → 0.1.0-alpha.8
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/client/actions/prepareCalls.d.ts +1 -1
- package/dist/esm/client/actions/prepareCalls.js +1 -1
- package/dist/esm/client/actions/prepareCalls.js.map +1 -1
- package/dist/esm/client/actions/requestAccount.js +5 -2
- package/dist/esm/client/actions/requestAccount.js.map +1 -1
- package/dist/esm/client/actions/signPreparedCalls.js +2 -1
- package/dist/esm/client/actions/signPreparedCalls.js.map +1 -1
- package/dist/esm/client/actions/signSignatureRequest.d.ts +3 -2
- package/dist/esm/client/actions/signSignatureRequest.js.map +1 -1
- package/dist/esm/client/client.e2e-test.js +53 -0
- package/dist/esm/client/client.e2e-test.js.map +1 -1
- package/dist/esm/isomorphic/actions/createSession.js +11 -2
- package/dist/esm/isomorphic/actions/createSession.js.map +1 -1
- package/dist/esm/isomorphic/actions/prepareCalls.js +21 -14
- package/dist/esm/isomorphic/actions/prepareCalls.js.map +1 -1
- package/dist/esm/isomorphic/actions/sendPreparedCalls.js +53 -8
- package/dist/esm/isomorphic/actions/sendPreparedCalls.js.map +1 -1
- package/dist/esm/isomorphic/client.d.ts +9 -0
- package/dist/esm/isomorphic/utils/7702.js +21 -8
- package/dist/esm/isomorphic/utils/7702.js.map +1 -1
- package/dist/esm/isomorphic/utils/createAccount.js +73 -33
- package/dist/esm/isomorphic/utils/createAccount.js.map +1 -1
- package/dist/esm/isomorphic/utils/supportsFeature.d.ts +4 -0
- package/dist/esm/isomorphic/utils/supportsFeature.js +21 -0
- package/dist/esm/isomorphic/utils/supportsFeature.js.map +1 -0
- package/dist/esm/rpc/request.d.ts +12 -2
- package/dist/esm/rpc/schema.d.ts +12 -2
- package/dist/esm/schemas.d.ts +16 -1
- package/dist/esm/schemas.js +12 -1
- package/dist/esm/schemas.js.map +1 -1
- package/dist/esm/types.d.ts +3 -0
- package/dist/esm/types.js.map +1 -1
- package/dist/types/client/actions/prepareCalls.d.ts +1 -1
- package/dist/types/client/actions/requestAccount.d.ts.map +1 -1
- package/dist/types/client/actions/signPreparedCalls.d.ts.map +1 -1
- package/dist/types/client/actions/signSignatureRequest.d.ts +3 -2
- package/dist/types/client/actions/signSignatureRequest.d.ts.map +1 -1
- package/dist/types/isomorphic/actions/createSession.d.ts.map +1 -1
- package/dist/types/isomorphic/actions/prepareCalls.d.ts.map +1 -1
- package/dist/types/isomorphic/actions/sendPreparedCalls.d.ts.map +1 -1
- package/dist/types/isomorphic/client.d.ts +9 -0
- package/dist/types/isomorphic/client.d.ts.map +1 -1
- package/dist/types/isomorphic/utils/7702.d.ts.map +1 -1
- package/dist/types/isomorphic/utils/createAccount.d.ts.map +1 -1
- package/dist/types/isomorphic/utils/supportsFeature.d.ts +5 -0
- package/dist/types/isomorphic/utils/supportsFeature.d.ts.map +1 -0
- package/dist/types/rpc/request.d.ts +12 -2
- package/dist/types/rpc/request.d.ts.map +1 -1
- package/dist/types/rpc/schema.d.ts +12 -2
- package/dist/types/rpc/schema.d.ts.map +1 -1
- package/dist/types/schemas.d.ts +16 -1
- package/dist/types/schemas.d.ts.map +1 -1
- package/dist/types/types.d.ts +3 -0
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/client/actions/prepareCalls.ts +1 -1
- package/src/client/actions/requestAccount.ts +10 -8
- package/src/client/actions/signPreparedCalls.ts +2 -1
- package/src/client/actions/signSignatureRequest.ts +4 -2
- package/src/client/client.e2e-test.ts +71 -0
- package/src/isomorphic/actions/createSession.ts +14 -1
- package/src/isomorphic/actions/prepareCalls.ts +22 -13
- package/src/isomorphic/actions/sendPreparedCalls.ts +59 -9
- package/src/isomorphic/utils/7702.ts +25 -9
- package/src/isomorphic/utils/createAccount.ts +81 -34
- package/src/isomorphic/utils/supportsFeature.ts +34 -0
- package/src/schemas.ts +20 -1
- package/src/types.ts +4 -0
|
@@ -87,11 +87,13 @@ export declare const WalletServerRpcSchema: {
|
|
|
87
87
|
[x: string]: unknown;
|
|
88
88
|
};
|
|
89
89
|
};
|
|
90
|
+
rawPayload: `0x${string}`;
|
|
90
91
|
} | {
|
|
91
92
|
type: "personal_sign";
|
|
92
93
|
data: string | {
|
|
93
94
|
raw: `0x${string}`;
|
|
94
95
|
};
|
|
96
|
+
rawPayload: `0x${string}`;
|
|
95
97
|
};
|
|
96
98
|
} | {
|
|
97
99
|
type: "user-operation-v070";
|
|
@@ -133,11 +135,13 @@ export declare const WalletServerRpcSchema: {
|
|
|
133
135
|
[x: string]: unknown;
|
|
134
136
|
};
|
|
135
137
|
};
|
|
138
|
+
rawPayload: `0x${string}`;
|
|
136
139
|
} | {
|
|
137
140
|
type: "personal_sign";
|
|
138
141
|
data: string | {
|
|
139
142
|
raw: `0x${string}`;
|
|
140
143
|
};
|
|
144
|
+
rawPayload: `0x${string}`;
|
|
141
145
|
};
|
|
142
146
|
} | {
|
|
143
147
|
type: "authorization";
|
|
@@ -148,6 +152,7 @@ export declare const WalletServerRpcSchema: {
|
|
|
148
152
|
};
|
|
149
153
|
signatureRequest: {
|
|
150
154
|
type: "eip7702Auth";
|
|
155
|
+
rawPayload: `0x${string}`;
|
|
151
156
|
};
|
|
152
157
|
})[];
|
|
153
158
|
} | {
|
|
@@ -186,11 +191,13 @@ export declare const WalletServerRpcSchema: {
|
|
|
186
191
|
[x: string]: unknown;
|
|
187
192
|
};
|
|
188
193
|
};
|
|
194
|
+
rawPayload: `0x${string}`;
|
|
189
195
|
} | {
|
|
190
196
|
type: "personal_sign";
|
|
191
197
|
data: string | {
|
|
192
198
|
raw: `0x${string}`;
|
|
193
199
|
};
|
|
200
|
+
rawPayload: `0x${string}`;
|
|
194
201
|
};
|
|
195
202
|
} | {
|
|
196
203
|
type: "user-operation-v070";
|
|
@@ -232,11 +239,13 @@ export declare const WalletServerRpcSchema: {
|
|
|
232
239
|
[x: string]: unknown;
|
|
233
240
|
};
|
|
234
241
|
};
|
|
242
|
+
rawPayload: `0x${string}`;
|
|
235
243
|
} | {
|
|
236
244
|
type: "personal_sign";
|
|
237
245
|
data: string | {
|
|
238
246
|
raw: `0x${string}`;
|
|
239
247
|
};
|
|
248
|
+
rawPayload: `0x${string}`;
|
|
240
249
|
};
|
|
241
250
|
};
|
|
242
251
|
} | {
|
|
@@ -460,7 +469,7 @@ export declare const WalletServerRpcSchema: {
|
|
|
460
469
|
id?: string | undefined;
|
|
461
470
|
creationOptions?: {
|
|
462
471
|
salt?: `0x${string}` | undefined;
|
|
463
|
-
accountType?: "sma-b" | undefined;
|
|
472
|
+
accountType?: "sma-b" | "la-v2" | "la-v1.0.1" | "la-v1.0.2" | "la-v1.1.0" | undefined;
|
|
464
473
|
} | {
|
|
465
474
|
accountType: "7702";
|
|
466
475
|
} | undefined;
|
|
@@ -478,7 +487,7 @@ export declare const WalletServerRpcSchema: {
|
|
|
478
487
|
id?: string | undefined;
|
|
479
488
|
creationHint?: {
|
|
480
489
|
salt?: `0x${string}` | undefined;
|
|
481
|
-
accountType?: "sma-b" | undefined;
|
|
490
|
+
accountType?: "sma-b" | "la-v2" | "la-v1.0.1" | "la-v1.0.2" | "la-v1.1.0" | undefined;
|
|
482
491
|
} | {
|
|
483
492
|
accountType: "7702";
|
|
484
493
|
} | undefined;
|
|
@@ -596,6 +605,7 @@ export declare const WalletServerRpcSchema: {
|
|
|
596
605
|
[x: string]: unknown;
|
|
597
606
|
};
|
|
598
607
|
};
|
|
608
|
+
rawPayload: `0x${string}`;
|
|
599
609
|
};
|
|
600
610
|
sessionId: `0x${string}`;
|
|
601
611
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/rpc/schema.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,qBAAqB
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/rpc/schema.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,qBAAqB;;;;;;;;;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AC;AAGF,MAAM,MAAM,yBAAyB,GAAG;IACtC,qBAAqB,CAAC,sBAAsB,CAAC;IAC7C,qBAAqB,CAAC,uBAAuB,CAAC;IAC9C,qBAAqB,CAAC,qBAAqB,CAAC;IAC5C,qBAAqB,CAAC,qBAAqB,CAAC;IAC5C,qBAAqB,CAAC,0BAA0B,CAAC;IACjD,qBAAqB,CAAC,uBAAuB,CAAC;IAC9C,qBAAqB,CAAC,sBAAsB,CAAC;CAC9C,CAAC"}
|
package/dist/types/schemas.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { type SchemaOptions, type Static } from "@sinclair/typebox";
|
|
2
|
+
export declare const baseAccountTypes: readonly ["sma-b", "la-v2", "la-v1.0.1", "la-v1.0.2", "la-v1.1.0"];
|
|
3
|
+
export type BaseAccountType = (typeof baseAccountTypes)[number];
|
|
4
|
+
export declare const accountTypes: readonly ["sma-b", "la-v2", "la-v1.0.1", "la-v1.0.2", "la-v1.1.0", "7702"];
|
|
5
|
+
export type AccountType = (typeof accountTypes)[number];
|
|
2
6
|
export declare const TypeHex: (options?: SchemaOptions) => import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
|
|
3
7
|
export declare const TypeAddress: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
|
|
4
8
|
export declare const TypeUuid: import("@sinclair/typebox").TString;
|
|
@@ -141,7 +145,7 @@ export declare const TypeCounterfactualInfo: import("@sinclair/typebox").TInters
|
|
|
141
145
|
}>]>]>;
|
|
142
146
|
export type TypeCounterfactualInfo = Static<typeof TypeCounterfactualInfo>;
|
|
143
147
|
export declare const TypeCreationOptions: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
|
|
144
|
-
accountType: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TLiteral<"sma-b">>;
|
|
148
|
+
accountType: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<import("@sinclair/typebox").TLiteral<"sma-b" | "la-v2" | "la-v1.0.1" | "la-v1.0.2" | "la-v1.1.0">[]>>;
|
|
145
149
|
salt: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">>;
|
|
146
150
|
}>, import("@sinclair/typebox").TObject<{
|
|
147
151
|
accountType: import("@sinclair/typebox").TLiteral<"7702">;
|
|
@@ -193,6 +197,7 @@ export declare const TypePersonalSignSignatureRequest: import("@sinclair/typebox
|
|
|
193
197
|
data: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TObject<{
|
|
194
198
|
raw: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
|
|
195
199
|
}>]>;
|
|
200
|
+
rawPayload: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
|
|
196
201
|
}>;
|
|
197
202
|
export declare const TypeTypedDataSignatureRequest: import("@sinclair/typebox").TObject<{
|
|
198
203
|
type: import("@sinclair/typebox").TLiteral<"eth_signTypedData_v4">;
|
|
@@ -229,15 +234,18 @@ export declare const TypeTypedDataSignatureRequest: import("@sinclair/typebox").
|
|
|
229
234
|
[x: string]: unknown;
|
|
230
235
|
};
|
|
231
236
|
}>;
|
|
237
|
+
rawPayload: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
|
|
232
238
|
}>;
|
|
233
239
|
export declare const TypeAuthorizationSignatureRequest: import("@sinclair/typebox").TObject<{
|
|
234
240
|
type: import("@sinclair/typebox").TLiteral<"eip7702Auth">;
|
|
241
|
+
rawPayload: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
|
|
235
242
|
}>;
|
|
236
243
|
export declare const TypeSignatureRequest: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
|
|
237
244
|
type: import("@sinclair/typebox").TLiteral<"personal_sign">;
|
|
238
245
|
data: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TObject<{
|
|
239
246
|
raw: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
|
|
240
247
|
}>]>;
|
|
248
|
+
rawPayload: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
|
|
241
249
|
}>, import("@sinclair/typebox").TObject<{
|
|
242
250
|
type: import("@sinclair/typebox").TLiteral<"eth_signTypedData_v4">;
|
|
243
251
|
data: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{
|
|
@@ -273,8 +281,10 @@ export declare const TypeSignatureRequest: import("@sinclair/typebox").TUnion<[i
|
|
|
273
281
|
[x: string]: unknown;
|
|
274
282
|
};
|
|
275
283
|
}>;
|
|
284
|
+
rawPayload: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
|
|
276
285
|
}>, import("@sinclair/typebox").TObject<{
|
|
277
286
|
type: import("@sinclair/typebox").TLiteral<"eip7702Auth">;
|
|
287
|
+
rawPayload: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
|
|
278
288
|
}>]>;
|
|
279
289
|
export declare const TypeCallId: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">, {
|
|
280
290
|
chainId: `0x${string}`;
|
|
@@ -300,6 +310,7 @@ export declare const PreparedCall_UserOpV060: import("@sinclair/typebox").TObjec
|
|
|
300
310
|
data: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TObject<{
|
|
301
311
|
raw: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
|
|
302
312
|
}>]>;
|
|
313
|
+
rawPayload: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
|
|
303
314
|
}>, import("@sinclair/typebox").TObject<{
|
|
304
315
|
type: import("@sinclair/typebox").TLiteral<"eth_signTypedData_v4">;
|
|
305
316
|
data: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{
|
|
@@ -335,6 +346,7 @@ export declare const PreparedCall_UserOpV060: import("@sinclair/typebox").TObjec
|
|
|
335
346
|
[x: string]: unknown;
|
|
336
347
|
};
|
|
337
348
|
}>;
|
|
349
|
+
rawPayload: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
|
|
338
350
|
}>]>;
|
|
339
351
|
}>;
|
|
340
352
|
export declare const PreparedCall_UserOpV070: import("@sinclair/typebox").TObject<{
|
|
@@ -361,6 +373,7 @@ export declare const PreparedCall_UserOpV070: import("@sinclair/typebox").TObjec
|
|
|
361
373
|
data: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TObject<{
|
|
362
374
|
raw: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
|
|
363
375
|
}>]>;
|
|
376
|
+
rawPayload: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
|
|
364
377
|
}>, import("@sinclair/typebox").TObject<{
|
|
365
378
|
type: import("@sinclair/typebox").TLiteral<"eth_signTypedData_v4">;
|
|
366
379
|
data: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{
|
|
@@ -396,6 +409,7 @@ export declare const PreparedCall_UserOpV070: import("@sinclair/typebox").TObjec
|
|
|
396
409
|
[x: string]: unknown;
|
|
397
410
|
};
|
|
398
411
|
}>;
|
|
412
|
+
rawPayload: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
|
|
399
413
|
}>]>;
|
|
400
414
|
}>;
|
|
401
415
|
export declare const PreparedCall_Authorization: import("@sinclair/typebox").TObject<{
|
|
@@ -407,6 +421,7 @@ export declare const PreparedCall_Authorization: import("@sinclair/typebox").TOb
|
|
|
407
421
|
chainId: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
|
|
408
422
|
signatureRequest: import("@sinclair/typebox").TObject<{
|
|
409
423
|
type: import("@sinclair/typebox").TLiteral<"eip7702Auth">;
|
|
424
|
+
rawPayload: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
|
|
410
425
|
}>;
|
|
411
426
|
}>;
|
|
412
427
|
export declare const TypeEdcsaSigData: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,aAAa,EAClB,KAAK,MAAM,EACZ,MAAM,mBAAmB,CAAC;AAqB3B,eAAO,MAAM,OAAO,GAAI,UAAU,aAAa,sEAG3C,CAAC;AAEL,eAAO,MAAM,WAAW,mEAA0C,CAAC;AAEnE,eAAO,MAAM,QAAQ,qCAEnB,CAAC;AAEH,eAAO,MAAM,0BAA0B,qCAErC,CAAC;AAGH,eAAO,MAAM,QAAQ,qFAEa,CAAC;AAEnC,eAAO,MAAM,OAAO,qFAEc,CAAC;AAEnC,eAAO,MAAM,2BAA2B;;;;;;;;;;;;EA0BtC,CAAC;AAEH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;EAgBtC,CAAC;AAEH,eAAO,MAAM,uBAAuB;;;;EAIlC,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;IAOhC,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;EAGhC,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2FhC,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;EA4BjC,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA0BjC,CAAC;AACH,MAAM,MAAM,sBAAsB,GAAG,MAAM,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAE3E,eAAO,MAAM,mBAAmB;;;;;
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EA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;;;;;;;;;;;IAK7C,CAAC;AAEF,eAAO,MAAM,oCAAoC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAKhD,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAczB,CAAC"}
|
package/dist/types/types.d.ts
CHANGED
|
@@ -36,4 +36,7 @@ export type InnerWalletApiClient = InnerWalletApiClientBase<InnerClientActions &
|
|
|
36
36
|
export type WithoutChainId<T> = T extends {
|
|
37
37
|
chainId: Hex;
|
|
38
38
|
} ? Omit<T, "chainId"> : T;
|
|
39
|
+
export type WithoutRawPayload<T> = T extends {
|
|
40
|
+
rawPayload: Hex;
|
|
41
|
+
} ? Omit<T, "rawPayload"> : T;
|
|
39
42
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAC7E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EACV,OAAO,EACP,KAAK,EACL,MAAM,EACN,GAAG,EACH,cAAc,EACd,SAAS,EACV,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EACV,sBAAsB,EACtB,sBAAsB,EACvB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC/E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAEjE,MAAM,MAAM,uBAAuB,CACjC,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,IACxD;IACF,KAAK,EAA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QAAE,OAAO,EAAE,GAAG,CAAA;KAAE,KAC9C,OAAO,CAAC,sBAAsB,CAAC,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,oBAAoB,CAAC;IAC9B,aAAa,EAAE,oBAAoB,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,UAAU,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI,CAAC;IAC7C,UAAU,EAAE,MAAM,aAAa,GAAG,SAAS,CAAC;CAC7C,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,wBAAwB,CACzD,kBAAkB,GAAG;IAAE,QAAQ,EAAE,aAAa,CAAA;CAAE,CACjD,CAAC;AAEF,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI,CAAC,SAAS;IAAE,OAAO,EAAE,GAAG,CAAA;CAAE,GACtD,IAAI,CAAC,CAAC,EAAE,SAAS,CAAC,GAClB,CAAC,CAAC;AAEN,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI,CAAC,SAAS;IAAE,UAAU,EAAE,GAAG,CAAA;CAAE,GAC5D,IAAI,CAAC,CAAC,EAAE,YAAY,CAAC,GACrB,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@account-kit/wallet-client",
|
|
3
3
|
"private": false,
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "0.1.0-alpha.
|
|
5
|
+
"version": "0.1.0-alpha.8",
|
|
6
6
|
"main": "./dist/esm/exports/index.js",
|
|
7
7
|
"module": "./dist/esm/exports/index.js",
|
|
8
8
|
"types": "./dist/types/exports/index.d.ts",
|
|
@@ -58,9 +58,9 @@
|
|
|
58
58
|
"typescript": "^5.8.2"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@aa-sdk/core": "^4.
|
|
62
|
-
"@account-kit/infra": "^4.
|
|
63
|
-
"@account-kit/smart-contracts": "^4.
|
|
61
|
+
"@aa-sdk/core": "^4.40.0",
|
|
62
|
+
"@account-kit/infra": "^4.40.0",
|
|
63
|
+
"@account-kit/smart-contracts": "^4.40.0",
|
|
64
64
|
"@sinclair/typebox": "^0.34.33",
|
|
65
65
|
"deep-equal": "^2.2.3",
|
|
66
66
|
"ox": "^0.6.12",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"access": "public",
|
|
71
71
|
"registry": "https://registry.npmjs.org/"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "529d34cd22178db91f8d67e6601b3e03b8759d19"
|
|
74
74
|
}
|
|
@@ -32,7 +32,7 @@ export type PrepareCallsResult = IsomorphicPrepareCallsResult;
|
|
|
32
32
|
* the user operation data and signature request
|
|
33
33
|
*
|
|
34
34
|
* @example
|
|
35
|
-
* // Prepare a
|
|
35
|
+
* // Prepare a sponsored user operation call
|
|
36
36
|
* const result = await client.prepareCalls({
|
|
37
37
|
* calls: [{
|
|
38
38
|
* to: "0x1234...",
|
|
@@ -57,6 +57,7 @@ export async function requestAccount(
|
|
|
57
57
|
};
|
|
58
58
|
|
|
59
59
|
const cachedAccount = client.internal.getAccount();
|
|
60
|
+
|
|
60
61
|
if (
|
|
61
62
|
cachedAccount &&
|
|
62
63
|
((args.accountAddress &&
|
|
@@ -66,17 +67,18 @@ export async function requestAccount(
|
|
|
66
67
|
return cachedAccount.account;
|
|
67
68
|
}
|
|
68
69
|
|
|
69
|
-
const { counterfactualInfo,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
const { accountAddress, counterfactualInfo, delegation } =
|
|
71
|
+
await client.request({
|
|
72
|
+
method: "wallet_requestAccount",
|
|
73
|
+
params: [args],
|
|
74
|
+
});
|
|
73
75
|
|
|
74
76
|
const account = await createAccount({
|
|
75
77
|
accountAddress,
|
|
76
|
-
counterfactualInfo:
|
|
77
|
-
TypeSerializedInitcode,
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
counterfactualInfo: counterfactualInfo
|
|
79
|
+
? Value.Parse(TypeSerializedInitcode, counterfactualInfo)
|
|
80
|
+
: undefined,
|
|
81
|
+
delegation,
|
|
80
82
|
chain: client.chain,
|
|
81
83
|
transport: custom(client.transport),
|
|
82
84
|
signer,
|
|
@@ -37,6 +37,7 @@ export async function signPreparedCalls(
|
|
|
37
37
|
params.data.map(async (call) => {
|
|
38
38
|
switch (call.type) {
|
|
39
39
|
case "authorization": {
|
|
40
|
+
const { signatureRequest: _signatureRequest, ...rest } = call;
|
|
40
41
|
const signature = await signSignatureRequest(signer, {
|
|
41
42
|
type: "eip7702Auth",
|
|
42
43
|
data: {
|
|
@@ -45,7 +46,7 @@ export async function signPreparedCalls(
|
|
|
45
46
|
},
|
|
46
47
|
});
|
|
47
48
|
return {
|
|
48
|
-
...
|
|
49
|
+
...rest,
|
|
49
50
|
signature,
|
|
50
51
|
};
|
|
51
52
|
}
|
|
@@ -9,13 +9,15 @@ import {
|
|
|
9
9
|
} from "../../schemas.js";
|
|
10
10
|
import { TypeEip7702UnsignedAuth } from "../../schemas.js";
|
|
11
11
|
import { vToYParity } from "ox/Signature";
|
|
12
|
+
import type { WithoutRawPayload } from "../../types.ts";
|
|
12
13
|
|
|
13
|
-
export type SignSignatureRequestParams =
|
|
14
|
+
export type SignSignatureRequestParams = WithoutRawPayload<
|
|
14
15
|
| Static<typeof TypePersonalSignSignatureRequest>
|
|
15
16
|
| Static<typeof TypeTypedDataSignatureRequest>
|
|
16
17
|
| (Static<typeof TypeAuthorizationSignatureRequest> & {
|
|
17
18
|
data: Static<typeof TypeEip7702UnsignedAuth>;
|
|
18
|
-
})
|
|
19
|
+
})
|
|
20
|
+
>;
|
|
19
21
|
|
|
20
22
|
export type SignSignatureRequestResult = {
|
|
21
23
|
type: "secp256k1";
|
|
@@ -119,6 +119,41 @@ describe("Client E2E Tests", () => {
|
|
|
119
119
|
expect(isValid).toBeTrue();
|
|
120
120
|
});
|
|
121
121
|
|
|
122
|
+
it("should successfully send a UO with paymaster using 7702", async () => {
|
|
123
|
+
const _signer = LocalAccountSigner.privateKeyToAccountSigner(
|
|
124
|
+
"0x49daf21e92c997093e9ffdf7e7ddbf8970e9eadc5d4847d0f690db25d5128e1f",
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
const _client = createSmartWalletClient({
|
|
128
|
+
transport,
|
|
129
|
+
chain: arbitrumSepolia,
|
|
130
|
+
mode: "local",
|
|
131
|
+
signer: _signer,
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
const account = await _client.requestAccount({
|
|
135
|
+
creationHint: {
|
|
136
|
+
accountType: "7702",
|
|
137
|
+
},
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
const preparedCalls = await _client.prepareCalls({
|
|
141
|
+
calls: [{ to: zeroAddress, value: "0x0" }],
|
|
142
|
+
from: account.address,
|
|
143
|
+
capabilities: {
|
|
144
|
+
paymasterService: {
|
|
145
|
+
policyId: process.env.TEST_PAYMASTER_POLICY_ID!,
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
const signedCalls = await _client.signPreparedCalls(preparedCalls);
|
|
151
|
+
|
|
152
|
+
const result = await _client.sendPreparedCalls(signedCalls);
|
|
153
|
+
|
|
154
|
+
expect(result.preparedCallIds).toBeArrayOfSize(1);
|
|
155
|
+
});
|
|
156
|
+
|
|
122
157
|
it("should successfully send a UO with paymaster", async () => {
|
|
123
158
|
const account = await client.requestAccount();
|
|
124
159
|
const preparedCalls = await client.prepareCalls({
|
|
@@ -310,6 +345,42 @@ describe("Client E2E Tests", () => {
|
|
|
310
345
|
expect(result.preparedCallIds).toBeArrayOfSize(1);
|
|
311
346
|
});
|
|
312
347
|
|
|
348
|
+
it("should successfully send a UO with paymaster using 7702", async () => {
|
|
349
|
+
const _signer = LocalAccountSigner.privateKeyToAccountSigner(
|
|
350
|
+
"0x00d35c6d307b5cddeb70aeed96ee27a551fee58bf1a43858477e6c11f9172ba8",
|
|
351
|
+
);
|
|
352
|
+
|
|
353
|
+
const _client = createSmartWalletClient({
|
|
354
|
+
transport,
|
|
355
|
+
chain: arbitrumSepolia,
|
|
356
|
+
mode: "remote",
|
|
357
|
+
signer: _signer,
|
|
358
|
+
});
|
|
359
|
+
|
|
360
|
+
const account = await _client.requestAccount({
|
|
361
|
+
creationHint: {
|
|
362
|
+
accountType: "7702",
|
|
363
|
+
},
|
|
364
|
+
});
|
|
365
|
+
expect(account.address).toBe(await _signer.getAddress());
|
|
366
|
+
|
|
367
|
+
const preparedCalls = await _client.prepareCalls({
|
|
368
|
+
calls: [{ to: zeroAddress, value: "0x0" }],
|
|
369
|
+
from: account.address,
|
|
370
|
+
capabilities: {
|
|
371
|
+
paymasterService: {
|
|
372
|
+
policyId: process.env.TEST_PAYMASTER_POLICY_ID!,
|
|
373
|
+
},
|
|
374
|
+
},
|
|
375
|
+
});
|
|
376
|
+
|
|
377
|
+
const signedCalls = await _client.signPreparedCalls(preparedCalls);
|
|
378
|
+
|
|
379
|
+
const result = await _client.sendPreparedCalls(signedCalls);
|
|
380
|
+
|
|
381
|
+
expect(result.preparedCallIds).toBeArrayOfSize(1);
|
|
382
|
+
});
|
|
383
|
+
|
|
313
384
|
it("should successfully create a session with grantPermissions and send a UO", async () => {
|
|
314
385
|
const account = await client.requestAccount();
|
|
315
386
|
|
|
@@ -12,19 +12,21 @@ import { Value } from "@sinclair/typebox/value";
|
|
|
12
12
|
import {
|
|
13
13
|
ChainNotFoundError,
|
|
14
14
|
custom,
|
|
15
|
+
hashTypedData,
|
|
15
16
|
hexToNumber,
|
|
16
17
|
toHex,
|
|
17
18
|
type Chain,
|
|
18
19
|
type Hex,
|
|
19
20
|
type Transport,
|
|
20
21
|
} from "viem";
|
|
22
|
+
import { InvalidRequestError } from "ox/RpcResponse";
|
|
21
23
|
import { TypePermission } from "../../capabilities/permissions/index.js";
|
|
22
24
|
import { isGlobalValidation } from "../../capabilities/permissions/mav2.js";
|
|
23
25
|
import type { wallet_createSession } from "../../rpc/request.js";
|
|
24
26
|
import type { WalletServerViemRpcSchema } from "../../rpc/schema.js";
|
|
25
27
|
import { createAccount, isModularAccountV2 } from "../utils/createAccount.js";
|
|
26
28
|
import { createDummySigner } from "../utils/createDummySigner.js";
|
|
27
|
-
import {
|
|
29
|
+
import { supportsFeature } from "../utils/supportsFeature.js";
|
|
28
30
|
|
|
29
31
|
export type CreateSessionParams = Omit<
|
|
30
32
|
Static<
|
|
@@ -81,6 +83,16 @@ export async function createSession(
|
|
|
81
83
|
});
|
|
82
84
|
}
|
|
83
85
|
|
|
86
|
+
if (
|
|
87
|
+
counterfactualInfo &&
|
|
88
|
+
!supportsFeature(counterfactualInfo, "permissions")
|
|
89
|
+
) {
|
|
90
|
+
throw new InvalidRequestError({
|
|
91
|
+
message: "Account type does not support createSession",
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// At this point we know the account supports the permission feature
|
|
84
96
|
const account = await createAccount({
|
|
85
97
|
chain: client.chain,
|
|
86
98
|
transport: custom(client.transport),
|
|
@@ -132,6 +144,7 @@ export async function createSession(
|
|
|
132
144
|
signatureRequest: {
|
|
133
145
|
type: "eth_signTypedData_v4" as const,
|
|
134
146
|
data: typedData,
|
|
147
|
+
rawPayload: hashTypedData(typedData),
|
|
135
148
|
},
|
|
136
149
|
fullPreSignatureDeferredActionDigest,
|
|
137
150
|
};
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
ChainNotFoundError,
|
|
10
10
|
custom,
|
|
11
11
|
fromHex,
|
|
12
|
+
hashMessage,
|
|
12
13
|
toHex,
|
|
13
14
|
type Chain,
|
|
14
15
|
type Transport,
|
|
@@ -17,7 +18,7 @@ import type { wallet_prepareCalls } from "../../rpc/request.js";
|
|
|
17
18
|
import type { WalletServerViemRpcSchema } from "../../rpc/schema.js";
|
|
18
19
|
import { createAccount } from "../utils/createAccount.js";
|
|
19
20
|
import { createDummySigner } from "../utils/createDummySigner.js";
|
|
20
|
-
import { createAuthorizationRequest
|
|
21
|
+
import { createAuthorizationRequest } from "../utils/7702.js";
|
|
21
22
|
import { InvalidRequestError } from "ox/RpcResponse";
|
|
22
23
|
import { assertNever } from "../../utils.js";
|
|
23
24
|
import { assertValid7702AccountAddress } from "../utils/7702.js";
|
|
@@ -50,20 +51,23 @@ export async function prepareCalls(
|
|
|
50
51
|
assertValid7702AccountAddress(params.from, params.capabilities?.eip7702Auth);
|
|
51
52
|
|
|
52
53
|
// in local mode, we probably want some kind of caching for this
|
|
53
|
-
const { counterfactualInfo, delegation } =
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
54
|
+
const { counterfactualInfo, delegation } = await client.request({
|
|
55
|
+
method: "wallet_requestAccount",
|
|
56
|
+
params: [
|
|
57
|
+
params.capabilities?.eip7702Auth
|
|
58
|
+
? {
|
|
59
|
+
signerAddress: params.from,
|
|
60
|
+
creationHint: {
|
|
61
|
+
accountType: "7702",
|
|
62
|
+
},
|
|
63
|
+
includeCounterfactualInfo: true,
|
|
64
|
+
}
|
|
65
|
+
: {
|
|
62
66
|
accountAddress: params.from,
|
|
63
67
|
includeCounterfactualInfo: true,
|
|
64
68
|
},
|
|
65
|
-
|
|
66
|
-
|
|
69
|
+
],
|
|
70
|
+
});
|
|
67
71
|
|
|
68
72
|
if (!counterfactualInfo && !delegation) {
|
|
69
73
|
throw new InvalidRequestError({
|
|
@@ -117,6 +121,8 @@ export async function prepareCalls(
|
|
|
117
121
|
|
|
118
122
|
const ep = account.getEntryPoint();
|
|
119
123
|
|
|
124
|
+
const uoHash = ep.getUserOperationHash(hexlifiedUo);
|
|
125
|
+
|
|
120
126
|
const uoRequest = {
|
|
121
127
|
type:
|
|
122
128
|
ep.version === "0.7.0"
|
|
@@ -129,8 +135,11 @@ export async function prepareCalls(
|
|
|
129
135
|
signatureRequest: {
|
|
130
136
|
type: "personal_sign" as const,
|
|
131
137
|
data: {
|
|
132
|
-
raw:
|
|
138
|
+
raw: uoHash,
|
|
133
139
|
},
|
|
140
|
+
rawPayload: hashMessage({
|
|
141
|
+
raw: uoHash,
|
|
142
|
+
}),
|
|
134
143
|
},
|
|
135
144
|
};
|
|
136
145
|
|
|
@@ -120,19 +120,69 @@ export async function sendPreparedCalls(
|
|
|
120
120
|
? parseSignature(decodeSignature(authorization.signature).data)
|
|
121
121
|
: undefined;
|
|
122
122
|
const uoSigHex = decodeSignature(userOp.signature).data;
|
|
123
|
+
|
|
124
|
+
const { counterfactualInfo, delegation } = await client.request({
|
|
125
|
+
method: "wallet_requestAccount",
|
|
126
|
+
params: [
|
|
127
|
+
{
|
|
128
|
+
accountAddress: userOp.data.sender,
|
|
129
|
+
includeCounterfactualInfo: true,
|
|
130
|
+
},
|
|
131
|
+
],
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
if (!counterfactualInfo && !delegation) {
|
|
135
|
+
throw new InvalidRequestError({
|
|
136
|
+
message:
|
|
137
|
+
"No counterfactual info or delegated implementation address found.",
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const factoryType = counterfactualInfo?.factoryType;
|
|
142
|
+
|
|
143
|
+
// build signature based on account type
|
|
144
|
+
const signature = (() => {
|
|
145
|
+
switch (factoryType) {
|
|
146
|
+
// light accounts
|
|
147
|
+
case "LightAccountV1.0.1":
|
|
148
|
+
case "LightAccountV1.0.2":
|
|
149
|
+
case "LightAccountV1.1.0":
|
|
150
|
+
// For LAv1, we always just pass the signature.
|
|
151
|
+
return uoSigHex;
|
|
152
|
+
case "LightAccountV2.0.0":
|
|
153
|
+
// for LAv2, we need to prepend the "SignatureType.EOA" byte
|
|
154
|
+
return concat(["0x00", uoSigHex]);
|
|
155
|
+
case undefined: // undefined defaults to sma-b
|
|
156
|
+
case "MAv2.0.0-sma-b":
|
|
157
|
+
// For sma-b, we need to handle deferred actions if needed and prepend the "Reserved
|
|
158
|
+
// Signature Segment" and "SignatureType.EOA" bytes
|
|
159
|
+
return deferredAction != null
|
|
160
|
+
? concatHex([
|
|
161
|
+
`0x${deferredAction.slice(68)}`, // Cuts off stuff prepended to the digest (nonce, etc.).
|
|
162
|
+
"0xFF",
|
|
163
|
+
"0x00",
|
|
164
|
+
uoSigHex,
|
|
165
|
+
])
|
|
166
|
+
: concat(["0xFF", "0x00", uoSigHex]);
|
|
167
|
+
case "MAv2.0.0-ma-ssv":
|
|
168
|
+
case "MAv2.0.0-ma-webauthn":
|
|
169
|
+
case "LightAccountV2.0.0-MultiOwner":
|
|
170
|
+
case "MAv1.0.0-MultiOwner":
|
|
171
|
+
case "MAv1.0.0-MultiSig":
|
|
172
|
+
case "unknown":
|
|
173
|
+
throw new InvalidRequestError({
|
|
174
|
+
message: `Unsupported factory type: ${factoryType}`,
|
|
175
|
+
});
|
|
176
|
+
default:
|
|
177
|
+
return assertNever(factoryType, "Unsupported factory type");
|
|
178
|
+
}
|
|
179
|
+
})();
|
|
180
|
+
|
|
123
181
|
return client
|
|
124
182
|
.sendRawUserOperation(
|
|
125
183
|
{
|
|
126
184
|
...userOp.data,
|
|
127
|
-
signature
|
|
128
|
-
deferredAction != null
|
|
129
|
-
? concatHex([
|
|
130
|
-
`0x${deferredAction.slice(68)}`, // Cuts off stuff prepended to the digest (nonce, etc. that we had previously).
|
|
131
|
-
"0xff",
|
|
132
|
-
"0x00",
|
|
133
|
-
uoSigHex,
|
|
134
|
-
])
|
|
135
|
-
: concat(["0xFF", "0x00", uoSigHex]),
|
|
185
|
+
signature,
|
|
136
186
|
eip7702Auth:
|
|
137
187
|
idx === 0 && authorization && authSig
|
|
138
188
|
? {
|