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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) 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/requestAccount.js +5 -2
  5. package/dist/esm/client/actions/requestAccount.js.map +1 -1
  6. package/dist/esm/client/actions/signPreparedCalls.js +2 -1
  7. package/dist/esm/client/actions/signPreparedCalls.js.map +1 -1
  8. package/dist/esm/client/actions/signSignatureRequest.d.ts +3 -2
  9. package/dist/esm/client/actions/signSignatureRequest.js.map +1 -1
  10. package/dist/esm/client/client.e2e-test.js +53 -0
  11. package/dist/esm/client/client.e2e-test.js.map +1 -1
  12. package/dist/esm/isomorphic/actions/createSession.js +11 -2
  13. package/dist/esm/isomorphic/actions/createSession.js.map +1 -1
  14. package/dist/esm/isomorphic/actions/prepareCalls.js +21 -14
  15. package/dist/esm/isomorphic/actions/prepareCalls.js.map +1 -1
  16. package/dist/esm/isomorphic/actions/sendPreparedCalls.js +53 -8
  17. package/dist/esm/isomorphic/actions/sendPreparedCalls.js.map +1 -1
  18. package/dist/esm/isomorphic/client.d.ts +9 -0
  19. package/dist/esm/isomorphic/utils/7702.js +21 -8
  20. package/dist/esm/isomorphic/utils/7702.js.map +1 -1
  21. package/dist/esm/isomorphic/utils/createAccount.js +73 -33
  22. package/dist/esm/isomorphic/utils/createAccount.js.map +1 -1
  23. package/dist/esm/isomorphic/utils/supportsFeature.d.ts +4 -0
  24. package/dist/esm/isomorphic/utils/supportsFeature.js +21 -0
  25. package/dist/esm/isomorphic/utils/supportsFeature.js.map +1 -0
  26. package/dist/esm/rpc/request.d.ts +12 -2
  27. package/dist/esm/rpc/schema.d.ts +12 -2
  28. package/dist/esm/schemas.d.ts +16 -1
  29. package/dist/esm/schemas.js +12 -1
  30. package/dist/esm/schemas.js.map +1 -1
  31. package/dist/esm/types.d.ts +3 -0
  32. package/dist/esm/types.js.map +1 -1
  33. package/dist/types/client/actions/prepareCalls.d.ts +1 -1
  34. package/dist/types/client/actions/requestAccount.d.ts.map +1 -1
  35. package/dist/types/client/actions/signPreparedCalls.d.ts.map +1 -1
  36. package/dist/types/client/actions/signSignatureRequest.d.ts +3 -2
  37. package/dist/types/client/actions/signSignatureRequest.d.ts.map +1 -1
  38. package/dist/types/isomorphic/actions/createSession.d.ts.map +1 -1
  39. package/dist/types/isomorphic/actions/prepareCalls.d.ts.map +1 -1
  40. package/dist/types/isomorphic/actions/sendPreparedCalls.d.ts.map +1 -1
  41. package/dist/types/isomorphic/client.d.ts +9 -0
  42. package/dist/types/isomorphic/client.d.ts.map +1 -1
  43. package/dist/types/isomorphic/utils/7702.d.ts.map +1 -1
  44. package/dist/types/isomorphic/utils/createAccount.d.ts.map +1 -1
  45. package/dist/types/isomorphic/utils/supportsFeature.d.ts +5 -0
  46. package/dist/types/isomorphic/utils/supportsFeature.d.ts.map +1 -0
  47. package/dist/types/rpc/request.d.ts +12 -2
  48. package/dist/types/rpc/request.d.ts.map +1 -1
  49. package/dist/types/rpc/schema.d.ts +12 -2
  50. package/dist/types/rpc/schema.d.ts.map +1 -1
  51. package/dist/types/schemas.d.ts +16 -1
  52. package/dist/types/schemas.d.ts.map +1 -1
  53. package/dist/types/types.d.ts +3 -0
  54. package/dist/types/types.d.ts.map +1 -1
  55. package/package.json +5 -5
  56. package/src/client/actions/prepareCalls.ts +1 -1
  57. package/src/client/actions/requestAccount.ts +10 -8
  58. package/src/client/actions/signPreparedCalls.ts +2 -1
  59. package/src/client/actions/signSignatureRequest.ts +4 -2
  60. package/src/client/client.e2e-test.ts +71 -0
  61. package/src/isomorphic/actions/createSession.ts +14 -1
  62. package/src/isomorphic/actions/prepareCalls.ts +22 -13
  63. package/src/isomorphic/actions/sendPreparedCalls.ts +59 -9
  64. package/src/isomorphic/utils/7702.ts +25 -9
  65. package/src/isomorphic/utils/createAccount.ts +81 -34
  66. package/src/isomorphic/utils/supportsFeature.ts +34 -0
  67. package/src/schemas.ts +20 -1
  68. package/src/types.ts +4 -0
@@ -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,cA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AI;oBACrB,OAAO,EAAE,aAAa,CAAC,OAAO;oBAC9B,GAAG;wBACD,GAAG,OAAO;wBACV,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 return client\n .sendRawUserOperation(\n {\n ...userOp.data,\n signature:\n deferredAction != null\n ? concatHex([\n `0x${deferredAction.slice(68)}`, // Cuts off stuff prepended to the digest (nonce, etc. that we had previously).\n \"0xff\",\n \"0x00\",\n uoSigHex,\n ])\n : concat([\"0xFF\", \"0x00\", uoSigHex]),\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,C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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"]}
@@ -50,11 +50,13 @@ export declare function isomorphicClientActions(client: SmartAccountClient<Trans
50
50
  [x: string]: unknown;
51
51
  };
52
52
  };
53
+ rawPayload: `0x${string}`;
53
54
  } | {
54
55
  type: "personal_sign";
55
56
  data: string | {
56
57
  raw: `0x${string}`;
57
58
  };
59
+ rawPayload: `0x${string}`;
58
60
  };
59
61
  } | {
60
62
  type: "user-operation-v070";
@@ -96,11 +98,13 @@ export declare function isomorphicClientActions(client: SmartAccountClient<Trans
96
98
  [x: string]: unknown;
97
99
  };
98
100
  };
101
+ rawPayload: `0x${string}`;
99
102
  } | {
100
103
  type: "personal_sign";
101
104
  data: string | {
102
105
  raw: `0x${string}`;
103
106
  };
107
+ rawPayload: `0x${string}`;
104
108
  };
105
109
  } | {
106
110
  type: "authorization";
@@ -111,6 +115,7 @@ export declare function isomorphicClientActions(client: SmartAccountClient<Trans
111
115
  };
112
116
  signatureRequest: {
113
117
  type: "eip7702Auth";
118
+ rawPayload: `0x${string}`;
114
119
  };
115
120
  })[];
116
121
  } | {
@@ -149,11 +154,13 @@ export declare function isomorphicClientActions(client: SmartAccountClient<Trans
149
154
  [x: string]: unknown;
150
155
  };
151
156
  };
157
+ rawPayload: `0x${string}`;
152
158
  } | {
153
159
  type: "personal_sign";
154
160
  data: string | {
155
161
  raw: `0x${string}`;
156
162
  };
163
+ rawPayload: `0x${string}`;
157
164
  };
158
165
  } | {
159
166
  type: "user-operation-v070";
@@ -195,11 +202,13 @@ export declare function isomorphicClientActions(client: SmartAccountClient<Trans
195
202
  [x: string]: unknown;
196
203
  };
197
204
  };
205
+ rawPayload: `0x${string}`;
198
206
  } | {
199
207
  type: "personal_sign";
200
208
  data: string | {
201
209
  raw: `0x${string}`;
202
210
  };
211
+ rawPayload: `0x${string}`;
203
212
  };
204
213
  }>;
205
214
  sendPreparedCalls: (params: SendPreparedCallsParams) => Promise<{
@@ -1,6 +1,7 @@
1
- import { concatHex, numberToHex, isAddress, } from "viem";
1
+ import { concatHex, numberToHex, isAddress, hexToNumber, } from "viem";
2
2
  import { PreparedCall_Authorization } from "../../schemas.js";
3
3
  import { InvalidRequestError } from "ox/RpcResponse";
4
+ import { hashAuthorization } from "viem/utils";
4
5
  export const createAuthorizationRequest = async (client, params) => {
5
6
  const expectedCode = concatHex(["0xef0100", params.delegation]);
6
7
  const code = (await client.getCode({ address: params.address })) ?? "0x";
@@ -19,6 +20,11 @@ export const createAuthorizationRequest = async (client, params) => {
19
20
  chainId: numberToHex(client.chain.id),
20
21
  signatureRequest: {
21
22
  type: "eip7702Auth",
23
+ rawPayload: hashAuthorization({
24
+ chainId: client.chain.id,
25
+ nonce: hexToNumber(data.nonce),
26
+ address: params.delegation,
27
+ }),
22
28
  },
23
29
  };
24
30
  };
@@ -49,13 +55,20 @@ export const parseDelegation = (eip7702AuthCapability) => {
49
55
  : getDelegationAddressForAccountType7702(eip7702AuthCapability.delegation);
50
56
  };
51
57
  export const assertValid7702AccountAddress = (fromAddress, eip7702AuthCapability) => {
52
- if (eip7702AuthCapability &&
53
- typeof eip7702AuthCapability === "object" &&
54
- "account" in eip7702AuthCapability &&
55
- eip7702AuthCapability?.account !== fromAddress) {
56
- throw new InvalidRequestError({
57
- message: `EIP-7702 delegation account ${eip7702AuthCapability.account} must match 'from' address ${fromAddress}.`,
58
- });
58
+ if (eip7702AuthCapability) {
59
+ if (typeof eip7702AuthCapability === "object" &&
60
+ "account" in eip7702AuthCapability &&
61
+ eip7702AuthCapability?.account !== fromAddress) {
62
+ throw new InvalidRequestError({
63
+ message: `EIP-7702 delegation account ${eip7702AuthCapability.account} must match 'from' address ${fromAddress}.`,
64
+ });
65
+ }
66
+ const delegation = parseDelegation(eip7702AuthCapability);
67
+ if (!isSupportedDelegationAddress7702(delegation)) {
68
+ throw new InvalidRequestError({
69
+ message: `Unsupported 7702 delegation address: ${delegation}`,
70
+ });
71
+ }
59
72
  }
60
73
  };
61
74
  //# sourceMappingURL=7702.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"7702.js","sourceRoot":"","sources":["../../../../src/isomorphic/utils/7702.ts"],"names":[],"mappings":"AACA,OAAO,EACL,SAAS,EACT,WAAW,EAIX,SAAS,GACV,MAAM,MAAM,CAAC;AAEd,OAAO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ountClient, SmartContractAccount } from \"@aa-sdk/core\";\nimport {\n concatHex,\n numberToHex,\n type Address,\n type Chain,\n type Transport,\n isAddress,\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\";\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 },\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 (\n eip7702AuthCapability &&\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"]}
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,MAAM,CAAC,MAAM,0BAA0B,GAAG,KAAK,EAC7C,MAMC,EACD,MAAiD,EACe,EAAE;IAClE,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,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,10 +1,10 @@
1
- import { createModularAccountV2, } from "@account-kit/smart-contracts";
1
+ import { createLightAccount, createModularAccountV2, } from "@account-kit/smart-contracts";
2
2
  import { concatHex, hexToNumber } from "viem";
3
3
  import { parsePermissionsContext } from "./parsePermissionsContext.js";
4
4
  import { assertNever } from "../../utils.js";
5
5
  import { getAccountTypeForDelegationAddress7702 } from "./7702.js";
6
- import { InternalError } from "ox/RpcResponse";
7
6
  import { PermissionsCapability } from "../../capabilities/permissions/index.js";
7
+ import { InternalError, InvalidRequestError } from "ox/RpcResponse";
8
8
  /**
9
9
  * Creates a smart account instance from the given parameters.
10
10
  * @param params - The parameters for creating a smart account.
@@ -12,30 +12,8 @@ import { PermissionsCapability } from "../../capabilities/permissions/index.js";
12
12
  */
13
13
  export async function createAccount(params) {
14
14
  const { counterfactualInfo: ci, ...accountParams } = params;
15
- const mode = params.delegation ? "7702" : "default";
16
- if (mode === "default") {
17
- if (!ci) {
18
- throw new InternalError({
19
- message: "Counterfactual info not found",
20
- });
21
- }
22
- if (ci.factoryType !== "MAv2.0.0-sma-b") {
23
- throw new InternalError({
24
- message: `Factory type ${ci.factoryType} is not currently supported.`,
25
- });
26
- }
27
- }
28
- else if (mode === "7702") {
29
- const accountType = getAccountTypeForDelegationAddress7702(params.delegation);
30
- if (accountType !== "ModularAccountV2") {
31
- throw new InternalError({
32
- message: "7702 mode currently only supports ModularAccountV2",
33
- });
34
- }
35
- }
36
- else {
37
- assertNever(mode, "Unexpected mode in createAccount");
38
- }
15
+ // This throws if we pass a permission context and the account is not MA-v2
16
+ // TODO: test that this edge case is handled correctly
39
17
  const parsedContext = parsePermissionsContext(params.permissions, ci, params.delegation);
40
18
  const signerEntity = parsedContext?.contextVersion === "NON_DEFERRED_ACTION"
41
19
  ? {
@@ -43,14 +21,76 @@ export async function createAccount(params) {
43
21
  isGlobalValidation: parsedContext.isGlobalValidation,
44
22
  }
45
23
  : undefined;
46
- // TODO: clean this up to support different account types.
47
- return createModularAccountV2({
24
+ const mode = params.delegation ? "7702" : "default";
25
+ if (mode === "7702") {
26
+ const accountType = getAccountTypeForDelegationAddress7702(params.delegation);
27
+ if (accountType !== "ModularAccountV2") {
28
+ throw new Error("7702 mode currently only supports ModularAccountV2");
29
+ }
30
+ return createModularAccountV2({
31
+ ...accountParams,
32
+ signerEntity,
33
+ deferredAction: parsedContext?.deferredAction,
34
+ mode,
35
+ });
36
+ }
37
+ if (mode !== "default") {
38
+ return assertNever(mode, "Unexpected mode in createAccount");
39
+ }
40
+ // At this point, we are guaranteed to be in default mode, where ci
41
+ // (counterfactualInfo) must be defined
42
+ if (!ci) {
43
+ throw new InternalError({
44
+ message: "Counterfactual info not found",
45
+ });
46
+ }
47
+ const factoryType = ci.factoryType;
48
+ const commonParams = {
48
49
  ...accountParams,
49
- signerEntity,
50
- deferredAction: parsedContext?.deferredAction,
51
- initCode: ci ? concatHex([ci.factoryAddress, ci.factoryData]) : undefined,
52
- mode,
53
- });
50
+ initCode: concatHex([ci.factoryAddress, ci.factoryData]),
51
+ };
52
+ // Return the account created based on the factory type
53
+ switch (factoryType) {
54
+ case "MAv2.0.0-sma-b":
55
+ return createModularAccountV2({
56
+ ...commonParams,
57
+ signerEntity,
58
+ deferredAction: parsedContext?.deferredAction,
59
+ mode,
60
+ });
61
+ case "LightAccountV2.0.0":
62
+ return createLightAccount({
63
+ ...commonParams,
64
+ version: "v2.0.0",
65
+ });
66
+ case "LightAccountV1.0.1":
67
+ return createLightAccount({
68
+ ...commonParams,
69
+ version: "v1.0.1",
70
+ });
71
+ case "LightAccountV1.0.2":
72
+ return createLightAccount({
73
+ ...commonParams,
74
+ version: "v1.0.2",
75
+ });
76
+ case "LightAccountV1.1.0":
77
+ return createLightAccount({
78
+ ...commonParams,
79
+ version: "v1.1.0",
80
+ });
81
+ case "LightAccountV2.0.0-MultiOwner":
82
+ case "MAv1.0.0-MultiOwner":
83
+ case "MAv1.0.0-MultiSig":
84
+ case "MAv2.0.0-ma-ssv":
85
+ case "MAv2.0.0-ma-webauthn":
86
+ case "unknown":
87
+ case undefined:
88
+ throw new InvalidRequestError({
89
+ message: `Account type currently unsupported: ${factoryType}`,
90
+ });
91
+ default:
92
+ return assertNever(factoryType, "Unsupported factory type");
93
+ }
54
94
  }
55
95
  export function isModularAccountV2(account) {
56
96
  return account.source === "ModularAccountV2";
@@ -1 +1 @@
1
- {"version":3,"file":"createAccount.js","sourceRoot":"","sources":["../../../../src/isomorphic/utils/createAccount.ts"],"names":[],"mappings":"AACA,OAAO,EACL,sBAAsB,GAEvB,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AAE9C,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,sCAAsC,EAAE,MAAM,WAAW,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAYhF;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,MAA2B;IAE3B,MAAM,EAAE,kBAAkB,EAAE,EAAE,EAAE,GAAG,aAAa,EAAE,GAAG,MAAM,CAAC;IAE5D,MAAM,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;IAEpD,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,IAAI,CAAC,EAAE,EAAE,CAAC;YACR,MAAM,IAAI,aAAa,CAAC;gBACtB,OAAO,EAAE,+BAA+B;aACzC,CAAC,CAAC;QACL,CAAC;QACD,IAAI,EAAE,CAAC,WAAW,KAAK,gBAAgB,EAAE,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2,\n type ModularAccountV2,\n} from \"@account-kit/smart-contracts\";\nimport type { StaticDecode } from \"@sinclair/typebox\";\nimport type { Address, Chain, Transport } from \"viem\";\nimport { concatHex, hexToNumber } from \"viem\";\nimport type { TypeSerializedInitcode } from \"../../schemas.js\";\nimport { parsePermissionsContext } from \"./parsePermissionsContext.js\";\nimport { assertNever } from \"../../utils.js\";\nimport { getAccountTypeForDelegationAddress7702 } from \"./7702.js\";\nimport { InternalError } from \"ox/RpcResponse\";\nimport { PermissionsCapability } from \"../../capabilities/permissions/index.js\";\n\ntype CreateAccountParams = {\n chain: Chain;\n transport: Transport;\n signer: SmartAccountSigner;\n accountAddress: Address;\n counterfactualInfo?: StaticDecode<typeof TypeSerializedInitcode>; // undefined for 7702 accounts\n permissions?: StaticDecode<typeof PermissionsCapability>;\n delegation?: Address;\n};\n\n/**\n * Creates a smart account instance from the given parameters.\n * @param params - The parameters for creating a smart account.\n * @returns A promise that resolves to the created smart account.\n */\nexport async function createAccount(\n params: CreateAccountParams,\n): Promise<SmartContractAccount> {\n const { counterfactualInfo: ci, ...accountParams } = params;\n\n const mode = params.delegation ? \"7702\" : \"default\";\n\n if (mode === \"default\") {\n if (!ci) {\n throw new InternalError({\n message: \"Counterfactual info not found\",\n });\n }\n if (ci.factoryType !== \"MAv2.0.0-sma-b\") {\n throw new InternalError({\n message: `Factory type ${ci.factoryType} is not currently supported.`,\n });\n }\n } else if (mode === \"7702\") {\n const accountType = getAccountTypeForDelegationAddress7702(\n params.delegation!,\n );\n if (accountType !== \"ModularAccountV2\") {\n throw new InternalError({\n message: \"7702 mode currently only supports ModularAccountV2\",\n });\n }\n } else {\n assertNever(mode, \"Unexpected mode in createAccount\");\n }\n\n const parsedContext = parsePermissionsContext(\n params.permissions,\n ci,\n params.delegation,\n );\n\n const signerEntity =\n parsedContext?.contextVersion === \"NON_DEFERRED_ACTION\"\n ? {\n entityId: hexToNumber(parsedContext.entityId),\n isGlobalValidation: parsedContext.isGlobalValidation,\n }\n : undefined;\n\n // TODO: clean this up to support different account types.\n return createModularAccountV2({\n ...accountParams,\n signerEntity,\n deferredAction: parsedContext?.deferredAction,\n initCode: ci ? concatHex([ci.factoryAddress, ci.factoryData]) : undefined,\n mode,\n });\n}\n\nexport function isModularAccountV2(\n account: SmartContractAccount,\n): account is ModularAccountV2 {\n return account.source === \"ModularAccountV2\";\n}\n"]}
1
+ {"version":3,"file":"createAccount.js","sourceRoot":"","sources":["../../../../src/isomorphic/utils/createAccount.ts"],"names":[],"mappings":"AACA,OAAO,EACL,kBAAkB,EAClB,sBAAsB,GAEvB,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AAE9C,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,sCAAsC,EAAE,MAAM,WAAW,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAChF,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAYpE;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,MAA2B;IAE3B,MAAM,EAAE,kBAAkB,EAAE,EAAE,EAAE,GAAG,aAAa,EAAE,GAAG,MAAM,CAAC;IAE5D,2EAA2E;IAC3E,sDAAsD;IACtD,MAAM,aAAa,GAAG,uBAAuB,CAC3C,MAAM,CAAC,WAAW,EAClB,EAAE,EACF,MAAM,CAAC,UAAU,CAClB,CAAC;IAEF,MAAM,YAAY,GAChB,aAAa,EAAE,cAAc,KAAK,qBAAqB;QACrD,CAAC,CAAC;YACE,QAAQ,EAAE,WAAW,CAAC,aAAa,CAAC,QAAQ,CAAC;YAC7C,kBAAkB,EAAE,aAAa,CAAC,kBAAkB;SACrD;QACH,CAAC,CAAC,SAAS,CAAC;IAEhB,MAAM,IAAI,GAAG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GAAG,YAAY;gBACf,OAAO,EAAE,QAAQ;aAClB,CAAC,CAAC;QACL,KAAK,oBAAoB;YACvB,OAAO,kBAAkB,CAAC;gBACxB,GAAG,YAAY;gBACf,OAAO,EAAE,QAAQ;aAClB,CAAC,CAAC;QACL,KAAK,oBAAoB;YACvB,OAAO,kBAAkB,CAAC;gBACxB,GAAG,YAAY;gBACf,OAAO,EAAE,QAAQ;aAClB,CAAC,CAAC;QACL,KAAK,+BAA+B,CAAC;QACrC,KAAK,qBAAqB,CAAC;QAC3B,KAAK,mBAAmB,CAAC;QACzB,KAAK,iBAAiB,CAAC;QACvB,KAAK,sBAAsB,CAAC;QAC5B,KAAK,SAAS,CAAC;QACf,KAAK,SAAS;YACZ,MAAM,IAAI,mBAAmB,CAAC;gBAC5B,OAAO,EAAE,uCAAuC,WAAW,EAAE;aAC9D,CAAC,CAAC;QACL;YACE,OAAO,WAAW,CAAC,WAAW,EAAE,0BAA0B,CAAC,CAAC;IAChE,CAAC;AACH,CAAC;AAED,MAAM,UAAU,kBAAkB,CAChC,OAA6B;IAE7B,OAAO,OAAO,CAAC,MAAM,KAAK,kBAAkB,CAAC;AAC/C,CAAC","sourcesContent":["import type { SmartAccountSigner, SmartContractAccount } from \"@aa-sdk/core\";\nimport {\n createLightAccount,\n createModularAccountV2,\n type ModularAccountV2,\n} from \"@account-kit/smart-contracts\";\nimport type { StaticDecode } from \"@sinclair/typebox\";\nimport type { Address, Chain, Transport } from \"viem\";\nimport { concatHex, hexToNumber } from \"viem\";\nimport type { TypeSerializedInitcode } from \"../../schemas.js\";\nimport { parsePermissionsContext } from \"./parsePermissionsContext.js\";\nimport { assertNever } from \"../../utils.js\";\nimport { getAccountTypeForDelegationAddress7702 } from \"./7702.js\";\nimport { PermissionsCapability } from \"../../capabilities/permissions/index.js\";\nimport { InternalError, InvalidRequestError } from \"ox/RpcResponse\";\n\ntype CreateAccountParams = {\n chain: Chain;\n transport: Transport;\n signer: SmartAccountSigner;\n accountAddress: Address;\n counterfactualInfo?: StaticDecode<typeof TypeSerializedInitcode>; // undefined for 7702 accounts\n permissions?: StaticDecode<typeof PermissionsCapability>;\n delegation?: Address;\n};\n\n/**\n * Creates a smart account instance from the given parameters.\n * @param params - The parameters for creating a smart account.\n * @returns A promise that resolves to the created smart account.\n */\nexport async function createAccount(\n params: CreateAccountParams,\n): Promise<SmartContractAccount> {\n const { counterfactualInfo: ci, ...accountParams } = params;\n\n // This throws if we pass a permission context and the account is not MA-v2\n // TODO: test that this edge case is handled correctly\n const parsedContext = parsePermissionsContext(\n params.permissions,\n ci,\n params.delegation,\n );\n\n const signerEntity =\n parsedContext?.contextVersion === \"NON_DEFERRED_ACTION\"\n ? {\n entityId: hexToNumber(parsedContext.entityId),\n isGlobalValidation: parsedContext.isGlobalValidation,\n }\n : undefined;\n\n const mode = params.delegation ? \"7702\" : \"default\";\n\n if (mode === \"7702\") {\n const accountType = getAccountTypeForDelegationAddress7702(\n params.delegation!,\n );\n if (accountType !== \"ModularAccountV2\") {\n throw new Error(\"7702 mode currently only supports ModularAccountV2\");\n }\n return createModularAccountV2({\n ...accountParams,\n signerEntity,\n deferredAction: parsedContext?.deferredAction,\n mode,\n });\n }\n\n if (mode !== \"default\") {\n return assertNever(mode, \"Unexpected mode in createAccount\");\n }\n\n // At this point, we are guaranteed to be in default mode, where ci\n // (counterfactualInfo) must be defined\n\n if (!ci) {\n throw new InternalError({\n message: \"Counterfactual info not found\",\n });\n }\n\n const factoryType = ci.factoryType;\n const commonParams = {\n ...accountParams,\n initCode: concatHex([ci.factoryAddress, ci.factoryData]),\n };\n\n // Return the account created based on the factory type\n switch (factoryType) {\n case \"MAv2.0.0-sma-b\":\n return createModularAccountV2({\n ...commonParams,\n signerEntity,\n deferredAction: parsedContext?.deferredAction,\n mode,\n });\n case \"LightAccountV2.0.0\":\n return createLightAccount({\n ...commonParams,\n version: \"v2.0.0\",\n });\n case \"LightAccountV1.0.1\":\n return createLightAccount({\n ...commonParams,\n version: \"v1.0.1\",\n });\n case \"LightAccountV1.0.2\":\n return createLightAccount({\n ...commonParams,\n version: \"v1.0.2\",\n });\n case \"LightAccountV1.1.0\":\n return createLightAccount({\n ...commonParams,\n version: \"v1.1.0\",\n });\n case \"LightAccountV2.0.0-MultiOwner\":\n case \"MAv1.0.0-MultiOwner\":\n case \"MAv1.0.0-MultiSig\":\n case \"MAv2.0.0-ma-ssv\":\n case \"MAv2.0.0-ma-webauthn\":\n case \"unknown\":\n case undefined:\n throw new InvalidRequestError({\n message: `Account type currently unsupported: ${factoryType}`,\n });\n default:\n return assertNever(factoryType, \"Unsupported factory type\");\n }\n}\n\nexport function isModularAccountV2(\n account: SmartContractAccount,\n): account is ModularAccountV2 {\n return account.source === \"ModularAccountV2\";\n}\n"]}
@@ -0,0 +1,4 @@
1
+ import type { StaticDecode } from "@sinclair/typebox";
2
+ import type { TypeSerializedInitcode } from "../../schemas.ts";
3
+ export type Feature = "permissions";
4
+ export declare function supportsFeature(counterfactualInfo: StaticDecode<typeof TypeSerializedInitcode>, feature: Feature): boolean;
@@ -0,0 +1,21 @@
1
+ const supportedFeatures = {
2
+ "LightAccountV1.0.1": [],
3
+ "LightAccountV1.0.2": [],
4
+ "LightAccountV1.1.0": [],
5
+ "LightAccountV2.0.0": [],
6
+ "LightAccountV2.0.0-MultiOwner": [],
7
+ "MAv1.0.0-MultiOwner": [],
8
+ "MAv1.0.0-MultiSig": [],
9
+ "MAv2.0.0-sma-b": ["permissions"],
10
+ "MAv2.0.0-ma-ssv": ["permissions"],
11
+ "MAv2.0.0-ma-webauthn": [],
12
+ unknown: [],
13
+ };
14
+ export function supportsFeature(counterfactualInfo, feature) {
15
+ const factorySupportedFeatures = supportedFeatures[counterfactualInfo.factoryType];
16
+ if (factorySupportedFeatures === undefined) {
17
+ throw new Error("Unsupported FactoryType: " + counterfactualInfo.factoryType);
18
+ }
19
+ return factorySupportedFeatures.includes(feature);
20
+ }
21
+ //# sourceMappingURL=supportsFeature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"supportsFeature.js","sourceRoot":"","sources":["../../../../src/isomorphic/utils/supportsFeature.ts"],"names":[],"mappings":"AAOA,MAAM,iBAAiB,GAAmC;IACxD,oBAAoB,EAAE,EAAE;IACxB,oBAAoB,EAAE,EAAE;IACxB,oBAAoB,EAAE,EAAE;IACxB,oBAAoB,EAAE,EAAE;IACxB,+BAA+B,EAAE,EAAE;IACnC,qBAAqB,EAAE,EAAE;IACzB,mBAAmB,EAAE,EAAE;IACvB,gBAAgB,EAAE,CAAC,aAAa,CAAC;IACjC,iBAAiB,EAAE,CAAC,aAAa,CAAC;IAClC,sBAAsB,EAAE,EAAE;IAC1B,OAAO,EAAE,EAAE;CACZ,CAAC;AAEF,MAAM,UAAU,eAAe,CAC7B,kBAA+D,EAC/D,OAAgB;IAEhB,MAAM,wBAAwB,GAC5B,iBAAiB,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC;IACpD,IAAI,wBAAwB,KAAK,SAAS,EAAE,CAAC;QAC3C,MAAM,IAAI,KAAK,CACb,2BAA2B,GAAG,kBAAkB,CAAC,WAAW,CAC7D,CAAC;IACJ,CAAC;IACD,OAAO,wBAAwB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AACpD,CAAC","sourcesContent":["import type { StaticDecode } from \"@sinclair/typebox\";\nimport type { TypeSerializedInitcode } from \"../../schemas.ts\";\n\nexport type Feature = \"permissions\";\n\ntype FactoryType = StaticDecode<typeof TypeSerializedInitcode>[\"factoryType\"];\n\nconst supportedFeatures: Record<FactoryType, Feature[]> = {\n \"LightAccountV1.0.1\": [],\n \"LightAccountV1.0.2\": [],\n \"LightAccountV1.1.0\": [],\n \"LightAccountV2.0.0\": [],\n \"LightAccountV2.0.0-MultiOwner\": [],\n \"MAv1.0.0-MultiOwner\": [],\n \"MAv1.0.0-MultiSig\": [],\n \"MAv2.0.0-sma-b\": [\"permissions\"],\n \"MAv2.0.0-ma-ssv\": [\"permissions\"],\n \"MAv2.0.0-ma-webauthn\": [],\n unknown: [],\n};\n\nexport function supportsFeature(\n counterfactualInfo: StaticDecode<typeof TypeSerializedInitcode>,\n feature: Feature,\n): boolean {\n const factorySupportedFeatures =\n supportedFeatures[counterfactualInfo.factoryType];\n if (factorySupportedFeatures === undefined) {\n throw new Error(\n \"Unsupported FactoryType: \" + counterfactualInfo.factoryType,\n );\n }\n return factorySupportedFeatures.includes(feature);\n}\n"]}
@@ -287,6 +287,7 @@ export declare const wallet_prepareCalls: import("@sinclair/typebox").TObject<{
287
287
  data: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TObject<{
288
288
  raw: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
289
289
  }>]>;
290
+ rawPayload: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
290
291
  }>, import("@sinclair/typebox").TObject<{
291
292
  type: import("@sinclair/typebox").TLiteral<"eth_signTypedData_v4">;
292
293
  data: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{
@@ -322,6 +323,7 @@ export declare const wallet_prepareCalls: import("@sinclair/typebox").TObject<{
322
323
  [x: string]: unknown;
323
324
  };
324
325
  }>;
326
+ rawPayload: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
325
327
  }>]>;
326
328
  }>, import("@sinclair/typebox").TObject<{
327
329
  type: import("@sinclair/typebox").TLiteral<"user-operation-v070">;
@@ -347,6 +349,7 @@ export declare const wallet_prepareCalls: import("@sinclair/typebox").TObject<{
347
349
  data: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TObject<{
348
350
  raw: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
349
351
  }>]>;
352
+ rawPayload: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
350
353
  }>, import("@sinclair/typebox").TObject<{
351
354
  type: import("@sinclair/typebox").TLiteral<"eth_signTypedData_v4">;
352
355
  data: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{
@@ -382,6 +385,7 @@ export declare const wallet_prepareCalls: import("@sinclair/typebox").TObject<{
382
385
  [x: string]: unknown;
383
386
  };
384
387
  }>;
388
+ rawPayload: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
385
389
  }>]>;
386
390
  }>, import("@sinclair/typebox").TObject<{
387
391
  type: import("@sinclair/typebox").TLiteral<"authorization">;
@@ -392,6 +396,7 @@ export declare const wallet_prepareCalls: import("@sinclair/typebox").TObject<{
392
396
  chainId: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
393
397
  signatureRequest: import("@sinclair/typebox").TObject<{
394
398
  type: import("@sinclair/typebox").TLiteral<"eip7702Auth">;
399
+ rawPayload: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
395
400
  }>;
396
401
  }>]>>;
397
402
  }>, import("@sinclair/typebox").TObject<{
@@ -414,6 +419,7 @@ export declare const wallet_prepareCalls: import("@sinclair/typebox").TObject<{
414
419
  data: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TObject<{
415
420
  raw: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
416
421
  }>]>;
422
+ rawPayload: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
417
423
  }>, import("@sinclair/typebox").TObject<{
418
424
  type: import("@sinclair/typebox").TLiteral<"eth_signTypedData_v4">;
419
425
  data: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{
@@ -449,6 +455,7 @@ export declare const wallet_prepareCalls: import("@sinclair/typebox").TObject<{
449
455
  [x: string]: unknown;
450
456
  };
451
457
  }>;
458
+ rawPayload: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
452
459
  }>]>;
453
460
  }>, import("@sinclair/typebox").TObject<{
454
461
  type: import("@sinclair/typebox").TLiteral<"user-operation-v070">;
@@ -474,6 +481,7 @@ export declare const wallet_prepareCalls: import("@sinclair/typebox").TObject<{
474
481
  data: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TObject<{
475
482
  raw: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
476
483
  }>]>;
484
+ rawPayload: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
477
485
  }>, import("@sinclair/typebox").TObject<{
478
486
  type: import("@sinclair/typebox").TLiteral<"eth_signTypedData_v4">;
479
487
  data: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{
@@ -509,6 +517,7 @@ export declare const wallet_prepareCalls: import("@sinclair/typebox").TObject<{
509
517
  [x: string]: unknown;
510
518
  };
511
519
  }>;
520
+ rawPayload: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
512
521
  }>]>;
513
522
  }>]>;
514
523
  }>;
@@ -519,7 +528,7 @@ export declare const wallet_requestAccount: import("@sinclair/typebox").TObject<
519
528
  signerAddress: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
520
529
  id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
521
530
  creationHint: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
522
- accountType: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TLiteral<"sma-b">>;
531
+ 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">[]>>;
523
532
  salt: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">>;
524
533
  }>, import("@sinclair/typebox").TObject<{
525
534
  accountType: import("@sinclair/typebox").TLiteral<"7702">;
@@ -548,7 +557,7 @@ export declare const wallet_createAccount: import("@sinclair/typebox").TObject<{
548
557
  signerAddress: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
549
558
  id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
550
559
  creationOptions: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
551
- accountType: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TLiteral<"sma-b">>;
560
+ 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">[]>>;
552
561
  salt: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">>;
553
562
  }>, import("@sinclair/typebox").TObject<{
554
563
  accountType: import("@sinclair/typebox").TLiteral<"7702">;
@@ -672,6 +681,7 @@ export declare const wallet_createSession: import("@sinclair/typebox").TObject<{
672
681
  [x: string]: unknown;
673
682
  };
674
683
  }>;
684
+ rawPayload: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
675
685
  }>;
676
686
  }>;
677
687
  }>;
@@ -87,11 +87,13 @@ export declare const WalletServerRpcSchema: {
87
87
  [x: string]: unknown;
88
88
  };
89
89
  };
90
+ rawPayload: `0x${string}`;
90
91
  } | {
91
92
  type: "personal_sign";
92
93
  data: string | {
93
94
  raw: `0x${string}`;
94
95
  };
96
+ rawPayload: `0x${string}`;
95
97
  };
96
98
  } | {
97
99
  type: "user-operation-v070";
@@ -133,11 +135,13 @@ export declare const WalletServerRpcSchema: {
133
135
  [x: string]: unknown;
134
136
  };
135
137
  };
138
+ rawPayload: `0x${string}`;
136
139
  } | {
137
140
  type: "personal_sign";
138
141
  data: string | {
139
142
  raw: `0x${string}`;
140
143
  };
144
+ rawPayload: `0x${string}`;
141
145
  };
142
146
  } | {
143
147
  type: "authorization";
@@ -148,6 +152,7 @@ export declare const WalletServerRpcSchema: {
148
152
  };
149
153
  signatureRequest: {
150
154
  type: "eip7702Auth";
155
+ rawPayload: `0x${string}`;
151
156
  };
152
157
  })[];
153
158
  } | {
@@ -186,11 +191,13 @@ export declare const WalletServerRpcSchema: {
186
191
  [x: string]: unknown;
187
192
  };
188
193
  };
194
+ rawPayload: `0x${string}`;
189
195
  } | {
190
196
  type: "personal_sign";
191
197
  data: string | {
192
198
  raw: `0x${string}`;
193
199
  };
200
+ rawPayload: `0x${string}`;
194
201
  };
195
202
  } | {
196
203
  type: "user-operation-v070";
@@ -232,11 +239,13 @@ export declare const WalletServerRpcSchema: {
232
239
  [x: string]: unknown;
233
240
  };
234
241
  };
242
+ rawPayload: `0x${string}`;
235
243
  } | {
236
244
  type: "personal_sign";
237
245
  data: string | {
238
246
  raw: `0x${string}`;
239
247
  };
248
+ rawPayload: `0x${string}`;
240
249
  };
241
250
  };
242
251
  } | {
@@ -460,7 +469,7 @@ export declare const WalletServerRpcSchema: {
460
469
  id?: string | undefined;
461
470
  creationOptions?: {
462
471
  salt?: `0x${string}` | undefined;
463
- accountType?: "sma-b" | undefined;
472
+ accountType?: "sma-b" | "la-v2" | "la-v1.0.1" | "la-v1.0.2" | "la-v1.1.0" | undefined;
464
473
  } | {
465
474
  accountType: "7702";
466
475
  } | undefined;
@@ -478,7 +487,7 @@ export declare const WalletServerRpcSchema: {
478
487
  id?: string | undefined;
479
488
  creationHint?: {
480
489
  salt?: `0x${string}` | undefined;
481
- accountType?: "sma-b" | undefined;
490
+ accountType?: "sma-b" | "la-v2" | "la-v1.0.1" | "la-v1.0.2" | "la-v1.1.0" | undefined;
482
491
  } | {
483
492
  accountType: "7702";
484
493
  } | undefined;
@@ -596,6 +605,7 @@ export declare const WalletServerRpcSchema: {
596
605
  [x: string]: unknown;
597
606
  };
598
607
  };
608
+ rawPayload: `0x${string}`;
599
609
  };
600
610
  sessionId: `0x${string}`;
601
611
  };