@account-kit/wallet-client 0.1.0-alpha.7 → 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.
Files changed (57) hide show
  1. package/dist/esm/client/actions/prepareCalls.d.ts +1 -1
  2. package/dist/esm/client/actions/prepareCalls.js +1 -1
  3. package/dist/esm/client/actions/prepareCalls.js.map +1 -1
  4. package/dist/esm/client/actions/signSignatureRequest.d.ts +3 -2
  5. package/dist/esm/client/actions/signSignatureRequest.js.map +1 -1
  6. package/dist/esm/isomorphic/actions/createSession.js +11 -2
  7. package/dist/esm/isomorphic/actions/createSession.js.map +1 -1
  8. package/dist/esm/isomorphic/actions/prepareCalls.js +21 -14
  9. package/dist/esm/isomorphic/actions/prepareCalls.js.map +1 -1
  10. package/dist/esm/isomorphic/actions/sendPreparedCalls.js +53 -8
  11. package/dist/esm/isomorphic/actions/sendPreparedCalls.js.map +1 -1
  12. package/dist/esm/isomorphic/client.d.ts +9 -0
  13. package/dist/esm/isomorphic/utils/7702.js +21 -8
  14. package/dist/esm/isomorphic/utils/7702.js.map +1 -1
  15. package/dist/esm/isomorphic/utils/createAccount.js +73 -33
  16. package/dist/esm/isomorphic/utils/createAccount.js.map +1 -1
  17. package/dist/esm/isomorphic/utils/supportsFeature.d.ts +4 -0
  18. package/dist/esm/isomorphic/utils/supportsFeature.js +21 -0
  19. package/dist/esm/isomorphic/utils/supportsFeature.js.map +1 -0
  20. package/dist/esm/rpc/request.d.ts +12 -2
  21. package/dist/esm/rpc/schema.d.ts +12 -2
  22. package/dist/esm/schemas.d.ts +16 -1
  23. package/dist/esm/schemas.js +12 -1
  24. package/dist/esm/schemas.js.map +1 -1
  25. package/dist/esm/types.d.ts +3 -0
  26. package/dist/esm/types.js.map +1 -1
  27. package/dist/types/client/actions/prepareCalls.d.ts +1 -1
  28. package/dist/types/client/actions/signSignatureRequest.d.ts +3 -2
  29. package/dist/types/client/actions/signSignatureRequest.d.ts.map +1 -1
  30. package/dist/types/isomorphic/actions/createSession.d.ts.map +1 -1
  31. package/dist/types/isomorphic/actions/prepareCalls.d.ts.map +1 -1
  32. package/dist/types/isomorphic/actions/sendPreparedCalls.d.ts.map +1 -1
  33. package/dist/types/isomorphic/client.d.ts +9 -0
  34. package/dist/types/isomorphic/client.d.ts.map +1 -1
  35. package/dist/types/isomorphic/utils/7702.d.ts.map +1 -1
  36. package/dist/types/isomorphic/utils/createAccount.d.ts.map +1 -1
  37. package/dist/types/isomorphic/utils/supportsFeature.d.ts +5 -0
  38. package/dist/types/isomorphic/utils/supportsFeature.d.ts.map +1 -0
  39. package/dist/types/rpc/request.d.ts +12 -2
  40. package/dist/types/rpc/request.d.ts.map +1 -1
  41. package/dist/types/rpc/schema.d.ts +12 -2
  42. package/dist/types/rpc/schema.d.ts.map +1 -1
  43. package/dist/types/schemas.d.ts +16 -1
  44. package/dist/types/schemas.d.ts.map +1 -1
  45. package/dist/types/types.d.ts +3 -0
  46. package/dist/types/types.d.ts.map +1 -1
  47. package/package.json +2 -2
  48. package/src/client/actions/prepareCalls.ts +1 -1
  49. package/src/client/actions/signSignatureRequest.ts +4 -2
  50. package/src/isomorphic/actions/createSession.ts +14 -1
  51. package/src/isomorphic/actions/prepareCalls.ts +22 -13
  52. package/src/isomorphic/actions/sendPreparedCalls.ts +59 -9
  53. package/src/isomorphic/utils/7702.ts +25 -9
  54. package/src/isomorphic/utils/createAccount.ts +81 -34
  55. package/src/isomorphic/utils/supportsFeature.ts +34 -0
  56. package/src/schemas.ts +20 -1
  57. package/src/types.ts +4 -0
@@ -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;;;;;KA0B/B,CAAC;AACF,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,OAAO,mBAAmB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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiBnC,CAAC;AAEF,eAAO,MAAM,0BAA0B;;;;;;;;;;;EAYtC,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;;;;;;oBA4C3B,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;EAqBvB,CAAC;AAEH,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAK7C,CAAC;AAEF,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAK7C,CAAC;AAEF,eAAO,MAAM,oCAAoC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAKhD,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAczB,CAAC"}
@@ -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,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GAC1B,SAAS,IACX,MAAM,CACR,SAAS,EACT,KAAK,EACL,cAAc,CAAC,OAAO,CAAC,GAAG,SAAS,EACnC,yBAAyB,EACzB;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAChC,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,gBAAgB,EAAE,CAChB,MAAM,EAAE,kBAAkB,EAC1B,MAAM,EAAE,sBAAsB,GAAG;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.7",
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",
@@ -70,5 +70,5 @@
70
70
  "access": "public",
71
71
  "registry": "https://registry.npmjs.org/"
72
72
  },
73
- "gitHead": "2bb34aba96eb2234c7dc3986a44ee0ec07c84c84"
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 sponosored user operation call
35
+ * // Prepare a sponsored user operation call
36
36
  * const result = await client.prepareCalls({
37
37
  * calls: [{
38
38
  * to: "0x1234...",
@@ -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";
@@ -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 { InvalidRequestError } from "ox/RpcResponse";
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, parseDelegation } from "../utils/7702.js";
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 } = params.capabilities?.eip7702Auth
54
- ? {
55
- counterfactualInfo: undefined,
56
- delegation: parseDelegation(params.capabilities.eip7702Auth),
57
- }
58
- : await client.request({
59
- method: "wallet_requestAccount",
60
- params: [
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: ep.getUserOperationHash(hexlifiedUo),
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
  ? {
@@ -6,12 +6,14 @@ import {
6
6
  type Chain,
7
7
  type Transport,
8
8
  isAddress,
9
+ hexToNumber,
9
10
  } from "viem";
10
11
  import type { WalletServerViemRpcSchema } from "../../rpc/schema.js";
11
12
  import { PreparedCall_Authorization } from "../../schemas.js";
12
13
  import type { Eip7702AuthCapability } from "../../capabilities/eip7702Auth.ts";
13
14
  import type { Static } from "@sinclair/typebox";
14
15
  import { InvalidRequestError } from "ox/RpcResponse";
16
+ import { hashAuthorization } from "viem/utils";
15
17
 
16
18
  export const createAuthorizationRequest = async (
17
19
  client: SmartAccountClient<
@@ -42,6 +44,11 @@ export const createAuthorizationRequest = async (
42
44
  chainId: numberToHex(client.chain.id),
43
45
  signatureRequest: {
44
46
  type: "eip7702Auth" as const,
47
+ rawPayload: hashAuthorization({
48
+ chainId: client.chain.id,
49
+ nonce: hexToNumber(data.nonce),
50
+ address: params.delegation,
51
+ }),
45
52
  },
46
53
  };
47
54
  };
@@ -103,14 +110,23 @@ export const assertValid7702AccountAddress = (
103
110
  fromAddress: Address,
104
111
  eip7702AuthCapability: Static<typeof Eip7702AuthCapability> | undefined,
105
112
  ) => {
106
- if (
107
- eip7702AuthCapability &&
108
- typeof eip7702AuthCapability === "object" &&
109
- "account" in eip7702AuthCapability &&
110
- eip7702AuthCapability?.account !== fromAddress
111
- ) {
112
- throw new InvalidRequestError({
113
- message: `EIP-7702 delegation account ${eip7702AuthCapability.account} must match 'from' address ${fromAddress}.`,
114
- });
113
+ if (eip7702AuthCapability) {
114
+ if (
115
+ typeof eip7702AuthCapability === "object" &&
116
+ "account" in eip7702AuthCapability &&
117
+ eip7702AuthCapability?.account !== fromAddress
118
+ ) {
119
+ throw new InvalidRequestError({
120
+ message: `EIP-7702 delegation account ${eip7702AuthCapability.account} must match 'from' address ${fromAddress}.`,
121
+ });
122
+ }
123
+
124
+ const delegation = parseDelegation(eip7702AuthCapability);
125
+
126
+ if (!isSupportedDelegationAddress7702(delegation)) {
127
+ throw new InvalidRequestError({
128
+ message: `Unsupported 7702 delegation address: ${delegation}`,
129
+ });
130
+ }
115
131
  }
116
132
  };
@@ -1,5 +1,6 @@
1
1
  import type { SmartAccountSigner, SmartContractAccount } from "@aa-sdk/core";
2
2
  import {
3
+ createLightAccount,
3
4
  createModularAccountV2,
4
5
  type ModularAccountV2,
5
6
  } from "@account-kit/smart-contracts";
@@ -10,8 +11,8 @@ import type { TypeSerializedInitcode } from "../../schemas.js";
10
11
  import { parsePermissionsContext } from "./parsePermissionsContext.js";
11
12
  import { assertNever } from "../../utils.js";
12
13
  import { getAccountTypeForDelegationAddress7702 } from "./7702.js";
13
- import { InternalError } from "ox/RpcResponse";
14
14
  import { PermissionsCapability } from "../../capabilities/permissions/index.js";
15
+ import { InternalError, InvalidRequestError } from "ox/RpcResponse";
15
16
 
16
17
  type CreateAccountParams = {
17
18
  chain: Chain;
@@ -33,32 +34,8 @@ export async function createAccount(
33
34
  ): Promise<SmartContractAccount> {
34
35
  const { counterfactualInfo: ci, ...accountParams } = params;
35
36
 
36
- const mode = params.delegation ? "7702" : "default";
37
-
38
- if (mode === "default") {
39
- if (!ci) {
40
- throw new InternalError({
41
- message: "Counterfactual info not found",
42
- });
43
- }
44
- if (ci.factoryType !== "MAv2.0.0-sma-b") {
45
- throw new InternalError({
46
- message: `Factory type ${ci.factoryType} is not currently supported.`,
47
- });
48
- }
49
- } else if (mode === "7702") {
50
- const accountType = getAccountTypeForDelegationAddress7702(
51
- params.delegation!,
52
- );
53
- if (accountType !== "ModularAccountV2") {
54
- throw new InternalError({
55
- message: "7702 mode currently only supports ModularAccountV2",
56
- });
57
- }
58
- } else {
59
- assertNever(mode, "Unexpected mode in createAccount");
60
- }
61
-
37
+ // This throws if we pass a permission context and the account is not MA-v2
38
+ // TODO: test that this edge case is handled correctly
62
39
  const parsedContext = parsePermissionsContext(
63
40
  params.permissions,
64
41
  ci,
@@ -73,14 +50,84 @@ export async function createAccount(
73
50
  }
74
51
  : undefined;
75
52
 
76
- // TODO: clean this up to support different account types.
77
- return createModularAccountV2({
53
+ const mode = params.delegation ? "7702" : "default";
54
+
55
+ if (mode === "7702") {
56
+ const accountType = getAccountTypeForDelegationAddress7702(
57
+ params.delegation!,
58
+ );
59
+ if (accountType !== "ModularAccountV2") {
60
+ throw new Error("7702 mode currently only supports ModularAccountV2");
61
+ }
62
+ return createModularAccountV2({
63
+ ...accountParams,
64
+ signerEntity,
65
+ deferredAction: parsedContext?.deferredAction,
66
+ mode,
67
+ });
68
+ }
69
+
70
+ if (mode !== "default") {
71
+ return assertNever(mode, "Unexpected mode in createAccount");
72
+ }
73
+
74
+ // At this point, we are guaranteed to be in default mode, where ci
75
+ // (counterfactualInfo) must be defined
76
+
77
+ if (!ci) {
78
+ throw new InternalError({
79
+ message: "Counterfactual info not found",
80
+ });
81
+ }
82
+
83
+ const factoryType = ci.factoryType;
84
+ const commonParams = {
78
85
  ...accountParams,
79
- signerEntity,
80
- deferredAction: parsedContext?.deferredAction,
81
- initCode: ci ? concatHex([ci.factoryAddress, ci.factoryData]) : undefined,
82
- mode,
83
- });
86
+ initCode: concatHex([ci.factoryAddress, ci.factoryData]),
87
+ };
88
+
89
+ // Return the account created based on the factory type
90
+ switch (factoryType) {
91
+ case "MAv2.0.0-sma-b":
92
+ return createModularAccountV2({
93
+ ...commonParams,
94
+ signerEntity,
95
+ deferredAction: parsedContext?.deferredAction,
96
+ mode,
97
+ });
98
+ case "LightAccountV2.0.0":
99
+ return createLightAccount({
100
+ ...commonParams,
101
+ version: "v2.0.0",
102
+ });
103
+ case "LightAccountV1.0.1":
104
+ return createLightAccount({
105
+ ...commonParams,
106
+ version: "v1.0.1",
107
+ });
108
+ case "LightAccountV1.0.2":
109
+ return createLightAccount({
110
+ ...commonParams,
111
+ version: "v1.0.2",
112
+ });
113
+ case "LightAccountV1.1.0":
114
+ return createLightAccount({
115
+ ...commonParams,
116
+ version: "v1.1.0",
117
+ });
118
+ case "LightAccountV2.0.0-MultiOwner":
119
+ case "MAv1.0.0-MultiOwner":
120
+ case "MAv1.0.0-MultiSig":
121
+ case "MAv2.0.0-ma-ssv":
122
+ case "MAv2.0.0-ma-webauthn":
123
+ case "unknown":
124
+ case undefined:
125
+ throw new InvalidRequestError({
126
+ message: `Account type currently unsupported: ${factoryType}`,
127
+ });
128
+ default:
129
+ return assertNever(factoryType, "Unsupported factory type");
130
+ }
84
131
  }
85
132
 
86
133
  export function isModularAccountV2(
@@ -0,0 +1,34 @@
1
+ import type { StaticDecode } from "@sinclair/typebox";
2
+ import type { TypeSerializedInitcode } from "../../schemas.ts";
3
+
4
+ export type Feature = "permissions";
5
+
6
+ type FactoryType = StaticDecode<typeof TypeSerializedInitcode>["factoryType"];
7
+
8
+ const supportedFeatures: Record<FactoryType, Feature[]> = {
9
+ "LightAccountV1.0.1": [],
10
+ "LightAccountV1.0.2": [],
11
+ "LightAccountV1.1.0": [],
12
+ "LightAccountV2.0.0": [],
13
+ "LightAccountV2.0.0-MultiOwner": [],
14
+ "MAv1.0.0-MultiOwner": [],
15
+ "MAv1.0.0-MultiSig": [],
16
+ "MAv2.0.0-sma-b": ["permissions"],
17
+ "MAv2.0.0-ma-ssv": ["permissions"],
18
+ "MAv2.0.0-ma-webauthn": [],
19
+ unknown: [],
20
+ };
21
+
22
+ export function supportsFeature(
23
+ counterfactualInfo: StaticDecode<typeof TypeSerializedInitcode>,
24
+ feature: Feature,
25
+ ): boolean {
26
+ const factorySupportedFeatures =
27
+ supportedFeatures[counterfactualInfo.factoryType];
28
+ if (factorySupportedFeatures === undefined) {
29
+ throw new Error(
30
+ "Unsupported FactoryType: " + counterfactualInfo.factoryType,
31
+ );
32
+ }
33
+ return factorySupportedFeatures.includes(feature);
34
+ }
package/src/schemas.ts CHANGED
@@ -24,6 +24,20 @@ FormatRegistry.Set("uuid", (value) => UUID_V4_REGEX.test(value));
24
24
  const BASE_64_URL_REGEX = /^[A-Za-z0-9_-]+$/; // Matches base64url encoded strings (without padding)
25
25
  FormatRegistry.Set("base64url", (value) => BASE_64_URL_REGEX.test(value));
26
26
 
27
+ export const baseAccountTypes = [
28
+ "sma-b",
29
+ "la-v2",
30
+ "la-v1.0.1",
31
+ "la-v1.0.2",
32
+ "la-v1.1.0",
33
+ ] as const;
34
+
35
+ export type BaseAccountType = (typeof baseAccountTypes)[number];
36
+
37
+ export const accountTypes = [...baseAccountTypes, "7702"] as const;
38
+
39
+ export type AccountType = (typeof accountTypes)[number];
40
+
27
41
  export const TypeHex = (options?: SchemaOptions) =>
28
42
  Type.TemplateLiteral("0x${string}", {
29
43
  ...options,
@@ -271,7 +285,9 @@ export const TypeCreationOptions = Type.Optional(
271
285
  Type.Object(
272
286
  {
273
287
  // Optional b/c `sma-b` is the default if no accountType is specified.
274
- accountType: Type.Optional(Type.Literal("sma-b")),
288
+ accountType: Type.Optional(
289
+ Type.Union(baseAccountTypes.map((lit) => Type.Literal(lit))),
290
+ ),
275
291
  salt: Type.Optional(TypeHex()),
276
292
  },
277
293
  {
@@ -371,6 +387,7 @@ export const TypePersonalSignSignatureRequest = Type.Object(
371
387
  { description: "Raw message" },
372
388
  ),
373
389
  ]),
390
+ rawPayload: TypeHex(),
374
391
  },
375
392
  { description: "Personal sign" },
376
393
  );
@@ -379,6 +396,7 @@ export const TypeTypedDataSignatureRequest = Type.Object(
379
396
  {
380
397
  type: Type.Literal("eth_signTypedData_v4"),
381
398
  data: TTypedDataDefinition,
399
+ rawPayload: TypeHex(),
382
400
  },
383
401
  {
384
402
  description: "Typed data",
@@ -387,6 +405,7 @@ export const TypeTypedDataSignatureRequest = Type.Object(
387
405
 
388
406
  export const TypeAuthorizationSignatureRequest = Type.Object({
389
407
  type: Type.Literal("eip7702Auth"),
408
+ rawPayload: TypeHex(),
390
409
  });
391
410
 
392
411
  export const TypeSignatureRequest = Type.Union([