@account-kit/wallet-client 0.1.0-alpha.8 → 0.1.0-alpha.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/dist/esm/capabilities/index.d.ts +3 -0
  2. package/dist/esm/capabilities/index.js +2 -0
  3. package/dist/esm/capabilities/index.js.map +1 -1
  4. package/dist/esm/capabilities/multiDimensionalNonce.d.ts +3 -0
  5. package/dist/esm/capabilities/multiDimensionalNonce.js +7 -0
  6. package/dist/esm/capabilities/multiDimensionalNonce.js.map +1 -0
  7. package/dist/esm/client/actions/signPreparedCalls.js +26 -37
  8. package/dist/esm/client/actions/signPreparedCalls.js.map +1 -1
  9. package/dist/esm/exports/internal.d.ts +1 -0
  10. package/dist/esm/exports/internal.js +1 -0
  11. package/dist/esm/exports/internal.js.map +1 -1
  12. package/dist/esm/isomorphic/actions/createSession.js +9 -3
  13. package/dist/esm/isomorphic/actions/createSession.js.map +1 -1
  14. package/dist/esm/isomorphic/actions/prepareCalls.js +19 -4
  15. package/dist/esm/isomorphic/actions/prepareCalls.js.map +1 -1
  16. package/dist/esm/isomorphic/actions/sendPreparedCalls.js +13 -4
  17. package/dist/esm/isomorphic/actions/sendPreparedCalls.js.map +1 -1
  18. package/dist/esm/isomorphic/utils/7702.d.ts +6 -1
  19. package/dist/esm/isomorphic/utils/7702.js +5 -4
  20. package/dist/esm/isomorphic/utils/7702.js.map +1 -1
  21. package/dist/esm/isomorphic/utils/createAccount.d.ts +1 -0
  22. package/dist/esm/isomorphic/utils/createAccount.js +25 -3
  23. package/dist/esm/isomorphic/utils/createAccount.js.map +1 -1
  24. package/dist/esm/rpc/request.d.ts +46 -2
  25. package/dist/esm/rpc/request.js +1 -0
  26. package/dist/esm/rpc/request.js.map +1 -1
  27. package/dist/esm/rpc/schema.d.ts +46 -2
  28. package/dist/esm/schemas.d.ts +23 -4
  29. package/dist/esm/schemas.js +46 -2
  30. package/dist/esm/schemas.js.map +1 -1
  31. package/dist/esm/utils.d.ts +1 -0
  32. package/dist/esm/utils.js.map +1 -1
  33. package/dist/types/capabilities/index.d.ts +3 -0
  34. package/dist/types/capabilities/index.d.ts.map +1 -1
  35. package/dist/types/capabilities/multiDimensionalNonce.d.ts +4 -0
  36. package/dist/types/capabilities/multiDimensionalNonce.d.ts.map +1 -0
  37. package/dist/types/client/actions/signPreparedCalls.d.ts.map +1 -1
  38. package/dist/types/exports/internal.d.ts +1 -0
  39. package/dist/types/exports/internal.d.ts.map +1 -1
  40. package/dist/types/isomorphic/actions/createSession.d.ts.map +1 -1
  41. package/dist/types/isomorphic/actions/prepareCalls.d.ts.map +1 -1
  42. package/dist/types/isomorphic/actions/sendPreparedCalls.d.ts.map +1 -1
  43. package/dist/types/isomorphic/utils/7702.d.ts +6 -1
  44. package/dist/types/isomorphic/utils/7702.d.ts.map +1 -1
  45. package/dist/types/isomorphic/utils/createAccount.d.ts +1 -0
  46. package/dist/types/isomorphic/utils/createAccount.d.ts.map +1 -1
  47. package/dist/types/rpc/request.d.ts +46 -2
  48. package/dist/types/rpc/request.d.ts.map +1 -1
  49. package/dist/types/rpc/schema.d.ts +46 -2
  50. package/dist/types/rpc/schema.d.ts.map +1 -1
  51. package/dist/types/schemas.d.ts +23 -4
  52. package/dist/types/schemas.d.ts.map +1 -1
  53. package/dist/types/utils.d.ts +1 -0
  54. package/dist/types/utils.d.ts.map +1 -1
  55. package/package.json +5 -5
  56. package/src/capabilities/index.ts +2 -0
  57. package/src/capabilities/multiDimensionalNonce.ts +7 -0
  58. package/src/client/actions/signPreparedCalls.ts +42 -43
  59. package/src/exports/internal.ts +1 -0
  60. package/src/isomorphic/actions/createSession.ts +11 -3
  61. package/src/isomorphic/actions/prepareCalls.ts +27 -9
  62. package/src/isomorphic/actions/sendPreparedCalls.ts +14 -4
  63. package/src/isomorphic/utils/7702.ts +16 -5
  64. package/src/isomorphic/utils/createAccount.ts +35 -2
  65. package/src/rpc/request.ts +1 -0
  66. package/src/schemas.ts +77 -5
  67. package/src/utils.ts +2 -0
@@ -35,4 +35,7 @@ export declare const Capabilities: import("@sinclair/typebox").TObject<{
35
35
  account: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">>;
36
36
  delegation: import("@sinclair/typebox").TUnion<(import("@sinclair/typebox").TLiteral<"0x69007702764179f14F51cdce752f4f775d74E139"> | import("@sinclair/typebox").TLiteral<"ModularAccountV2">)[]>;
37
37
  }>, import("@sinclair/typebox").TLiteral<true>]>>;
38
+ nonceOverride: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
39
+ nonceKey: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
40
+ }>>;
38
41
  }>;
@@ -3,10 +3,12 @@ import { GasParamsOverrideCapability } from "./overrides.js";
3
3
  import { PaymasterCapability } from "./paymaster.js";
4
4
  import { PermissionsCapability } from "./permissions/index.js";
5
5
  import { Eip7702AuthCapability } from "./eip7702Auth.js";
6
+ import { MultiDimensionalNonceCapability } from "./multiDimensionalNonce.js";
6
7
  export const Capabilities = Type.Object({
7
8
  permissions: Type.Optional(PermissionsCapability),
8
9
  paymasterService: Type.Optional(PaymasterCapability),
9
10
  gasParamsOverride: Type.Optional(GasParamsOverrideCapability),
10
11
  eip7702Auth: Type.Optional(Eip7702AuthCapability),
12
+ nonceOverride: Type.Optional(MultiDimensionalNonceCapability),
11
13
  });
12
14
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/capabilities/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC;IACtC,WAAW,EAAE,IAAI,CAAC,QAAQ,CAAC,qBAAqB,CAAC;IACjD,gBAAgB,EAAE,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC;IACpD,iBAAiB,EAAE,IAAI,CAAC,QAAQ,CAAC,2BAA2B,CAAC;IAC7D,WAAW,EAAE,IAAI,CAAC,QAAQ,CAAC,qBAAqB,CAAC;CAClD,CAAC,CAAC","sourcesContent":["import { Type } from \"@sinclair/typebox\";\nimport { GasParamsOverrideCapability } from \"./overrides.js\";\nimport { PaymasterCapability } from \"./paymaster.js\";\nimport { PermissionsCapability } from \"./permissions/index.js\";\nimport { Eip7702AuthCapability } from \"./eip7702Auth.js\";\n\nexport const Capabilities = Type.Object({\n permissions: Type.Optional(PermissionsCapability),\n paymasterService: Type.Optional(PaymasterCapability),\n gasParamsOverride: Type.Optional(GasParamsOverrideCapability),\n eip7702Auth: Type.Optional(Eip7702AuthCapability),\n});\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/capabilities/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,+BAA+B,EAAE,MAAM,4BAA4B,CAAC;AAE7E,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC;IACtC,WAAW,EAAE,IAAI,CAAC,QAAQ,CAAC,qBAAqB,CAAC;IACjD,gBAAgB,EAAE,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC;IACpD,iBAAiB,EAAE,IAAI,CAAC,QAAQ,CAAC,2BAA2B,CAAC;IAC7D,WAAW,EAAE,IAAI,CAAC,QAAQ,CAAC,qBAAqB,CAAC;IACjD,aAAa,EAAE,IAAI,CAAC,QAAQ,CAAC,+BAA+B,CAAC;CAC9D,CAAC,CAAC","sourcesContent":["import { Type } from \"@sinclair/typebox\";\nimport { GasParamsOverrideCapability } from \"./overrides.js\";\nimport { PaymasterCapability } from \"./paymaster.js\";\nimport { PermissionsCapability } from \"./permissions/index.js\";\nimport { Eip7702AuthCapability } from \"./eip7702Auth.js\";\nimport { MultiDimensionalNonceCapability } from \"./multiDimensionalNonce.js\";\n\nexport const Capabilities = Type.Object({\n permissions: Type.Optional(PermissionsCapability),\n paymasterService: Type.Optional(PaymasterCapability),\n gasParamsOverride: Type.Optional(GasParamsOverrideCapability),\n eip7702Auth: Type.Optional(Eip7702AuthCapability),\n nonceOverride: Type.Optional(MultiDimensionalNonceCapability),\n});\n"]}
@@ -0,0 +1,3 @@
1
+ export declare const MultiDimensionalNonceCapability: import("@sinclair/typebox").TObject<{
2
+ nonceKey: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
3
+ }>;
@@ -0,0 +1,7 @@
1
+ import { Type } from "@sinclair/typebox";
2
+ import { TypeHex } from "../schemas.js";
3
+ export const MultiDimensionalNonceCapability = Type.Object({
4
+ // we do not support the optional sequentialNonce param
5
+ nonceKey: TypeHex({ description: "Override nonce key as hex string" }),
6
+ });
7
+ //# sourceMappingURL=multiDimensionalNonce.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"multiDimensionalNonce.js","sourceRoot":"","sources":["../../../src/capabilities/multiDimensionalNonce.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,MAAM,CAAC,MAAM,+BAA+B,GAAG,IAAI,CAAC,MAAM,CAAC;IACzD,uDAAuD;IACvD,QAAQ,EAAE,OAAO,CAAC,EAAE,WAAW,EAAE,kCAAkC,EAAE,CAAC;CACvE,CAAC,CAAC","sourcesContent":["import { Type } from \"@sinclair/typebox\";\nimport { TypeHex } from \"../schemas.js\";\n\nexport const MultiDimensionalNonceCapability = Type.Object({\n // we do not support the optional sequentialNonce param\n nonceKey: TypeHex({ description: \"Override nonce key as hex string\" }),\n});\n"]}
@@ -1,6 +1,6 @@
1
1
  import { signSignatureRequest } from "./signSignatureRequest.js";
2
2
  import { wallet_sendPreparedCalls } from "../../rpc/request.js";
3
- import { assertNever } from "../../utils.js";
3
+ import { PreparedCall_Authorization, PreparedCall_UserOpV060, PreparedCall_UserOpV070, } from "../../schemas.js";
4
4
  /**
5
5
  * Signs prepared calls using the provided signer.
6
6
  *
@@ -9,46 +9,35 @@ import { assertNever } from "../../utils.js";
9
9
  * @returns {Promise<SignPreparedCallsResult>} A Promise that resolves to the signed calls
10
10
  **/
11
11
  export async function signPreparedCalls(signer, params) {
12
- if (params.type !== "array") {
13
- const { signatureRequest, ...call } = params;
12
+ const signAuthorizationCall = async (call) => {
13
+ const { signatureRequest: _signatureRequest, ...rest } = call;
14
+ const signature = await signSignatureRequest(signer, {
15
+ type: "eip7702Auth",
16
+ data: {
17
+ ...rest.data,
18
+ chainId: call.chainId,
19
+ },
20
+ });
21
+ return {
22
+ ...rest,
23
+ signature,
24
+ };
25
+ };
26
+ const signUserOperationCall = async (call) => {
27
+ const { signatureRequest, ...rest } = call;
14
28
  const signature = await signSignatureRequest(signer, signatureRequest);
15
29
  return {
16
- ...call,
30
+ ...rest,
17
31
  signature,
18
32
  };
19
- }
20
- return {
21
- type: "array",
22
- data: await Promise.all(params.data.map(async (call) => {
23
- switch (call.type) {
24
- case "authorization": {
25
- const { signatureRequest: _signatureRequest, ...rest } = call;
26
- const signature = await signSignatureRequest(signer, {
27
- type: "eip7702Auth",
28
- data: {
29
- ...call.data,
30
- chainId: call.chainId,
31
- },
32
- });
33
- return {
34
- ...rest,
35
- signature,
36
- };
37
- }
38
- case "user-operation-v060":
39
- case "user-operation-v070": {
40
- const { signatureRequest, ...rest } = call;
41
- const signature = await signSignatureRequest(signer, signatureRequest);
42
- return {
43
- ...rest,
44
- signature,
45
- };
46
- }
47
- default: {
48
- return assertNever(call, "Unexpected call type");
49
- }
50
- }
51
- })),
52
33
  };
34
+ return params.type === "array"
35
+ ? {
36
+ type: "array",
37
+ data: await Promise.all(params.data.map((call) => call.type === "authorization"
38
+ ? signAuthorizationCall(call)
39
+ : signUserOperationCall(call))),
40
+ }
41
+ : signUserOperationCall(params);
53
42
  }
54
43
  //# sourceMappingURL=signPreparedCalls.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"signPreparedCalls.js","sourceRoot":"","sources":["../../../../src/client/actions/signPreparedCalls.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAQ7C;;;;;;IAMI;AACJ,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,MAA0B,EAC1B,MAA+B;IAE/B,IAAI,MAAM,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QAC5B,MAAM,EAAE,gBAAgB,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;QAC7C,MAAM,SAAS,GAAG,MAAM,oBAAoB,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;QACvE,OAAO;YACL,GAAG,IAAI;YACP,SAAS;SACV,CAAC;IACJ,CAAC;IAED,OAAO;QACL,IAAI,EAAE,OAAgB;QACtB,IAAI,EAAE,MAAM,OAAO,CAAC,GAAG,CACrB,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;YAC7B,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;gBAClB,KAAK,eAAe,CAAC,CAAC,CAAC;oBACrB,MAAM,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC;oBAC9D,MAAM,SAAS,GAAG,MAAM,oBAAoB,CAAC,MAAM,EAAE;wBACnD,IAAI,EAAE,aAAa;wBACnB,IAAI,EAAE;4BACJ,GAAG,IAAI,CAAC,IAAI;4BACZ,OAAO,EAAE,IAAI,CAAC,OAAO;yBACtB;qBACF,CAAC,CAAC;oBACH,OAAO;wBACL,GAAG,IAAI;wBACP,SAAS;qBACV,CAAC;gBACJ,CAAC;gBACD,KAAK,qBAAqB,CAAC;gBAC3B,KAAK,qBAAqB,CAAC,CAAC,CAAC;oBAC3B,MAAM,EAAE,gBAAgB,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC;oBAC3C,MAAM,SAAS,GAAG,MAAM,oBAAoB,CAC1C,MAAM,EACN,gBAAgB,CACjB,CAAC;oBACF,OAAO;wBACL,GAAG,IAAI;wBACP,SAAS;qBACV,CAAC;gBACJ,CAAC;gBACD,OAAO,CAAC,CAAC,CAAC;oBACR,OAAO,WAAW,CAAC,IAAI,EAAE,sBAAsB,CAAC,CAAC;gBACnD,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CACH;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type { PrepareCallsResult } from \"./prepareCalls.ts\";\nimport type { SmartAccountSigner } from \"@aa-sdk/core\";\nimport { signSignatureRequest } from \"./signSignatureRequest.js\";\nimport type { Static } from \"@sinclair/typebox\";\nimport { wallet_sendPreparedCalls } from \"../../rpc/request.js\";\nimport { assertNever } from \"../../utils.js\";\n\nexport type SignPreparedCallsParams = PrepareCallsResult;\n\nexport type SignPreparedCallsResult = Static<\n (typeof wallet_sendPreparedCalls)[\"properties\"][\"Request\"][\"properties\"][\"params\"]\n>[0];\n\n/**\n * Signs prepared calls using the provided signer.\n *\n * @param {SmartAccountSigner} signer - The signer to use\n * @param {SignPreparedCallsParams} params - The prepared calls with signature requests\n * @returns {Promise<SignPreparedCallsResult>} A Promise that resolves to the signed calls\n **/\nexport async function signPreparedCalls(\n signer: SmartAccountSigner,\n params: SignPreparedCallsParams,\n): Promise<SignPreparedCallsResult> {\n if (params.type !== \"array\") {\n const { signatureRequest, ...call } = params;\n const signature = await signSignatureRequest(signer, signatureRequest);\n return {\n ...call,\n signature,\n };\n }\n\n return {\n type: \"array\" as const,\n data: await Promise.all(\n params.data.map(async (call) => {\n switch (call.type) {\n case \"authorization\": {\n const { signatureRequest: _signatureRequest, ...rest } = call;\n const signature = await signSignatureRequest(signer, {\n type: \"eip7702Auth\",\n data: {\n ...call.data,\n chainId: call.chainId,\n },\n });\n return {\n ...rest,\n signature,\n };\n }\n case \"user-operation-v060\":\n case \"user-operation-v070\": {\n const { signatureRequest, ...rest } = call;\n const signature = await signSignatureRequest(\n signer,\n signatureRequest,\n );\n return {\n ...rest,\n signature,\n };\n }\n default: {\n return assertNever(call, \"Unexpected call type\");\n }\n }\n }),\n ),\n };\n}\n"]}
1
+ {"version":3,"file":"signPreparedCalls.js","sourceRoot":"","sources":["../../../../src/client/actions/signPreparedCalls.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EACL,0BAA0B,EAC1B,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,kBAAkB,CAAC;AAQ1B;;;;;;IAMI;AACJ,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,MAA0B,EAC1B,MAA+B;IAE/B,MAAM,qBAAqB,GAAG,KAAK,EACjC,IAA+C,EAC/C,EAAE;QACF,MAAM,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC;QAC9D,MAAM,SAAS,GAAG,MAAM,oBAAoB,CAAC,MAAM,EAAE;YACnD,IAAI,EAAE,aAAa;YACnB,IAAI,EAAE;gBACJ,GAAG,IAAI,CAAC,IAAI;gBACZ,OAAO,EAAE,IAAI,CAAC,OAAO;aACtB;SACF,CAAC,CAAC;QACH,OAAO;YACL,GAAG,IAAI;YACP,SAAS;SACV,CAAC;IACJ,CAAC,CAAC;IAEF,MAAM,qBAAqB,GAAG,KAAK,EACjC,IAE0C,EAC1C,EAAE;QACF,MAAM,EAAE,gBAAgB,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC;QAC3C,MAAM,SAAS,GAAG,MAAM,oBAAoB,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;QACvE,OAAO;YACL,GAAG,IAAI;YACP,SAAS;SACV,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,MAAM,CAAC,IAAI,KAAK,OAAO;QAC5B,CAAC,CAAC;YACE,IAAI,EAAE,OAAgB;YACtB,IAAI,EAAE,MAAM,OAAO,CAAC,GAAG,CACrB,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CACvB,IAAI,CAAC,IAAI,KAAK,eAAe;gBAC3B,CAAC,CAAC,qBAAqB,CAAC,IAAI,CAAC;gBAC7B,CAAC,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAChC,CACF;SACF;QACH,CAAC,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC;AACpC,CAAC","sourcesContent":["import type { PrepareCallsResult } from \"./prepareCalls.ts\";\nimport type { SmartAccountSigner } from \"@aa-sdk/core\";\nimport { signSignatureRequest } from \"./signSignatureRequest.js\";\nimport type { Static } from \"@sinclair/typebox\";\nimport { wallet_sendPreparedCalls } from \"../../rpc/request.js\";\nimport {\n PreparedCall_Authorization,\n PreparedCall_UserOpV060,\n PreparedCall_UserOpV070,\n} from \"../../schemas.js\";\n\nexport type SignPreparedCallsParams = PrepareCallsResult;\n\nexport type SignPreparedCallsResult = Static<\n (typeof wallet_sendPreparedCalls)[\"properties\"][\"Request\"][\"properties\"][\"params\"]\n>[0];\n\n/**\n * Signs prepared calls using the provided signer.\n *\n * @param {SmartAccountSigner} signer - The signer to use\n * @param {SignPreparedCallsParams} params - The prepared calls with signature requests\n * @returns {Promise<SignPreparedCallsResult>} A Promise that resolves to the signed calls\n **/\nexport async function signPreparedCalls(\n signer: SmartAccountSigner,\n params: SignPreparedCallsParams,\n): Promise<SignPreparedCallsResult> {\n const signAuthorizationCall = async (\n call: Static<typeof PreparedCall_Authorization>,\n ) => {\n const { signatureRequest: _signatureRequest, ...rest } = call;\n const signature = await signSignatureRequest(signer, {\n type: \"eip7702Auth\",\n data: {\n ...rest.data,\n chainId: call.chainId,\n },\n });\n return {\n ...rest,\n signature,\n };\n };\n\n const signUserOperationCall = async (\n call:\n | Static<typeof PreparedCall_UserOpV060>\n | Static<typeof PreparedCall_UserOpV070>,\n ) => {\n const { signatureRequest, ...rest } = call;\n const signature = await signSignatureRequest(signer, signatureRequest);\n return {\n ...rest,\n signature,\n };\n };\n\n return params.type === \"array\"\n ? {\n type: \"array\" as const,\n data: await Promise.all(\n params.data.map((call) =>\n call.type === \"authorization\"\n ? signAuthorizationCall(call)\n : signUserOperationCall(call),\n ),\n ),\n }\n : signUserOperationCall(params);\n}\n"]}
@@ -5,6 +5,7 @@ export * from "../capabilities/permissions/mav2.js";
5
5
  export type * from "../isomorphic/client.js";
6
6
  export { createIsomorphicClient } from "../isomorphic/client.js";
7
7
  export { createDummySigner } from "../isomorphic/utils/createDummySigner.js";
8
+ export { prepareInitialOwners } from "../isomorphic/utils/createAccount.js";
8
9
  export * from "../rpc/request.js";
9
10
  export * as RpcSchemas from "../rpc/request.js";
10
11
  export * from "../rpc/schema.js";
@@ -7,6 +7,7 @@ export * from "../capabilities/permissions/index.js";
7
7
  export * from "../capabilities/permissions/mav2.js";
8
8
  export { createIsomorphicClient } from "../isomorphic/client.js";
9
9
  export { createDummySigner } from "../isomorphic/utils/createDummySigner.js";
10
+ export { prepareInitialOwners } from "../isomorphic/utils/createAccount.js";
10
11
  export * from "../rpc/request.js";
11
12
  export * as RpcSchemas from "../rpc/request.js";
12
13
  export * from "../rpc/schema.js";
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/exports/internal.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,qFAAqF;AACrF,wBAAwB;AACxB,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sCAAsC,CAAC;AACrD,cAAc,qCAAqC,CAAC;AAEpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAC7E,cAAc,mBAAmB,CAAC;AAClC,OAAO,KAAK,UAAU,MAAM,mBAAmB,CAAC;AAChD,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAE9B,cAAc,aAAa,CAAC","sourcesContent":["// exports from this file are meant to be imported by our packages in the monorepo\n// we will expose this in the package.json as a named export like `this-pkg/internal`\n// TODO: name `this-pkg`\nexport * from \"../capabilities/index.js\";\nexport * from \"../capabilities/paymaster.js\";\nexport * from \"../capabilities/permissions/index.js\";\nexport * from \"../capabilities/permissions/mav2.js\";\nexport type * from \"../isomorphic/client.js\";\nexport { createIsomorphicClient } from \"../isomorphic/client.js\";\nexport { createDummySigner } from \"../isomorphic/utils/createDummySigner.js\";\nexport * from \"../rpc/request.js\";\nexport * as RpcSchemas from \"../rpc/request.js\";\nexport * from \"../rpc/schema.js\";\nexport * from \"../schemas.js\";\nexport type * from \"../types.ts\";\nexport * from \"../utils.js\";\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/exports/internal.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,qFAAqF;AACrF,wBAAwB;AACxB,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sCAAsC,CAAC;AACrD,cAAc,qCAAqC,CAAC;AAEpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,cAAc,mBAAmB,CAAC;AAClC,OAAO,KAAK,UAAU,MAAM,mBAAmB,CAAC;AAChD,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAE9B,cAAc,aAAa,CAAC","sourcesContent":["// exports from this file are meant to be imported by our packages in the monorepo\n// we will expose this in the package.json as a named export like `this-pkg/internal`\n// TODO: name `this-pkg`\nexport * from \"../capabilities/index.js\";\nexport * from \"../capabilities/paymaster.js\";\nexport * from \"../capabilities/permissions/index.js\";\nexport * from \"../capabilities/permissions/mav2.js\";\nexport type * from \"../isomorphic/client.js\";\nexport { createIsomorphicClient } from \"../isomorphic/client.js\";\nexport { createDummySigner } from \"../isomorphic/utils/createDummySigner.js\";\nexport { prepareInitialOwners } from \"../isomorphic/utils/createAccount.js\";\nexport * from \"../rpc/request.js\";\nexport * as RpcSchemas from \"../rpc/request.js\";\nexport * from \"../rpc/schema.js\";\nexport * from \"../schemas.js\";\nexport type * from \"../types.ts\";\nexport * from \"../utils.js\";\n"]}
@@ -8,6 +8,7 @@ import { isGlobalValidation } from "../../capabilities/permissions/mav2.js";
8
8
  import { createAccount, isModularAccountV2 } from "../utils/createAccount.js";
9
9
  import { createDummySigner } from "../utils/createDummySigner.js";
10
10
  import { supportsFeature } from "../utils/supportsFeature.js";
11
+ import { isDelegated } from "../utils/7702.js";
11
12
  export async function createSession(client, params) {
12
13
  if (!client.chain) {
13
14
  throw new ChainNotFoundError();
@@ -21,12 +22,16 @@ export async function createSession(client, params) {
21
22
  },
22
23
  ],
23
24
  });
24
- if (delegation) {
25
+ if (delegation &&
26
+ !(await isDelegated(client, {
27
+ address: params.account,
28
+ delegation,
29
+ }))) {
25
30
  throw new InvalidRequestError({
26
- message: "'wallet_createSession' does not currently support 7702 accounts.",
31
+ message: "7702 account must be delegated before calling `wallet_createSession`",
27
32
  });
28
33
  }
29
- if (!counterfactualInfo) {
34
+ if (!delegation && !counterfactualInfo) {
30
35
  throw new InvalidRequestError({
31
36
  message: "No counterfactual info found.",
32
37
  });
@@ -77,6 +82,7 @@ export async function createSession(client, params) {
77
82
  .compileDeferred();
78
83
  return {
79
84
  sessionId: null, // In remote mode, the server will set this later.
85
+ chainId: toHex(client.chain.id),
80
86
  entityId: toHex(entityId),
81
87
  signatureRequest: {
82
88
  type: "eth_signTypedData_v4",
@@ -1 +1 @@
1
- {"version":3,"file":"createSession.js","sourceRoot":"","sources":["../../../../src/isomorphic/actions/createSession.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,GAGzB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,eAAe,EACf,iBAAiB,GAClB,MAAM,2CAA2C,CAAC;AAEnD,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EACL,kBAAkB,EAClB,MAAM,EACN,aAAa,EACb,WAAW,EACX,KAAK,GAIN,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAG5E,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAoB9D,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,MAMC,EACD,MAA2B;IAE3B,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QAClB,MAAM,IAAI,kBAAkB,EAAE,CAAC;IACjC,CAAC;IAED,MAAM,EAAE,kBAAkB,EAAE,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EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,MAAM,OAAO,CAAC,mBAAmB,CAAC;QAC5D,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS;QACpE,kBAAkB,EAAE,kBAAkB,CAAC,MAAM,CAAC;KAC/C,CAAC,CAAC;IAEH,MAAM,EAAE,SAAS,EAAE,oCAAoC,EAAE,GACvD,MAAM,IAAI,iBAAiB,CAAC;QAC1B,MAAM,EAAE,OAAO;QACf,GAAG,EAAE;YACH,GAAG,MAAM,CAAC,GAAG;YACb,+BAA+B;YAC/B,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI;SAClE;QACD,QAAQ;QACR,KAAK;QACL,QAAQ,EAAE,MAAM,CAAC,SAAS;KAC3B,CAAC;SACC,cAAc,CAAC;QACd,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CACjD,KAAK,CAAC,MAAM,CAAC,cAAc,EAAE,UAAU,CAAC,CACzC;KACF,CAAC;SACD,eAAe,EAAE,CAAC;IAEvB,OAAO;QACL,SAAS,EAAE,IAAI,EAAE,kDAAkD;QACnE,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC;QACzB,gBAAgB,EAAE;YAChB,IAAI,EAAE,sBAA+B;YACrC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE,aAAa,CAAC,SAAS,CAAC;SACrC;QACD,oCAAoC;KACrC,CAAC;AACJ,CAAC","sourcesContent":["import {\n createSmartAccountClient,\n type SmartAccountClient,\n type SmartContractAccount,\n} from \"@aa-sdk/core\";\nimport {\n deferralActions,\n PermissionBuilder,\n} from \"@account-kit/smart-contracts/experimental\";\nimport type { Static } from \"@sinclair/typebox\";\nimport { Value } from \"@sinclair/typebox/value\";\nimport {\n ChainNotFoundError,\n custom,\n hashTypedData,\n hexToNumber,\n toHex,\n type Chain,\n type Hex,\n type Transport,\n} from \"viem\";\nimport { InvalidRequestError } from \"ox/RpcResponse\";\nimport { TypePermission } from \"../../capabilities/permissions/index.js\";\nimport { isGlobalValidation } from \"../../capabilities/permissions/mav2.js\";\nimport type { wallet_createSession } from \"../../rpc/request.js\";\nimport type { WalletServerViemRpcSchema } from \"../../rpc/schema.js\";\nimport { createAccount, isModularAccountV2 } from \"../utils/createAccount.js\";\nimport { createDummySigner } from \"../utils/createDummySigner.js\";\nimport { supportsFeature } from \"../utils/supportsFeature.js\";\n\nexport type CreateSessionParams = Omit<\n Static<\n (typeof wallet_createSession)[\"properties\"][\"Request\"][\"properties\"][\"params\"]\n >[0],\n \"chainId\"\n> & {\n entityId?: Hex;\n};\n\nexport type CreateSessionResult = Omit<\n Static<(typeof wallet_createSession)[\"properties\"][\"ReturnType\"]>,\n \"sessionId\"\n> & {\n sessionId: Hex | null;\n entityId: Hex;\n fullPreSignatureDeferredActionDigest: Hex;\n};\n\nexport async function createSession(\n client: SmartAccountClient<\n Transport,\n Chain,\n SmartContractAccount | undefined,\n Record<string, unknown>,\n WalletServerViemRpcSchema\n >,\n params: CreateSessionParams,\n): Promise<CreateSessionResult> {\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n\n const { counterfactualInfo, delegation } = await client.request({\n method: \"wallet_requestAccount\",\n params: [\n {\n accountAddress: params.account,\n includeCounterfactualInfo: true,\n },\n ],\n });\n\n if (delegation) {\n throw new InvalidRequestError({\n message:\n \"'wallet_createSession' does not currently support 7702 accounts.\",\n });\n }\n\n if (!counterfactualInfo) {\n throw new InvalidRequestError({\n message: \"No counterfactual info found.\",\n });\n }\n\n if (\n counterfactualInfo &&\n !supportsFeature(counterfactualInfo, \"permissions\")\n ) {\n throw new InvalidRequestError({\n message: \"Account type does not support createSession\",\n });\n }\n\n // At this point we know the account supports the permission feature\n const account = await createAccount({\n chain: client.chain,\n transport: custom(client.transport),\n signer: createDummySigner(params.account),\n accountAddress: params.account,\n counterfactualInfo,\n delegation,\n });\n\n if (!isModularAccountV2(account)) {\n throw new InvalidRequestError({\n message: \"Sessions are currently only supported by MAv2 accounts.\",\n });\n }\n\n const _client = createSmartAccountClient({\n chain: client.chain,\n transport: custom(client.transport),\n account,\n }).extend(deferralActions);\n\n const { entityId, nonce } = await _client.getEntityIdAndNonce({\n entityId: params.entityId ? hexToNumber(params.entityId) : undefined,\n isGlobalValidation: isGlobalValidation(params),\n });\n\n const { typedData, fullPreSignatureDeferredActionDigest } =\n await new PermissionBuilder({\n client: _client,\n key: {\n ...params.key,\n // Alias 'ecdsa' to 'secp256k1'\n type: params.key.type === \"ecdsa\" ? \"secp256k1\" : params.key.type,\n },\n entityId,\n nonce,\n deadline: params.expirySec,\n })\n .addPermissions({\n permissions: params.permissions.map((permission) =>\n Value.Encode(TypePermission, permission),\n ),\n })\n .compileDeferred();\n\n return {\n sessionId: null, // In remote mode, the server will set this later.\n entityId: toHex(entityId),\n signatureRequest: {\n type: \"eth_signTypedData_v4\" as const,\n data: typedData,\n rawPayload: hashTypedData(typedData),\n },\n fullPreSignatureDeferredActionDigest,\n };\n}\n"]}
1
+ {"version":3,"file":"createSession.js","sourceRoot":"","sources":["../../../../src/isomorphic/actions/createSession.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,GAGzB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,eAAe,EACf,iBAAiB,GAClB,MAAM,2CAA2C,CAAC;AAEnD,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EACL,kBAAkB,EAClB,MAAM,EACN,aAAa,EACb,WAAW,EACX,KAAK,GAIN,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,EA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,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CACjD,KAAK,CAAC,MAAM,CAAC,cAAc,EAAE,UAAU,CAAC,CACzC;KACF,CAAC;SACD,eAAe,EAAE,CAAC;IAEvB,OAAO;QACL,SAAS,EAAE,IAAI,EAAE,kDAAkD;QACnE,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;QAC/B,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC;QACzB,gBAAgB,EAAE;YAChB,IAAI,EAAE,sBAA+B;YACrC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE,aAAa,CAAC,SAAS,CAAC;SACrC;QACD,oCAAoC;KACrC,CAAC;AACJ,CAAC","sourcesContent":["import {\n createSmartAccountClient,\n type SmartAccountClient,\n type SmartContractAccount,\n} from \"@aa-sdk/core\";\nimport {\n deferralActions,\n PermissionBuilder,\n} from \"@account-kit/smart-contracts/experimental\";\nimport type { Static } from \"@sinclair/typebox\";\nimport { Value } from \"@sinclair/typebox/value\";\nimport {\n ChainNotFoundError,\n custom,\n hashTypedData,\n hexToNumber,\n toHex,\n type Chain,\n type Hex,\n type Transport,\n} from \"viem\";\nimport { InvalidRequestError } from \"ox/RpcResponse\";\nimport { TypePermission } from \"../../capabilities/permissions/index.js\";\nimport { isGlobalValidation } from \"../../capabilities/permissions/mav2.js\";\nimport type { wallet_createSession } from \"../../rpc/request.js\";\nimport type { WalletServerViemRpcSchema } from \"../../rpc/schema.js\";\nimport { createAccount, isModularAccountV2 } from \"../utils/createAccount.js\";\nimport { createDummySigner } from \"../utils/createDummySigner.js\";\nimport { supportsFeature } from \"../utils/supportsFeature.js\";\nimport { isDelegated } from \"../utils/7702.js\";\n\nexport type CreateSessionParams = Omit<\n Static<\n (typeof wallet_createSession)[\"properties\"][\"Request\"][\"properties\"][\"params\"]\n >[0],\n \"chainId\"\n> & {\n entityId?: Hex;\n};\n\nexport type CreateSessionResult = Omit<\n Static<(typeof wallet_createSession)[\"properties\"][\"ReturnType\"]>,\n \"sessionId\"\n> & {\n sessionId: Hex | null;\n entityId: Hex;\n fullPreSignatureDeferredActionDigest: Hex;\n};\n\nexport async function createSession(\n client: SmartAccountClient<\n Transport,\n Chain,\n SmartContractAccount | undefined,\n Record<string, unknown>,\n WalletServerViemRpcSchema\n >,\n params: CreateSessionParams,\n): Promise<CreateSessionResult> {\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n\n const { counterfactualInfo, delegation } = await client.request({\n method: \"wallet_requestAccount\",\n params: [\n {\n accountAddress: params.account,\n includeCounterfactualInfo: true,\n },\n ],\n });\n\n if (\n delegation &&\n !(await isDelegated(client, {\n address: params.account,\n delegation,\n }))\n ) {\n throw new InvalidRequestError({\n message:\n \"7702 account must be delegated before calling `wallet_createSession`\",\n });\n }\n\n if (!delegation && !counterfactualInfo) {\n throw new InvalidRequestError({\n message: \"No counterfactual info found.\",\n });\n }\n\n if (\n counterfactualInfo &&\n !supportsFeature(counterfactualInfo, \"permissions\")\n ) {\n throw new InvalidRequestError({\n message: \"Account type does not support createSession\",\n });\n }\n\n // At this point we know the account supports the permission feature\n const account = await createAccount({\n chain: client.chain,\n transport: custom(client.transport),\n signer: createDummySigner(params.account),\n accountAddress: params.account,\n counterfactualInfo,\n delegation,\n });\n\n if (!isModularAccountV2(account)) {\n throw new InvalidRequestError({\n message: \"Sessions are currently only supported by MAv2 accounts.\",\n });\n }\n\n const _client = createSmartAccountClient({\n chain: client.chain,\n transport: custom(client.transport),\n account,\n }).extend(deferralActions);\n\n const { entityId, nonce } = await _client.getEntityIdAndNonce({\n entityId: params.entityId ? hexToNumber(params.entityId) : undefined,\n isGlobalValidation: isGlobalValidation(params),\n });\n\n const { typedData, fullPreSignatureDeferredActionDigest } =\n await new PermissionBuilder({\n client: _client,\n key: {\n ...params.key,\n // Alias 'ecdsa' to 'secp256k1'\n type: params.key.type === \"ecdsa\" ? \"secp256k1\" : params.key.type,\n },\n entityId,\n nonce,\n deadline: params.expirySec,\n })\n .addPermissions({\n permissions: params.permissions.map((permission) =>\n Value.Encode(TypePermission, permission),\n ),\n })\n .compileDeferred();\n\n return {\n sessionId: null, // In remote mode, the server will set this later.\n chainId: toHex(client.chain.id),\n entityId: toHex(entityId),\n signatureRequest: {\n type: \"eth_signTypedData_v4\" as const,\n data: typedData,\n rawPayload: hashTypedData(typedData),\n },\n fullPreSignatureDeferredActionDigest,\n };\n}\n"]}
@@ -2,7 +2,7 @@ import { deepHexlify, default7702GasEstimator, } from "@aa-sdk/core";
2
2
  import { ChainNotFoundError, custom, fromHex, hashMessage, toHex, } from "viem";
3
3
  import { createAccount } from "../utils/createAccount.js";
4
4
  import { createDummySigner } from "../utils/createDummySigner.js";
5
- import { createAuthorizationRequest } from "../utils/7702.js";
5
+ import { createAuthorizationRequest, isDelegated } from "../utils/7702.js";
6
6
  import { InvalidRequestError } from "ox/RpcResponse";
7
7
  import { assertNever } from "../../utils.js";
8
8
  import { assertValid7702AccountAddress } from "../utils/7702.js";
@@ -43,13 +43,23 @@ export async function prepareCalls(client, params) {
43
43
  permissions: params.capabilities?.permissions,
44
44
  delegation,
45
45
  });
46
- // If using 7702, we need an Authorization (unless it's already authorized).
47
- const authorizationRequest = delegation
46
+ const authorizationRequest = delegation &&
47
+ !(await isDelegated(client, {
48
+ address: account.address,
49
+ delegation,
50
+ }))
48
51
  ? await createAuthorizationRequest(client, {
49
52
  address: account.address,
50
53
  delegation,
51
54
  })
52
55
  : undefined;
56
+ if (params.capabilities?.permissions && authorizationRequest) {
57
+ // The user shouldn't see this in most cases since we require
58
+ // the account to be delegated before creating the session.
59
+ throw new InvalidRequestError({
60
+ message: "When using a 7702 account with a session key, the account must be delegated before preparing calls.",
61
+ });
62
+ }
53
63
  if (authorizationRequest) {
54
64
  // @ts-expect-error - this is available but not typed as public
55
65
  client.middleware.gasEstimator = default7702GasEstimator();
@@ -63,7 +73,12 @@ export async function prepareCalls(client, params) {
63
73
  value: x.value ? fromHex(x.value, "bigint") : undefined,
64
74
  })),
65
75
  account,
66
- overrides: params.capabilities?.gasParamsOverride,
76
+ overrides: {
77
+ ...params.capabilities?.gasParamsOverride,
78
+ nonceKey: params.capabilities?.nonceOverride?.nonceKey
79
+ ? fromHex(params.capabilities.nonceOverride.nonceKey, "bigint")
80
+ : undefined,
81
+ },
67
82
  });
68
83
  // The eip7702Auth field should never be included in the UO sig
69
84
  // request. It's handled by a separate authorization request.
@@ -1 +1 @@
1
- {"version":3,"file":"prepareCalls.js","sourceRoot":"","sources":["../../../../src/isomorphic/actions/prepareCalls.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,uBAAuB,GAGxB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,kBAAkB,EAClB,MAAM,EACN,OAAO,EACP,WAAW,EACX,KAAK,GAGN,MAAM,MAAM,CAAC;AAGd,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,6BAA6B,EAAE,MAAM,kBAAkB,CAAC;AAajE,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,MAMC,EACD,MAA0B;IAE1B,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QAClB,MAAM,IAAI,kBAAkB,EAAE,CAAC;IACjC,CAAC;IAED,6BAA6B,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC;IAE7E,gEAAgE;IAChE,MAAM,EAAE,kBAAkB,EAAE,UAAU,EAAE,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC;QAC9D,MAAM,EAAE,uBAAuB;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AAE,CAAC,oBAAoB,EAAE,SAAS,CAAC;SACxC;QACH,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC","sourcesContent":["import {\n deepHexlify,\n default7702GasEstimator,\n type SmartAccountClient,\n type SmartContractAccount,\n} from \"@aa-sdk/core\";\nimport type { Static } from \"@sinclair/typebox\";\nimport {\n ChainNotFoundError,\n custom,\n fromHex,\n hashMessage,\n toHex,\n type Chain,\n type Transport,\n} from \"viem\";\nimport type { wallet_prepareCalls } from \"../../rpc/request.js\";\nimport type { WalletServerViemRpcSchema } from \"../../rpc/schema.js\";\nimport { createAccount } from \"../utils/createAccount.js\";\nimport { createDummySigner } from \"../utils/createDummySigner.js\";\nimport { createAuthorizationRequest } from \"../utils/7702.js\";\nimport { InvalidRequestError } from \"ox/RpcResponse\";\nimport { assertNever } from \"../../utils.js\";\nimport { assertValid7702AccountAddress } from \"../utils/7702.js\";\n\nexport type PrepareCallsParams = Omit<\n Static<\n (typeof wallet_prepareCalls)[\"properties\"][\"Request\"][\"properties\"][\"params\"]\n >[0],\n \"chainId\"\n>;\n\nexport type PrepareCallsResult = Static<\n (typeof wallet_prepareCalls)[\"properties\"][\"ReturnType\"]\n>;\n\nexport async function prepareCalls(\n client: SmartAccountClient<\n Transport,\n Chain,\n SmartContractAccount | undefined,\n Record<string, unknown>,\n WalletServerViemRpcSchema\n >,\n params: PrepareCallsParams,\n): Promise<PrepareCallsResult> {\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n\n assertValid7702AccountAddress(params.from, params.capabilities?.eip7702Auth);\n\n // in local mode, we probably want some kind of caching for this\n const { counterfactualInfo, delegation } = await client.request({\n method: \"wallet_requestAccount\",\n params: [\n params.capabilities?.eip7702Auth\n ? {\n signerAddress: params.from,\n creationHint: {\n accountType: \"7702\",\n },\n includeCounterfactualInfo: true,\n }\n : {\n accountAddress: params.from,\n includeCounterfactualInfo: true,\n },\n ],\n });\n\n if (!counterfactualInfo && !delegation) {\n throw new InvalidRequestError({\n message:\n \"No counterfactual info or delegated implementation address found.\",\n });\n }\n\n const account = await createAccount({\n chain: client.chain,\n transport: custom(client.transport),\n signer: createDummySigner(params.from),\n accountAddress: params.from,\n counterfactualInfo,\n permissions: params.capabilities?.permissions,\n delegation,\n });\n\n // If using 7702, we need an Authorization (unless it's already authorized).\n const authorizationRequest = delegation\n ? await createAuthorizationRequest(client, {\n address: account.address,\n delegation,\n })\n : undefined;\n\n if (authorizationRequest) {\n // @ts-expect-error - this is available but not typed as public\n client.middleware.gasEstimator = default7702GasEstimator();\n }\n\n // TODO: oops we don't actually support setting the policyId as an override here\n // if we assume that the the isomorphic client is never used directly, then we can assume that this is handled upstream correctly\n const builtUo = await client.buildUserOperation({\n uo: params.calls.map((x) => ({\n target: x.to,\n data: x.data ?? \"0x\",\n value: x.value ? fromHex(x.value, \"bigint\") : undefined,\n })),\n account,\n overrides: params.capabilities?.gasParamsOverride,\n });\n\n // The eip7702Auth field should never be included in the UO sig\n // request. It's handled by a separate authorization request.\n if (\"eip7702Auth\" in builtUo) {\n builtUo.eip7702Auth = undefined;\n }\n\n const hexlifiedUo = deepHexlify(builtUo);\n\n const ep = account.getEntryPoint();\n\n const uoHash = ep.getUserOperationHash(hexlifiedUo);\n\n const uoRequest = {\n type:\n ep.version === \"0.7.0\"\n ? (\"user-operation-v070\" as const)\n : ep.version === \"0.6.0\"\n ? (\"user-operation-v060\" as const)\n : assertNever(ep.version, \"Unexpected entry point version\"),\n data: hexlifiedUo,\n chainId: toHex(client.chain.id),\n signatureRequest: {\n type: \"personal_sign\" as const,\n data: {\n raw: uoHash,\n },\n rawPayload: hashMessage({\n raw: uoHash,\n }),\n },\n };\n\n return authorizationRequest\n ? {\n type: \"array\" as const,\n data: [authorizationRequest, uoRequest],\n }\n : uoRequest;\n}\n"]}
1
+ {"version":3,"file":"prepareCalls.js","sourceRoot":"","sources":["../../../../src/isomorphic/actions/prepareCalls.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,uBAAuB,GAGxB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BAAoB;QACzB,CAAC,CAAC;YACE,IAAI,EAAE,OAAgB;YACtB,IAAI,EAAE,CAAC,oBAAoB,EAAE,SAAS,CAAC;SACxC;QACH,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC","sourcesContent":["import {\n deepHexlify,\n default7702GasEstimator,\n type SmartAccountClient,\n type SmartContractAccount,\n} from \"@aa-sdk/core\";\nimport type { Static } from \"@sinclair/typebox\";\nimport {\n ChainNotFoundError,\n custom,\n fromHex,\n hashMessage,\n toHex,\n type Chain,\n type Transport,\n} from \"viem\";\nimport type { wallet_prepareCalls } from \"../../rpc/request.js\";\nimport type { WalletServerViemRpcSchema } from \"../../rpc/schema.js\";\nimport { createAccount } from \"../utils/createAccount.js\";\nimport { createDummySigner } from \"../utils/createDummySigner.js\";\nimport { createAuthorizationRequest, isDelegated } from \"../utils/7702.js\";\nimport { InvalidRequestError } from \"ox/RpcResponse\";\nimport { assertNever } from \"../../utils.js\";\nimport { assertValid7702AccountAddress } from \"../utils/7702.js\";\n\nexport type PrepareCallsParams = Omit<\n Static<\n (typeof wallet_prepareCalls)[\"properties\"][\"Request\"][\"properties\"][\"params\"]\n >[0],\n \"chainId\"\n>;\n\nexport type PrepareCallsResult = Static<\n (typeof wallet_prepareCalls)[\"properties\"][\"ReturnType\"]\n>;\n\nexport async function prepareCalls(\n client: SmartAccountClient<\n Transport,\n Chain,\n SmartContractAccount | undefined,\n Record<string, unknown>,\n WalletServerViemRpcSchema\n >,\n params: PrepareCallsParams,\n): Promise<PrepareCallsResult> {\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n\n assertValid7702AccountAddress(params.from, params.capabilities?.eip7702Auth);\n\n // in local mode, we probably want some kind of caching for this\n const { counterfactualInfo, delegation } = await client.request({\n method: \"wallet_requestAccount\",\n params: [\n params.capabilities?.eip7702Auth\n ? {\n signerAddress: params.from,\n creationHint: {\n accountType: \"7702\",\n },\n includeCounterfactualInfo: true,\n }\n : {\n accountAddress: params.from,\n includeCounterfactualInfo: true,\n },\n ],\n });\n\n if (!counterfactualInfo && !delegation) {\n throw new InvalidRequestError({\n message:\n \"No counterfactual info or delegated implementation address found.\",\n });\n }\n\n const account = await createAccount({\n chain: client.chain,\n transport: custom(client.transport),\n signer: createDummySigner(params.from),\n accountAddress: params.from,\n counterfactualInfo,\n permissions: params.capabilities?.permissions,\n delegation,\n });\n\n const authorizationRequest =\n delegation &&\n !(await isDelegated(client, {\n address: account.address,\n delegation,\n }))\n ? await createAuthorizationRequest(client, {\n address: account.address,\n delegation,\n })\n : undefined;\n\n if (params.capabilities?.permissions && authorizationRequest) {\n // The user shouldn't see this in most cases since we require\n // the account to be delegated before creating the session.\n throw new InvalidRequestError({\n message:\n \"When using a 7702 account with a session key, the account must be delegated before preparing calls.\",\n });\n }\n\n if (authorizationRequest) {\n // @ts-expect-error - this is available but not typed as public\n client.middleware.gasEstimator = default7702GasEstimator();\n }\n\n // TODO: oops we don't actually support setting the policyId as an override here\n // if we assume that the the isomorphic client is never used directly, then we can assume that this is handled upstream correctly\n const builtUo = await client.buildUserOperation({\n uo: params.calls.map((x) => ({\n target: x.to,\n data: x.data ?? \"0x\",\n value: x.value ? fromHex(x.value, \"bigint\") : undefined,\n })),\n account,\n overrides: {\n ...params.capabilities?.gasParamsOverride,\n nonceKey: params.capabilities?.nonceOverride?.nonceKey\n ? fromHex(params.capabilities.nonceOverride.nonceKey, \"bigint\")\n : undefined,\n },\n });\n\n // The eip7702Auth field should never be included in the UO sig\n // request. It's handled by a separate authorization request.\n if (\"eip7702Auth\" in builtUo) {\n builtUo.eip7702Auth = undefined;\n }\n\n const hexlifiedUo = deepHexlify(builtUo);\n\n const ep = account.getEntryPoint();\n\n const uoHash = ep.getUserOperationHash(hexlifiedUo);\n\n const uoRequest = {\n type:\n ep.version === \"0.7.0\"\n ? (\"user-operation-v070\" as const)\n : ep.version === \"0.6.0\"\n ? (\"user-operation-v060\" as const)\n : assertNever(ep.version, \"Unexpected entry point version\"),\n data: hexlifiedUo,\n chainId: toHex(client.chain.id),\n signatureRequest: {\n type: \"personal_sign\" as const,\n data: {\n raw: uoHash,\n },\n rawPayload: hashMessage({\n raw: uoHash,\n }),\n },\n };\n\n return authorizationRequest\n ? {\n type: \"array\" as const,\n data: [authorizationRequest, uoRequest],\n }\n : uoRequest;\n}\n"]}
@@ -37,6 +37,11 @@ export async function sendPreparedCalls(client, params) {
37
37
  return isUserOp;
38
38
  })
39
39
  : [params];
40
+ if (!userOps.length) {
41
+ throw new InvalidRequestError({
42
+ message: "Calls must include at least one user operation",
43
+ });
44
+ }
40
45
  const authorizations = params.type === "array"
41
46
  ? params.data.filter((it) => it.type === "authorization")
42
47
  : [];
@@ -85,10 +90,12 @@ export async function sendPreparedCalls(client, params) {
85
90
  case "LightAccountV1.0.1":
86
91
  case "LightAccountV1.0.2":
87
92
  case "LightAccountV1.1.0":
88
- // For LAv1, we always just pass the signature.
93
+ case "MAv1.0.0-MultiOwner":
94
+ // For LAv1 and MAv1-MultiOwner, we always just pass the signature.
89
95
  return uoSigHex;
90
96
  case "LightAccountV2.0.0":
91
- // for LAv2, we need to prepend the "SignatureType.EOA" byte
97
+ // for LAv2, we need to prepend the "SignatureType.EOA" byte.
98
+ // TODO: Once we support nested smart accounts, switch this byte depending on the signature type.
92
99
  return concat(["0x00", uoSigHex]);
93
100
  case undefined: // undefined defaults to sma-b
94
101
  case "MAv2.0.0-sma-b":
@@ -102,10 +109,12 @@ export async function sendPreparedCalls(client, params) {
102
109
  uoSigHex,
103
110
  ])
104
111
  : concat(["0xFF", "0x00", uoSigHex]);
112
+ case "LightAccountV2.0.0-MultiOwner":
113
+ // for LAv2-MultiOwner, we need to prepend the "SignatureType.EOA" byte
114
+ // TODO: Once we support nested smart accounts, switch this byte depending on the signature type, and add the smart account signer's address.
115
+ return concat(["0x00", uoSigHex]);
105
116
  case "MAv2.0.0-ma-ssv":
106
117
  case "MAv2.0.0-ma-webauthn":
107
- case "LightAccountV2.0.0-MultiOwner":
108
- case "MAv1.0.0-MultiOwner":
109
118
  case "MAv1.0.0-MultiSig":
110
119
  case "unknown":
111
120
  throw new InvalidRequestError({
@@ -1 +1 @@
1
- {"version":3,"file":"sendPreparedCalls.js","sourceRoot":"","sources":["../../../../src/isomorphic/actions/sendPreparedCalls.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,GAGd,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EACL,SAAS,EACT,kBAAkB,EAClB,MAAM,EACN,SAAS,EACT,WAAW,EACX,cAAc,EACd,KAAK,GAKN,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AAClF,OAAO,EAAiC,MAAM,sBAAsB,CAAC;AAErE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,gCAAgC,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAU9D,+DAA+D;AAC/D,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,MAMC,EACD,MAA+B;IAE/B,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QAClB,MAAM,IAAI,kBAAkB,EAAE,CAAC;IACjC,CAAC;IAED,MAAM,cAAc,GAAoB,CAAC,GAAG,EAAE;QAC5C,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,WAAW,EAAE,CAAC;YACtC,OAAO;QACT,CAAC;QAED,MAAM,cAAc,GAAG,wBAAwB,CAC7C,MAAM,CAAC,YAAY,CAAC,WAAW,CAChC,CAAC;QAEF,IAAI,cAAc,CAAC,cAAc,KAAK,6BAA6B,EAAE,CAAC;YACpE,MAAM,IAAI,mBAAmB,CAAC;gBAC5B,OAAO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BACV,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC;qBACtC;iBACF;gBACH,CAAC,CAAC,SAAS;SAChB,EACD,EAAE,CAAC,OAAO,CACX;aACA,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;YACb,IACE,GAAG,YAAY,SAAS;gBACxB,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,yCAAyC,CAAC,EAC/D,CAAC;gBACD,MAAM,IAAI,SAAS,CACjB,GAAG,GAAG,CAAC,OAAO,0FAA0F,CACzG,CAAC;YACJ,CAAC;YACD,MAAM,GAAG,CAAC;QACZ,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CACH,CAAC;IAEF,OAAO;QACL,eAAe,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CACnC,KAAK,CAAC,MAAM,CAAC,UAAU,EAAE;YACvB,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;YAC/B,IAAI;SACL,CAAC,CACH;KACF,CAAC;AACJ,CAAC","sourcesContent":["import {\n getEntryPoint,\n type SmartAccountClient,\n type SmartContractAccount,\n} from \"@aa-sdk/core\";\nimport { Value } from \"@sinclair/typebox/value\";\nimport {\n BaseError,\n ChainNotFoundError,\n concat,\n concatHex,\n numberToHex,\n parseSignature,\n toHex,\n type Address,\n type Chain,\n type Hex,\n type Transport,\n} from \"viem\";\nimport { decodePermissionsContext } from \"../../capabilities/permissions/mav2.js\";\nimport { type wallet_sendPreparedCalls } from \"../../rpc/request.js\";\nimport type { WalletServerViemRpcSchema } from \"../../rpc/schema.js\";\nimport { TypeCallId } from \"../../schemas.js\";\nimport { isSupportedDelegationAddress7702 } from \"../utils/7702.js\";\nimport { InvalidRequestError } from \"ox/RpcResponse\";\nimport { assertNever } from \"../../utils.js\";\nimport type { Static } from \"@sinclair/typebox\";\nimport { decodeSignature } from \"../utils/decodeSignature.js\";\n\nexport type SendPreparedCallsParams = Static<\n (typeof wallet_sendPreparedCalls)[\"properties\"][\"Request\"][\"properties\"][\"params\"]\n>[0];\n\nexport type SendPreparedCallsResult = Static<\n (typeof wallet_sendPreparedCalls)[\"properties\"][\"ReturnType\"]\n>;\n\n// TODO: this only supports MAv2 right now, we need to fix this\nexport async function sendPreparedCalls(\n client: SmartAccountClient<\n Transport,\n Chain,\n SmartContractAccount | undefined,\n Record<string, unknown>,\n WalletServerViemRpcSchema\n >,\n params: SendPreparedCallsParams,\n): Promise<SendPreparedCallsResult> {\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n\n const deferredAction: Hex | undefined = (() => {\n if (!params.capabilities?.permissions) {\n return;\n }\n\n const decodedContext = decodePermissionsContext(\n params.capabilities.permissions,\n );\n\n if (decodedContext.contextVersion === \"REMOTE_MODE_DEFERRED_ACTION\") {\n throw new InvalidRequestError({\n message:\n \"Remote mode deferred action not supported in isomorphic client\",\n });\n }\n\n return decodedContext.deferredAction;\n })();\n\n const userOps =\n params.type === \"array\"\n ? params.data.filter((it) => {\n const isUserOp =\n it.type === \"user-operation-v060\" ||\n it.type === \"user-operation-v070\";\n if (isUserOp && it.chainId !== toHex(client.chain.id)) {\n throw new InvalidRequestError({\n message:\n \"Multiple chain IDs in a single request are not currently supported.\",\n });\n }\n return isUserOp;\n })\n : [params];\n\n const authorizations =\n params.type === \"array\"\n ? params.data.filter((it) => it.type === \"authorization\")\n : [];\n\n if (authorizations.length > 1) {\n throw new InvalidRequestError({\n message:\n \"Multiple authorizations in a single request are not currently supported\",\n });\n }\n const [authorization] = authorizations;\n\n // One last safety check to be sure the UO wasn't modified to include an unsupported 7702 delegation address.\n if (\n authorization &&\n !isSupportedDelegationAddress7702(authorization.data.address)\n ) {\n throw new InvalidRequestError({\n message: `Unsupported 7702 delegation address: ${authorization.data.address}`,\n });\n }\n\n const hashes = await Promise.all(\n userOps.map(async (userOp, idx) => {\n const ep: { address: Address } =\n userOp.type === \"user-operation-v060\"\n ? getEntryPoint(client.chain, { version: \"0.6.0\" })\n : userOp.type === \"user-operation-v070\"\n ? getEntryPoint(client.chain, { version: \"0.7.0\" })\n : assertNever(userOp, \"Unexpected user op type\");\n const authSig = authorization\n ? parseSignature(decodeSignature(authorization.signature).data)\n : undefined;\n const uoSigHex = decodeSignature(userOp.signature).data;\n\n const { counterfactualInfo, delegation } = await client.request({\n method: \"wallet_requestAccount\",\n params: [\n {\n accountAddress: userOp.data.sender,\n includeCounterfactualInfo: true,\n },\n ],\n });\n\n if (!counterfactualInfo && !delegation) {\n throw new InvalidRequestError({\n message:\n \"No counterfactual info or delegated implementation address found.\",\n });\n }\n\n const factoryType = counterfactualInfo?.factoryType;\n\n // build signature based on account type\n const signature = (() => {\n switch (factoryType) {\n // light accounts\n case \"LightAccountV1.0.1\":\n case \"LightAccountV1.0.2\":\n case \"LightAccountV1.1.0\":\n // For LAv1, we always just pass the signature.\n return uoSigHex;\n case \"LightAccountV2.0.0\":\n // for LAv2, we need to prepend the \"SignatureType.EOA\" byte\n return concat([\"0x00\", uoSigHex]);\n case undefined: // undefined defaults to sma-b\n case \"MAv2.0.0-sma-b\":\n // For sma-b, we need to handle deferred actions if needed and prepend the \"Reserved\n // Signature Segment\" and \"SignatureType.EOA\" bytes\n return deferredAction != null\n ? concatHex([\n `0x${deferredAction.slice(68)}`, // Cuts off stuff prepended to the digest (nonce, etc.).\n \"0xFF\",\n \"0x00\",\n uoSigHex,\n ])\n : concat([\"0xFF\", \"0x00\", uoSigHex]);\n case \"MAv2.0.0-ma-ssv\":\n case \"MAv2.0.0-ma-webauthn\":\n case \"LightAccountV2.0.0-MultiOwner\":\n case \"MAv1.0.0-MultiOwner\":\n case \"MAv1.0.0-MultiSig\":\n case \"unknown\":\n throw new InvalidRequestError({\n message: `Unsupported factory type: ${factoryType}`,\n });\n default:\n return assertNever(factoryType, \"Unsupported factory type\");\n }\n })();\n\n return client\n .sendRawUserOperation(\n {\n ...userOp.data,\n signature,\n eip7702Auth:\n idx === 0 && authorization && authSig\n ? {\n ...authorization.data,\n chainId: authorization.chainId,\n ...{\n ...authSig,\n yParity: numberToHex(authSig.yParity),\n },\n }\n : undefined,\n },\n ep.address,\n )\n .catch((err) => {\n if (\n err instanceof BaseError &&\n err.details.endsWith(\"is not a contract and initCode is empty\")\n ) {\n throw new BaseError(\n `${err.details} (If using 7702, be sure you include the signed authorization in the request parameters)`,\n );\n }\n throw err;\n });\n }),\n );\n\n return {\n preparedCallIds: hashes.map((hash) =>\n Value.Encode(TypeCallId, {\n chainId: toHex(client.chain.id),\n hash,\n }),\n ),\n };\n}\n"]}
1
+ {"version":3,"file":"sendPreparedCalls.js","sourceRoot":"","sources":["../../../../src/isomorphic/actions/sendPreparedCalls.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,GAGd,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EACL,SAAS,EACT,kBAAkB,EAClB,MAAM,EACN,SAAS,EACT,WAAW,EACX,cAAc,EACd,KAAK,GAKN,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AAClF,OAAO,EAAiC,MAAM,sBAAsB,CAAC;AAErE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,gCAAgC,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAU9D,+DAA+D;AAC/D,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,MAMC,EACD,MAA+B;IAE/B,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QAClB,MAAM,IAAI,kBAAkB,EAAE,CAAC;IACjC,CAAC;IAED,MAAM,cAAc,GAAoB,CAAC,GAAG,EAAE;QAC5C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aa-sdk/core\";\nimport { Value } from \"@sinclair/typebox/value\";\nimport {\n BaseError,\n ChainNotFoundError,\n concat,\n concatHex,\n numberToHex,\n parseSignature,\n toHex,\n type Address,\n type Chain,\n type Hex,\n type Transport,\n} from \"viem\";\nimport { decodePermissionsContext } from \"../../capabilities/permissions/mav2.js\";\nimport { type wallet_sendPreparedCalls } from \"../../rpc/request.js\";\nimport type { WalletServerViemRpcSchema } from \"../../rpc/schema.js\";\nimport { TypeCallId } from \"../../schemas.js\";\nimport { isSupportedDelegationAddress7702 } from \"../utils/7702.js\";\nimport { InvalidRequestError } from \"ox/RpcResponse\";\nimport { assertNever } from \"../../utils.js\";\nimport type { Static } from \"@sinclair/typebox\";\nimport { decodeSignature } from \"../utils/decodeSignature.js\";\n\nexport type SendPreparedCallsParams = Static<\n (typeof wallet_sendPreparedCalls)[\"properties\"][\"Request\"][\"properties\"][\"params\"]\n>[0];\n\nexport type SendPreparedCallsResult = Static<\n (typeof wallet_sendPreparedCalls)[\"properties\"][\"ReturnType\"]\n>;\n\n// TODO: this only supports MAv2 right now, we need to fix this\nexport async function sendPreparedCalls(\n client: SmartAccountClient<\n Transport,\n Chain,\n SmartContractAccount | undefined,\n Record<string, unknown>,\n WalletServerViemRpcSchema\n >,\n params: SendPreparedCallsParams,\n): Promise<SendPreparedCallsResult> {\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n\n const deferredAction: Hex | undefined = (() => {\n if (!params.capabilities?.permissions) {\n return;\n }\n\n const decodedContext = decodePermissionsContext(\n params.capabilities.permissions,\n );\n\n if (decodedContext.contextVersion === \"REMOTE_MODE_DEFERRED_ACTION\") {\n throw new InvalidRequestError({\n message:\n \"Remote mode deferred action not supported in isomorphic client\",\n });\n }\n\n return decodedContext.deferredAction;\n })();\n\n const userOps =\n params.type === \"array\"\n ? params.data.filter((it) => {\n const isUserOp =\n it.type === \"user-operation-v060\" ||\n it.type === \"user-operation-v070\";\n if (isUserOp && it.chainId !== toHex(client.chain.id)) {\n throw new InvalidRequestError({\n message:\n \"Multiple chain IDs in a single request are not currently supported.\",\n });\n }\n return isUserOp;\n })\n : [params];\n\n if (!userOps.length) {\n throw new InvalidRequestError({\n message: \"Calls must include at least one user operation\",\n });\n }\n\n const authorizations =\n params.type === \"array\"\n ? params.data.filter((it) => it.type === \"authorization\")\n : [];\n\n if (authorizations.length > 1) {\n throw new InvalidRequestError({\n message:\n \"Multiple authorizations in a single request are not currently supported\",\n });\n }\n const [authorization] = authorizations;\n\n // One last safety check to be sure the UO wasn't modified to include an unsupported 7702 delegation address.\n if (\n authorization &&\n !isSupportedDelegationAddress7702(authorization.data.address)\n ) {\n throw new InvalidRequestError({\n message: `Unsupported 7702 delegation address: ${authorization.data.address}`,\n });\n }\n\n const hashes = await Promise.all(\n userOps.map(async (userOp, idx) => {\n const ep: { address: Address } =\n userOp.type === \"user-operation-v060\"\n ? getEntryPoint(client.chain, { version: \"0.6.0\" })\n : userOp.type === \"user-operation-v070\"\n ? getEntryPoint(client.chain, { version: \"0.7.0\" })\n : assertNever(userOp, \"Unexpected user op type\");\n const authSig = authorization\n ? parseSignature(decodeSignature(authorization.signature).data)\n : undefined;\n const uoSigHex = decodeSignature(userOp.signature).data;\n\n const { counterfactualInfo, delegation } = await client.request({\n method: \"wallet_requestAccount\",\n params: [\n {\n accountAddress: userOp.data.sender,\n includeCounterfactualInfo: true,\n },\n ],\n });\n\n if (!counterfactualInfo && !delegation) {\n throw new InvalidRequestError({\n message:\n \"No counterfactual info or delegated implementation address found.\",\n });\n }\n\n const factoryType = counterfactualInfo?.factoryType;\n\n // build signature based on account type\n const signature = (() => {\n switch (factoryType) {\n // light accounts\n case \"LightAccountV1.0.1\":\n case \"LightAccountV1.0.2\":\n case \"LightAccountV1.1.0\":\n case \"MAv1.0.0-MultiOwner\":\n // For LAv1 and MAv1-MultiOwner, we always just pass the signature.\n return uoSigHex;\n case \"LightAccountV2.0.0\":\n // for LAv2, we need to prepend the \"SignatureType.EOA\" byte.\n // TODO: Once we support nested smart accounts, switch this byte depending on the signature type.\n return concat([\"0x00\", uoSigHex]);\n case undefined: // undefined defaults to sma-b\n case \"MAv2.0.0-sma-b\":\n // For sma-b, we need to handle deferred actions if needed and prepend the \"Reserved\n // Signature Segment\" and \"SignatureType.EOA\" bytes\n return deferredAction != null\n ? concatHex([\n `0x${deferredAction.slice(68)}`, // Cuts off stuff prepended to the digest (nonce, etc.).\n \"0xFF\",\n \"0x00\",\n uoSigHex,\n ])\n : concat([\"0xFF\", \"0x00\", uoSigHex]);\n case \"LightAccountV2.0.0-MultiOwner\":\n // for LAv2-MultiOwner, we need to prepend the \"SignatureType.EOA\" byte\n // TODO: Once we support nested smart accounts, switch this byte depending on the signature type, and add the smart account signer's address.\n return concat([\"0x00\", uoSigHex]);\n case \"MAv2.0.0-ma-ssv\":\n case \"MAv2.0.0-ma-webauthn\":\n case \"MAv1.0.0-MultiSig\":\n case \"unknown\":\n throw new InvalidRequestError({\n message: `Unsupported factory type: ${factoryType}`,\n });\n default:\n return assertNever(factoryType, \"Unsupported factory type\");\n }\n })();\n\n return client\n .sendRawUserOperation(\n {\n ...userOp.data,\n signature,\n eip7702Auth:\n idx === 0 && authorization && authSig\n ? {\n ...authorization.data,\n chainId: authorization.chainId,\n ...{\n ...authSig,\n yParity: numberToHex(authSig.yParity),\n },\n }\n : undefined,\n },\n ep.address,\n )\n .catch((err) => {\n if (\n err instanceof BaseError &&\n err.details.endsWith(\"is not a contract and initCode is empty\")\n ) {\n throw new BaseError(\n `${err.details} (If using 7702, be sure you include the signed authorization in the request parameters)`,\n );\n }\n throw err;\n });\n }),\n );\n\n return {\n preparedCallIds: hashes.map((hash) =>\n Value.Encode(TypeCallId, {\n chainId: toHex(client.chain.id),\n hash,\n }),\n ),\n };\n}\n"]}
@@ -4,10 +4,15 @@ import type { WalletServerViemRpcSchema } from "../../rpc/schema.js";
4
4
  import { PreparedCall_Authorization } from "../../schemas.js";
5
5
  import type { Eip7702AuthCapability } from "../../capabilities/eip7702Auth.ts";
6
6
  import type { Static } from "@sinclair/typebox";
7
+ /** Checks if an address is actively delegated on-chain. */
8
+ export declare const isDelegated: (client: SmartAccountClient<Transport, Chain, SmartContractAccount | undefined, Record<string, unknown>, WalletServerViemRpcSchema>, params: {
9
+ address: Address;
10
+ delegation: Address;
11
+ }) => Promise<boolean>;
7
12
  export declare const createAuthorizationRequest: (client: SmartAccountClient<Transport, Chain, SmartContractAccount | undefined, Record<string, unknown>, WalletServerViemRpcSchema>, params: {
8
13
  address: Address;
9
14
  delegation: Address;
10
- }) => Promise<Static<typeof PreparedCall_Authorization> | undefined>;
15
+ }) => Promise<Static<typeof PreparedCall_Authorization>>;
11
16
  export declare const EIP_7702_ACCOUNT_TYPE: readonly ["ModularAccountV2"];
12
17
  type Supported7702AccountType = (typeof EIP_7702_ACCOUNT_TYPE)[number];
13
18
  export declare const SUPPORTED_DELEGATION_ADDRESSES: "0x69007702764179f14F51cdce752f4f775d74E139"[];
@@ -2,12 +2,13 @@ import { concatHex, numberToHex, isAddress, hexToNumber, } from "viem";
2
2
  import { PreparedCall_Authorization } from "../../schemas.js";
3
3
  import { InvalidRequestError } from "ox/RpcResponse";
4
4
  import { hashAuthorization } from "viem/utils";
5
- export const createAuthorizationRequest = async (client, params) => {
5
+ /** Checks if an address is actively delegated on-chain. */
6
+ export const isDelegated = async (client, params) => {
6
7
  const expectedCode = concatHex(["0xef0100", params.delegation]);
7
8
  const code = (await client.getCode({ address: params.address })) ?? "0x";
8
- if (code.toLowerCase() === expectedCode.toLowerCase()) {
9
- return undefined; // Already authorized.
10
- }
9
+ return code.toLowerCase() === expectedCode.toLowerCase();
10
+ };
11
+ export const createAuthorizationRequest = async (client, params) => {
11
12
  const data = {
12
13
  address: params.delegation,
13
14
  nonce: numberToHex(await client.getTransactionCount({
@@ -1 +1 @@
1
- {"version":3,"file":"7702.js","sourceRoot":"","sources":["../../../../src/isomorphic/utils/7702.ts"],"names":[],"mappings":"AACA,OAAO,EACL,SAAS,EACT,WAAW,E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E;IACF,IAAI,qBAAqB,EAAE,CAAC;QAC1B,IACE,OAAO,qBAAqB,KAAK,QAAQ;YACzC,SAAS,IAAI,qBAAqB;YAClC,qBAAqB,EAAE,OAAO,KAAK,WAAW,EAC9C,CAAC;YACD,MAAM,IAAI,mBAAmB,CAAC;gBAC5B,OAAO,EAAE,+BAA+B,qBAAqB,CAAC,OAAO,8BAA8B,WAAW,GAAG;aAClH,CAAC,CAAC;QACL,CAAC;QAED,MAAM,UAAU,GAAG,eAAe,CAAC,qBAAqB,CAAC,CAAC;QAE1D,IAAI,CAAC,gCAAgC,CAAC,UAAU,CAAC,EAAE,CAAC;YAClD,MAAM,IAAI,mBAAmB,CAAC;gBAC5B,OAAO,EAAE,wCAAwC,UAAU,EAAE;aAC9D,CAAC,CAAC;QACL,CAAC;IACH,CAAC;AACH,CAAC,CAAC","sourcesContent":["import type { SmartAccountClient, SmartContractAccount } from \"@aa-sdk/core\";\nimport {\n concatHex,\n numberToHex,\n type Address,\n type Chain,\n type Transport,\n isAddress,\n hexToNumber,\n} from \"viem\";\nimport type { WalletServerViemRpcSchema } from \"../../rpc/schema.js\";\nimport { PreparedCall_Authorization } from \"../../schemas.js\";\nimport type { Eip7702AuthCapability } from \"../../capabilities/eip7702Auth.ts\";\nimport type { Static } from \"@sinclair/typebox\";\nimport { InvalidRequestError } from \"ox/RpcResponse\";\nimport { hashAuthorization } from \"viem/utils\";\n\nexport const createAuthorizationRequest = async (\n client: SmartAccountClient<\n Transport,\n Chain,\n SmartContractAccount | undefined,\n Record<string, unknown>,\n WalletServerViemRpcSchema\n >,\n params: { address: Address; delegation: Address },\n): Promise<Static<typeof PreparedCall_Authorization> | undefined> => {\n const expectedCode = concatHex([\"0xef0100\", params.delegation]);\n const code = (await client.getCode({ address: params.address })) ?? \"0x\";\n if (code.toLowerCase() === expectedCode.toLowerCase()) {\n return undefined; // Already authorized.\n }\n const data = {\n address: params.delegation,\n nonce: numberToHex(\n await client.getTransactionCount({\n address: params.address,\n }),\n ),\n };\n return {\n type: \"authorization\" as const,\n data,\n chainId: numberToHex(client.chain.id),\n signatureRequest: {\n type: \"eip7702Auth\" as const,\n rawPayload: hashAuthorization({\n chainId: client.chain.id,\n nonce: hexToNumber(data.nonce),\n address: params.delegation,\n }),\n },\n };\n};\n\nexport const EIP_7702_ACCOUNT_TYPE = [\"ModularAccountV2\"] as const;\n\ntype Supported7702AccountType = (typeof EIP_7702_ACCOUNT_TYPE)[number];\n\nconst Eip7702AccountTypeToDelegationAddress = {\n ModularAccountV2: \"0x69007702764179f14F51cdce752f4f775d74E139\",\n} as const satisfies Record<Supported7702AccountType, Address>;\n\nconst DelegationAddressToAccountType: Record<\n Address,\n Supported7702AccountType\n> = Object.fromEntries(\n Object.entries(Eip7702AccountTypeToDelegationAddress).map(([key, value]) => [\n value,\n key,\n ]),\n) as Record<Address, Supported7702AccountType>;\n\nexport const SUPPORTED_DELEGATION_ADDRESSES = Object.values(\n Eip7702AccountTypeToDelegationAddress,\n);\n\nexport const isSupportedDelegationAddress7702 = (address: Address): boolean => {\n return (SUPPORTED_DELEGATION_ADDRESSES as Address[]).includes(address);\n};\n\nexport const getAccountTypeForDelegationAddress7702 = (\n address: Address,\n): Supported7702AccountType | undefined => {\n return DelegationAddressToAccountType[address];\n};\n\nconst getDelegationAddressForAccountType7702 = (\n accountType: Supported7702AccountType,\n): (typeof SUPPORTED_DELEGATION_ADDRESSES)[number] => {\n return Eip7702AccountTypeToDelegationAddress[accountType];\n};\n\nconst DEFAULT_7702_DELEGATION_ADDR =\n Eip7702AccountTypeToDelegationAddress[\"ModularAccountV2\"];\n\nexport const parseDelegation = (\n eip7702AuthCapability: Static<typeof Eip7702AuthCapability>,\n) => {\n return eip7702AuthCapability === true\n ? DEFAULT_7702_DELEGATION_ADDR\n : isAddress(eip7702AuthCapability.delegation)\n ? eip7702AuthCapability.delegation\n : getDelegationAddressForAccountType7702(\n eip7702AuthCapability.delegation,\n );\n};\n\nexport const assertValid7702AccountAddress = (\n fromAddress: Address,\n eip7702AuthCapability: Static<typeof Eip7702AuthCapability> | undefined,\n) => {\n if (eip7702AuthCapability) {\n if (\n typeof eip7702AuthCapability === \"object\" &&\n \"account\" in eip7702AuthCapability &&\n eip7702AuthCapability?.account !== fromAddress\n ) {\n throw new InvalidRequestError({\n message: `EIP-7702 delegation account ${eip7702AuthCapability.account} must match 'from' address ${fromAddress}.`,\n });\n }\n\n const delegation = parseDelegation(eip7702AuthCapability);\n\n if (!isSupportedDelegationAddress7702(delegation)) {\n throw new InvalidRequestError({\n message: `Unsupported 7702 delegation address: ${delegation}`,\n });\n }\n }\n};\n"]}
1
+ {"version":3,"file":"7702.js","sourceRoot":"","sources":["../../../../src/isomorphic/utils/7702.ts"],"names":[],"mappings":"AACA,OAAO,EACL,SAAS,EACT,WAAW,EAIX,SAAS,EACT,WAAW,GACZ,MAAM,MAAM,CAAC;AAEd,OAAO,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAG9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE/C,2DAA2D;AAC3D,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,EAC9B,MAMC,EACD,MAAiD,EAC/B,EAAE;IACpB,MAAM,YAAY,GAAG,SAAS,CAAC,CAAC,UAAU,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC;IAChE,MAAM,IAAI,GAAG,CAAC,MAAM,MAAM,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,IAAI,CAAC;IACzE,OAAO,IAAI,CAAC,WAAW,EAAE,KAAK,YAAY,CAAC,WAAW,EAAE,CAAC;AAC3D,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,0BAA0B,GAAG,KAAK,EAC7C,MAMC,EACD,MAAiD,EACG,EAAE;IACtD,MAAM,IAAI,GAAG;QACX,OAAO,EAAE,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EF,MAAM,sCAAsC,GAAG,CAC7C,WAAqC,EACY,EAAE;IACnD,OAAO,qCAAqC,CAAC,WAAW,CAAC,CAAC;AAC5D,CAAC,CAAC;AAEF,MAAM,4BAA4B,GAChC,qCAAqC,CAAC,kBAAkB,CAAC,CAAC;AAE5D,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,qBAA2D,EAC3D,EAAE;IACF,OAAO,qBAAqB,KAAK,IAAI;QACnC,CAAC,CAAC,4BAA4B;QAC9B,CAAC,CAAC,SAAS,CAAC,qBAAqB,CAAC,UAAU,CAAC;YAC3C,CAAC,CAAC,qBAAqB,CAAC,UAAU;YAClC,CAAC,CAAC,sCAAsC,CACpC,qBAAqB,CAAC,UAAU,CACjC,CAAC;AACV,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAC3C,WAAoB,EACpB,qBAAuE,EACvE,EAAE;IACF,IAAI,qBAAqB,EAAE,CAAC;QAC1B,IACE,OAAO,qBAAqB,KAAK,QAAQ;YACzC,SAAS,IAAI,qBAAqB;YAClC,qBAAqB,EAAE,OAAO,KAAK,WAAW,EAC9C,CAAC;YACD,MAAM,IAAI,mBAAmB,CAAC;gBAC5B,OAAO,EAAE,+BAA+B,qBAAqB,CAAC,OAAO,8BAA8B,WAAW,GAAG;aAClH,CAAC,CAAC;QACL,CAAC;QAED,MAAM,UAAU,GAAG,eAAe,CAAC,qBAAqB,CAAC,CAAC;QAE1D,IAAI,CAAC,gCAAgC,CAAC,UAAU,CAAC,EAAE,CAAC;YAClD,MAAM,IAAI,mBAAmB,CAAC;gBAC5B,OAAO,EAAE,wCAAwC,UAAU,EAAE;aAC9D,CAAC,CAAC;QACL,CAAC;IACH,CAAC;AACH,CAAC,CAAC","sourcesContent":["import type { SmartAccountClient, SmartContractAccount } from \"@aa-sdk/core\";\nimport {\n concatHex,\n numberToHex,\n type Address,\n type Chain,\n type Transport,\n isAddress,\n hexToNumber,\n} from \"viem\";\nimport type { WalletServerViemRpcSchema } from \"../../rpc/schema.js\";\nimport { PreparedCall_Authorization } from \"../../schemas.js\";\nimport type { Eip7702AuthCapability } from \"../../capabilities/eip7702Auth.ts\";\nimport type { Static } from \"@sinclair/typebox\";\nimport { InvalidRequestError } from \"ox/RpcResponse\";\nimport { hashAuthorization } from \"viem/utils\";\n\n/** Checks if an address is actively delegated on-chain. */\nexport const isDelegated = async (\n client: SmartAccountClient<\n Transport,\n Chain,\n SmartContractAccount | undefined,\n Record<string, unknown>,\n WalletServerViemRpcSchema\n >,\n params: { address: Address; delegation: Address },\n): Promise<boolean> => {\n const expectedCode = concatHex([\"0xef0100\", params.delegation]);\n const code = (await client.getCode({ address: params.address })) ?? \"0x\";\n return code.toLowerCase() === expectedCode.toLowerCase();\n};\n\nexport const createAuthorizationRequest = async (\n client: SmartAccountClient<\n Transport,\n Chain,\n SmartContractAccount | undefined,\n Record<string, unknown>,\n WalletServerViemRpcSchema\n >,\n params: { address: Address; delegation: Address },\n): Promise<Static<typeof PreparedCall_Authorization>> => {\n const data = {\n address: params.delegation,\n nonce: numberToHex(\n await client.getTransactionCount({\n address: params.address,\n }),\n ),\n };\n return {\n type: \"authorization\" as const,\n data,\n chainId: numberToHex(client.chain.id),\n signatureRequest: {\n type: \"eip7702Auth\" as const,\n rawPayload: hashAuthorization({\n chainId: client.chain.id,\n nonce: hexToNumber(data.nonce),\n address: params.delegation,\n }),\n },\n };\n};\n\nexport const EIP_7702_ACCOUNT_TYPE = [\"ModularAccountV2\"] as const;\n\ntype Supported7702AccountType = (typeof EIP_7702_ACCOUNT_TYPE)[number];\n\nconst Eip7702AccountTypeToDelegationAddress = {\n ModularAccountV2: \"0x69007702764179f14F51cdce752f4f775d74E139\",\n} as const satisfies Record<Supported7702AccountType, Address>;\n\nconst DelegationAddressToAccountType: Record<\n Address,\n Supported7702AccountType\n> = Object.fromEntries(\n Object.entries(Eip7702AccountTypeToDelegationAddress).map(([key, value]) => [\n value,\n key,\n ]),\n) as Record<Address, Supported7702AccountType>;\n\nexport const SUPPORTED_DELEGATION_ADDRESSES = Object.values(\n Eip7702AccountTypeToDelegationAddress,\n);\n\nexport const isSupportedDelegationAddress7702 = (address: Address): boolean => {\n return (SUPPORTED_DELEGATION_ADDRESSES as Address[]).includes(address);\n};\n\nexport const getAccountTypeForDelegationAddress7702 = (\n address: Address,\n): Supported7702AccountType | undefined => {\n return DelegationAddressToAccountType[address];\n};\n\nconst getDelegationAddressForAccountType7702 = (\n accountType: Supported7702AccountType,\n): (typeof SUPPORTED_DELEGATION_ADDRESSES)[number] => {\n return Eip7702AccountTypeToDelegationAddress[accountType];\n};\n\nconst DEFAULT_7702_DELEGATION_ADDR =\n Eip7702AccountTypeToDelegationAddress[\"ModularAccountV2\"];\n\nexport const parseDelegation = (\n eip7702AuthCapability: Static<typeof Eip7702AuthCapability>,\n) => {\n return eip7702AuthCapability === true\n ? DEFAULT_7702_DELEGATION_ADDR\n : isAddress(eip7702AuthCapability.delegation)\n ? eip7702AuthCapability.delegation\n : getDelegationAddressForAccountType7702(\n eip7702AuthCapability.delegation,\n );\n};\n\nexport const assertValid7702AccountAddress = (\n fromAddress: Address,\n eip7702AuthCapability: Static<typeof Eip7702AuthCapability> | undefined,\n) => {\n if (eip7702AuthCapability) {\n if (\n typeof eip7702AuthCapability === \"object\" &&\n \"account\" in eip7702AuthCapability &&\n eip7702AuthCapability?.account !== fromAddress\n ) {\n throw new InvalidRequestError({\n message: `EIP-7702 delegation account ${eip7702AuthCapability.account} must match 'from' address ${fromAddress}.`,\n });\n }\n\n const delegation = parseDelegation(eip7702AuthCapability);\n\n if (!isSupportedDelegationAddress7702(delegation)) {\n throw new InvalidRequestError({\n message: `Unsupported 7702 delegation address: ${delegation}`,\n });\n }\n }\n};\n"]}
@@ -20,4 +20,5 @@ type CreateAccountParams = {
20
20
  */
21
21
  export declare function createAccount(params: CreateAccountParams): Promise<SmartContractAccount>;
22
22
  export declare function isModularAccountV2(account: SmartContractAccount): account is ModularAccountV2;
23
+ export declare function prepareInitialOwners(initialOwners: Address[], signerAddress: Address): Address[];
23
24
  export {};
@@ -1,5 +1,5 @@
1
- import { createLightAccount, createModularAccountV2, } from "@account-kit/smart-contracts";
2
- import { concatHex, hexToNumber } from "viem";
1
+ import { createLightAccount, createModularAccountV2, createMultiOwnerLightAccount, createMultiOwnerModularAccount, } from "@account-kit/smart-contracts";
2
+ import { concatHex, hexToBigInt, hexToNumber, zeroAddress } from "viem";
3
3
  import { parsePermissionsContext } from "./parsePermissionsContext.js";
4
4
  import { assertNever } from "../../utils.js";
5
5
  import { getAccountTypeForDelegationAddress7702 } from "./7702.js";
@@ -78,8 +78,15 @@ export async function createAccount(params) {
78
78
  ...commonParams,
79
79
  version: "v1.1.0",
80
80
  });
81
- case "LightAccountV2.0.0-MultiOwner":
82
81
  case "MAv1.0.0-MultiOwner":
82
+ return createMultiOwnerModularAccount({
83
+ ...commonParams,
84
+ });
85
+ case "LightAccountV2.0.0-MultiOwner":
86
+ return createMultiOwnerLightAccount({
87
+ ...commonParams,
88
+ version: "v2.0.0",
89
+ });
83
90
  case "MAv1.0.0-MultiSig":
84
91
  case "MAv2.0.0-ma-ssv":
85
92
  case "MAv2.0.0-ma-webauthn":
@@ -95,4 +102,19 @@ export async function createAccount(params) {
95
102
  export function isModularAccountV2(account) {
96
103
  return account.source === "ModularAccountV2";
97
104
  }
105
+ // Performs basic checks on the initialOwners array and returns a new array with the signer address added if not present.
106
+ // Pulled from MAv1 support in Account Kit.
107
+ export function prepareInitialOwners(initialOwners, signerAddress) {
108
+ const preparedOwners = Array.from(new Set([...initialOwners, signerAddress])).sort((a, b) => {
109
+ const bigintA = hexToBigInt(a);
110
+ const bigintB = hexToBigInt(b);
111
+ return bigintA < bigintB ? -1 : bigintA > bigintB ? 1 : 0;
112
+ });
113
+ if (preparedOwners.some((x) => x === zeroAddress)) {
114
+ throw new InvalidRequestError({
115
+ message: "Initial owners cannot contain the zero address",
116
+ });
117
+ }
118
+ return preparedOwners;
119
+ }
98
120
  //# sourceMappingURL=createAccount.js.map