@account-kit/wallet-client 0.1.0-alpha.4 → 0.1.0-alpha.5

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 (141) hide show
  1. package/dist/esm/capabilities/eip7702Auth.d.ts +4 -0
  2. package/dist/esm/capabilities/eip7702Auth.js +16 -0
  3. package/dist/esm/capabilities/eip7702Auth.js.map +1 -0
  4. package/dist/esm/capabilities/index.d.ts +4 -0
  5. package/dist/esm/capabilities/index.js +2 -0
  6. package/dist/esm/capabilities/index.js.map +1 -1
  7. package/dist/esm/capabilities/permissions/index.d.ts +1 -1
  8. package/dist/esm/capabilities/permissions/mav2.js +1 -0
  9. package/dist/esm/capabilities/permissions/mav2.js.map +1 -1
  10. package/dist/esm/client/actions/getCallsStatus.d.ts +1 -2
  11. package/dist/esm/client/actions/getCallsStatus.js +19 -0
  12. package/dist/esm/client/actions/getCallsStatus.js.map +1 -1
  13. package/dist/esm/client/actions/grantPermissions.d.ts +6 -6
  14. package/dist/esm/client/actions/grantPermissions.js +115 -3
  15. package/dist/esm/client/actions/grantPermissions.js.map +1 -1
  16. package/dist/esm/client/actions/prepareCalls.d.ts +4 -4
  17. package/dist/esm/client/actions/prepareCalls.js +38 -5
  18. package/dist/esm/client/actions/prepareCalls.js.map +1 -1
  19. package/dist/esm/client/actions/requestAccount.d.ts +3 -4
  20. package/dist/esm/client/actions/requestAccount.js +18 -1
  21. package/dist/esm/client/actions/requestAccount.js.map +1 -1
  22. package/dist/esm/client/actions/signMessage.d.ts +3 -3
  23. package/dist/esm/client/actions/signMessage.js +18 -0
  24. package/dist/esm/client/actions/signMessage.js.map +1 -1
  25. package/dist/esm/client/actions/signSignatureRequest.d.ts +3 -3
  26. package/dist/esm/client/actions/signSignatureRequest.js +2 -2
  27. package/dist/esm/client/actions/signSignatureRequest.js.map +1 -1
  28. package/dist/esm/client/actions/signTypedData.d.ts +2 -2
  29. package/dist/esm/client/actions/signTypedData.js +31 -0
  30. package/dist/esm/client/actions/signTypedData.js.map +1 -1
  31. package/dist/esm/client/client.e2e-test.js +19 -19
  32. package/dist/esm/client/client.e2e-test.js.map +1 -1
  33. package/dist/esm/client/decorator.d.ts +4 -4
  34. package/dist/esm/client/decorator.js.map +1 -1
  35. package/dist/esm/client/index.d.ts +35 -10
  36. package/dist/esm/client/index.js +0 -29
  37. package/dist/esm/client/index.js.map +1 -1
  38. package/dist/esm/isomorphic/actions/createSession.js +21 -10
  39. package/dist/esm/isomorphic/actions/createSession.js.map +1 -1
  40. package/dist/esm/isomorphic/actions/getCallsStatus.js +62 -9
  41. package/dist/esm/isomorphic/actions/getCallsStatus.js.map +1 -1
  42. package/dist/esm/isomorphic/actions/prepareCalls.js +18 -11
  43. package/dist/esm/isomorphic/actions/prepareCalls.js.map +1 -1
  44. package/dist/esm/isomorphic/actions/sendPreparedCalls.js +2 -2
  45. package/dist/esm/isomorphic/actions/sendPreparedCalls.js.map +1 -1
  46. package/dist/esm/isomorphic/client.d.ts +1 -1
  47. package/dist/esm/isomorphic/utils/7702.d.ts +9 -3
  48. package/dist/esm/isomorphic/utils/7702.js +35 -8
  49. package/dist/esm/isomorphic/utils/7702.js.map +1 -1
  50. package/dist/esm/isomorphic/utils/createAccount.d.ts +2 -2
  51. package/dist/esm/isomorphic/utils/createAccount.js +4 -3
  52. package/dist/esm/isomorphic/utils/createAccount.js.map +1 -1
  53. package/dist/esm/isomorphic/utils/parsePermissionsContext.d.ts +2 -2
  54. package/dist/esm/isomorphic/utils/parsePermissionsContext.js +8 -7
  55. package/dist/esm/isomorphic/utils/parsePermissionsContext.js.map +1 -1
  56. package/dist/esm/local/client.d.ts +2 -2
  57. package/dist/esm/local/client.js.map +1 -1
  58. package/dist/esm/remote/client.d.ts +8 -2
  59. package/dist/esm/remote/client.js +1 -7
  60. package/dist/esm/remote/client.js.map +1 -1
  61. package/dist/esm/rpc/request.d.ts +12 -2
  62. package/dist/esm/rpc/request.js +6 -9
  63. package/dist/esm/rpc/request.js.map +1 -1
  64. package/dist/esm/rpc/schema.d.ts +23 -13
  65. package/dist/esm/schemas.d.ts +3 -1
  66. package/dist/esm/schemas.js +6 -4
  67. package/dist/esm/schemas.js.map +1 -1
  68. package/dist/esm/types.d.ts +7 -10
  69. package/dist/esm/types.js.map +1 -1
  70. package/dist/types/capabilities/eip7702Auth.d.ts +5 -0
  71. package/dist/types/capabilities/eip7702Auth.d.ts.map +1 -0
  72. package/dist/types/capabilities/index.d.ts +4 -0
  73. package/dist/types/capabilities/index.d.ts.map +1 -1
  74. package/dist/types/capabilities/permissions/index.d.ts +1 -1
  75. package/dist/types/capabilities/permissions/mav2.d.ts.map +1 -1
  76. package/dist/types/client/actions/getCallsStatus.d.ts +1 -2
  77. package/dist/types/client/actions/getCallsStatus.d.ts.map +1 -1
  78. package/dist/types/client/actions/grantPermissions.d.ts +6 -6
  79. package/dist/types/client/actions/grantPermissions.d.ts.map +1 -1
  80. package/dist/types/client/actions/prepareCalls.d.ts +4 -4
  81. package/dist/types/client/actions/prepareCalls.d.ts.map +1 -1
  82. package/dist/types/client/actions/requestAccount.d.ts +3 -4
  83. package/dist/types/client/actions/requestAccount.d.ts.map +1 -1
  84. package/dist/types/client/actions/signMessage.d.ts +3 -3
  85. package/dist/types/client/actions/signMessage.d.ts.map +1 -1
  86. package/dist/types/client/actions/signSignatureRequest.d.ts +3 -3
  87. package/dist/types/client/actions/signSignatureRequest.d.ts.map +1 -1
  88. package/dist/types/client/actions/signTypedData.d.ts +2 -2
  89. package/dist/types/client/actions/signTypedData.d.ts.map +1 -1
  90. package/dist/types/client/decorator.d.ts +4 -4
  91. package/dist/types/client/decorator.d.ts.map +1 -1
  92. package/dist/types/client/index.d.ts +35 -10
  93. package/dist/types/client/index.d.ts.map +1 -1
  94. package/dist/types/isomorphic/actions/createSession.d.ts.map +1 -1
  95. package/dist/types/isomorphic/actions/getCallsStatus.d.ts.map +1 -1
  96. package/dist/types/isomorphic/actions/prepareCalls.d.ts.map +1 -1
  97. package/dist/types/isomorphic/client.d.ts +1 -1
  98. package/dist/types/isomorphic/utils/7702.d.ts +9 -3
  99. package/dist/types/isomorphic/utils/7702.d.ts.map +1 -1
  100. package/dist/types/isomorphic/utils/createAccount.d.ts +2 -2
  101. package/dist/types/isomorphic/utils/createAccount.d.ts.map +1 -1
  102. package/dist/types/isomorphic/utils/parsePermissionsContext.d.ts +2 -2
  103. package/dist/types/isomorphic/utils/parsePermissionsContext.d.ts.map +1 -1
  104. package/dist/types/local/client.d.ts +2 -2
  105. package/dist/types/local/client.d.ts.map +1 -1
  106. package/dist/types/remote/client.d.ts +8 -2
  107. package/dist/types/remote/client.d.ts.map +1 -1
  108. package/dist/types/rpc/request.d.ts +12 -2
  109. package/dist/types/rpc/request.d.ts.map +1 -1
  110. package/dist/types/rpc/schema.d.ts +23 -13
  111. package/dist/types/rpc/schema.d.ts.map +1 -1
  112. package/dist/types/schemas.d.ts +3 -1
  113. package/dist/types/schemas.d.ts.map +1 -1
  114. package/dist/types/types.d.ts +7 -10
  115. package/dist/types/types.d.ts.map +1 -1
  116. package/package.json +2 -2
  117. package/src/capabilities/eip7702Auth.ts +19 -0
  118. package/src/capabilities/index.ts +2 -0
  119. package/src/capabilities/permissions/mav2.ts +1 -0
  120. package/src/client/actions/getCallsStatus.ts +0 -10
  121. package/src/client/actions/grantPermissions.ts +12 -25
  122. package/src/client/actions/prepareCalls.ts +18 -23
  123. package/src/client/actions/requestAccount.ts +9 -26
  124. package/src/client/actions/signMessage.ts +2 -17
  125. package/src/client/actions/signSignatureRequest.ts +5 -5
  126. package/src/client/actions/signTypedData.ts +1 -16
  127. package/src/client/client.e2e-test.ts +22 -22
  128. package/src/client/decorator.ts +5 -10
  129. package/src/client/index.ts +16 -39
  130. package/src/isomorphic/actions/createSession.ts +29 -10
  131. package/src/isomorphic/actions/getCallsStatus.ts +82 -10
  132. package/src/isomorphic/actions/prepareCalls.ts +19 -11
  133. package/src/isomorphic/actions/sendPreparedCalls.ts +2 -2
  134. package/src/isomorphic/utils/7702.ts +61 -13
  135. package/src/isomorphic/utils/createAccount.ts +5 -5
  136. package/src/isomorphic/utils/parsePermissionsContext.ts +9 -9
  137. package/src/local/client.ts +3 -5
  138. package/src/remote/client.ts +5 -13
  139. package/src/rpc/request.ts +8 -9
  140. package/src/schemas.ts +8 -4
  141. package/src/types.ts +5 -21
@@ -1,11 +1,11 @@
1
1
  import type { SmartAccountSigner } from "@aa-sdk/core";
2
2
  import type { Static } from "@sinclair/typebox";
3
3
  import { type Hex } from "viem";
4
- import { TypeSignatureRequest } from "../../schemas.js";
4
+ import { TypeSignatureRequest, type TypeSignatureType } from "../../schemas.js";
5
5
  import type { Eip7702ExtendedFields } from "@aa-sdk/core";
6
6
  export type SignSignatureRequestParams = Static<typeof TypeSignatureRequest>;
7
7
  export type SignSignatureRequestResult = {
8
- type: "ecdsa";
8
+ type: Exclude<TypeSignatureType, "contract">;
9
9
  signature: Hex;
10
10
  signedAuthorization?: Eip7702ExtendedFields["eip7702Auth"];
11
11
  };
@@ -18,7 +18,7 @@ export type SignSignatureRequestResult = {
18
18
  * @param {string} params.type - The type of signature request ('personal_sign', 'eth_signTypedData_v4', or 'signature_with_authorization')
19
19
  * @param {any} params.data - The data to sign, format depends on the signature type
20
20
  * @returns {Promise<SignSignatureRequestResult>} A Promise that resolves to the signature result
21
- * @returns {string} result.type - The signature type (currently only 'ecdsa' is supported)
21
+ * @returns {string} result.type - The signature type (currently only 'secp256k1' is supported)
22
22
  * @returns {Hex} result.signature - The hex-encoded signature
23
23
  * @returns {Eip7702ExtendedFields["eip7702Auth"]} result.signedAuthorization - The signed EIP-7702 authorization, if applicable
24
24
  *
@@ -9,7 +9,7 @@ export async function signSignatureRequest(signer, params) {
9
9
  : assertNever(params, "Unexpected signature request type");
10
10
  if (!params.authorizationRequest) {
11
11
  return {
12
- type: "ecdsa",
12
+ type: "secp256k1",
13
13
  signature,
14
14
  };
15
15
  }
@@ -28,7 +28,7 @@ export async function signSignatureRequest(signer, params) {
28
28
  yParity,
29
29
  };
30
30
  return {
31
- type: "ecdsa",
31
+ type: "secp256k1",
32
32
  signature,
33
33
  signedAuthorization,
34
34
  };
@@ -1 +1 @@
1
- {"version":3,"file":"signSignatureRequest.js","sourceRoot":"","sources":["../../../../src/client/actions/signSignatureRequest.ts"],"names":[],"mappings":"AAEA,OAAO,EAAY,KAAK,EAAE,MAAM,MAAM,CAAC;AACvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAgD7C,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,MAA0B,EAC1B,MAAkC;IAElC,MAAM,SAAS,GACb,MAAM,CAAC,IAAI,KAAK,eAAe;QAC7B,CAAC,CAAC,MAAM,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC;QACvC,CAAC,CAAC,MAAM,CAAC,IAAI,KAAK,sBAAsB;YACtC,CAAC,CAAC,MAAM,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC;YACzC,CAAC,CAAC,WAAW,CAAC,MAAM,EAAE,mCAAmC,CAAC,CAAC;IAEjE,IAAI,CAAC,MAAM,CAAC,oBAAoB,EAAE,CAAC;QACjC,OAAO;YACL,IAAI,EAAE,OAAgB;YACtB,SAAS;SACV,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE,CAAC;QAC9B,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;IACjE,CAAC;IAED,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,iBAAiB,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;IAC5E,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,OAAO,CAAC;IACzB,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC;IAE1D,MAAM,mBAAmB,GAAG;QAC1B,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,oBAAoB,CAAC,OAAO,CAAC;QACnD,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,oBAAoB,CAAC,KAAK,CAAC;QAC/C,OAAO,EAAE,MAAM,CAAC,oBAAoB,CAAC,OAAO;QAC5C,CAAC;QACD,CAAC;QACD,OAAO;KACR,CAAC;IAEF,OAAO;QACL,IAAI,EAAE,OAAgB;QACtB,SAAS;QACT,mBAAmB;KACpB,CAAC;AACJ,CAAC","sourcesContent":["import type { SmartAccountSigner } from \"@aa-sdk/core\";\nimport type { Static } from \"@sinclair/typebox\";\nimport { type Hex, toHex } from \"viem\";\nimport { TypeSignatureRequest } from \"../../schemas.js\";\nimport { assertNever } from \"../../utils.js\";\nimport type { Eip7702ExtendedFields } from \"@aa-sdk/core\";\n\nexport type SignSignatureRequestParams = Static<typeof TypeSignatureRequest>;\n\nexport type SignSignatureRequestResult = {\n type: \"ecdsa\";\n signature: Hex;\n signedAuthorization?: Eip7702ExtendedFields[\"eip7702Auth\"];\n};\n\n/**\n * Signs a signature request using the provided signer.\n * This method handles different types of signature requests including personal_sign and eth_signTypedData_v4.\n *\n * @param {SmartAccountSigner} signer - The signer to use for signing the request\n * @param {SignSignatureRequestParams} params - The signature request parameters\n * @param {string} params.type - The type of signature request ('personal_sign', 'eth_signTypedData_v4', or 'signature_with_authorization')\n * @param {any} params.data - The data to sign, format depends on the signature type\n * @returns {Promise<SignSignatureRequestResult>} A Promise that resolves to the signature result\n * @returns {string} result.type - The signature type (currently only 'ecdsa' is supported)\n * @returns {Hex} result.signature - The hex-encoded signature\n * @returns {Eip7702ExtendedFields[\"eip7702Auth\"]} result.signedAuthorization - The signed EIP-7702 authorization, if applicable\n *\n * @example\n * // Sign a personal message\n * const result = await client.signSignatureRequest({\n * type: 'personal_sign',\n * data: 'Hello, world!'\n * });\n *\n * @example\n * // Sign typed data (EIP-712)\n * const result = await client.signSignatureRequest({\n * type: 'eth_signTypedData_v4',\n * data: {\n * domain: { ... },\n * types: { ... },\n * primaryType: '...',\n * message: { ... }\n * }\n * });\n */\nexport function signSignatureRequest(\n signer: SmartAccountSigner,\n params: SignSignatureRequestParams,\n): Promise<SignSignatureRequestResult>;\n\nexport async function signSignatureRequest(\n signer: SmartAccountSigner,\n params: SignSignatureRequestParams,\n): Promise<SignSignatureRequestResult> {\n const signature =\n params.type === \"personal_sign\"\n ? await signer.signMessage(params.data)\n : params.type === \"eth_signTypedData_v4\"\n ? await signer.signTypedData(params.data)\n : assertNever(params, \"Unexpected signature request type\");\n\n if (!params.authorizationRequest) {\n return {\n type: \"ecdsa\" as const,\n signature,\n };\n }\n\n if (!signer.signAuthorization) {\n throw new Error(\"Signer does not implement signAuthorization\");\n }\n\n const authSig = await signer.signAuthorization(params.authorizationRequest);\n const { r, s } = authSig;\n const yParity = toHex(authSig.yParity ?? authSig.v - 27n);\n\n const signedAuthorization = {\n chainId: toHex(params.authorizationRequest.chainId),\n nonce: toHex(params.authorizationRequest.nonce),\n address: params.authorizationRequest.address,\n r,\n s,\n yParity,\n };\n\n return {\n type: \"ecdsa\" as const,\n signature,\n signedAuthorization,\n };\n}\n"]}
1
+ {"version":3,"file":"signSignatureRequest.js","sourceRoot":"","sources":["../../../../src/client/actions/signSignatureRequest.ts"],"names":[],"mappings":"AAEA,OAAO,EAAY,KAAK,EAAE,MAAM,MAAM,CAAC;AACvC,OAAO,EAAE,oBAAoB,EAA0B,MAAM,kBAAkB,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAgD7C,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,MAA0B,EAC1B,MAAkC;IAElC,MAAM,SAAS,GACb,MAAM,CAAC,IAAI,KAAK,eAAe;QAC7B,CAAC,CAAC,MAAM,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC;QACvC,CAAC,CAAC,MAAM,CAAC,IAAI,KAAK,sBAAsB;YACtC,CAAC,CAAC,MAAM,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC;YACzC,CAAC,CAAC,WAAW,CAAC,MAAM,EAAE,mCAAmC,CAAC,CAAC;IAEjE,IAAI,CAAC,MAAM,CAAC,oBAAoB,EAAE,CAAC;QACjC,OAAO;YACL,IAAI,EAAE,WAAoB;YAC1B,SAAS;SACV,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE,CAAC;QAC9B,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;IACjE,CAAC;IAED,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,iBAAiB,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;IAC5E,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,OAAO,CAAC;IACzB,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC;IAE1D,MAAM,mBAAmB,GAAG;QAC1B,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,oBAAoB,CAAC,OAAO,CAAC;QACnD,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,oBAAoB,CAAC,KAAK,CAAC;QAC/C,OAAO,EAAE,MAAM,CAAC,oBAAoB,CAAC,OAAO;QAC5C,CAAC;QACD,CAAC;QACD,OAAO;KACR,CAAC;IAEF,OAAO;QACL,IAAI,EAAE,WAAoB;QAC1B,SAAS;QACT,mBAAmB;KACpB,CAAC;AACJ,CAAC","sourcesContent":["import type { SmartAccountSigner } from \"@aa-sdk/core\";\nimport type { Static } from \"@sinclair/typebox\";\nimport { type Hex, toHex } from \"viem\";\nimport { TypeSignatureRequest, type TypeSignatureType } from \"../../schemas.js\";\nimport { assertNever } from \"../../utils.js\";\nimport type { Eip7702ExtendedFields } from \"@aa-sdk/core\";\n\nexport type SignSignatureRequestParams = Static<typeof TypeSignatureRequest>;\n\nexport type SignSignatureRequestResult = {\n type: Exclude<TypeSignatureType, \"contract\">; // TODO: Add support for identifying contract signatures\n signature: Hex;\n signedAuthorization?: Eip7702ExtendedFields[\"eip7702Auth\"];\n};\n\n/**\n * Signs a signature request using the provided signer.\n * This method handles different types of signature requests including personal_sign and eth_signTypedData_v4.\n *\n * @param {SmartAccountSigner} signer - The signer to use for signing the request\n * @param {SignSignatureRequestParams} params - The signature request parameters\n * @param {string} params.type - The type of signature request ('personal_sign', 'eth_signTypedData_v4', or 'signature_with_authorization')\n * @param {any} params.data - The data to sign, format depends on the signature type\n * @returns {Promise<SignSignatureRequestResult>} A Promise that resolves to the signature result\n * @returns {string} result.type - The signature type (currently only 'secp256k1' is supported)\n * @returns {Hex} result.signature - The hex-encoded signature\n * @returns {Eip7702ExtendedFields[\"eip7702Auth\"]} result.signedAuthorization - The signed EIP-7702 authorization, if applicable\n *\n * @example\n * // Sign a personal message\n * const result = await client.signSignatureRequest({\n * type: 'personal_sign',\n * data: 'Hello, world!'\n * });\n *\n * @example\n * // Sign typed data (EIP-712)\n * const result = await client.signSignatureRequest({\n * type: 'eth_signTypedData_v4',\n * data: {\n * domain: { ... },\n * types: { ... },\n * primaryType: '...',\n * message: { ... }\n * }\n * });\n */\nexport function signSignatureRequest(\n signer: SmartAccountSigner,\n params: SignSignatureRequestParams,\n): Promise<SignSignatureRequestResult>;\n\nexport async function signSignatureRequest(\n signer: SmartAccountSigner,\n params: SignSignatureRequestParams,\n): Promise<SignSignatureRequestResult> {\n const signature =\n params.type === \"personal_sign\"\n ? await signer.signMessage(params.data)\n : params.type === \"eth_signTypedData_v4\"\n ? await signer.signTypedData(params.data)\n : assertNever(params, \"Unexpected signature request type\");\n\n if (!params.authorizationRequest) {\n return {\n type: \"secp256k1\" as const,\n signature,\n };\n }\n\n if (!signer.signAuthorization) {\n throw new Error(\"Signer does not implement signAuthorization\");\n }\n\n const authSig = await signer.signAuthorization(params.authorizationRequest);\n const { r, s } = authSig;\n const yParity = toHex(authSig.yParity ?? authSig.v - 27n);\n\n const signedAuthorization = {\n chainId: toHex(params.authorizationRequest.chainId),\n nonce: toHex(params.authorizationRequest.nonce),\n address: params.authorizationRequest.address,\n r,\n s,\n yParity,\n };\n\n return {\n type: \"secp256k1\" as const,\n signature,\n signedAuthorization,\n };\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import type { SmartAccountSigner } from "@aa-sdk/core";
2
- import { type Address, type Hex, type JsonRpcAccount, type TypedDataDefinition } from "viem";
2
+ import { type Address, type Hex, type TypedDataDefinition } from "viem";
3
3
  import type { InnerWalletApiClient } from "../../types.ts";
4
4
  export type SignTypedDataParams = TypedDataDefinition & {
5
5
  account?: Address;
@@ -36,4 +36,4 @@ export type SignTypedDataResult = Hex;
36
36
  * }
37
37
  * });
38
38
  */
39
- export declare function signTypedData<TAccount extends JsonRpcAccount<Address> | undefined = JsonRpcAccount<Address> | undefined>(client: InnerWalletApiClient<TAccount>, signer: SmartAccountSigner, params: SignTypedDataParams): Promise<SignTypedDataResult>;
39
+ export declare function signTypedData(client: InnerWalletApiClient, signer: SmartAccountSigner, params: SignTypedDataParams): Promise<SignTypedDataResult>;
@@ -1,5 +1,36 @@
1
1
  import {} from "viem";
2
2
  import { requestAccount } from "./requestAccount.js";
3
+ /**
4
+ * Signs typed data (EIP-712) using the smart account.
5
+ * This method requests the account associated with the signer and uses it to sign the typed data.
6
+ *
7
+ * @param {InnerWalletApiClient} client - The wallet API client to use for the request
8
+ * @param {SmartAccountSigner} signer - The signer of the smart account
9
+ * @param {TypedDataDefinition} params - The typed data to sign, following EIP-712 format
10
+ * @returns {Promise<SignTypedDataResult>} A Promise that resolves to the signature as a hex string
11
+ *
12
+ * @example
13
+ * // Sign typed data
14
+ * const signature = await client.signTypedData({
15
+ * domain: {
16
+ * name: 'Example DApp',
17
+ * version: '1',
18
+ * chainId: 1,
19
+ * verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC'
20
+ * },
21
+ * types: {
22
+ * Person: [
23
+ * { name: 'name', type: 'string' },
24
+ * { name: 'wallet', type: 'address' }
25
+ * ]
26
+ * },
27
+ * primaryType: 'Person',
28
+ * message: {
29
+ * name: 'John Doe',
30
+ * wallet: '0xAaAaAaAaAaAaAaAaAaAAAAAAAAaaaAaAaAaaAaAa'
31
+ * }
32
+ * });
33
+ */
3
34
  export async function signTypedData(client, signer, params) {
4
35
  const account = await requestAccount(client, signer, {
5
36
  accountAddress: params.account ?? client.account?.address,
@@ -1 +1 @@
1
- {"version":3,"file":"signTypedData.js","sourceRoot":"","sources":["../../../../src/client/actions/signTypedData.ts"],"names":[],"mappings":"AACA,OAAO,EAKN,MAAM,MAAM,CAAC;AAEd,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAiDrD,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,MAA4B,EAC5B,MAA0B,EAC1B,MAA2B;IAE3B,MAAM,OAAO,GAAG,MAAM,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE;QACnD,cAAc,EAAE,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,OAAO,EAAE,OAAO;KAC1D,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC;AAC/C,CAAC","sourcesContent":["import type { SmartAccountSigner } from \"@aa-sdk/core\";\nimport {\n type Address,\n type Hex,\n type JsonRpcAccount,\n type TypedDataDefinition,\n} from \"viem\";\nimport type { InnerWalletApiClient } from \"../../types.ts\";\nimport { requestAccount } from \"./requestAccount.js\";\n\nexport type SignTypedDataParams = TypedDataDefinition & {\n account?: Address;\n};\n\nexport type SignTypedDataResult = Hex;\n\n/**\n * Signs typed data (EIP-712) using the smart account.\n * This method requests the account associated with the signer and uses it to sign the typed data.\n *\n * @param {InnerWalletApiClient} client - The wallet API client to use for the request\n * @param {SmartAccountSigner} signer - The signer of the smart account\n * @param {TypedDataDefinition} params - The typed data to sign, following EIP-712 format\n * @returns {Promise<SignTypedDataResult>} A Promise that resolves to the signature as a hex string\n *\n * @example\n * // Sign typed data\n * const signature = await client.signTypedData({\n * domain: {\n * name: 'Example DApp',\n * version: '1',\n * chainId: 1,\n * verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC'\n * },\n * types: {\n * Person: [\n * { name: 'name', type: 'string' },\n * { name: 'wallet', type: 'address' }\n * ]\n * },\n * primaryType: 'Person',\n * message: {\n * name: 'John Doe',\n * wallet: '0xAaAaAaAaAaAaAaAaAaAAAAAAAAaaaAaAaAaaAaAa'\n * }\n * });\n */\nexport async function signTypedData<\n TAccount extends JsonRpcAccount<Address> | undefined =\n | JsonRpcAccount<Address>\n | undefined,\n>(\n client: InnerWalletApiClient<TAccount>,\n signer: SmartAccountSigner,\n params: SignTypedDataParams,\n): Promise<SignTypedDataResult>;\n\nexport async function signTypedData(\n client: InnerWalletApiClient,\n signer: SmartAccountSigner,\n params: SignTypedDataParams,\n): Promise<SignTypedDataResult> {\n const account = await requestAccount(client, signer, {\n accountAddress: params.account ?? client.account?.address,\n });\n\n return account.signTypedDataWith6492(params);\n}\n"]}
1
+ {"version":3,"file":"signTypedData.js","sourceRoot":"","sources":["../../../../src/client/actions/signTypedData.ts"],"names":[],"mappings":"AACA,OAAO,EAAoD,MAAM,MAAM,CAAC;AAExE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAQrD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,MAA4B,EAC5B,MAA0B,EAC1B,MAA2B;IAE3B,MAAM,OAAO,GAAG,MAAM,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE;QACnD,cAAc,EAAE,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,OAAO,EAAE,OAAO;KAC1D,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC;AAC/C,CAAC","sourcesContent":["import type { SmartAccountSigner } from \"@aa-sdk/core\";\nimport { type Address, type Hex, type TypedDataDefinition } from \"viem\";\nimport type { InnerWalletApiClient } from \"../../types.ts\";\nimport { requestAccount } from \"./requestAccount.js\";\n\nexport type SignTypedDataParams = TypedDataDefinition & {\n account?: Address;\n};\n\nexport type SignTypedDataResult = Hex;\n\n/**\n * Signs typed data (EIP-712) using the smart account.\n * This method requests the account associated with the signer and uses it to sign the typed data.\n *\n * @param {InnerWalletApiClient} client - The wallet API client to use for the request\n * @param {SmartAccountSigner} signer - The signer of the smart account\n * @param {TypedDataDefinition} params - The typed data to sign, following EIP-712 format\n * @returns {Promise<SignTypedDataResult>} A Promise that resolves to the signature as a hex string\n *\n * @example\n * // Sign typed data\n * const signature = await client.signTypedData({\n * domain: {\n * name: 'Example DApp',\n * version: '1',\n * chainId: 1,\n * verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC'\n * },\n * types: {\n * Person: [\n * { name: 'name', type: 'string' },\n * { name: 'wallet', type: 'address' }\n * ]\n * },\n * primaryType: 'Person',\n * message: {\n * name: 'John Doe',\n * wallet: '0xAaAaAaAaAaAaAaAaAaAAAAAAAAaaaAaAaAaaAaAa'\n * }\n * });\n */\nexport async function signTypedData(\n client: InnerWalletApiClient,\n signer: SmartAccountSigner,\n params: SignTypedDataParams,\n): Promise<SignTypedDataResult> {\n const account = await requestAccount(client, signer, {\n accountAddress: params.account ?? client.account?.address,\n });\n\n return account.signTypedDataWith6492(params);\n}\n"]}
@@ -13,7 +13,7 @@ describe("Client E2E Tests", () => {
13
13
  apiKey: process.env.TEST_ALCHEMY_API_KEY,
14
14
  });
15
15
  describe("Local Mode Tests", () => {
16
- const signer = LocalAccountSigner.privateKeyToAccountSigner("0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff81");
16
+ const signer = LocalAccountSigner.privateKeyToAccountSigner("0xbaca22d9b6846ec09a4da378ffa07e2f14ce7d65675d135911b6fd281416bb03");
17
17
  const client = createSmartWalletClient({
18
18
  transport,
19
19
  chain: arbitrumSepolia,
@@ -24,25 +24,25 @@ describe("Client E2E Tests", () => {
24
24
  chain: arbitrumSepolia,
25
25
  transport,
26
26
  });
27
+ it("should successfully get a counterfactual address", async () => {
28
+ const account = await client.requestAccount();
29
+ expect(account.address).toMatchInlineSnapshot(`"0xa46944b7a39c35d931D514ACAc3ac77c226a81ff"`);
30
+ });
27
31
  it("should successfully request account with different salt", async () => {
28
32
  const account = await client.requestAccount({
29
- id: "2d00c64e-2e55-4925-832e-e288dbf1139e",
33
+ id: "f4c1d956-24ef-4002-a141-2c9d6d92af1a",
30
34
  creationHint: { salt: "0x1" },
31
35
  });
32
- expect(account.address).toMatchInlineSnapshot(`"0x569bCECaC47Ef9706c4b2370f2891bccd4cdE30c"`);
36
+ expect(account.address).toMatchInlineSnapshot(`"0xA692f0E5AfAD20F771443D89C635146C6A592f06"`);
33
37
  });
34
38
  it("should not cache account if different inputs provided", async () => {
35
39
  const account = await client.requestAccount();
36
40
  const account2 = await client.requestAccount({
37
- id: "2d00c64e-2e55-4925-832e-e288dbf1139e",
38
- creationHint: { salt: "0x1" },
41
+ id: "52ab44be-b03e-47ed-ad65-43014ea5fbfc",
42
+ creationHint: { salt: "0x2" },
39
43
  });
40
44
  expect(account.address).not.toEqual(account2.address);
41
45
  });
42
- it("should successfully get a counterfactual address", async () => {
43
- const account = await client.requestAccount();
44
- expect(account.address).toMatchInlineSnapshot(`"0x26809de7733F9CcB5c0c61210a4f78d6F1daFc58"`);
45
- });
46
46
  it("can correctly sign a message", async () => {
47
47
  const account = await client.requestAccount();
48
48
  const message = "hello world";
@@ -66,7 +66,7 @@ describe("Client E2E Tests", () => {
66
66
  });
67
67
  it("can correctly sign a message with a different account", async () => {
68
68
  const account = await client.requestAccount({
69
- id: "2d00c64e-2e55-4925-832e-e288dbf1139e",
69
+ id: "f4c1d956-24ef-4002-a141-2c9d6d92af1a",
70
70
  creationHint: { salt: "0x1" },
71
71
  });
72
72
  const message = "hello world";
@@ -83,7 +83,7 @@ describe("Client E2E Tests", () => {
83
83
  });
84
84
  it("can correctly sign typed data with a different account", async () => {
85
85
  const account = await client.requestAccount({
86
- id: "2d00c64e-2e55-4925-832e-e288dbf1139e",
86
+ id: "f4c1d956-24ef-4002-a141-2c9d6d92af1a",
87
87
  creationHint: { salt: "0x1" },
88
88
  });
89
89
  const signature = await client.signTypedData({
@@ -149,7 +149,7 @@ describe("Client E2E Tests", () => {
149
149
  });
150
150
  });
151
151
  describe("Remote Mode Tests", () => {
152
- const signer = LocalAccountSigner.privateKeyToAccountSigner("0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80");
152
+ const signer = LocalAccountSigner.privateKeyToAccountSigner("0xd7b061ef04d29cf68b3c89356678eccec9988de8d5ed892c19461c4a9d65925d");
153
153
  const client = createSmartWalletClient({
154
154
  transport,
155
155
  chain: arbitrumSepolia,
@@ -162,20 +162,20 @@ describe("Client E2E Tests", () => {
162
162
  });
163
163
  it("should successfully get a counterfactual address", async () => {
164
164
  const account = await client.requestAccount();
165
- expect(account.address).toMatchInlineSnapshot(`"0x65b5DE0251f553B2208762a4724303E750294D96"`);
165
+ expect(account.address).toMatchInlineSnapshot(`"0x76E765e80FFAC96ac10Aa8908a8267A3B80d606D"`);
166
166
  });
167
167
  it("should successfully request account with different salt", async () => {
168
168
  const account = await client.requestAccount({
169
- id: "8670d2d8-2781-49e9-a75c-1eb980271ca9",
169
+ id: "26b375e3-c94a-4e98-b6b7-5a97121aa583",
170
170
  creationHint: { salt: "0x1" },
171
171
  });
172
- expect(account.address).toMatchInlineSnapshot(`"0xC9B8271E44f14be83CecfDE1dDb325e9fa15e9Ff"`);
172
+ expect(account.address).toMatchInlineSnapshot(`"0xdfdd407b9569D40BEFa503208753E59cAc9713fA"`);
173
173
  });
174
174
  it("should not cache account if different inputs provided", async () => {
175
175
  const account = await client.requestAccount();
176
176
  const account2 = await client.requestAccount({
177
- id: "8670d2d8-2781-49e9-a75c-1eb980271ca9",
178
- creationHint: { salt: "0x1" },
177
+ id: "2a3320b4-6ed2-4833-a488-5188e9bdd9d2",
178
+ creationHint: { salt: "0x2" },
179
179
  });
180
180
  expect(account.address).not.toEqual(account2.address);
181
181
  });
@@ -202,7 +202,7 @@ describe("Client E2E Tests", () => {
202
202
  });
203
203
  it("can correctly sign a message with a different account", async () => {
204
204
  const account = await client.requestAccount({
205
- id: "8670d2d8-2781-49e9-a75c-1eb980271ca9",
205
+ id: "26b375e3-c94a-4e98-b6b7-5a97121aa583",
206
206
  creationHint: { salt: "0x1" },
207
207
  });
208
208
  const message = "hello world";
@@ -219,7 +219,7 @@ describe("Client E2E Tests", () => {
219
219
  });
220
220
  it("can correctly sign typed data with a different account", async () => {
221
221
  const account = await client.requestAccount({
222
- id: "8670d2d8-2781-49e9-a75c-1eb980271ca9",
222
+ id: "26b375e3-c94a-4e98-b6b7-5a97121aa583",
223
223
  creationHint: { salt: "0x1" },
224
224
  });
225
225
  const signature = await client.signTypedData({
@@ -1 +1 @@
1
- {"version":3,"file":"client.e2e-test.js","sourceRoot":"","sources":["../../../src/client/client.e2e-test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAgB,MAAM,MAAM,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAErD,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,MAAM,SAAS,GAAG,OAAO,CACvB,OAAO,CAAC,GAAG,CAAC,qBAAqB;QAC/B,CAAC,CAAC;YACE,MAAM,EAAE,OAA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AAO,EAAE;YACP,IAAI,EAAE;gBACJ,IAAI,EAAE,OAAO;gBACb,MAAM,EAAE,4CAA4C;aACrD;YACD,EAAE,EAAE;gBACF,IAAI,EAAE,KAAK;gBACX,MAAM,EAAE,4CAA4C;aACrD;YACD,QAAQ,EAAE,aAAa;SACxB;KACO,CAAC;AACb,CAAC,CAAC,CAAC","sourcesContent":["import { LocalAccountSigner } from \"@aa-sdk/core\";\nimport { alchemy, arbitrumSepolia } from \"@account-kit/infra\";\nimport { describe, expect, it } from \"bun:test\";\nimport { createPublicClient, zeroAddress, type Address } from \"viem\";\nimport { signSignatureRequest } from \"./actions/signSignatureRequest.js\";\nimport { createSmartWalletClient } from \"./index.js\";\n\ndescribe(\"Client E2E Tests\", () => {\n const transport = alchemy(\n process.env.ALCHEMY_PROXY_RPC_URL\n ? {\n rpcUrl: process.env.ALCHEMY_PROXY_RPC_URL,\n }\n : {\n apiKey: process.env.TEST_ALCHEMY_API_KEY!,\n },\n );\n describe(\"Local Mode Tests\", () => {\n const signer = LocalAccountSigner.privateKeyToAccountSigner(\n \"0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff81\",\n );\n\n const client = createSmartWalletClient({\n transport,\n chain: arbitrumSepolia,\n mode: \"local\",\n signer,\n });\n\n const publicClient = createPublicClient({\n chain: arbitrumSepolia,\n transport,\n });\n\n it(\"should successfully request account with different salt\", async () => {\n const account = await client.requestAccount({\n id: \"2d00c64e-2e55-4925-832e-e288dbf1139e\",\n creationHint: { salt: \"0x1\" },\n });\n\n expect(account.address).toMatchInlineSnapshot(\n `\"0x569bCECaC47Ef9706c4b2370f2891bccd4cdE30c\"`,\n );\n });\n\n it(\"should not cache account if different inputs provided\", async () => {\n const account = await client.requestAccount();\n const account2 = await client.requestAccount({\n id: \"2d00c64e-2e55-4925-832e-e288dbf1139e\",\n creationHint: { salt: \"0x1\" },\n });\n\n expect(account.address).not.toEqual(account2.address);\n });\n\n it(\"should successfully get a counterfactual address\", async () => {\n const account = await client.requestAccount();\n expect(account.address).toMatchInlineSnapshot(\n `\"0x26809de7733F9CcB5c0c61210a4f78d6F1daFc58\"`,\n );\n });\n\n it(\"can correctly sign a message\", async () => {\n const account = await client.requestAccount();\n const message = \"hello world\";\n const signature = await client.signMessage({ message });\n const isValid = await publicClient.verifyMessage({\n address: account.address,\n message,\n signature,\n });\n expect(isValid).toBeTrue();\n });\n\n it(\"can correctly sign typed data\", async () => {\n const account = await client.requestAccount();\n const signature = await client.signTypedData(givenTypedData);\n const isValid = await publicClient.verifyTypedData({\n ...givenTypedData,\n signature,\n address: account.address,\n });\n expect(isValid).toBeTrue();\n });\n\n it(\"can correctly sign a message with a different account\", async () => {\n const account = await client.requestAccount({\n id: \"2d00c64e-2e55-4925-832e-e288dbf1139e\",\n creationHint: { salt: \"0x1\" },\n });\n const message = \"hello world\";\n\n const signature = await client.signMessage({\n message,\n account: account.address,\n });\n const isValid = await publicClient.verifyMessage({\n address: account.address,\n message,\n signature,\n });\n expect(isValid).toBeTrue();\n });\n\n it(\"can correctly sign typed data with a different account\", async () => {\n const account = await client.requestAccount({\n id: \"2d00c64e-2e55-4925-832e-e288dbf1139e\",\n creationHint: { salt: \"0x1\" },\n });\n\n const signature = await client.signTypedData({\n ...givenTypedData,\n account: account.address,\n });\n const isValid = await publicClient.verifyTypedData({\n ...givenTypedData,\n signature,\n address: account.address,\n });\n expect(isValid).toBeTrue();\n });\n\n it(\"should successfully send a UO with paymaster\", async () => {\n const account = await client.requestAccount();\n const preparedCall = await client.prepareCalls({\n calls: [{ to: zeroAddress, value: \"0x0\" }],\n from: account.address,\n capabilities: {\n paymasterService: {\n policyId: process.env.TEST_PAYMASTER_POLICY_ID!,\n },\n },\n });\n\n const signature = await client.signSignatureRequest(\n preparedCall.signatureRequest,\n );\n\n const result = await client.sendPreparedCalls({\n ...preparedCall,\n signature,\n });\n\n expect(result.preparedCallIds).toBeArrayOfSize(1);\n });\n\n it(\"should successfully create a session with grantPermissions and send a UO\", async () => {\n const account = await client.requestAccount();\n\n const sessionKey = LocalAccountSigner.generatePrivateKeySigner();\n\n const permissions = await client.grantPermissions({\n account: account.address,\n expiry: Math.floor(Date.now() / 1000) + 60 * 60,\n key: {\n publicKey: await sessionKey.getAddress(),\n type: \"secp256k1\",\n },\n permissions: [{ type: \"root\" }],\n });\n\n const preparedCall = await client.prepareCalls({\n calls: [{ to: zeroAddress, value: \"0x0\" }],\n from: account.address,\n capabilities: {\n paymasterService: {\n policyId: process.env.TEST_PAYMASTER_POLICY_ID!,\n },\n permissions,\n },\n });\n\n const signature = await signSignatureRequest(\n sessionKey,\n preparedCall.signatureRequest,\n );\n\n const result = await client.sendPreparedCalls({\n ...preparedCall,\n signature,\n capabilities: {\n permissions,\n },\n });\n\n expect(result.preparedCallIds).toBeArrayOfSize(1);\n });\n });\n\n describe(\"Remote Mode Tests\", () => {\n const signer = LocalAccountSigner.privateKeyToAccountSigner(\n \"0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80\",\n );\n\n const client = createSmartWalletClient({\n transport,\n chain: arbitrumSepolia,\n mode: \"remote\",\n signer,\n });\n\n const publicClient = createPublicClient({\n chain: arbitrumSepolia,\n transport,\n });\n\n it(\"should successfully get a counterfactual address\", async () => {\n const account = await client.requestAccount();\n expect(account.address).toMatchInlineSnapshot(\n `\"0x65b5DE0251f553B2208762a4724303E750294D96\"`,\n );\n });\n\n it(\"should successfully request account with different salt\", async () => {\n const account = await client.requestAccount({\n id: \"8670d2d8-2781-49e9-a75c-1eb980271ca9\",\n creationHint: { salt: \"0x1\" },\n });\n\n expect(account.address).toMatchInlineSnapshot(\n `\"0xC9B8271E44f14be83CecfDE1dDb325e9fa15e9Ff\"`,\n );\n });\n\n it(\"should not cache account if different inputs provided\", async () => {\n const account = await client.requestAccount();\n const account2 = await client.requestAccount({\n id: \"8670d2d8-2781-49e9-a75c-1eb980271ca9\",\n creationHint: { salt: \"0x1\" },\n });\n\n expect(account.address).not.toEqual(account2.address);\n });\n\n it(\"can correctly sign a message\", async () => {\n const account = await client.requestAccount();\n const message = \"hello world\";\n const signature = await client.signMessage({ message });\n const isValid = await publicClient.verifyMessage({\n address: account.address,\n message: \"hello world\",\n signature,\n });\n expect(isValid).toBeTrue();\n });\n\n it(\"can correctly sign typed data\", async () => {\n const account = await client.requestAccount();\n const signature = await client.signTypedData(givenTypedData);\n const isValid = await publicClient.verifyTypedData({\n ...givenTypedData,\n signature,\n address: account.address,\n });\n expect(isValid).toBeTrue();\n });\n\n it(\"can correctly sign a message with a different account\", async () => {\n const account = await client.requestAccount({\n id: \"8670d2d8-2781-49e9-a75c-1eb980271ca9\",\n creationHint: { salt: \"0x1\" },\n });\n\n const message = \"hello world\";\n const signature = await client.signMessage({\n message,\n account: account.address,\n });\n const isValid = await publicClient.verifyMessage({\n address: account.address,\n message: \"hello world\",\n signature,\n });\n expect(isValid).toBeTrue();\n });\n\n it(\"can correctly sign typed data with a different account\", async () => {\n const account = await client.requestAccount({\n id: \"8670d2d8-2781-49e9-a75c-1eb980271ca9\",\n creationHint: { salt: \"0x1\" },\n });\n\n const signature = await client.signTypedData({\n ...givenTypedData,\n account: account.address,\n });\n\n const isValid = await publicClient.verifyTypedData({\n ...givenTypedData,\n signature,\n address: account.address,\n });\n expect(isValid).toBeTrue();\n });\n\n it(\"should successfully send a UO with paymaster\", async () => {\n const account = await client.requestAccount();\n const preparedCall = await client.prepareCalls({\n calls: [{ to: zeroAddress, value: \"0x0\" }],\n from: account.address,\n capabilities: {\n paymasterService: {\n policyId: process.env.TEST_PAYMASTER_POLICY_ID!,\n },\n },\n });\n\n const signature = await client.signSignatureRequest(\n preparedCall.signatureRequest,\n );\n\n const result = await client.sendPreparedCalls({\n ...preparedCall,\n signature,\n });\n\n expect(result.preparedCallIds).toBeArrayOfSize(1);\n });\n\n it(\"should successfully create a session with grantPermissions and send a UO\", async () => {\n const account = await client.requestAccount();\n\n const sessionKey = LocalAccountSigner.generatePrivateKeySigner();\n\n const permissions = await client.grantPermissions({\n account: account.address,\n expiry: Math.floor(Date.now() / 1000) + 60 * 60,\n key: {\n publicKey: await sessionKey.getAddress(),\n type: \"secp256k1\",\n },\n permissions: [{ type: \"root\" }],\n });\n\n const preparedCall = await client.prepareCalls({\n calls: [{ to: zeroAddress, value: \"0x0\" }],\n from: account.address,\n capabilities: {\n paymasterService: {\n policyId: process.env.TEST_PAYMASTER_POLICY_ID!,\n },\n permissions,\n },\n });\n\n const signature = await signSignatureRequest(\n sessionKey,\n preparedCall.signatureRequest,\n );\n\n const result = await client.sendPreparedCalls({\n ...preparedCall,\n signature,\n capabilities: {\n permissions,\n },\n });\n\n expect(result.preparedCallIds).toBeArrayOfSize(1);\n });\n });\n\n const givenTypedData = {\n types: {\n Person: [\n { name: \"name\", type: \"string\" },\n { name: \"wallet\", type: \"address\" },\n ],\n Mail: [\n { name: \"from\", type: \"Person\" },\n { name: \"to\", type: \"Person\" },\n { name: \"contents\", type: \"string\" },\n ],\n },\n primaryType: \"Mail\" as const,\n domain: {\n name: \"Ether Mail\",\n version: \"1\",\n chainId: 1,\n verifyingContract:\n \"0xbbc68f94D29d52EE8D4994E54d6ED0fEAeb99C2c\" as Address,\n },\n message: {\n from: {\n name: \"Alice\",\n wallet: \"0xFC24e57486116026740634F629ffC4E5C95A6893\",\n },\n to: {\n name: \"Bob\",\n wallet: \"0xe7a26f006EAA562308C5df235C02BFB9a5849177\",\n },\n contents: \"Hello, Bob!\",\n },\n } as const;\n});\n"]}
1
+ {"version":3,"file":"client.e2e-test.js","sourceRoot":"","sources":["../../../src/client/client.e2e-test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAA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E,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE;gBAC9B,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE;aACrC;SACF;QACD,WAAW,EAAE,MAAe;QAC5B,MAAM,EAAE;YACN,IAAI,EAAE,YAAY;YAClB,OAAO,EAAE,GAAG;YACZ,OAAO,EAAE,CAAC;YACV,iBAAiB,EACf,4CAAuD;SAC1D;QACD,OAAO,EAAE;YACP,IAAI,EAAE;gBACJ,IAAI,EAAE,OAAO;gBACb,MAAM,EAAE,4CAA4C;aACrD;YACD,EAAE,EAAE;gBACF,IAAI,EAAE,KAAK;gBACX,MAAM,EAAE,4CAA4C;aACrD;YACD,QAAQ,EAAE,aAAa;SACxB;KACO,CAAC;AACb,CAAC,CAAC,CAAC","sourcesContent":["import { LocalAccountSigner } from \"@aa-sdk/core\";\nimport { alchemy, arbitrumSepolia } from \"@account-kit/infra\";\nimport { describe, expect, it } from \"bun:test\";\nimport { createPublicClient, zeroAddress, type Address } from \"viem\";\nimport { signSignatureRequest } from \"./actions/signSignatureRequest.js\";\nimport { createSmartWalletClient } from \"./index.js\";\n\ndescribe(\"Client E2E Tests\", () => {\n const transport = alchemy(\n process.env.ALCHEMY_PROXY_RPC_URL\n ? {\n rpcUrl: process.env.ALCHEMY_PROXY_RPC_URL,\n }\n : {\n apiKey: process.env.TEST_ALCHEMY_API_KEY!,\n },\n );\n describe(\"Local Mode Tests\", () => {\n const signer = LocalAccountSigner.privateKeyToAccountSigner(\n \"0xbaca22d9b6846ec09a4da378ffa07e2f14ce7d65675d135911b6fd281416bb03\",\n );\n\n const client = createSmartWalletClient({\n transport,\n chain: arbitrumSepolia,\n mode: \"local\",\n signer,\n });\n\n const publicClient = createPublicClient({\n chain: arbitrumSepolia,\n transport,\n });\n\n it(\"should successfully get a counterfactual address\", async () => {\n const account = await client.requestAccount();\n expect(account.address).toMatchInlineSnapshot(\n `\"0xa46944b7a39c35d931D514ACAc3ac77c226a81ff\"`,\n );\n });\n\n it(\"should successfully request account with different salt\", async () => {\n const account = await client.requestAccount({\n id: \"f4c1d956-24ef-4002-a141-2c9d6d92af1a\",\n creationHint: { salt: \"0x1\" },\n });\n\n expect(account.address).toMatchInlineSnapshot(\n `\"0xA692f0E5AfAD20F771443D89C635146C6A592f06\"`,\n );\n });\n\n it(\"should not cache account if different inputs provided\", async () => {\n const account = await client.requestAccount();\n const account2 = await client.requestAccount({\n id: \"52ab44be-b03e-47ed-ad65-43014ea5fbfc\",\n creationHint: { salt: \"0x2\" },\n });\n\n expect(account.address).not.toEqual(account2.address);\n });\n\n it(\"can correctly sign a message\", async () => {\n const account = await client.requestAccount();\n const message = \"hello world\";\n const signature = await client.signMessage({ message });\n const isValid = await publicClient.verifyMessage({\n address: account.address,\n message,\n signature,\n });\n expect(isValid).toBeTrue();\n });\n\n it(\"can correctly sign typed data\", async () => {\n const account = await client.requestAccount();\n const signature = await client.signTypedData(givenTypedData);\n const isValid = await publicClient.verifyTypedData({\n ...givenTypedData,\n signature,\n address: account.address,\n });\n expect(isValid).toBeTrue();\n });\n\n it(\"can correctly sign a message with a different account\", async () => {\n const account = await client.requestAccount({\n id: \"f4c1d956-24ef-4002-a141-2c9d6d92af1a\",\n creationHint: { salt: \"0x1\" },\n });\n const message = \"hello world\";\n\n const signature = await client.signMessage({\n message,\n account: account.address,\n });\n const isValid = await publicClient.verifyMessage({\n address: account.address,\n message,\n signature,\n });\n expect(isValid).toBeTrue();\n });\n\n it(\"can correctly sign typed data with a different account\", async () => {\n const account = await client.requestAccount({\n id: \"f4c1d956-24ef-4002-a141-2c9d6d92af1a\",\n creationHint: { salt: \"0x1\" },\n });\n\n const signature = await client.signTypedData({\n ...givenTypedData,\n account: account.address,\n });\n const isValid = await publicClient.verifyTypedData({\n ...givenTypedData,\n signature,\n address: account.address,\n });\n expect(isValid).toBeTrue();\n });\n\n it(\"should successfully send a UO with paymaster\", async () => {\n const account = await client.requestAccount();\n const preparedCall = await client.prepareCalls({\n calls: [{ to: zeroAddress, value: \"0x0\" }],\n from: account.address,\n capabilities: {\n paymasterService: {\n policyId: process.env.TEST_PAYMASTER_POLICY_ID!,\n },\n },\n });\n\n const signature = await client.signSignatureRequest(\n preparedCall.signatureRequest,\n );\n\n const result = await client.sendPreparedCalls({\n ...preparedCall,\n signature,\n });\n\n expect(result.preparedCallIds).toBeArrayOfSize(1);\n });\n\n it(\"should successfully create a session with grantPermissions and send a UO\", async () => {\n const account = await client.requestAccount();\n\n const sessionKey = LocalAccountSigner.generatePrivateKeySigner();\n\n const permissions = await client.grantPermissions({\n account: account.address,\n expiry: Math.floor(Date.now() / 1000) + 60 * 60,\n key: {\n publicKey: await sessionKey.getAddress(),\n type: \"secp256k1\",\n },\n permissions: [{ type: \"root\" }],\n });\n\n const preparedCall = await client.prepareCalls({\n calls: [{ to: zeroAddress, value: \"0x0\" }],\n from: account.address,\n capabilities: {\n paymasterService: {\n policyId: process.env.TEST_PAYMASTER_POLICY_ID!,\n },\n permissions,\n },\n });\n\n const signature = await signSignatureRequest(\n sessionKey,\n preparedCall.signatureRequest,\n );\n\n const result = await client.sendPreparedCalls({\n ...preparedCall,\n signature,\n capabilities: {\n permissions,\n },\n });\n\n expect(result.preparedCallIds).toBeArrayOfSize(1);\n });\n });\n\n describe(\"Remote Mode Tests\", () => {\n const signer = LocalAccountSigner.privateKeyToAccountSigner(\n \"0xd7b061ef04d29cf68b3c89356678eccec9988de8d5ed892c19461c4a9d65925d\",\n );\n\n const client = createSmartWalletClient({\n transport,\n chain: arbitrumSepolia,\n mode: \"remote\",\n signer,\n });\n\n const publicClient = createPublicClient({\n chain: arbitrumSepolia,\n transport,\n });\n\n it(\"should successfully get a counterfactual address\", async () => {\n const account = await client.requestAccount();\n expect(account.address).toMatchInlineSnapshot(\n `\"0x76E765e80FFAC96ac10Aa8908a8267A3B80d606D\"`,\n );\n });\n\n it(\"should successfully request account with different salt\", async () => {\n const account = await client.requestAccount({\n id: \"26b375e3-c94a-4e98-b6b7-5a97121aa583\",\n creationHint: { salt: \"0x1\" },\n });\n\n expect(account.address).toMatchInlineSnapshot(\n `\"0xdfdd407b9569D40BEFa503208753E59cAc9713fA\"`,\n );\n });\n\n it(\"should not cache account if different inputs provided\", async () => {\n const account = await client.requestAccount();\n const account2 = await client.requestAccount({\n id: \"2a3320b4-6ed2-4833-a488-5188e9bdd9d2\",\n creationHint: { salt: \"0x2\" },\n });\n\n expect(account.address).not.toEqual(account2.address);\n });\n\n it(\"can correctly sign a message\", async () => {\n const account = await client.requestAccount();\n const message = \"hello world\";\n const signature = await client.signMessage({ message });\n const isValid = await publicClient.verifyMessage({\n address: account.address,\n message: \"hello world\",\n signature,\n });\n expect(isValid).toBeTrue();\n });\n\n it(\"can correctly sign typed data\", async () => {\n const account = await client.requestAccount();\n const signature = await client.signTypedData(givenTypedData);\n const isValid = await publicClient.verifyTypedData({\n ...givenTypedData,\n signature,\n address: account.address,\n });\n expect(isValid).toBeTrue();\n });\n\n it(\"can correctly sign a message with a different account\", async () => {\n const account = await client.requestAccount({\n id: \"26b375e3-c94a-4e98-b6b7-5a97121aa583\",\n creationHint: { salt: \"0x1\" },\n });\n\n const message = \"hello world\";\n const signature = await client.signMessage({\n message,\n account: account.address,\n });\n const isValid = await publicClient.verifyMessage({\n address: account.address,\n message: \"hello world\",\n signature,\n });\n expect(isValid).toBeTrue();\n });\n\n it(\"can correctly sign typed data with a different account\", async () => {\n const account = await client.requestAccount({\n id: \"26b375e3-c94a-4e98-b6b7-5a97121aa583\",\n creationHint: { salt: \"0x1\" },\n });\n\n const signature = await client.signTypedData({\n ...givenTypedData,\n account: account.address,\n });\n\n const isValid = await publicClient.verifyTypedData({\n ...givenTypedData,\n signature,\n address: account.address,\n });\n expect(isValid).toBeTrue();\n });\n\n it(\"should successfully send a UO with paymaster\", async () => {\n const account = await client.requestAccount();\n const preparedCall = await client.prepareCalls({\n calls: [{ to: zeroAddress, value: \"0x0\" }],\n from: account.address,\n capabilities: {\n paymasterService: {\n policyId: process.env.TEST_PAYMASTER_POLICY_ID!,\n },\n },\n });\n\n const signature = await client.signSignatureRequest(\n preparedCall.signatureRequest,\n );\n\n const result = await client.sendPreparedCalls({\n ...preparedCall,\n signature,\n });\n\n expect(result.preparedCallIds).toBeArrayOfSize(1);\n });\n\n it(\"should successfully create a session with grantPermissions and send a UO\", async () => {\n const account = await client.requestAccount();\n\n const sessionKey = LocalAccountSigner.generatePrivateKeySigner();\n\n const permissions = await client.grantPermissions({\n account: account.address,\n expiry: Math.floor(Date.now() / 1000) + 60 * 60,\n key: {\n publicKey: await sessionKey.getAddress(),\n type: \"secp256k1\",\n },\n permissions: [{ type: \"root\" }],\n });\n\n const preparedCall = await client.prepareCalls({\n calls: [{ to: zeroAddress, value: \"0x0\" }],\n from: account.address,\n capabilities: {\n paymasterService: {\n policyId: process.env.TEST_PAYMASTER_POLICY_ID!,\n },\n permissions,\n },\n });\n\n const signature = await signSignatureRequest(\n sessionKey,\n preparedCall.signatureRequest,\n );\n\n const result = await client.sendPreparedCalls({\n ...preparedCall,\n signature,\n capabilities: {\n permissions,\n },\n });\n\n expect(result.preparedCallIds).toBeArrayOfSize(1);\n });\n });\n\n const givenTypedData = {\n types: {\n Person: [\n { name: \"name\", type: \"string\" },\n { name: \"wallet\", type: \"address\" },\n ],\n Mail: [\n { name: \"from\", type: \"Person\" },\n { name: \"to\", type: \"Person\" },\n { name: \"contents\", type: \"string\" },\n ],\n },\n primaryType: \"Mail\" as const,\n domain: {\n name: \"Ether Mail\",\n version: \"1\",\n chainId: 1,\n verifyingContract:\n \"0xbbc68f94D29d52EE8D4994E54d6ED0fEAeb99C2c\" as Address,\n },\n message: {\n from: {\n name: \"Alice\",\n wallet: \"0xFC24e57486116026740634F629ffC4E5C95A6893\",\n },\n to: {\n name: \"Bob\",\n wallet: \"0xe7a26f006EAA562308C5df235C02BFB9a5849177\",\n },\n contents: \"Hello, Bob!\",\n },\n } as const;\n});\n"]}
@@ -1,5 +1,5 @@
1
1
  import type { SmartAccountSigner } from "@aa-sdk/core";
2
- import type { Hex, JsonRpcAccount } from "viem";
2
+ import type { Address, Hex } from "viem";
3
3
  import type { SendPreparedCallsParams, SendPreparedCallsResult } from "../isomorphic/actions/sendPreparedCalls.ts";
4
4
  import type { InnerWalletApiClient } from "../types.ts";
5
5
  import { type CreateAccountParams, type CreateAccountResult } from "./actions/createAccount.js";
@@ -11,8 +11,8 @@ import { type RequestAccountParams, type RequestAccountResult } from "./actions/
11
11
  import { type SignMessageParams } from "./actions/signMessage.js";
12
12
  import { type SignSignatureRequestParams, type SignSignatureRequestResult } from "./actions/signSignatureRequest.js";
13
13
  import { type SignTypedDataParams } from "./actions/signTypedData.js";
14
- export type SmartWalletActions<TAccount extends JsonRpcAccount | undefined = JsonRpcAccount | undefined> = {
15
- requestAccount: (params?: RequestAccountParams<TAccount>) => Promise<RequestAccountResult>;
14
+ export type SmartWalletActions<TAccount extends Address | undefined = Address | undefined> = {
15
+ requestAccount: (params?: RequestAccountParams) => Promise<RequestAccountResult>;
16
16
  prepareCalls: (params: PrepareCallsParams<TAccount>) => Promise<PrepareCallsResult>;
17
17
  sendPreparedCalls: (params: SendPreparedCallsParams) => Promise<SendPreparedCallsResult>;
18
18
  createAccount: (params: CreateAccountParams) => Promise<CreateAccountResult>;
@@ -23,4 +23,4 @@ export type SmartWalletActions<TAccount extends JsonRpcAccount | undefined = Jso
23
23
  signTypedData: (params: SignTypedDataParams) => Promise<Hex>;
24
24
  grantPermissions: (params: GrantPermissionsParams<TAccount>) => Promise<GrantPermissionsResult>;
25
25
  };
26
- export declare function smartWalletClientActions<TAccount extends JsonRpcAccount | undefined = JsonRpcAccount | undefined>(client: InnerWalletApiClient<TAccount>, signer: SmartAccountSigner): SmartWalletActions<TAccount>;
26
+ export declare function smartWalletClientActions<TAccount extends Address | undefined = Address | undefined>(client: InnerWalletApiClient, signer: SmartAccountSigner): SmartWalletActions<TAccount>;
@@ -1 +1 @@
1
- {"version":3,"file":"decorator.js","sourceRoot":"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,CAAC;QACtE,WAAW,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;QAC5D,aAAa,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;QAChE,gBAAgB,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;KACvE,CAAC;AACJ,CAAC","sourcesContent":["import type { SmartAccountSigner } from \"@aa-sdk/core\";\nimport type { Hex, JsonRpcAccount } from \"viem\";\nimport type {\n SendPreparedCallsParams,\n SendPreparedCallsResult,\n} from \"../isomorphic/actions/sendPreparedCalls.ts\";\nimport type { InnerWalletApiClient } from \"../types.ts\";\nimport {\n createAccount,\n type CreateAccountParams,\n type CreateAccountResult,\n} from \"./actions/createAccount.js\";\nimport {\n getCallsStatus,\n type GetCallsStatusParams,\n type GetCallsStatusResult,\n} from \"./actions/getCallsStatus.js\";\nimport {\n grantPermissions,\n type GrantPermissionsParams,\n type GrantPermissionsResult,\n} from \"./actions/grantPermissions.js\";\nimport {\n listAccounts,\n type ListAccountsParams,\n type ListAccountsResult,\n} from \"./actions/listAccounts.js\";\nimport {\n prepareCalls,\n type PrepareCallsParams,\n type PrepareCallsResult,\n} from \"./actions/prepareCalls.js\";\nimport {\n requestAccount,\n type RequestAccountParams,\n type RequestAccountResult,\n} from \"./actions/requestAccount.js\";\nimport { sendPreparedCalls } from \"./actions/sendPreparedCalls.js\";\nimport { signMessage, type SignMessageParams } from \"./actions/signMessage.js\";\nimport {\n signSignatureRequest,\n type SignSignatureRequestParams,\n type SignSignatureRequestResult,\n} from \"./actions/signSignatureRequest.js\";\nimport {\n signTypedData,\n type SignTypedDataParams,\n} from \"./actions/signTypedData.js\";\n\nexport type SmartWalletActions<\n TAccount extends JsonRpcAccount | undefined = JsonRpcAccount | undefined,\n> = {\n requestAccount: (\n params?: RequestAccountParams<TAccount>,\n ) => Promise<RequestAccountResult>;\n prepareCalls: (\n params: PrepareCallsParams<TAccount>,\n ) => Promise<PrepareCallsResult>;\n sendPreparedCalls: (\n params: SendPreparedCallsParams,\n ) => Promise<SendPreparedCallsResult>;\n createAccount: (params: CreateAccountParams) => Promise<CreateAccountResult>;\n listAccounts: (params: ListAccountsParams) => Promise<ListAccountsResult>;\n getCallsStatus: (\n params: GetCallsStatusParams,\n ) => Promise<GetCallsStatusResult>;\n signSignatureRequest: (\n params: SignSignatureRequestParams,\n ) => Promise<SignSignatureRequestResult>;\n signMessage: (params: SignMessageParams) => Promise<Hex>;\n signTypedData: (params: SignTypedDataParams) => Promise<Hex>;\n grantPermissions: (\n params: GrantPermissionsParams<TAccount>,\n ) => Promise<GrantPermissionsResult>;\n};\n\nexport function smartWalletClientActions<\n TAccount extends JsonRpcAccount | undefined = JsonRpcAccount | undefined,\n>(\n client: InnerWalletApiClient<TAccount>,\n signer: SmartAccountSigner,\n): SmartWalletActions<TAccount>;\n\nexport function smartWalletClientActions(\n client: InnerWalletApiClient,\n signer: SmartAccountSigner,\n): SmartWalletActions {\n return {\n requestAccount: (params) => requestAccount(client, signer, params),\n createAccount: (params) => createAccount(client, signer, params),\n prepareCalls: (params) => prepareCalls(client, params),\n listAccounts: (params) => listAccounts(client, params),\n sendPreparedCalls: (params) => sendPreparedCalls(client, params),\n getCallsStatus: (params) => getCallsStatus(client, params),\n signSignatureRequest: (params) => signSignatureRequest(signer, params),\n signMessage: (params) => signMessage(client, signer, params),\n signTypedData: (params) => signTypedData(client, signer, params),\n grantPermissions: (params) => grantPermissions(client, signer, params),\n };\n}\n"]}
1
+ {"version":3,"file":"decorator.js","sourceRoot":"","sources":["../../../src/client/decorator.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,aAAa,GAGd,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,cAAc,GAGf,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,gBAAgB,GA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C,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;QAChE,gBAAgB,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;KACvE,CAAC;AACJ,CAAC","sourcesContent":["import type { SmartAccountSigner } from \"@aa-sdk/core\";\nimport type { Address, Hex } from \"viem\";\nimport type {\n SendPreparedCallsParams,\n SendPreparedCallsResult,\n} from \"../isomorphic/actions/sendPreparedCalls.ts\";\nimport type { InnerWalletApiClient } from \"../types.ts\";\nimport {\n createAccount,\n type CreateAccountParams,\n type CreateAccountResult,\n} from \"./actions/createAccount.js\";\nimport {\n getCallsStatus,\n type GetCallsStatusParams,\n type GetCallsStatusResult,\n} from \"./actions/getCallsStatus.js\";\nimport {\n grantPermissions,\n type GrantPermissionsParams,\n type GrantPermissionsResult,\n} from \"./actions/grantPermissions.js\";\nimport {\n listAccounts,\n type ListAccountsParams,\n type ListAccountsResult,\n} from \"./actions/listAccounts.js\";\nimport {\n prepareCalls,\n type PrepareCallsParams,\n type PrepareCallsResult,\n} from \"./actions/prepareCalls.js\";\nimport {\n requestAccount,\n type RequestAccountParams,\n type RequestAccountResult,\n} from \"./actions/requestAccount.js\";\nimport { sendPreparedCalls } from \"./actions/sendPreparedCalls.js\";\nimport { signMessage, type SignMessageParams } from \"./actions/signMessage.js\";\nimport {\n signSignatureRequest,\n type SignSignatureRequestParams,\n type SignSignatureRequestResult,\n} from \"./actions/signSignatureRequest.js\";\nimport {\n signTypedData,\n type SignTypedDataParams,\n} from \"./actions/signTypedData.js\";\n\nexport type SmartWalletActions<\n TAccount extends Address | undefined = Address | undefined,\n> = {\n requestAccount: (\n params?: RequestAccountParams,\n ) => Promise<RequestAccountResult>;\n prepareCalls: (\n params: PrepareCallsParams<TAccount>,\n ) => Promise<PrepareCallsResult>;\n sendPreparedCalls: (\n params: SendPreparedCallsParams,\n ) => Promise<SendPreparedCallsResult>;\n createAccount: (params: CreateAccountParams) => Promise<CreateAccountResult>;\n listAccounts: (params: ListAccountsParams) => Promise<ListAccountsResult>;\n getCallsStatus: (\n params: GetCallsStatusParams,\n ) => Promise<GetCallsStatusResult>;\n signSignatureRequest: (\n params: SignSignatureRequestParams,\n ) => Promise<SignSignatureRequestResult>;\n signMessage: (params: SignMessageParams) => Promise<Hex>;\n signTypedData: (params: SignTypedDataParams) => Promise<Hex>;\n grantPermissions: (\n params: GrantPermissionsParams<TAccount>,\n ) => Promise<GrantPermissionsResult>;\n};\n\nexport function smartWalletClientActions<\n TAccount extends Address | undefined = Address | undefined,\n>(\n client: InnerWalletApiClient,\n signer: SmartAccountSigner,\n): SmartWalletActions<TAccount> {\n return {\n requestAccount: (params) => requestAccount(client, signer, params),\n createAccount: (params) => createAccount(client, signer, params),\n prepareCalls: (params) => prepareCalls(client, params),\n listAccounts: (params) => listAccounts(client, params),\n sendPreparedCalls: (params) => sendPreparedCalls(client, params),\n getCallsStatus: (params) => getCallsStatus(client, params),\n signSignatureRequest: (params) => signSignatureRequest(signer, params),\n signMessage: (params) => signMessage(client, signer, params),\n signTypedData: (params) => signTypedData(client, signer, params),\n grantPermissions: (params) => grantPermissions(client, signer, params),\n };\n}\n"]}
@@ -1,19 +1,44 @@
1
1
  import type { SmartAccountSigner } from "@aa-sdk/core";
2
2
  import type { AlchemyTransport } from "@account-kit/infra";
3
- import type { Address, Chain, IsUndefined, JsonRpcAccount, Prettify } from "viem";
3
+ import type { Address, Chain, Prettify } from "viem";
4
4
  import type { InnerWalletApiClient } from "../types.ts";
5
5
  import { type SmartWalletActions } from "./decorator.js";
6
- export type SmartWalletClientParams<TAccount extends JsonRpcAccount<Address> | undefined = JsonRpcAccount<Address> | undefined> = Prettify<{
6
+ export type SmartWalletClientParams<TAccount extends Address | undefined = Address | undefined> = Prettify<{
7
7
  transport: AlchemyTransport;
8
8
  chain: Chain;
9
9
  signer: SmartAccountSigner;
10
10
  mode: "local" | "remote";
11
11
  policyId?: string;
12
- } & (IsUndefined<TAccount> extends true ? {
13
- account?: never;
14
- } : {
15
- account: Address;
16
- })>;
17
- export type SmartWalletClient<TAccount extends JsonRpcAccount<Address> | undefined = JsonRpcAccount<Address> | undefined> = InnerWalletApiClient<TAccount> & SmartWalletActions<TAccount>;
18
- export declare function createSmartWalletClient<TAccount extends JsonRpcAccount<Address> | undefined = JsonRpcAccount<Address> | undefined>(params: SmartWalletClientParams<TAccount>): SmartWalletClient<TAccount>;
19
- export declare function createSmartWalletClient<TAccount extends JsonRpcAccount<Address> = JsonRpcAccount<Address>>(params: SmartWalletClientParams<TAccount>): SmartWalletClient<TAccount>;
12
+ account?: TAccount | Address | undefined;
13
+ }>;
14
+ export type SmartWalletClient<TAccount extends Address | undefined = Address | undefined> = InnerWalletApiClient & SmartWalletActions<TAccount>;
15
+ /**
16
+ * Creates a smart wallet client that can be used to interact with a smart account.
17
+ *
18
+ * @param {SmartWalletClientParams} params - The parameters for creating the smart wallet client
19
+ * @param {AlchemyTransport} params.transport - The Alchemy transport to use
20
+ * @param {Chain} params.chain - The chain to use
21
+ * @param {SmartAccountSigner} params.signer - The signer to use for the smart account
22
+ * @param {"local" | "remote"} params.mode - The client's mode (local or remote).
23
+ * @param {string} [params.policyId] - The policy ID for gas sponsorship (optional)
24
+ * @param {Address} [params.account] - The smart account address to use (optional)
25
+ * @returns {SmartWalletClient} - A viem-compatible client
26
+ *
27
+ * @example
28
+ * import { LocalAccountSigner } from "@aa-sdk/core";
29
+ * import { alchemy, arbitrumSepolia } from "@account-kit/infra";
30
+ * import { generatePrivateKey } from "viem/accounts";
31
+ * import { createSmartWalletClient } from "@account-kit/wallet-client";
32
+ *
33
+ * const signer = LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey());
34
+ * const transport = alchemy({
35
+ * apiKey: "your-alchemy-api-key",
36
+ * });
37
+ * const client = createSmartWalletClient({
38
+ * transport,
39
+ * chain: arbitrumSepolia,
40
+ * mode: "remote",
41
+ * signer,
42
+ * });
43
+ */
44
+ export declare function createSmartWalletClient<TAccount extends Address | undefined = undefined>(params: SmartWalletClientParams<TAccount>): SmartWalletClient<TAccount>;
@@ -1,35 +1,6 @@
1
1
  import { createLocalClient } from "../local/client.js";
2
2
  import { createRemoteClient } from "../remote/client.js";
3
3
  import { smartWalletClientActions, } from "./decorator.js";
4
- /**
5
- * Creates a smart wallet client that can be used to interact with a smart account.
6
- *
7
- * @param {SmartWalletClientParams} params - The parameters for creating the smart wallet client
8
- * @param {AlchemyTransport} params.transport - The Alchemy transport to use
9
- * @param {Chain} params.chain - The chain to use
10
- * @param {SmartAccountSigner} params.signer - The signer to use for the smart account
11
- * @param {"local" | "remote"} params.mode - The client's mode (local or remote).
12
- * @param {string} [params.policyId] - The policy ID for gas sponsorship (optional)
13
- * @param {Address} [params.account] - The smart account address to use (optional)
14
- * @returns {SmartWalletClient} - A viem-compatible client
15
- *
16
- * @example
17
- * import { LocalAccountSigner } from "@aa-sdk/core";
18
- * import { alchemy, arbitrumSepolia } from "@account-kit/infra";
19
- * import { generatePrivateKey } from "viem/accounts";
20
- * import { createSmartWalletClient } from "@account-kit/wallet-client";
21
- *
22
- * const signer = LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey());
23
- * const transport = alchemy({
24
- * apiKey: "your-alchemy-api-key",
25
- * });
26
- * const client = createSmartWalletClient({
27
- * transport,
28
- * chain: arbitrumSepolia,
29
- * mode: "remote",
30
- * signer,
31
- * });
32
- */
33
4
  export function createSmartWalletClient(params) {
34
5
  const { transport, chain, policyId, mode, account, signer } = params;
35
6
  const innerClient = mode === "local"
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EACL,wBAAwB,GAEzB,MAAM,gBAAgB,CAAC;AAsCxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,UAAU,uBAAuB,CACrC,MAA+B;IAE/B,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IAErE,MAAM,WAAW,GACf,IAAI,KAAK,OAAO;QACd,CAAC,CAAC,iBAAiB,CAAC;YAChB,SAAS;YACT,KAAK;YACL,QAAQ;YACR,OAAO;SACR,CAAC;QACJ,CAAC,CAAC,kBAAkB,CAAC;YACjB,SAAS;YACT,KAAK;YACL,QAAQ;YACR,OAAO;SACR,CAAC,CAAC;IAET,yCAAyC;IACzC,qDAAqD;IACrD,4JAA4J;IAC5J,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CACnC,wBAAwB,CAAC,MAAM,EAAE,MAAM,CAAC,CACzC,CAAC;AACJ,CAAC;AAED,iBAAiB;AACjB,yDAAyD;AACzD,2CAA2C;AAC3C,wBAAwB;AACxB,4CAA4C;AAC5C,mBAAmB;AACnB,MAAM;AAEN,gEAAgE;AAEhE,sDAAsD;AACtD,2CAA2C;AAC3C,wBAAwB;AACxB,4CAA4C;AAC5C,mBAAmB;AACnB,0BAA0B;AAC1B,MAAM;AAEN,6DAA6D","sourcesContent":["import type { SmartAccountSigner } from \"@aa-sdk/core\";\nimport type { AlchemyTransport } from \"@account-kit/infra\";\nimport type {\n Address,\n Chain,\n IsUndefined,\n JsonRpcAccount,\n Prettify,\n} from \"viem\";\nimport { createLocalClient } from \"../local/client.js\";\nimport { createRemoteClient } from \"../remote/client.js\";\nimport type { InnerWalletApiClient } from \"../types.ts\";\nimport {\n smartWalletClientActions,\n type SmartWalletActions,\n} from \"./decorator.js\";\n\nexport type SmartWalletClientParams<\n TAccount extends JsonRpcAccount<Address> | undefined =\n | JsonRpcAccount<Address>\n | undefined,\n> = Prettify<\n {\n transport: AlchemyTransport;\n chain: Chain;\n signer: SmartAccountSigner;\n mode: \"local\" | \"remote\";\n policyId?: string;\n } & (IsUndefined<TAccount> extends true\n ? {\n account?: never;\n }\n : {\n account: Address;\n })\n>;\n\nexport type SmartWalletClient<\n TAccount extends JsonRpcAccount<Address> | undefined =\n | JsonRpcAccount<Address>\n | undefined,\n> = InnerWalletApiClient<TAccount> & SmartWalletActions<TAccount>;\n\nexport function createSmartWalletClient<\n TAccount extends JsonRpcAccount<Address> | undefined =\n | JsonRpcAccount<Address>\n | undefined,\n>(params: SmartWalletClientParams<TAccount>): SmartWalletClient<TAccount>;\n\nexport function createSmartWalletClient<\n TAccount extends JsonRpcAccount<Address> = JsonRpcAccount<Address>,\n>(params: SmartWalletClientParams<TAccount>): SmartWalletClient<TAccount>;\n\n/**\n * Creates a smart wallet client that can be used to interact with a smart account.\n *\n * @param {SmartWalletClientParams} params - The parameters for creating the smart wallet client\n * @param {AlchemyTransport} params.transport - The Alchemy transport to use\n * @param {Chain} params.chain - The chain to use\n * @param {SmartAccountSigner} params.signer - The signer to use for the smart account\n * @param {\"local\" | \"remote\"} params.mode - The client's mode (local or remote).\n * @param {string} [params.policyId] - The policy ID for gas sponsorship (optional)\n * @param {Address} [params.account] - The smart account address to use (optional)\n * @returns {SmartWalletClient} - A viem-compatible client\n *\n * @example\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { alchemy, arbitrumSepolia } from \"@account-kit/infra\";\n * import { generatePrivateKey } from \"viem/accounts\";\n * import { createSmartWalletClient } from \"@account-kit/wallet-client\";\n *\n * const signer = LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey());\n * const transport = alchemy({\n * apiKey: \"your-alchemy-api-key\",\n * });\n * const client = createSmartWalletClient({\n * transport,\n * chain: arbitrumSepolia,\n * mode: \"remote\",\n * signer,\n * });\n */\nexport function createSmartWalletClient(\n params: SmartWalletClientParams,\n): SmartWalletClient {\n const { transport, chain, policyId, mode, account, signer } = params;\n\n const innerClient =\n mode === \"local\"\n ? createLocalClient({\n transport,\n chain,\n policyId,\n account,\n })\n : createRemoteClient({\n transport,\n chain,\n policyId,\n account,\n });\n\n // TODO: we need to do a few things here:\n // 1. decorate the client with the wallet api actions\n // 2. potentially we might want to make this client async and have it use `requestAccount` so that it can create a SCA client with an account attached to it\n return innerClient.extend((client) =>\n smartWalletClientActions(client, signer),\n );\n}\n\n// Example usage:\n// const clientWithoutAccount = createSmartWalletClient({\n// transport: alchemy({ apiKey: \"123\" }),\n// chain: baseSepolia,\n// signer: createDummySigner(zeroAddress),\n// mode: \"local\",\n// });\n\n// const account1 = await clientWithoutAccount.requestAccount();\n\n// const clientWithAccount = createSmartWalletClient({\n// transport: alchemy({ apiKey: \"123\" }),\n// chain: baseSepolia,\n// signer: createDummySigner(zeroAddress),\n// mode: \"local\",\n// account: zeroAddress,\n// });\n\n// const account2 = await clientWithAccount.requestAccount();\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EACL,wBAAwB,GAEzB,MAAM,gBAAgB,CAAC;AAkDxB,MAAM,UAAU,uBAAuB,CACrC,MAA+B;IAE/B,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IAErE,MAAM,WAAW,GACf,IAAI,KAAK,OAAO;QACd,CAAC,CAAC,iBAAiB,CAAC;YAChB,SAAS;YACT,KAAK;YACL,QAAQ;YACR,OAAO;SACR,CAAC;QACJ,CAAC,CAAC,kBAAkB,CAAC;YACjB,SAAS;YACT,KAAK;YACL,QAAQ;YACR,OAAO;SACR,CAAC,CAAC;IAET,yCAAyC;IACzC,qDAAqD;IACrD,4JAA4J;IAC5J,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CACnC,wBAAwB,CAAC,MAAM,EAAE,MAAM,CAAC,CACzC,CAAC;AACJ,CAAC;AAED,iBAAiB;AACjB,yDAAyD;AACzD,2CAA2C;AAC3C,wBAAwB;AACxB,4CAA4C;AAC5C,mBAAmB;AACnB,MAAM;AAEN,gEAAgE;AAEhE,sDAAsD;AACtD,2CAA2C;AAC3C,wBAAwB;AACxB,4CAA4C;AAC5C,mBAAmB;AACnB,0BAA0B;AAC1B,MAAM;AAEN,6DAA6D","sourcesContent":["import type { SmartAccountSigner } from \"@aa-sdk/core\";\nimport type { AlchemyTransport } from \"@account-kit/infra\";\nimport type { Address, Chain, Prettify } from \"viem\";\nimport { createLocalClient } from \"../local/client.js\";\nimport { createRemoteClient } from \"../remote/client.js\";\nimport type { InnerWalletApiClient } from \"../types.ts\";\nimport {\n smartWalletClientActions,\n type SmartWalletActions,\n} from \"./decorator.js\";\n\nexport type SmartWalletClientParams<\n TAccount extends Address | undefined = Address | undefined,\n> = Prettify<{\n transport: AlchemyTransport;\n chain: Chain;\n signer: SmartAccountSigner;\n mode: \"local\" | \"remote\";\n policyId?: string;\n account?: TAccount | Address | undefined;\n}>;\n\nexport type SmartWalletClient<\n TAccount extends Address | undefined = Address | undefined,\n> = InnerWalletApiClient & SmartWalletActions<TAccount>;\n\n/**\n * Creates a smart wallet client that can be used to interact with a smart account.\n *\n * @param {SmartWalletClientParams} params - The parameters for creating the smart wallet client\n * @param {AlchemyTransport} params.transport - The Alchemy transport to use\n * @param {Chain} params.chain - The chain to use\n * @param {SmartAccountSigner} params.signer - The signer to use for the smart account\n * @param {\"local\" | \"remote\"} params.mode - The client's mode (local or remote).\n * @param {string} [params.policyId] - The policy ID for gas sponsorship (optional)\n * @param {Address} [params.account] - The smart account address to use (optional)\n * @returns {SmartWalletClient} - A viem-compatible client\n *\n * @example\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { alchemy, arbitrumSepolia } from \"@account-kit/infra\";\n * import { generatePrivateKey } from \"viem/accounts\";\n * import { createSmartWalletClient } from \"@account-kit/wallet-client\";\n *\n * const signer = LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey());\n * const transport = alchemy({\n * apiKey: \"your-alchemy-api-key\",\n * });\n * const client = createSmartWalletClient({\n * transport,\n * chain: arbitrumSepolia,\n * mode: \"remote\",\n * signer,\n * });\n */\nexport function createSmartWalletClient<\n TAccount extends Address | undefined = undefined,\n>(params: SmartWalletClientParams<TAccount>): SmartWalletClient<TAccount>;\n\nexport function createSmartWalletClient(\n params: SmartWalletClientParams,\n): SmartWalletClient {\n const { transport, chain, policyId, mode, account, signer } = params;\n\n const innerClient =\n mode === \"local\"\n ? createLocalClient({\n transport,\n chain,\n policyId,\n account,\n })\n : createRemoteClient({\n transport,\n chain,\n policyId,\n account,\n });\n\n // TODO: we need to do a few things here:\n // 1. decorate the client with the wallet api actions\n // 2. potentially we might want to make this client async and have it use `requestAccount` so that it can create a SCA client with an account attached to it\n return innerClient.extend((client) =>\n smartWalletClientActions(client, signer),\n );\n}\n\n// Example usage:\n// const clientWithoutAccount = createSmartWalletClient({\n// transport: alchemy({ apiKey: \"123\" }),\n// chain: baseSepolia,\n// signer: createDummySigner(zeroAddress),\n// mode: \"local\",\n// });\n\n// const account1 = await clientWithoutAccount.requestAccount();\n\n// const clientWithAccount = createSmartWalletClient({\n// transport: alchemy({ apiKey: \"123\" }),\n// chain: baseSepolia,\n// signer: createDummySigner(zeroAddress),\n// mode: \"local\",\n// account: zeroAddress,\n// });\n\n// const account2 = await clientWithAccount.requestAccount();\n"]}
@@ -8,19 +8,26 @@ import { createAccount, isModularAccountV2 } from "../utils/createAccount.js";
8
8
  import { createDummySigner } from "../utils/createDummySigner.js";
9
9
  import { createAuthorization } from "../utils/7702.js";
10
10
  import { InvalidRequestError } from "ox/RpcResponse";
11
+ import { parseDelegation, assertValid7702AccountAddress, } from "../utils/7702.js";
11
12
  export async function createSession(client, params) {
12
13
  if (!client.chain) {
13
14
  throw new ChainNotFoundError();
14
15
  }
15
- const { counterfactualInfo, delegation } = await client.request({
16
- method: "wallet_requestAccount",
17
- params: [
18
- {
19
- accountAddress: params.account,
20
- includeCounterfactualInfo: true,
21
- },
22
- ],
23
- });
16
+ assertValid7702AccountAddress(params.account, params.capabilities?.eip7702Auth);
17
+ const { counterfactualInfo, delegation } = params.capabilities?.eip7702Auth
18
+ ? {
19
+ counterfactualInfo: undefined,
20
+ delegation: parseDelegation(params.capabilities.eip7702Auth),
21
+ }
22
+ : await client.request({
23
+ method: "wallet_requestAccount",
24
+ params: [
25
+ {
26
+ accountAddress: params.account,
27
+ includeCounterfactualInfo: true,
28
+ },
29
+ ],
30
+ });
24
31
  if (!counterfactualInfo && !delegation) {
25
32
  throw new InvalidRequestError({
26
33
  message: "No counterfactual info or delegated implementation address found.",
@@ -50,7 +57,11 @@ export async function createSession(client, params) {
50
57
  });
51
58
  const { typedData, fullPreSignatureDeferredActionDigest } = await new PermissionBuilder({
52
59
  client: _client,
53
- key: params.key,
60
+ key: {
61
+ ...params.key,
62
+ // Alias 'ecdsa' to 'secp256k1'
63
+ type: params.key.type === "ecdsa" ? "secp256k1" : params.key.type,
64
+ },
54
65
  entityId,
55
66
  nonce,
56
67
  deadline: params.expiry,