@aa-sdk/core 4.35.0 → 4.35.1

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 (212) hide show
  1. package/README.md +1 -1
  2. package/dist/esm/account/smartContractAccount.d.ts +1 -1
  3. package/dist/esm/account/smartContractAccount.js.map +1 -1
  4. package/dist/esm/actions/bundler/estimateUserOperationGas.d.ts +3 -2
  5. package/dist/esm/actions/bundler/estimateUserOperationGas.js.map +1 -1
  6. package/dist/esm/actions/bundler/getSupportedEntryPoints.js.map +1 -1
  7. package/dist/esm/actions/bundler/getUserOperationByHash.js.map +1 -1
  8. package/dist/esm/actions/bundler/getUserOperationReceipt.js.map +1 -1
  9. package/dist/esm/actions/bundler/sendRawUserOperation.d.ts +2 -1
  10. package/dist/esm/actions/bundler/sendRawUserOperation.js.map +1 -1
  11. package/dist/esm/actions/smartAccount/buildUserOperation.js.map +1 -1
  12. package/dist/esm/actions/smartAccount/buildUserOperationFromTx.js.map +1 -1
  13. package/dist/esm/actions/smartAccount/buildUserOperationFromTxs.js.map +1 -1
  14. package/dist/esm/actions/smartAccount/checkGasSponsorshipEligibility.js.map +1 -1
  15. package/dist/esm/actions/smartAccount/dropAndReplaceUserOperation.js.map +1 -1
  16. package/dist/esm/actions/smartAccount/estimateUserOperationGas.js.map +1 -1
  17. package/dist/esm/actions/smartAccount/getAddress.js.map +1 -1
  18. package/dist/esm/actions/smartAccount/internal/initUserOperation.js.map +1 -1
  19. package/dist/esm/actions/smartAccount/internal/runMiddlewareStack.js.map +1 -1
  20. package/dist/esm/actions/smartAccount/internal/sendUserOperation.js.map +1 -1
  21. package/dist/esm/actions/smartAccount/sendTransaction.js.map +1 -1
  22. package/dist/esm/actions/smartAccount/sendTransactions.js.map +1 -1
  23. package/dist/esm/actions/smartAccount/sendUserOperation.js.map +1 -1
  24. package/dist/esm/actions/smartAccount/signMessage.js.map +1 -1
  25. package/dist/esm/actions/smartAccount/signTypedData.js.map +1 -1
  26. package/dist/esm/actions/smartAccount/signUserOperation.js.map +1 -1
  27. package/dist/esm/actions/smartAccount/types.js.map +1 -1
  28. package/dist/esm/actions/smartAccount/upgradeAccount.js.map +1 -1
  29. package/dist/esm/actions/smartAccount/waitForUserOperationTransacation.js.map +1 -1
  30. package/dist/esm/client/addBreadcrumb.js.map +1 -1
  31. package/dist/esm/client/bundlerClient.js.map +1 -1
  32. package/dist/esm/client/decorators/bundlerClient.js.map +1 -1
  33. package/dist/esm/client/decorators/smartAccountClient.js.map +1 -1
  34. package/dist/esm/client/isSmartAccountClient.js.map +1 -1
  35. package/dist/esm/client/schema.d.ts +25 -25
  36. package/dist/esm/client/schema.js.map +1 -1
  37. package/dist/esm/client/smartAccountClient.js.map +1 -1
  38. package/dist/esm/client/types.js.map +1 -1
  39. package/dist/esm/ens/utils.js.map +1 -1
  40. package/dist/esm/entrypoint/0.6.d.ts +2 -2
  41. package/dist/esm/entrypoint/0.6.js.map +1 -1
  42. package/dist/esm/entrypoint/0.7.d.ts +1 -1
  43. package/dist/esm/entrypoint/0.7.js.map +1 -1
  44. package/dist/esm/entrypoint/index.d.ts +1 -1
  45. package/dist/esm/entrypoint/index.js.map +1 -1
  46. package/dist/esm/entrypoint/types.js.map +1 -1
  47. package/dist/esm/errors/account.js.map +1 -1
  48. package/dist/esm/errors/client.js.map +1 -1
  49. package/dist/esm/errors/entrypoint.js.map +1 -1
  50. package/dist/esm/errors/signer.js.map +1 -1
  51. package/dist/esm/errors/useroperation.js.map +1 -1
  52. package/dist/esm/middleware/actions.js.map +1 -1
  53. package/dist/esm/middleware/defaults/7702gasEstimator.d.ts +2 -2
  54. package/dist/esm/middleware/defaults/7702gasEstimator.js +2 -2
  55. package/dist/esm/middleware/defaults/7702gasEstimator.js.map +1 -1
  56. package/dist/esm/middleware/defaults/7702signer.d.ts +1 -1
  57. package/dist/esm/middleware/defaults/7702signer.js +1 -1
  58. package/dist/esm/middleware/defaults/7702signer.js.map +1 -1
  59. package/dist/esm/middleware/defaults/feeEstimator.js.map +1 -1
  60. package/dist/esm/middleware/defaults/gasEstimator.js.map +1 -1
  61. package/dist/esm/middleware/defaults/paymasterAndData.js.map +1 -1
  62. package/dist/esm/middleware/defaults/userOpSigner.js.map +1 -1
  63. package/dist/esm/middleware/erc7677middleware.js.map +1 -1
  64. package/dist/esm/middleware/types.js.map +1 -1
  65. package/dist/esm/signer/local-account.d.ts +2 -207
  66. package/dist/esm/signer/local-account.js.map +1 -1
  67. package/dist/esm/signer/schema.d.ts +1 -1
  68. package/dist/esm/signer/types.js.map +1 -1
  69. package/dist/esm/signer/wallet-client.d.ts +2 -207
  70. package/dist/esm/signer/wallet-client.js.map +1 -1
  71. package/dist/esm/transport/split.js.map +1 -1
  72. package/dist/esm/types.js.map +1 -1
  73. package/dist/esm/utils/bigint.js.map +1 -1
  74. package/dist/esm/utils/defaults.js.map +1 -1
  75. package/dist/esm/utils/index.d.ts +2 -2
  76. package/dist/esm/utils/index.js.map +1 -1
  77. package/dist/esm/utils/schema.js.map +1 -1
  78. package/dist/esm/utils/stateOverride.js.map +1 -1
  79. package/dist/esm/utils/testUtils.js.map +1 -1
  80. package/dist/esm/utils/traceHeader.js.map +1 -1
  81. package/dist/esm/utils/types.js.map +1 -1
  82. package/dist/esm/utils/userop.d.ts +2 -2
  83. package/dist/esm/utils/userop.js +1 -1
  84. package/dist/esm/utils/userop.js.map +1 -1
  85. package/dist/esm/version.d.ts +1 -1
  86. package/dist/esm/version.js +1 -1
  87. package/dist/esm/version.js.map +1 -1
  88. package/dist/types/account/smartContractAccount.d.ts +1 -1
  89. package/dist/types/account/smartContractAccount.d.ts.map +1 -1
  90. package/dist/types/actions/bundler/estimateUserOperationGas.d.ts +3 -2
  91. package/dist/types/actions/bundler/estimateUserOperationGas.d.ts.map +1 -1
  92. package/dist/types/actions/bundler/getSupportedEntryPoints.d.ts.map +1 -1
  93. package/dist/types/actions/bundler/getUserOperationByHash.d.ts.map +1 -1
  94. package/dist/types/actions/bundler/getUserOperationReceipt.d.ts.map +1 -1
  95. package/dist/types/actions/bundler/sendRawUserOperation.d.ts +2 -1
  96. package/dist/types/actions/bundler/sendRawUserOperation.d.ts.map +1 -1
  97. package/dist/types/actions/smartAccount/buildUserOperation.d.ts.map +1 -1
  98. package/dist/types/actions/smartAccount/buildUserOperationFromTx.d.ts.map +1 -1
  99. package/dist/types/actions/smartAccount/buildUserOperationFromTxs.d.ts.map +1 -1
  100. package/dist/types/actions/smartAccount/checkGasSponsorshipEligibility.d.ts.map +1 -1
  101. package/dist/types/actions/smartAccount/dropAndReplaceUserOperation.d.ts.map +1 -1
  102. package/dist/types/actions/smartAccount/estimateUserOperationGas.d.ts.map +1 -1
  103. package/dist/types/actions/smartAccount/internal/initUserOperation.d.ts.map +1 -1
  104. package/dist/types/actions/smartAccount/internal/runMiddlewareStack.d.ts.map +1 -1
  105. package/dist/types/actions/smartAccount/internal/sendUserOperation.d.ts.map +1 -1
  106. package/dist/types/actions/smartAccount/sendTransaction.d.ts.map +1 -1
  107. package/dist/types/actions/smartAccount/sendUserOperation.d.ts.map +1 -1
  108. package/dist/types/actions/smartAccount/signUserOperation.d.ts.map +1 -1
  109. package/dist/types/actions/smartAccount/types.d.ts.map +1 -1
  110. package/dist/types/client/decorators/smartAccountClient.d.ts.map +1 -1
  111. package/dist/types/client/schema.d.ts +25 -25
  112. package/dist/types/client/schema.d.ts.map +1 -1
  113. package/dist/types/ens/utils.d.ts.map +1 -1
  114. package/dist/types/entrypoint/0.6.d.ts +2 -2
  115. package/dist/types/entrypoint/0.6.d.ts.map +1 -1
  116. package/dist/types/entrypoint/0.7.d.ts +1 -1
  117. package/dist/types/entrypoint/0.7.d.ts.map +1 -1
  118. package/dist/types/entrypoint/index.d.ts +1 -1
  119. package/dist/types/entrypoint/index.d.ts.map +1 -1
  120. package/dist/types/entrypoint/types.d.ts.map +1 -1
  121. package/dist/types/errors/useroperation.d.ts.map +1 -1
  122. package/dist/types/middleware/actions.d.ts.map +1 -1
  123. package/dist/types/middleware/defaults/7702gasEstimator.d.ts +2 -2
  124. package/dist/types/middleware/defaults/7702signer.d.ts +1 -1
  125. package/dist/types/middleware/types.d.ts.map +1 -1
  126. package/dist/types/signer/local-account.d.ts +2 -207
  127. package/dist/types/signer/local-account.d.ts.map +1 -1
  128. package/dist/types/signer/schema.d.ts +1 -1
  129. package/dist/types/signer/schema.d.ts.map +1 -1
  130. package/dist/types/signer/utils.d.ts.map +1 -1
  131. package/dist/types/signer/wallet-client.d.ts +2 -207
  132. package/dist/types/signer/wallet-client.d.ts.map +1 -1
  133. package/dist/types/transport/split.d.ts.map +1 -1
  134. package/dist/types/types.d.ts.map +1 -1
  135. package/dist/types/utils/bigint.d.ts.map +1 -1
  136. package/dist/types/utils/bytes.d.ts.map +1 -1
  137. package/dist/types/utils/defaults.d.ts.map +1 -1
  138. package/dist/types/utils/index.d.ts +2 -2
  139. package/dist/types/utils/index.d.ts.map +1 -1
  140. package/dist/types/utils/testUtils.d.ts.map +1 -1
  141. package/dist/types/utils/traceHeader.d.ts.map +1 -1
  142. package/dist/types/utils/userop.d.ts +2 -2
  143. package/dist/types/utils/userop.d.ts.map +1 -1
  144. package/dist/types/version.d.ts +1 -1
  145. package/package.json +3 -6
  146. package/src/account/smartContractAccount.ts +27 -25
  147. package/src/actions/bundler/estimateUserOperationGas.ts +2 -2
  148. package/src/actions/bundler/getSupportedEntryPoints.ts +2 -2
  149. package/src/actions/bundler/getUserOperationByHash.ts +2 -2
  150. package/src/actions/bundler/getUserOperationReceipt.ts +2 -2
  151. package/src/actions/bundler/sendRawUserOperation.ts +2 -2
  152. package/src/actions/smartAccount/buildUserOperation.ts +5 -4
  153. package/src/actions/smartAccount/buildUserOperationFromTx.ts +4 -3
  154. package/src/actions/smartAccount/buildUserOperationFromTxs.ts +9 -8
  155. package/src/actions/smartAccount/checkGasSponsorshipEligibility.ts +5 -4
  156. package/src/actions/smartAccount/dropAndReplaceUserOperation.ts +7 -6
  157. package/src/actions/smartAccount/estimateUserOperationGas.ts +5 -4
  158. package/src/actions/smartAccount/getAddress.ts +2 -2
  159. package/src/actions/smartAccount/internal/initUserOperation.ts +7 -6
  160. package/src/actions/smartAccount/internal/runMiddlewareStack.ts +13 -12
  161. package/src/actions/smartAccount/internal/sendUserOperation.ts +3 -2
  162. package/src/actions/smartAccount/sendTransaction.ts +5 -4
  163. package/src/actions/smartAccount/sendTransactions.ts +3 -3
  164. package/src/actions/smartAccount/sendUserOperation.ts +4 -3
  165. package/src/actions/smartAccount/signMessage.ts +3 -3
  166. package/src/actions/smartAccount/signTypedData.ts +3 -3
  167. package/src/actions/smartAccount/signUserOperation.ts +4 -3
  168. package/src/actions/smartAccount/types.ts +23 -15
  169. package/src/actions/smartAccount/upgradeAccount.ts +3 -3
  170. package/src/actions/smartAccount/waitForUserOperationTransacation.ts +5 -5
  171. package/src/client/addBreadcrumb.ts +1 -1
  172. package/src/client/bundlerClient.ts +5 -5
  173. package/src/client/decorators/bundlerClient.ts +7 -7
  174. package/src/client/decorators/smartAccountClient.ts +20 -18
  175. package/src/client/isSmartAccountClient.ts +4 -4
  176. package/src/client/schema.ts +2 -2
  177. package/src/client/smartAccountClient.ts +14 -14
  178. package/src/client/types.ts +2 -2
  179. package/src/ens/utils.ts +1 -1
  180. package/src/entrypoint/0.6.ts +3 -3
  181. package/src/entrypoint/0.7.ts +4 -4
  182. package/src/entrypoint/index.ts +10 -9
  183. package/src/entrypoint/types.ts +30 -28
  184. package/src/errors/account.ts +1 -1
  185. package/src/errors/client.ts +3 -3
  186. package/src/errors/entrypoint.ts +2 -2
  187. package/src/errors/signer.ts +1 -1
  188. package/src/errors/useroperation.ts +6 -3
  189. package/src/middleware/actions.ts +3 -3
  190. package/src/middleware/defaults/7702gasEstimator.ts +4 -4
  191. package/src/middleware/defaults/7702signer.ts +3 -3
  192. package/src/middleware/defaults/feeEstimator.ts +4 -4
  193. package/src/middleware/defaults/gasEstimator.ts +6 -6
  194. package/src/middleware/defaults/paymasterAndData.ts +1 -1
  195. package/src/middleware/defaults/userOpSigner.ts +2 -2
  196. package/src/middleware/erc7677middleware.ts +9 -9
  197. package/src/middleware/types.ts +7 -5
  198. package/src/signer/local-account.ts +7 -7
  199. package/src/signer/types.ts +3 -3
  200. package/src/signer/wallet-client.ts +2 -2
  201. package/src/transport/split.ts +1 -1
  202. package/src/types.ts +29 -29
  203. package/src/utils/bigint.ts +4 -4
  204. package/src/utils/defaults.ts +1 -1
  205. package/src/utils/index.ts +12 -9
  206. package/src/utils/schema.ts +2 -2
  207. package/src/utils/stateOverride.ts +4 -4
  208. package/src/utils/testUtils.ts +2 -2
  209. package/src/utils/traceHeader.ts +14 -11
  210. package/src/utils/types.ts +1 -1
  211. package/src/utils/userop.ts +17 -17
  212. package/src/version.ts +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"userOpSigner.js","sourceRoot":"","sources":["../../../../src/middleware/defaults/userOpSigner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EACL,WAAW,EACX,cAAc,EACd,iBAAiB,GAClB,MAAM,sBAAsB,CAAC;AAG9B;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAuB,KAAK,EAC1D,MAAM,EACN,EAAE,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,EACpC,EAAE;IACF,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,oBAAoB,EAAE,CAAC;IACnC,CAAC;IAED,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC;QACnB,MAAM,IAAI,kBAAkB,EAAE,CAAC;IACjC,CAAC;IAED,MAAM,cAAc,GAAG,MAAM,iBAAiB,CAAC,MAAM,CAAC,CAAC;IACvD,MAAM,OAAO,GAAG,WAAW,CAAC,cAAc,CAAC,CAAC;IAC5C,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,CAAC;QAC7B,MAAM,IAAI,yBAAyB,CAAC,cAAc,CAAC,CAAC;IACtD,CAAC;IAED,OAAO;QACL,GAAG,cAAc;QACjB,SAAS,EAAE,MAAM,OAAO,CAAC,qBAAqB,CAC5C,OAAO,CAAC,aAAa,EAAE,CAAC,oBAAoB,CAAC,OAAO,CAAC,CACtD;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { AccountNotFoundError } from \"../../errors/account.js\";\nimport { ChainNotFoundError } from \"../../errors/client.js\";\nimport { InvalidUserOperationError } from \"../../errors/useroperation.js\";\nimport {\n deepHexlify,\n isValidRequest,\n resolveProperties,\n} from \"../../utils/index.js\";\nimport type { ClientMiddlewareFn } from \"../types\";\n\n/**\n * Provides a default middleware function for signing user operations with a client account. This function validates the request and adds the signature to it.\n * This is already included in the client returned from `createSmartAccountClient`\n *\n * @param {UserOperationStruct} struct The user operation structure to be signed\n * @param {*} context The middleware context containing the client and account information\n * @param {Client} context.client The client object, which should include account and chain information\n * @param {Account} [context.account] Optional, the account used for signing, defaults to the client's account if not provided\n * @returns {Promise<UserOperationStruct>} A promise that resolves to the signed user operation structure\n */\nexport const defaultUserOpSigner: ClientMiddlewareFn = async (\n struct,\n { client, account = client.account }\n) => {\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n if (!client?.chain) {\n throw new ChainNotFoundError();\n }\n\n const resolvedStruct = await resolveProperties(struct);\n const request = deepHexlify(resolvedStruct);\n if (!isValidRequest(request)) {\n throw new InvalidUserOperationError(resolvedStruct);\n }\n\n return {\n ...resolvedStruct,\n signature: await account.signUserOperationHash(\n account.getEntryPoint().getUserOperationHash(request)\n ),\n };\n};\n"]}
1
+ {"version":3,"file":"userOpSigner.js","sourceRoot":"","sources":["../../../../src/middleware/defaults/userOpSigner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EACL,WAAW,EACX,cAAc,EACd,iBAAiB,GAClB,MAAM,sBAAsB,CAAC;AAG9B;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAuB,KAAK,EAC1D,MAAM,EACN,EAAE,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,EACpC,EAAE;IACF,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,oBAAoB,EAAE,CAAC;IACnC,CAAC;IAED,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC;QACnB,MAAM,IAAI,kBAAkB,EAAE,CAAC;IACjC,CAAC;IAED,MAAM,cAAc,GAAG,MAAM,iBAAiB,CAAC,MAAM,CAAC,CAAC;IACvD,MAAM,OAAO,GAAG,WAAW,CAAC,cAAc,CAAC,CAAC;IAC5C,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,CAAC;QAC7B,MAAM,IAAI,yBAAyB,CAAC,cAAc,CAAC,CAAC;IACtD,CAAC;IAED,OAAO;QACL,GAAG,cAAc;QACjB,SAAS,EAAE,MAAM,OAAO,CAAC,qBAAqB,CAC5C,OAAO,CAAC,aAAa,EAAE,CAAC,oBAAoB,CAAC,OAAO,CAAC,CACtD;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { AccountNotFoundError } from \"../../errors/account.js\";\nimport { ChainNotFoundError } from \"../../errors/client.js\";\nimport { InvalidUserOperationError } from \"../../errors/useroperation.js\";\nimport {\n deepHexlify,\n isValidRequest,\n resolveProperties,\n} from \"../../utils/index.js\";\nimport type { ClientMiddlewareFn } from \"../types\";\n\n/**\n * Provides a default middleware function for signing user operations with a client account. This function validates the request and adds the signature to it.\n * This is already included in the client returned from `createSmartAccountClient`\n *\n * @param {UserOperationStruct} struct The user operation structure to be signed\n * @param {*} context The middleware context containing the client and account information\n * @param {Client} context.client The client object, which should include account and chain information\n * @param {Account} [context.account] Optional, the account used for signing, defaults to the client's account if not provided\n * @returns {Promise<UserOperationStruct>} A promise that resolves to the signed user operation structure\n */\nexport const defaultUserOpSigner: ClientMiddlewareFn = async (\n struct,\n { client, account = client.account },\n) => {\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n if (!client?.chain) {\n throw new ChainNotFoundError();\n }\n\n const resolvedStruct = await resolveProperties(struct);\n const request = deepHexlify(resolvedStruct);\n if (!isValidRequest(request)) {\n throw new InvalidUserOperationError(resolvedStruct);\n }\n\n return {\n ...resolvedStruct,\n signature: await account.signUserOperationHash(\n account.getEntryPoint().getUserOperationHash(request),\n ),\n };\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"erc7677middleware.js","sourceRoot":"","sources":["../../../src/middleware/erc7677middleware.ts"],"names":[],"mappings":"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","sourcesContent":["import {\n toHex,\n type Address,\n type Chain,\n type Client,\n type Hex,\n type Transport,\n} from \"viem\";\nimport type { ClientMiddlewareConfig } from \"../client/types\";\nimport type { EntryPointVersion } from \"../entrypoint/types\";\nimport { ChainNotFoundError } from \"../errors/client.js\";\nimport type {\n UserOperationFeeOptions,\n UserOperationOverrides,\n UserOperationRequest,\n UserOperationStruct,\n} from \"../types\";\nimport {\n deepHexlify,\n resolveProperties,\n type Deferrable,\n} from \"../utils/index.js\";\nimport type { ClientMiddlewareFn } from \"./types\";\n\nexport type Erc7677RpcSchema<\n TContext extends Record<string, any> = Record<string, any>\n> = [\n {\n Method: \"pm_getPaymasterStubData\";\n Parameters: [UserOperationRequest, Address, Hex, TContext];\n ReturnType: {\n sponsor?: { name: string; icon?: string }; // Sponsor info\n paymaster?: Address; // Paymaster address (entrypoint v0.7)\n paymasterData?: Hex; // Paymaster data (entrypoint v0.7)\n paymasterVerificationGasLimit?: Hex; // Paymaster validation gas (entrypoint v0.7)\n paymasterPostOpGasLimit?: Hex; // Paymaster post-op gas (entrypoint v0.7)\n paymasterAndData?: Hex; // Paymaster and data (entrypoint v0.6)\n isFinal?: boolean; // Indicates that the caller does not need to call pm_getPaymasterData\n };\n },\n {\n Method: \"pm_getPaymasterData\";\n Parameters: [UserOperationRequest, Address, Hex, TContext];\n ReturnType: {\n paymaster?: Address; // Paymaster address (entrypoint v0.7)\n paymasterData?: Hex; // Paymaster data (entrypoint v0.7)\n paymasterAndData?: Hex; // Paymaster and data (entrypoint v0.6)\n };\n }\n];\n\nexport type Erc7677Client<\n T extends Transport = Transport,\n TContext extends Record<string, any> = Record<string, any>\n> = Client<T, Chain, undefined, Erc7677RpcSchema<TContext>>;\n\nexport type Erc7677MiddlewareParams<\n TContext extends Record<string, any> | undefined =\n | Record<string, any>\n | undefined,\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion\n> = {\n context?:\n | ((\n struct: Deferrable<UserOperationStruct<TEntryPointVersion>>,\n args: {\n overrides?: UserOperationOverrides<TEntryPointVersion>;\n feeOptions?: UserOperationFeeOptions;\n }\n ) => Promise<TContext>)\n | TContext;\n};\n\n/**\n * Middleware function for interacting with ERC-7677 enabled clients. It supports resolving paymaster and data fields for user operations.\n * This middleware assumes that your RPC provider supports the ERC-7677 methods (pm_getPaymasterStubData and pm_getPaymasterData).\n *\n * @example\n * ```ts\n * import { createSmartAccountClient, erc7677Middleware } from \"@aa-sdk/core\";\n * import { http } from \"viem\";\n * import { sepolia } from \"viem/chains\";\n *\n * const client = createSmartAccountClient({\n * transport: http(\"rpc-url\"),\n * chain: sepolia,\n * // this assumes that your RPC provider supports the ERC-7677 methods AND takes no context\n * ...erc7677Middleware(),\n * })\n * ```\n *\n * @param {Erc7677MiddlewareParams<TContext>} params Middleware parameters including context function or object. Context can be resolved dynamically by passing in a function which takes in the context at the time of sending a user op\n * @returns {Pick<ClientMiddlewareConfig, \"dummyPaymasterAndData\" | \"paymasterAndData\">} An object containing middleware functions `dummyPaymasterAndData` and `paymasterAndData` for processing user operations with the paymaster data\n */\nexport function erc7677Middleware<\n TContext extends Record<string, any> | undefined =\n | Record<string, any>\n | undefined\n>(\n params?: Erc7677MiddlewareParams<TContext>\n): Required<\n Pick<ClientMiddlewareConfig, \"dummyPaymasterAndData\" | \"paymasterAndData\">\n> {\n const dummyPaymasterAndData: ClientMiddlewareFn = async (\n uo,\n { client, account, feeOptions, overrides }\n ) => {\n const userOp = deepHexlify(await resolveProperties(uo));\n\n // Those values will be set after fee estimation.\n userOp.maxFeePerGas = \"0x0\";\n userOp.maxPriorityFeePerGas = \"0x0\";\n userOp.callGasLimit = \"0x0\";\n userOp.verificationGasLimit = \"0x0\";\n userOp.preVerificationGas = \"0x0\";\n\n const entrypoint = account.getEntryPoint();\n\n if (entrypoint.version === \"0.7.0\") {\n userOp.paymasterVerificationGasLimit = \"0x0\";\n userOp.paymasterPostOpGasLimit = \"0x0\";\n }\n\n const context =\n (typeof params?.context === \"function\"\n ? await params?.context(userOp, { overrides, feeOptions })\n : params?.context) ?? {};\n\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n\n const erc7677client = client as Erc7677Client;\n // TODO: probably need to handle the sponsor and isFinal fields\n const {\n paymaster,\n paymasterAndData,\n paymasterData,\n paymasterPostOpGasLimit,\n paymasterVerificationGasLimit,\n } = await erc7677client.request({\n method: \"pm_getPaymasterStubData\",\n params: [userOp, entrypoint.address, toHex(client.chain.id), context],\n });\n\n if (entrypoint.version === \"0.6.0\") {\n return {\n ...uo,\n paymasterAndData,\n };\n }\n\n return {\n ...uo,\n paymaster,\n paymasterData,\n paymasterPostOpGasLimit,\n paymasterVerificationGasLimit,\n };\n };\n\n const paymasterAndData: ClientMiddlewareFn = async (\n uo,\n { client, account, feeOptions, overrides }\n ) => {\n const userOp = deepHexlify(await resolveProperties(uo));\n const context =\n (typeof params?.context === \"function\"\n ? await params?.context(userOp, { overrides, feeOptions })\n : params?.context) ?? {};\n\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n\n const erc7677client = client as Erc7677Client;\n\n const entrypoint = account.getEntryPoint();\n const { paymaster, paymasterAndData, paymasterData } =\n await erc7677client.request({\n method: \"pm_getPaymasterData\",\n params: [userOp, entrypoint.address, toHex(client.chain.id), context],\n });\n\n if (entrypoint.version === \"0.6.0\") {\n return {\n ...uo,\n paymasterAndData,\n };\n }\n\n return {\n ...uo,\n paymaster,\n paymasterData,\n };\n };\n\n return {\n dummyPaymasterAndData,\n paymasterAndData,\n };\n}\n"]}
1
+ {"version":3,"file":"erc7677middleware.js","sourceRoot":"","sources":["../../../src/middleware/erc7677middleware.ts"],"names":[],"mappings":"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","sourcesContent":["import {\n toHex,\n type Address,\n type Chain,\n type Client,\n type Hex,\n type Transport,\n} from \"viem\";\nimport type { ClientMiddlewareConfig } from \"../client/types\";\nimport type { EntryPointVersion } from \"../entrypoint/types\";\nimport { ChainNotFoundError } from \"../errors/client.js\";\nimport type {\n UserOperationFeeOptions,\n UserOperationOverrides,\n UserOperationRequest,\n UserOperationStruct,\n} from \"../types\";\nimport {\n deepHexlify,\n resolveProperties,\n type Deferrable,\n} from \"../utils/index.js\";\nimport type { ClientMiddlewareFn } from \"./types\";\n\nexport type Erc7677RpcSchema<\n TContext extends Record<string, any> = Record<string, any>,\n> = [\n {\n Method: \"pm_getPaymasterStubData\";\n Parameters: [UserOperationRequest, Address, Hex, TContext];\n ReturnType: {\n sponsor?: { name: string; icon?: string }; // Sponsor info\n paymaster?: Address; // Paymaster address (entrypoint v0.7)\n paymasterData?: Hex; // Paymaster data (entrypoint v0.7)\n paymasterVerificationGasLimit?: Hex; // Paymaster validation gas (entrypoint v0.7)\n paymasterPostOpGasLimit?: Hex; // Paymaster post-op gas (entrypoint v0.7)\n paymasterAndData?: Hex; // Paymaster and data (entrypoint v0.6)\n isFinal?: boolean; // Indicates that the caller does not need to call pm_getPaymasterData\n };\n },\n {\n Method: \"pm_getPaymasterData\";\n Parameters: [UserOperationRequest, Address, Hex, TContext];\n ReturnType: {\n paymaster?: Address; // Paymaster address (entrypoint v0.7)\n paymasterData?: Hex; // Paymaster data (entrypoint v0.7)\n paymasterAndData?: Hex; // Paymaster and data (entrypoint v0.6)\n };\n },\n];\n\nexport type Erc7677Client<\n T extends Transport = Transport,\n TContext extends Record<string, any> = Record<string, any>,\n> = Client<T, Chain, undefined, Erc7677RpcSchema<TContext>>;\n\nexport type Erc7677MiddlewareParams<\n TContext extends Record<string, any> | undefined =\n | Record<string, any>\n | undefined,\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion,\n> = {\n context?:\n | ((\n struct: Deferrable<UserOperationStruct<TEntryPointVersion>>,\n args: {\n overrides?: UserOperationOverrides<TEntryPointVersion>;\n feeOptions?: UserOperationFeeOptions;\n },\n ) => Promise<TContext>)\n | TContext;\n};\n\n/**\n * Middleware function for interacting with ERC-7677 enabled clients. It supports resolving paymaster and data fields for user operations.\n * This middleware assumes that your RPC provider supports the ERC-7677 methods (pm_getPaymasterStubData and pm_getPaymasterData).\n *\n * @example\n * ```ts\n * import { createSmartAccountClient, erc7677Middleware } from \"@aa-sdk/core\";\n * import { http } from \"viem\";\n * import { sepolia } from \"viem/chains\";\n *\n * const client = createSmartAccountClient({\n * transport: http(\"rpc-url\"),\n * chain: sepolia,\n * // this assumes that your RPC provider supports the ERC-7677 methods AND takes no context\n * ...erc7677Middleware(),\n * })\n * ```\n *\n * @param {Erc7677MiddlewareParams<TContext>} params Middleware parameters including context function or object. Context can be resolved dynamically by passing in a function which takes in the context at the time of sending a user op\n * @returns {Pick<ClientMiddlewareConfig, \"dummyPaymasterAndData\" | \"paymasterAndData\">} An object containing middleware functions `dummyPaymasterAndData` and `paymasterAndData` for processing user operations with the paymaster data\n */\nexport function erc7677Middleware<\n TContext extends Record<string, any> | undefined =\n | Record<string, any>\n | undefined,\n>(\n params?: Erc7677MiddlewareParams<TContext>,\n): Required<\n Pick<ClientMiddlewareConfig, \"dummyPaymasterAndData\" | \"paymasterAndData\">\n> {\n const dummyPaymasterAndData: ClientMiddlewareFn = async (\n uo,\n { client, account, feeOptions, overrides },\n ) => {\n const userOp = deepHexlify(await resolveProperties(uo));\n\n // Those values will be set after fee estimation.\n userOp.maxFeePerGas = \"0x0\";\n userOp.maxPriorityFeePerGas = \"0x0\";\n userOp.callGasLimit = \"0x0\";\n userOp.verificationGasLimit = \"0x0\";\n userOp.preVerificationGas = \"0x0\";\n\n const entrypoint = account.getEntryPoint();\n\n if (entrypoint.version === \"0.7.0\") {\n userOp.paymasterVerificationGasLimit = \"0x0\";\n userOp.paymasterPostOpGasLimit = \"0x0\";\n }\n\n const context =\n (typeof params?.context === \"function\"\n ? await params?.context(userOp, { overrides, feeOptions })\n : params?.context) ?? {};\n\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n\n const erc7677client = client as Erc7677Client;\n // TODO: probably need to handle the sponsor and isFinal fields\n const {\n paymaster,\n paymasterAndData,\n paymasterData,\n paymasterPostOpGasLimit,\n paymasterVerificationGasLimit,\n } = await erc7677client.request({\n method: \"pm_getPaymasterStubData\",\n params: [userOp, entrypoint.address, toHex(client.chain.id), context],\n });\n\n if (entrypoint.version === \"0.6.0\") {\n return {\n ...uo,\n paymasterAndData,\n };\n }\n\n return {\n ...uo,\n paymaster,\n paymasterData,\n paymasterPostOpGasLimit,\n paymasterVerificationGasLimit,\n };\n };\n\n const paymasterAndData: ClientMiddlewareFn = async (\n uo,\n { client, account, feeOptions, overrides },\n ) => {\n const userOp = deepHexlify(await resolveProperties(uo));\n const context =\n (typeof params?.context === \"function\"\n ? await params?.context(userOp, { overrides, feeOptions })\n : params?.context) ?? {};\n\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n\n const erc7677client = client as Erc7677Client;\n\n const entrypoint = account.getEntryPoint();\n const { paymaster, paymasterAndData, paymasterData } =\n await erc7677client.request({\n method: \"pm_getPaymasterData\",\n params: [userOp, entrypoint.address, toHex(client.chain.id), context],\n });\n\n if (entrypoint.version === \"0.6.0\") {\n return {\n ...uo,\n paymasterAndData,\n };\n }\n\n return {\n ...uo,\n paymaster,\n paymasterData,\n };\n };\n\n return {\n dummyPaymasterAndData,\n paymasterAndData,\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/middleware/types.ts"],"names":[],"mappings":";AAyDA,gCAAgC","sourcesContent":["import type {\n GetEntryPointFromAccount,\n SmartContractAccount,\n} from \"../account/smartContractAccount\";\nimport type { UserOperationContext } from \"../actions/smartAccount/types\";\nimport type {\n UserOperationFeeOptions,\n UserOperationOverrides,\n UserOperationStruct,\n} from \"../types\";\nimport type { Deferrable } from \"../utils\";\nimport type { MiddlewareClient } from \"./actions\";\n\nexport type ClientMiddlewareArgs<\n TAccount extends SmartContractAccount,\n C extends MiddlewareClient,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>\n> = {\n overrides?: UserOperationOverrides<TEntryPointVersion>;\n context?: TContext;\n feeOptions?: UserOperationFeeOptions;\n account: TAccount;\n client: C;\n};\n\n// [!region ClientMiddlewareFn]\nexport type ClientMiddlewareFn<\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n> = <\n TAccount extends SmartContractAccount,\n C extends MiddlewareClient,\n TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>\n>(\n struct: Deferrable<UserOperationStruct<TEntryPointVersion>>,\n args: ClientMiddlewareArgs<TAccount, C, TContext, TEntryPointVersion>\n) => Promise<Deferrable<UserOperationStruct<TEntryPointVersion>>>;\n// [!endregion ClientMiddlewareFn]\n\n// [!region ClientMiddleware]\nexport type ClientMiddleware<\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n> = {\n dummyPaymasterAndData: ClientMiddlewareFn<TContext>;\n feeEstimator: ClientMiddlewareFn<TContext>;\n gasEstimator: ClientMiddlewareFn<TContext>;\n customMiddleware: ClientMiddlewareFn<TContext>;\n paymasterAndData: ClientMiddlewareFn<TContext>;\n userOperationSimulator: ClientMiddlewareFn<TContext>;\n signUserOperation: ClientMiddlewareFn<TContext>;\n};\n// [!endregion ClientMiddleware]\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/middleware/types.ts"],"names":[],"mappings":";AA2DA,gCAAgC","sourcesContent":["import type {\n GetEntryPointFromAccount,\n SmartContractAccount,\n} from \"../account/smartContractAccount\";\nimport type { UserOperationContext } from \"../actions/smartAccount/types\";\nimport type {\n UserOperationFeeOptions,\n UserOperationOverrides,\n UserOperationStruct,\n} from \"../types\";\nimport type { Deferrable } from \"../utils\";\nimport type { MiddlewareClient } from \"./actions\";\n\nexport type ClientMiddlewareArgs<\n TAccount extends SmartContractAccount,\n C extends MiddlewareClient,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n TEntryPointVersion extends\n GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>,\n> = {\n overrides?: UserOperationOverrides<TEntryPointVersion>;\n context?: TContext;\n feeOptions?: UserOperationFeeOptions;\n account: TAccount;\n client: C;\n};\n\n// [!region ClientMiddlewareFn]\nexport type ClientMiddlewareFn<\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n> = <\n TAccount extends SmartContractAccount,\n C extends MiddlewareClient,\n TEntryPointVersion extends\n GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>,\n>(\n struct: Deferrable<UserOperationStruct<TEntryPointVersion>>,\n args: ClientMiddlewareArgs<TAccount, C, TContext, TEntryPointVersion>,\n) => Promise<Deferrable<UserOperationStruct<TEntryPointVersion>>>;\n// [!endregion ClientMiddlewareFn]\n\n// [!region ClientMiddleware]\nexport type ClientMiddleware<\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n> = {\n dummyPaymasterAndData: ClientMiddlewareFn<TContext>;\n feeEstimator: ClientMiddlewareFn<TContext>;\n gasEstimator: ClientMiddlewareFn<TContext>;\n customMiddleware: ClientMiddlewareFn<TContext>;\n paymasterAndData: ClientMiddlewareFn<TContext>;\n userOperationSimulator: ClientMiddlewareFn<TContext>;\n signUserOperation: ClientMiddlewareFn<TContext>;\n};\n// [!endregion ClientMiddleware]\n"]}
@@ -1,4 +1,4 @@
1
- import { type HDAccount, type HDOptions, type Hex, type LocalAccount, type PrivateKeyAccount, type SignableMessage, type SignedAuthorization, type TypedDataDefinition } from "viem";
1
+ import { type HDAccount, type HDOptions, type Hex, type LocalAccount, type PrivateKeyAccount, type SignableMessage, type SignedAuthorization, type TypedData, type TypedDataDefinition } from "viem";
2
2
  import type { AuthorizationRequest, SmartAccountSigner } from "./types.js";
3
3
  /**
4
4
  * Represents a local account signer and provides methods to sign messages and transactions, as well as static methods to create the signer from mnemonic or private key.
@@ -58,212 +58,7 @@ export declare class LocalAccountSigner<T extends HDAccount | PrivateKeyAccount
58
58
  * @param {TypedDataDefinition<TTypedData, TPrimaryType>} params The parameters defining the typed data and primary type
59
59
  * @returns {Promise<Hex>} A promise that resolves to the signed data in hexadecimal format
60
60
  */
61
- readonly signTypedData: <const TTypedData extends Record<string, unknown> | {
62
- [x: string]: readonly import("viem").TypedDataParameter[];
63
- [x: `string[${string}]`]: undefined;
64
- [x: `function[${string}]`]: undefined;
65
- [x: `uint256[${string}]`]: undefined;
66
- [x: `uint48[${string}]`]: undefined;
67
- [x: `bool[${string}]`]: undefined;
68
- [x: `bytes[${string}]`]: undefined;
69
- [x: `address[${string}]`]: undefined;
70
- [x: `bytes32[${string}]`]: undefined;
71
- [x: `uint32[${string}]`]: undefined;
72
- [x: `uint112[${string}]`]: undefined;
73
- [x: `uint192[${string}]`]: undefined;
74
- [x: `bytes4[${string}]`]: undefined;
75
- [x: `uint8[${string}]`]: undefined;
76
- [x: `uint64[${string}]`]: undefined;
77
- [x: `bytes6[${string}]`]: undefined;
78
- [x: `bytes2[${string}]`]: undefined;
79
- [x: `bytes1[${string}]`]: undefined;
80
- [x: `bytes5[${string}]`]: undefined;
81
- [x: `bytes3[${string}]`]: undefined;
82
- [x: `bytes7[${string}]`]: undefined;
83
- [x: `bytes11[${string}]`]: undefined;
84
- [x: `bytes8[${string}]`]: undefined;
85
- [x: `bytes9[${string}]`]: undefined;
86
- [x: `bytes10[${string}]`]: undefined;
87
- [x: `bytes25[${string}]`]: undefined;
88
- [x: `bytes12[${string}]`]: undefined;
89
- [x: `bytes13[${string}]`]: undefined;
90
- [x: `bytes14[${string}]`]: undefined;
91
- [x: `bytes15[${string}]`]: undefined;
92
- [x: `bytes16[${string}]`]: undefined;
93
- [x: `bytes17[${string}]`]: undefined;
94
- [x: `bytes18[${string}]`]: undefined;
95
- [x: `bytes19[${string}]`]: undefined;
96
- [x: `bytes20[${string}]`]: undefined;
97
- [x: `bytes21[${string}]`]: undefined;
98
- [x: `bytes22[${string}]`]: undefined;
99
- [x: `bytes23[${string}]`]: undefined;
100
- [x: `bytes24[${string}]`]: undefined;
101
- [x: `bytes26[${string}]`]: undefined;
102
- [x: `bytes27[${string}]`]: undefined;
103
- [x: `bytes28[${string}]`]: undefined;
104
- [x: `bytes29[${string}]`]: undefined;
105
- [x: `bytes30[${string}]`]: undefined;
106
- [x: `bytes31[${string}]`]: undefined;
107
- [x: `int[${string}]`]: undefined;
108
- [x: `int8[${string}]`]: undefined;
109
- [x: `int16[${string}]`]: undefined;
110
- [x: `int24[${string}]`]: undefined;
111
- [x: `int32[${string}]`]: undefined;
112
- [x: `int40[${string}]`]: undefined;
113
- [x: `int48[${string}]`]: undefined;
114
- [x: `int56[${string}]`]: undefined;
115
- [x: `int64[${string}]`]: undefined;
116
- [x: `int72[${string}]`]: undefined;
117
- [x: `int80[${string}]`]: undefined;
118
- [x: `int88[${string}]`]: undefined;
119
- [x: `int96[${string}]`]: undefined;
120
- [x: `int104[${string}]`]: undefined;
121
- [x: `int112[${string}]`]: undefined;
122
- [x: `int120[${string}]`]: undefined;
123
- [x: `int128[${string}]`]: undefined;
124
- [x: `int136[${string}]`]: undefined;
125
- [x: `int144[${string}]`]: undefined;
126
- [x: `int152[${string}]`]: undefined;
127
- [x: `int160[${string}]`]: undefined;
128
- [x: `int168[${string}]`]: undefined;
129
- [x: `int176[${string}]`]: undefined;
130
- [x: `int184[${string}]`]: undefined;
131
- [x: `int192[${string}]`]: undefined;
132
- [x: `int200[${string}]`]: undefined;
133
- [x: `int208[${string}]`]: undefined;
134
- [x: `int216[${string}]`]: undefined;
135
- [x: `int224[${string}]`]: undefined;
136
- [x: `int232[${string}]`]: undefined;
137
- [x: `int240[${string}]`]: undefined;
138
- [x: `int248[${string}]`]: undefined;
139
- [x: `int256[${string}]`]: undefined;
140
- [x: `uint[${string}]`]: undefined;
141
- [x: `uint16[${string}]`]: undefined;
142
- [x: `uint24[${string}]`]: undefined;
143
- [x: `uint40[${string}]`]: undefined;
144
- [x: `uint56[${string}]`]: undefined;
145
- [x: `uint72[${string}]`]: undefined;
146
- [x: `uint80[${string}]`]: undefined;
147
- [x: `uint88[${string}]`]: undefined;
148
- [x: `uint96[${string}]`]: undefined;
149
- [x: `uint104[${string}]`]: undefined;
150
- [x: `uint120[${string}]`]: undefined;
151
- [x: `uint128[${string}]`]: undefined;
152
- [x: `uint136[${string}]`]: undefined;
153
- [x: `uint144[${string}]`]: undefined;
154
- [x: `uint152[${string}]`]: undefined;
155
- [x: `uint160[${string}]`]: undefined;
156
- [x: `uint168[${string}]`]: undefined;
157
- [x: `uint176[${string}]`]: undefined;
158
- [x: `uint184[${string}]`]: undefined;
159
- [x: `uint200[${string}]`]: undefined;
160
- [x: `uint208[${string}]`]: undefined;
161
- [x: `uint216[${string}]`]: undefined;
162
- [x: `uint224[${string}]`]: undefined;
163
- [x: `uint232[${string}]`]: undefined;
164
- [x: `uint240[${string}]`]: undefined;
165
- [x: `uint248[${string}]`]: undefined;
166
- string?: undefined;
167
- uint256?: undefined;
168
- uint48?: undefined;
169
- bool?: undefined;
170
- bytes?: undefined;
171
- address?: undefined;
172
- bytes32?: undefined;
173
- uint32?: undefined;
174
- uint112?: undefined;
175
- uint192?: undefined;
176
- bytes4?: undefined;
177
- uint8?: undefined;
178
- uint64?: undefined;
179
- bytes6?: undefined;
180
- bytes2?: undefined;
181
- bytes1?: undefined;
182
- bytes5?: undefined;
183
- bytes3?: undefined;
184
- bytes7?: undefined;
185
- bytes11?: undefined;
186
- bytes8?: undefined;
187
- bytes9?: undefined;
188
- bytes10?: undefined;
189
- bytes25?: undefined;
190
- bytes12?: undefined;
191
- bytes13?: undefined;
192
- bytes14?: undefined;
193
- bytes15?: undefined;
194
- bytes16?: undefined;
195
- bytes17?: undefined;
196
- bytes18?: undefined;
197
- bytes19?: undefined;
198
- bytes20?: undefined;
199
- bytes21?: undefined;
200
- bytes22?: undefined;
201
- bytes23?: undefined;
202
- bytes24?: undefined;
203
- bytes26?: undefined;
204
- bytes27?: undefined;
205
- bytes28?: undefined;
206
- bytes29?: undefined;
207
- bytes30?: undefined;
208
- bytes31?: undefined;
209
- int8?: undefined;
210
- int16?: undefined;
211
- int24?: undefined;
212
- int32?: undefined;
213
- int40?: undefined;
214
- int48?: undefined;
215
- int56?: undefined;
216
- int64?: undefined;
217
- int72?: undefined;
218
- int80?: undefined;
219
- int88?: undefined;
220
- int96?: undefined;
221
- int104?: undefined;
222
- int112?: undefined;
223
- int120?: undefined;
224
- int128?: undefined;
225
- int136?: undefined;
226
- int144?: undefined;
227
- int152?: undefined;
228
- int160?: undefined;
229
- int168?: undefined;
230
- int176?: undefined;
231
- int184?: undefined;
232
- int192?: undefined;
233
- int200?: undefined;
234
- int208?: undefined;
235
- int216?: undefined;
236
- int224?: undefined;
237
- int232?: undefined;
238
- int240?: undefined;
239
- int248?: undefined;
240
- int256?: undefined;
241
- uint16?: undefined;
242
- uint24?: undefined;
243
- uint40?: undefined;
244
- uint56?: undefined;
245
- uint72?: undefined;
246
- uint80?: undefined;
247
- uint88?: undefined;
248
- uint96?: undefined;
249
- uint104?: undefined;
250
- uint120?: undefined;
251
- uint128?: undefined;
252
- uint136?: undefined;
253
- uint144?: undefined;
254
- uint152?: undefined;
255
- uint160?: undefined;
256
- uint168?: undefined;
257
- uint176?: undefined;
258
- uint184?: undefined;
259
- uint200?: undefined;
260
- uint208?: undefined;
261
- uint216?: undefined;
262
- uint224?: undefined;
263
- uint232?: undefined;
264
- uint240?: undefined;
265
- uint248?: undefined;
266
- }, TPrimaryType extends "EIP712Domain" | keyof TTypedData = keyof TTypedData>(params: TypedDataDefinition<TTypedData, TPrimaryType>) => Promise<Hex>;
61
+ readonly signTypedData: <const TTypedData extends TypedData | Record<string, unknown>, TPrimaryType extends keyof TTypedData | "EIP712Domain" = keyof TTypedData>(params: TypedDataDefinition<TTypedData, TPrimaryType>) => Promise<Hex>;
267
62
  /**
268
63
  * Signs an unsigned authorization using the provided private key account.
269
64
  *
@@ -1 +1 @@
1
- {"version":3,"file":"local-account.js","sourceRoot":"","sources":["../../../src/signer/local-account.ts"],"names":[],"mappings":"AAAA,OAAO,EAUN,MAAM,MAAM,CAAC;AACd,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,eAAe,CAAC;AAGvB;;GAEG;AACH,MAAM,OAAO,kBAAkB;IAO7B;;;;;;;;;;;;;;OAcG;IACH,YAAY,KAAQ;QAlBpB;;;;;WAAS;QACT;;;;;WAAmB;QAsBnB;;;;;;;;;;;;;;WAcG;QACM;;;;mBAAoE,CAC3E,OAAO,EACP,EAAE;gBACF,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;YAC7C,CAAC;WAAC;QAEF;;;;;;;;;;;;;;;;;;;WAmBG;QACM;;;;mBAAgB,KAAK,EAI5B,MAAqD,EACvC,EAAE;gBAChB,OAAO,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;YAC1C,CAAC;WAAC;QA6BF;;;;;;;;;;;;;WAaG;QACM;;;;mBAAa,KAAK,IAA4B,EAAE;gBACvD,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;YAC5B,CAAC;WAAC;QAjGA,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,iBAAiB;IACjD,CAAC;IAoDD;;;;;;;;;;;;;;;;;;OAkBG;IAEH,iBAAiB,CAEf,qBAAmD;QAEnD,OAAO,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,qBAAqB,CAAC,CAAC;IAC7D,CAAC;IAoBD;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,uBAAuB,CAC5B,GAAW,EACX,IAAgB;QAEhB,MAAM,MAAM,GAAG,iBAAiB,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QAC5C,OAAO,IAAI,kBAAkB,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,yBAAyB,CAC9B,GAAQ;QAER,MAAM,MAAM,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC;QACxC,OAAO,IAAI,kBAAkB,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;IAED;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,wBAAwB;QAC7B,MAAM,MAAM,GAAG,mBAAmB,CAAC,kBAAkB,EAAE,CAAC,CAAC;QACzD,OAAO,IAAI,kBAAkB,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;CACF","sourcesContent":["import {\n type HDAccount,\n type HDOptions,\n type Hex,\n type LocalAccount,\n type PrivateKeyAccount,\n type SignableMessage,\n type SignedAuthorization,\n type TypedData,\n type TypedDataDefinition,\n} from \"viem\";\nimport {\n generatePrivateKey,\n mnemonicToAccount,\n privateKeyToAccount,\n} from \"viem/accounts\";\nimport type { AuthorizationRequest, SmartAccountSigner } from \"./types.js\";\n\n/**\n * Represents a local account signer and provides methods to sign messages and transactions, as well as static methods to create the signer from mnemonic or private key.\n */\nexport class LocalAccountSigner<\n T extends HDAccount | PrivateKeyAccount | LocalAccount\n> implements SmartAccountSigner<T>\n{\n inner: T;\n signerType: string;\n\n /**\n * A function to initialize an object with an inner parameter and derive a signerType from it.\n *\n * @example\n * ```ts\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { privateKeyToAccount, generatePrivateKey } from \"viem\";\n *\n * const signer = new LocalAccountSigner(\n * privateKeyToAccount(generatePrivateKey()),\n * );\n * ```\n *\n * @param {T} inner The inner parameter containing the necessary data\n */\n constructor(inner: T) {\n this.inner = inner;\n this.signerType = inner.type; // type: \"local\"\n }\n\n /**\n * Signs the provided message using the inner signMessage function.\n *\n * @example\n * ```ts\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { generatePrivateKey } from \"viem\";\n *\n * const signer = LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey());\n * const signature = await signer.signMessage(\"Hello, world!\");\n * ```\n *\n * @param {string} message The message to be signed\n * @returns {Promise<any>} A promise that resolves to the signed message\n */\n readonly signMessage: (message: SignableMessage) => Promise<`0x${string}`> = (\n message\n ) => {\n return this.inner.signMessage({ message });\n };\n\n /**\n * Signs typed data using the given parameters.\n *\n * @example\n * ```ts\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { generatePrivateKey } from \"viem\";\n *\n * const signer = LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey());\n * const signature = await signer.signTypedData({\n * domain: {},\n * types: {},\n * primaryType: \"\",\n * message: {},\n * });\n * ```\n *\n * @param {TypedDataDefinition<TTypedData, TPrimaryType>} params The parameters defining the typed data and primary type\n * @returns {Promise<Hex>} A promise that resolves to the signed data in hexadecimal format\n */\n readonly signTypedData = async <\n const TTypedData extends TypedData | Record<string, unknown>,\n TPrimaryType extends keyof TTypedData | \"EIP712Domain\" = keyof TTypedData\n >(\n params: TypedDataDefinition<TTypedData, TPrimaryType>\n ): Promise<Hex> => {\n return this.inner.signTypedData(params);\n };\n\n /**\n * Signs an unsigned authorization using the provided private key account.\n *\n * @example\n * ```ts twoslash\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { generatePrivateKey } from \"viem/accounts\";\n *\n * const signer = LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey());\n * const signedAuthorization = await signer.signAuthorization({\n * contractAddress: \"0x1234123412341234123412341234123412341234\",\n * chainId: 1,\n * nonce: 3,\n * });\n * ```\n *\n * @param {AuthorizationRequest<number>} unsignedAuthorization - The unsigned authorization to be signed.\n * @returns {Promise<SignedAuthorization<number>>} A promise that resolves to the signed authorization.\n */\n\n signAuthorization(\n this: LocalAccountSigner<PrivateKeyAccount>,\n unsignedAuthorization: AuthorizationRequest<number>\n ): Promise<SignedAuthorization<number>> {\n return this.inner.signAuthorization(unsignedAuthorization);\n }\n\n /**\n * Returns the address of the inner object in a specific hexadecimal format.\n *\n * @example\n * ```ts\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { generatePrivateKey } from \"viem\";\n *\n * const signer = LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey());\n * const address = await signer.getAddress();\n * ```\n *\n * @returns {Promise<Hex>} A promise that resolves to the address in the format `0x{string}`\n */\n readonly getAddress = async (): Promise<`0x${string}`> => {\n return this.inner.address;\n };\n\n /**\n * Creates a LocalAccountSigner using the provided mnemonic key and optional HD options.\n *\n * @example\n * ```ts\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { generateMnemonic } from \"viem\";\n *\n * const signer = LocalAccountSigner.mnemonicToAccountSigner(generateMnemonic());\n * ```\n *\n * @param {string} key The mnemonic key to derive the account from.\n * @param {HDOptions} [opts] Optional HD options for deriving the account.\n * @returns {LocalAccountSigner<HDAccount>} A LocalAccountSigner object for the derived account.\n */\n static mnemonicToAccountSigner(\n key: string,\n opts?: HDOptions\n ): LocalAccountSigner<HDAccount> {\n const signer = mnemonicToAccount(key, opts);\n return new LocalAccountSigner(signer);\n }\n\n /**\n * Creates a `LocalAccountSigner` instance using the provided private key.\n *\n * @example\n * ```ts\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { generatePrivateKey } from \"viem\";\n *\n * const signer = LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey());\n * ```\n *\n * @param {Hex} key The private key in hexadecimal format\n * @returns {LocalAccountSigner<PrivateKeyAccount>} An instance of `LocalAccountSigner` initialized with the provided private key\n */\n static privateKeyToAccountSigner(\n key: Hex\n ): LocalAccountSigner<PrivateKeyAccount> {\n const signer = privateKeyToAccount(key);\n return new LocalAccountSigner(signer);\n }\n\n /**\n * Generates a new private key and creates a `LocalAccountSigner` for a `PrivateKeyAccount`.\n *\n * @example\n * ```ts\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n *\n * const signer = LocalAccountSigner.generatePrivateKeySigner();\n * ```\n *\n * @returns {LocalAccountSigner<PrivateKeyAccount>} A `LocalAccountSigner` instance initialized with the generated private key account\n */\n static generatePrivateKeySigner(): LocalAccountSigner<PrivateKeyAccount> {\n const signer = privateKeyToAccount(generatePrivateKey());\n return new LocalAccountSigner(signer);\n }\n}\n"]}
1
+ {"version":3,"file":"local-account.js","sourceRoot":"","sources":["../../../src/signer/local-account.ts"],"names":[],"mappings":"AAAA,OAAO,EAUN,MAAM,MAAM,CAAC;AACd,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,eAAe,CAAC;AAGvB;;GAEG;AACH,MAAM,OAAO,kBAAkB;IAO7B;;;;;;;;;;;;;;OAcG;IACH,YAAY,KAAQ;QAlBpB;;;;;WAAS;QACT;;;;;WAAmB;QAsBnB;;;;;;;;;;;;;;WAcG;QACM;;;;mBAAoE,CAC3E,OAAO,EACP,EAAE;gBACF,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;YAC7C,CAAC;WAAC;QAEF;;;;;;;;;;;;;;;;;;;WAmBG;QACM;;;;mBAAgB,KAAK,EAI5B,MAAqD,EACvC,EAAE;gBAChB,OAAO,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;YAC1C,CAAC;WAAC;QA6BF;;;;;;;;;;;;;WAaG;QACM;;;;mBAAa,KAAK,IAA4B,EAAE;gBACvD,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;YAC5B,CAAC;WAAC;QAjGA,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,iBAAiB;IACjD,CAAC;IAoDD;;;;;;;;;;;;;;;;;;OAkBG;IAEH,iBAAiB,CAEf,qBAAmD;QAEnD,OAAO,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,qBAAqB,CAAC,CAAC;IAC7D,CAAC;IAoBD;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,uBAAuB,CAC5B,GAAW,EACX,IAAgB;QAEhB,MAAM,MAAM,GAAG,iBAAiB,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QAC5C,OAAO,IAAI,kBAAkB,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,yBAAyB,CAC9B,GAAQ;QAER,MAAM,MAAM,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC;QACxC,OAAO,IAAI,kBAAkB,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;IAED;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,wBAAwB;QAC7B,MAAM,MAAM,GAAG,mBAAmB,CAAC,kBAAkB,EAAE,CAAC,CAAC;QACzD,OAAO,IAAI,kBAAkB,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;CACF","sourcesContent":["import {\n type HDAccount,\n type HDOptions,\n type Hex,\n type LocalAccount,\n type PrivateKeyAccount,\n type SignableMessage,\n type SignedAuthorization,\n type TypedData,\n type TypedDataDefinition,\n} from \"viem\";\nimport {\n generatePrivateKey,\n mnemonicToAccount,\n privateKeyToAccount,\n} from \"viem/accounts\";\nimport type { AuthorizationRequest, SmartAccountSigner } from \"./types.js\";\n\n/**\n * Represents a local account signer and provides methods to sign messages and transactions, as well as static methods to create the signer from mnemonic or private key.\n */\nexport class LocalAccountSigner<\n T extends HDAccount | PrivateKeyAccount | LocalAccount,\n> implements SmartAccountSigner<T>\n{\n inner: T;\n signerType: string;\n\n /**\n * A function to initialize an object with an inner parameter and derive a signerType from it.\n *\n * @example\n * ```ts\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { privateKeyToAccount, generatePrivateKey } from \"viem\";\n *\n * const signer = new LocalAccountSigner(\n * privateKeyToAccount(generatePrivateKey()),\n * );\n * ```\n *\n * @param {T} inner The inner parameter containing the necessary data\n */\n constructor(inner: T) {\n this.inner = inner;\n this.signerType = inner.type; // type: \"local\"\n }\n\n /**\n * Signs the provided message using the inner signMessage function.\n *\n * @example\n * ```ts\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { generatePrivateKey } from \"viem\";\n *\n * const signer = LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey());\n * const signature = await signer.signMessage(\"Hello, world!\");\n * ```\n *\n * @param {string} message The message to be signed\n * @returns {Promise<any>} A promise that resolves to the signed message\n */\n readonly signMessage: (message: SignableMessage) => Promise<`0x${string}`> = (\n message,\n ) => {\n return this.inner.signMessage({ message });\n };\n\n /**\n * Signs typed data using the given parameters.\n *\n * @example\n * ```ts\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { generatePrivateKey } from \"viem\";\n *\n * const signer = LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey());\n * const signature = await signer.signTypedData({\n * domain: {},\n * types: {},\n * primaryType: \"\",\n * message: {},\n * });\n * ```\n *\n * @param {TypedDataDefinition<TTypedData, TPrimaryType>} params The parameters defining the typed data and primary type\n * @returns {Promise<Hex>} A promise that resolves to the signed data in hexadecimal format\n */\n readonly signTypedData = async <\n const TTypedData extends TypedData | Record<string, unknown>,\n TPrimaryType extends keyof TTypedData | \"EIP712Domain\" = keyof TTypedData,\n >(\n params: TypedDataDefinition<TTypedData, TPrimaryType>,\n ): Promise<Hex> => {\n return this.inner.signTypedData(params);\n };\n\n /**\n * Signs an unsigned authorization using the provided private key account.\n *\n * @example\n * ```ts twoslash\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { generatePrivateKey } from \"viem/accounts\";\n *\n * const signer = LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey());\n * const signedAuthorization = await signer.signAuthorization({\n * contractAddress: \"0x1234123412341234123412341234123412341234\",\n * chainId: 1,\n * nonce: 3,\n * });\n * ```\n *\n * @param {AuthorizationRequest<number>} unsignedAuthorization - The unsigned authorization to be signed.\n * @returns {Promise<SignedAuthorization<number>>} A promise that resolves to the signed authorization.\n */\n\n signAuthorization(\n this: LocalAccountSigner<PrivateKeyAccount>,\n unsignedAuthorization: AuthorizationRequest<number>,\n ): Promise<SignedAuthorization<number>> {\n return this.inner.signAuthorization(unsignedAuthorization);\n }\n\n /**\n * Returns the address of the inner object in a specific hexadecimal format.\n *\n * @example\n * ```ts\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { generatePrivateKey } from \"viem\";\n *\n * const signer = LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey());\n * const address = await signer.getAddress();\n * ```\n *\n * @returns {Promise<Hex>} A promise that resolves to the address in the format `0x{string}`\n */\n readonly getAddress = async (): Promise<`0x${string}`> => {\n return this.inner.address;\n };\n\n /**\n * Creates a LocalAccountSigner using the provided mnemonic key and optional HD options.\n *\n * @example\n * ```ts\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { generateMnemonic } from \"viem\";\n *\n * const signer = LocalAccountSigner.mnemonicToAccountSigner(generateMnemonic());\n * ```\n *\n * @param {string} key The mnemonic key to derive the account from.\n * @param {HDOptions} [opts] Optional HD options for deriving the account.\n * @returns {LocalAccountSigner<HDAccount>} A LocalAccountSigner object for the derived account.\n */\n static mnemonicToAccountSigner(\n key: string,\n opts?: HDOptions,\n ): LocalAccountSigner<HDAccount> {\n const signer = mnemonicToAccount(key, opts);\n return new LocalAccountSigner(signer);\n }\n\n /**\n * Creates a `LocalAccountSigner` instance using the provided private key.\n *\n * @example\n * ```ts\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { generatePrivateKey } from \"viem\";\n *\n * const signer = LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey());\n * ```\n *\n * @param {Hex} key The private key in hexadecimal format\n * @returns {LocalAccountSigner<PrivateKeyAccount>} An instance of `LocalAccountSigner` initialized with the provided private key\n */\n static privateKeyToAccountSigner(\n key: Hex,\n ): LocalAccountSigner<PrivateKeyAccount> {\n const signer = privateKeyToAccount(key);\n return new LocalAccountSigner(signer);\n }\n\n /**\n * Generates a new private key and creates a `LocalAccountSigner` for a `PrivateKeyAccount`.\n *\n * @example\n * ```ts\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n *\n * const signer = LocalAccountSigner.generatePrivateKeySigner();\n * ```\n *\n * @returns {LocalAccountSigner<PrivateKeyAccount>} A `LocalAccountSigner` instance initialized with the generated private key account\n */\n static generatePrivateKeySigner(): LocalAccountSigner<PrivateKeyAccount> {\n const signer = privateKeyToAccount(generatePrivateKey());\n return new LocalAccountSigner(signer);\n }\n}\n"]}
@@ -14,5 +14,5 @@ import type { SmartAccountSigner } from "./types";
14
14
  * @param {any} signer the object to check
15
15
  * @returns {boolean} A boolean indicating whether the object is a `SmartAccountSigner`
16
16
  */
17
- export declare const isSigner: (signer: any) => signer is SmartAccountSigner<any>;
17
+ export declare const isSigner: (signer: any) => signer is SmartAccountSigner;
18
18
  export declare const SignerSchema: z.ZodType<SmartAccountSigner<any>, z.ZodTypeDef, SmartAccountSigner<any>>;
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/signer/types.ts"],"names":[],"mappings":";AAkEA,kCAAkC","sourcesContent":["import type { Address } from \"abitype\";\nimport type {\n Hex,\n OneOf,\n SignableMessage,\n TypedData,\n TypedDataDefinition,\n SignedAuthorization,\n} from \"viem\";\n\n// [!region SmartAccountAuthenticator]\n/**\n * Extends the @interface SmartAccountSigner interface with authentication.\n *\n * @template AuthParams - the generic type of the authentication parameters\n * @template AuthDetails - the generic type of the authentication details\n * @template Inner - the generic type of the inner client that the signer wraps to provide functionality such as signing, etc.\n */\nexport interface SmartAccountAuthenticator<AuthParams, AuthDetails, Inner = any>\n extends SmartAccountSigner<Inner> {\n authenticate: (params: AuthParams) => Promise<AuthDetails>;\n\n getAuthDetails: () => Promise<AuthDetails>;\n}\n// [!endregion SmartAccountAuthenticator]\n\n// [!region SmartAccountSigner]\n// TODO: This is a temporary type to be removed when viem is updated\nexport type AuthorizationRequest<uint32 = number> = OneOf<\n | {\n address: Address;\n }\n | {\n contractAddress: Address;\n }\n> & {\n /** Chain ID. */\n chainId: uint32;\n /** Nonce of the EOA to delegate to. */\n nonce: uint32;\n};\n\n/**\n * A signer that can sign messages and typed data.\n *\n * @template Inner - the generic type of the inner client that the signer wraps to provide functionality such as signing, etc.\n */\nexport interface SmartAccountSigner<Inner = any> {\n signerType: string;\n inner: Inner;\n\n getAddress: () => Promise<Address>;\n\n signMessage: (message: SignableMessage) => Promise<Hex>;\n\n signTypedData: <\n const TTypedData extends TypedData | Record<string, unknown>,\n TPrimaryType extends keyof TTypedData | \"EIP712Domain\" = keyof TTypedData\n >(\n params: TypedDataDefinition<TTypedData, TPrimaryType>\n ) => Promise<Hex>;\n\n signAuthorization?: (\n unsignedAuthorization: AuthorizationRequest<number>\n ) => Promise<SignedAuthorization<number>>;\n}\n// [!endregion SmartAccountSigner]\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/signer/types.ts"],"names":[],"mappings":";AAkEA,kCAAkC","sourcesContent":["import type { Address } from \"abitype\";\nimport type {\n Hex,\n OneOf,\n SignableMessage,\n TypedData,\n TypedDataDefinition,\n SignedAuthorization,\n} from \"viem\";\n\n// [!region SmartAccountAuthenticator]\n/**\n * Extends the @interface SmartAccountSigner interface with authentication.\n *\n * @template AuthParams - the generic type of the authentication parameters\n * @template AuthDetails - the generic type of the authentication details\n * @template Inner - the generic type of the inner client that the signer wraps to provide functionality such as signing, etc.\n */\nexport interface SmartAccountAuthenticator<AuthParams, AuthDetails, Inner = any>\n extends SmartAccountSigner<Inner> {\n authenticate: (params: AuthParams) => Promise<AuthDetails>;\n\n getAuthDetails: () => Promise<AuthDetails>;\n}\n// [!endregion SmartAccountAuthenticator]\n\n// [!region SmartAccountSigner]\n// TODO: This is a temporary type to be removed when viem is updated\nexport type AuthorizationRequest<uint32 = number> = OneOf<\n | {\n address: Address;\n }\n | {\n contractAddress: Address;\n }\n> & {\n /** Chain ID. */\n chainId: uint32;\n /** Nonce of the EOA to delegate to. */\n nonce: uint32;\n};\n\n/**\n * A signer that can sign messages and typed data.\n *\n * @template Inner - the generic type of the inner client that the signer wraps to provide functionality such as signing, etc.\n */\nexport interface SmartAccountSigner<Inner = any> {\n signerType: string;\n inner: Inner;\n\n getAddress: () => Promise<Address>;\n\n signMessage: (message: SignableMessage) => Promise<Hex>;\n\n signTypedData: <\n const TTypedData extends TypedData | Record<string, unknown>,\n TPrimaryType extends keyof TTypedData | \"EIP712Domain\" = keyof TTypedData,\n >(\n params: TypedDataDefinition<TTypedData, TPrimaryType>,\n ) => Promise<Hex>;\n\n signAuthorization?: (\n unsignedAuthorization: AuthorizationRequest<number>,\n ) => Promise<SignedAuthorization<number>>;\n}\n// [!endregion SmartAccountSigner]\n"]}
@@ -1,4 +1,4 @@
1
- import { type Hex, type SignableMessage, type TypedDataDefinition, type WalletClient } from "viem";
1
+ import { type Hex, type SignableMessage, type TypedData, type TypedDataDefinition, type WalletClient } from "viem";
2
2
  import type { SmartAccountSigner } from "./types";
3
3
  /**
4
4
  * Represents a wallet client signer for smart accounts, providing methods to get the address, sign messages, and sign typed data.
@@ -98,210 +98,5 @@ export declare class WalletClientSigner implements SmartAccountSigner<WalletClie
98
98
  * @param {TypedDataDefinition<TTypedData, TPrimaryType>} typedData The typed data to be signed
99
99
  * @returns {Promise<Hex>} A promise that resolves to a hex string representing the signed data
100
100
  */
101
- signTypedData: <const TTypedData extends Record<string, unknown> | {
102
- [x: string]: readonly import("viem").TypedDataParameter[];
103
- [x: `string[${string}]`]: undefined;
104
- [x: `function[${string}]`]: undefined;
105
- [x: `uint256[${string}]`]: undefined;
106
- [x: `uint48[${string}]`]: undefined;
107
- [x: `bool[${string}]`]: undefined;
108
- [x: `bytes[${string}]`]: undefined;
109
- [x: `address[${string}]`]: undefined;
110
- [x: `bytes32[${string}]`]: undefined;
111
- [x: `uint32[${string}]`]: undefined;
112
- [x: `uint112[${string}]`]: undefined;
113
- [x: `uint192[${string}]`]: undefined;
114
- [x: `bytes4[${string}]`]: undefined;
115
- [x: `uint8[${string}]`]: undefined;
116
- [x: `uint64[${string}]`]: undefined;
117
- [x: `bytes6[${string}]`]: undefined;
118
- [x: `bytes2[${string}]`]: undefined;
119
- [x: `bytes1[${string}]`]: undefined;
120
- [x: `bytes5[${string}]`]: undefined;
121
- [x: `bytes3[${string}]`]: undefined;
122
- [x: `bytes7[${string}]`]: undefined;
123
- [x: `bytes11[${string}]`]: undefined;
124
- [x: `bytes8[${string}]`]: undefined;
125
- [x: `bytes9[${string}]`]: undefined;
126
- [x: `bytes10[${string}]`]: undefined;
127
- [x: `bytes25[${string}]`]: undefined;
128
- [x: `bytes12[${string}]`]: undefined;
129
- [x: `bytes13[${string}]`]: undefined;
130
- [x: `bytes14[${string}]`]: undefined;
131
- [x: `bytes15[${string}]`]: undefined;
132
- [x: `bytes16[${string}]`]: undefined;
133
- [x: `bytes17[${string}]`]: undefined;
134
- [x: `bytes18[${string}]`]: undefined;
135
- [x: `bytes19[${string}]`]: undefined;
136
- [x: `bytes20[${string}]`]: undefined;
137
- [x: `bytes21[${string}]`]: undefined;
138
- [x: `bytes22[${string}]`]: undefined;
139
- [x: `bytes23[${string}]`]: undefined;
140
- [x: `bytes24[${string}]`]: undefined;
141
- [x: `bytes26[${string}]`]: undefined;
142
- [x: `bytes27[${string}]`]: undefined;
143
- [x: `bytes28[${string}]`]: undefined;
144
- [x: `bytes29[${string}]`]: undefined;
145
- [x: `bytes30[${string}]`]: undefined;
146
- [x: `bytes31[${string}]`]: undefined;
147
- [x: `int[${string}]`]: undefined;
148
- [x: `int8[${string}]`]: undefined;
149
- [x: `int16[${string}]`]: undefined;
150
- [x: `int24[${string}]`]: undefined;
151
- [x: `int32[${string}]`]: undefined;
152
- [x: `int40[${string}]`]: undefined;
153
- [x: `int48[${string}]`]: undefined;
154
- [x: `int56[${string}]`]: undefined;
155
- [x: `int64[${string}]`]: undefined;
156
- [x: `int72[${string}]`]: undefined;
157
- [x: `int80[${string}]`]: undefined;
158
- [x: `int88[${string}]`]: undefined;
159
- [x: `int96[${string}]`]: undefined;
160
- [x: `int104[${string}]`]: undefined;
161
- [x: `int112[${string}]`]: undefined;
162
- [x: `int120[${string}]`]: undefined;
163
- [x: `int128[${string}]`]: undefined;
164
- [x: `int136[${string}]`]: undefined;
165
- [x: `int144[${string}]`]: undefined;
166
- [x: `int152[${string}]`]: undefined;
167
- [x: `int160[${string}]`]: undefined;
168
- [x: `int168[${string}]`]: undefined;
169
- [x: `int176[${string}]`]: undefined;
170
- [x: `int184[${string}]`]: undefined;
171
- [x: `int192[${string}]`]: undefined;
172
- [x: `int200[${string}]`]: undefined;
173
- [x: `int208[${string}]`]: undefined;
174
- [x: `int216[${string}]`]: undefined;
175
- [x: `int224[${string}]`]: undefined;
176
- [x: `int232[${string}]`]: undefined;
177
- [x: `int240[${string}]`]: undefined;
178
- [x: `int248[${string}]`]: undefined;
179
- [x: `int256[${string}]`]: undefined;
180
- [x: `uint[${string}]`]: undefined;
181
- [x: `uint16[${string}]`]: undefined;
182
- [x: `uint24[${string}]`]: undefined;
183
- [x: `uint40[${string}]`]: undefined;
184
- [x: `uint56[${string}]`]: undefined;
185
- [x: `uint72[${string}]`]: undefined;
186
- [x: `uint80[${string}]`]: undefined;
187
- [x: `uint88[${string}]`]: undefined;
188
- [x: `uint96[${string}]`]: undefined;
189
- [x: `uint104[${string}]`]: undefined;
190
- [x: `uint120[${string}]`]: undefined;
191
- [x: `uint128[${string}]`]: undefined;
192
- [x: `uint136[${string}]`]: undefined;
193
- [x: `uint144[${string}]`]: undefined;
194
- [x: `uint152[${string}]`]: undefined;
195
- [x: `uint160[${string}]`]: undefined;
196
- [x: `uint168[${string}]`]: undefined;
197
- [x: `uint176[${string}]`]: undefined;
198
- [x: `uint184[${string}]`]: undefined;
199
- [x: `uint200[${string}]`]: undefined;
200
- [x: `uint208[${string}]`]: undefined;
201
- [x: `uint216[${string}]`]: undefined;
202
- [x: `uint224[${string}]`]: undefined;
203
- [x: `uint232[${string}]`]: undefined;
204
- [x: `uint240[${string}]`]: undefined;
205
- [x: `uint248[${string}]`]: undefined;
206
- string?: undefined;
207
- uint256?: undefined;
208
- uint48?: undefined;
209
- bool?: undefined;
210
- bytes?: undefined;
211
- address?: undefined;
212
- bytes32?: undefined;
213
- uint32?: undefined;
214
- uint112?: undefined;
215
- uint192?: undefined;
216
- bytes4?: undefined;
217
- uint8?: undefined;
218
- uint64?: undefined;
219
- bytes6?: undefined;
220
- bytes2?: undefined;
221
- bytes1?: undefined;
222
- bytes5?: undefined;
223
- bytes3?: undefined;
224
- bytes7?: undefined;
225
- bytes11?: undefined;
226
- bytes8?: undefined;
227
- bytes9?: undefined;
228
- bytes10?: undefined;
229
- bytes25?: undefined;
230
- bytes12?: undefined;
231
- bytes13?: undefined;
232
- bytes14?: undefined;
233
- bytes15?: undefined;
234
- bytes16?: undefined;
235
- bytes17?: undefined;
236
- bytes18?: undefined;
237
- bytes19?: undefined;
238
- bytes20?: undefined;
239
- bytes21?: undefined;
240
- bytes22?: undefined;
241
- bytes23?: undefined;
242
- bytes24?: undefined;
243
- bytes26?: undefined;
244
- bytes27?: undefined;
245
- bytes28?: undefined;
246
- bytes29?: undefined;
247
- bytes30?: undefined;
248
- bytes31?: undefined;
249
- int8?: undefined;
250
- int16?: undefined;
251
- int24?: undefined;
252
- int32?: undefined;
253
- int40?: undefined;
254
- int48?: undefined;
255
- int56?: undefined;
256
- int64?: undefined;
257
- int72?: undefined;
258
- int80?: undefined;
259
- int88?: undefined;
260
- int96?: undefined;
261
- int104?: undefined;
262
- int112?: undefined;
263
- int120?: undefined;
264
- int128?: undefined;
265
- int136?: undefined;
266
- int144?: undefined;
267
- int152?: undefined;
268
- int160?: undefined;
269
- int168?: undefined;
270
- int176?: undefined;
271
- int184?: undefined;
272
- int192?: undefined;
273
- int200?: undefined;
274
- int208?: undefined;
275
- int216?: undefined;
276
- int224?: undefined;
277
- int232?: undefined;
278
- int240?: undefined;
279
- int248?: undefined;
280
- int256?: undefined;
281
- uint16?: undefined;
282
- uint24?: undefined;
283
- uint40?: undefined;
284
- uint56?: undefined;
285
- uint72?: undefined;
286
- uint80?: undefined;
287
- uint88?: undefined;
288
- uint96?: undefined;
289
- uint104?: undefined;
290
- uint120?: undefined;
291
- uint128?: undefined;
292
- uint136?: undefined;
293
- uint144?: undefined;
294
- uint152?: undefined;
295
- uint160?: undefined;
296
- uint168?: undefined;
297
- uint176?: undefined;
298
- uint184?: undefined;
299
- uint200?: undefined;
300
- uint208?: undefined;
301
- uint216?: undefined;
302
- uint224?: undefined;
303
- uint232?: undefined;
304
- uint240?: undefined;
305
- uint248?: undefined;
306
- }, TPrimaryType extends string | keyof TTypedData = string>(typedData: TypedDataDefinition<TTypedData, TPrimaryType>) => Promise<Hex>;
101
+ signTypedData: <const TTypedData extends TypedData | Record<string, unknown>, TPrimaryType extends keyof TTypedData | "EIP712Domain" | string = string>(typedData: TypedDataDefinition<TTypedData, TPrimaryType>) => Promise<Hex>;
307
102
  }
@@ -1 +1 @@
1
- {"version":3,"file":"wallet-client.js","sourceRoot":"","sources":["../../../src/signer/wallet-client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,GAMX,MAAM,MAAM,CAAC;AAGd,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAG7D;;GAEG;AACH,MAAM,OAAO,kBAAkB;IAI7B;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,YAAY,MAAoB,EAAE,UAAkB;QAxBpD;;;;;WAAmB;QACnB;;;;;WAAoB;QA+BpB;;;;;;;;;;;;;;;;;;;WAmBG;QACH;;;;mBAA2C,KAAK,IAAI,EAAE;gBACpD,IAAI,SAAS,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC;gBAChD,OAAO,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;YAClC,CAAC;WAAC;QAEF;;;;;;;;;;;;;;;;;;;;WAoBG;QACM;;;;mBACP,KAAK,EAAE,OAAO,EAAE,EAAE;gBAChB,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;gBAEhE,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;YACtD,CAAC;WAAC;QAEJ;;;;;;;;;;;;;;;;;;;;;;;;;;WA0BG;QACH;;;;mBAAgB,KAAK,EAInB,SAAwD,EAC1C,EAAE;gBAChB,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;gBAEhE,MAAM,MAAM,GAAG;oBACb,OAAO;oBACP,GAAG,SAAS;iBACuD,CAAC;gBAEtE,OAAO,IAAI,CAAC,KAAK,CAAC,aAAa,CAAqB,MAAM,CAAC,CAAC;YAC9D,CAAC;WAAC;QArGA,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC;QACpB,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,MAAM,IAAI,sBAAsB,CAAC,UAAU,CAAC,CAAC;QAC/C,CAAC;QACD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;CAiGF","sourcesContent":["import {\n getAddress,\n type Hex,\n type SignableMessage,\n type TypedData,\n type TypedDataDefinition,\n type WalletClient,\n} from \"viem\";\nimport type { Account } from \"viem/accounts\";\nimport type { SignTypedDataParameters } from \"viem/actions\";\nimport { InvalidSignerTypeError } from \"../errors/signer.js\";\nimport type { SmartAccountSigner } from \"./types\";\n\n/**\n * Represents a wallet client signer for smart accounts, providing methods to get the address, sign messages, and sign typed data.\n */\nexport class WalletClientSigner implements SmartAccountSigner<WalletClient> {\n signerType: string;\n inner: WalletClient;\n\n /**\n * Initializes a signer with a given wallet client and signer type.\n *\n * @example\n * ```ts\n * import { WalletClientSigner } from \"@aa-sdk/core\";\n * import { createWalletClient, custom } from 'viem'\n * import { mainnet } from 'viem/chains'\n *\n * const client = createWalletClient({\n * chain: mainnet,\n * transport: custom(window.ethereum!)\n * });\n *\n * const signer = new WalletClientSigner(client, 'wallet');\n * ```\n *\n * @param {WalletClient} client The wallet client to interact with\n * @param {string} signerType The type of signer; must be a valid signer type, otherwise an error will be thrown\n * @throws {InvalidSignerTypeError} If the signer type is invalid\n */\n constructor(client: WalletClient, signerType: string) {\n this.inner = client;\n if (!signerType) {\n throw new InvalidSignerTypeError(signerType);\n }\n this.signerType = signerType;\n }\n\n /**\n * Asynchronously retrieves addresses from the inner object and returns the first address after applying the `getAddress` function.\n *\n * @example\n * ```ts\n * import { WalletClientSigner } from \"@aa-sdk/core\";\n * import { createWalletClient, custom } from 'viem'\n * import { mainnet } from 'viem/chains'\n *\n * const client = createWalletClient({\n * chain: mainnet,\n * transport: custom(window.ethereum!)\n * });\n *\n * const signer = new WalletClientSigner(client, 'wallet');\n * console.log(await signer.getAddress());\n * ```\n *\n * @returns {Promise<string>} A promise that resolves to the first address after being processed by the `getAddress` function.\n */\n getAddress: () => Promise<`0x${string}`> = async () => {\n let addresses = await this.inner.getAddresses();\n return getAddress(addresses[0]);\n };\n\n /**\n * Signs a message using the account's signing method.\n *\n * @example\n * ```ts\n * import { WalletClientSigner } from \"@aa-sdk/core\";\n * import { createWalletClient, custom } from 'viem'\n * import { mainnet } from 'viem/chains'\n *\n * const client = createWalletClient({\n * chain: mainnet,\n * transport: custom(window.ethereum!)\n * });\n *\n * const signer = new WalletClientSigner(client, 'wallet');\n * console.log(await signer.signMessage(\"hello\"));\n * ```\n *\n * @param {string} message the message string that needs to be signed\n * @returns {Promise<string>} a promise that resolves to the signed message\n */\n readonly signMessage: (message: SignableMessage) => Promise<`0x${string}`> =\n async (message) => {\n const account = this.inner.account ?? (await this.getAddress());\n\n return this.inner.signMessage({ message, account });\n };\n\n /**\n * Signs the provided typed data using the account's private key.\n *\n * @example\n * ```ts\n * import { WalletClientSigner } from \"@aa-sdk/core\";\n * import { createWalletClient, custom } from 'viem'\n * import { mainnet } from 'viem/chains'\n *\n * const client = createWalletClient({\n * chain: mainnet,\n * transport: custom(window.ethereum!)\n * });\n *\n * const signer = new WalletClientSigner(client, 'wallet');\n * console.log(await signer.signTypedData({\n * types: {\n * \"Message\": [{ name: \"content\", type: \"string\" }]\n * },\n * primaryType: \"Message\",\n * message: { content: \"Hello\" },\n * }));\n * ```\n *\n * @param {TypedDataDefinition<TTypedData, TPrimaryType>} typedData The typed data to be signed\n * @returns {Promise<Hex>} A promise that resolves to a hex string representing the signed data\n */\n signTypedData = async <\n const TTypedData extends TypedData | Record<string, unknown>,\n TPrimaryType extends keyof TTypedData | \"EIP712Domain\" | string = string\n >(\n typedData: TypedDataDefinition<TTypedData, TPrimaryType>\n ): Promise<Hex> => {\n const account = this.inner.account ?? (await this.getAddress());\n\n const params = {\n account,\n ...typedData,\n } as SignTypedDataParameters<TTypedData, string, Account | undefined>;\n\n return this.inner.signTypedData<TTypedData, string>(params);\n };\n}\n"]}
1
+ {"version":3,"file":"wallet-client.js","sourceRoot":"","sources":["../../../src/signer/wallet-client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,GAMX,MAAM,MAAM,CAAC;AAGd,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAG7D;;GAEG;AACH,MAAM,OAAO,kBAAkB;IAI7B;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,YAAY,MAAoB,EAAE,UAAkB;QAxBpD;;;;;WAAmB;QACnB;;;;;WAAoB;QA+BpB;;;;;;;;;;;;;;;;;;;WAmBG;QACH;;;;mBAA2C,KAAK,IAAI,EAAE;gBACpD,IAAI,SAAS,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC;gBAChD,OAAO,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;YAClC,CAAC;WAAC;QAEF;;;;;;;;;;;;;;;;;;;;WAoBG;QACM;;;;mBACP,KAAK,EAAE,OAAO,EAAE,EAAE;gBAChB,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;gBAEhE,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;YACtD,CAAC;WAAC;QAEJ;;;;;;;;;;;;;;;;;;;;;;;;;;WA0BG;QACH;;;;mBAAgB,KAAK,EAInB,SAAwD,EAC1C,EAAE;gBAChB,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;gBAEhE,MAAM,MAAM,GAAG;oBACb,OAAO;oBACP,GAAG,SAAS;iBACuD,CAAC;gBAEtE,OAAO,IAAI,CAAC,KAAK,CAAC,aAAa,CAAqB,MAAM,CAAC,CAAC;YAC9D,CAAC;WAAC;QArGA,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC;QACpB,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,MAAM,IAAI,sBAAsB,CAAC,UAAU,CAAC,CAAC;QAC/C,CAAC;QACD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;CAiGF","sourcesContent":["import {\n getAddress,\n type Hex,\n type SignableMessage,\n type TypedData,\n type TypedDataDefinition,\n type WalletClient,\n} from \"viem\";\nimport type { Account } from \"viem/accounts\";\nimport type { SignTypedDataParameters } from \"viem/actions\";\nimport { InvalidSignerTypeError } from \"../errors/signer.js\";\nimport type { SmartAccountSigner } from \"./types\";\n\n/**\n * Represents a wallet client signer for smart accounts, providing methods to get the address, sign messages, and sign typed data.\n */\nexport class WalletClientSigner implements SmartAccountSigner<WalletClient> {\n signerType: string;\n inner: WalletClient;\n\n /**\n * Initializes a signer with a given wallet client and signer type.\n *\n * @example\n * ```ts\n * import { WalletClientSigner } from \"@aa-sdk/core\";\n * import { createWalletClient, custom } from 'viem'\n * import { mainnet } from 'viem/chains'\n *\n * const client = createWalletClient({\n * chain: mainnet,\n * transport: custom(window.ethereum!)\n * });\n *\n * const signer = new WalletClientSigner(client, 'wallet');\n * ```\n *\n * @param {WalletClient} client The wallet client to interact with\n * @param {string} signerType The type of signer; must be a valid signer type, otherwise an error will be thrown\n * @throws {InvalidSignerTypeError} If the signer type is invalid\n */\n constructor(client: WalletClient, signerType: string) {\n this.inner = client;\n if (!signerType) {\n throw new InvalidSignerTypeError(signerType);\n }\n this.signerType = signerType;\n }\n\n /**\n * Asynchronously retrieves addresses from the inner object and returns the first address after applying the `getAddress` function.\n *\n * @example\n * ```ts\n * import { WalletClientSigner } from \"@aa-sdk/core\";\n * import { createWalletClient, custom } from 'viem'\n * import { mainnet } from 'viem/chains'\n *\n * const client = createWalletClient({\n * chain: mainnet,\n * transport: custom(window.ethereum!)\n * });\n *\n * const signer = new WalletClientSigner(client, 'wallet');\n * console.log(await signer.getAddress());\n * ```\n *\n * @returns {Promise<string>} A promise that resolves to the first address after being processed by the `getAddress` function.\n */\n getAddress: () => Promise<`0x${string}`> = async () => {\n let addresses = await this.inner.getAddresses();\n return getAddress(addresses[0]);\n };\n\n /**\n * Signs a message using the account's signing method.\n *\n * @example\n * ```ts\n * import { WalletClientSigner } from \"@aa-sdk/core\";\n * import { createWalletClient, custom } from 'viem'\n * import { mainnet } from 'viem/chains'\n *\n * const client = createWalletClient({\n * chain: mainnet,\n * transport: custom(window.ethereum!)\n * });\n *\n * const signer = new WalletClientSigner(client, 'wallet');\n * console.log(await signer.signMessage(\"hello\"));\n * ```\n *\n * @param {string} message the message string that needs to be signed\n * @returns {Promise<string>} a promise that resolves to the signed message\n */\n readonly signMessage: (message: SignableMessage) => Promise<`0x${string}`> =\n async (message) => {\n const account = this.inner.account ?? (await this.getAddress());\n\n return this.inner.signMessage({ message, account });\n };\n\n /**\n * Signs the provided typed data using the account's private key.\n *\n * @example\n * ```ts\n * import { WalletClientSigner } from \"@aa-sdk/core\";\n * import { createWalletClient, custom } from 'viem'\n * import { mainnet } from 'viem/chains'\n *\n * const client = createWalletClient({\n * chain: mainnet,\n * transport: custom(window.ethereum!)\n * });\n *\n * const signer = new WalletClientSigner(client, 'wallet');\n * console.log(await signer.signTypedData({\n * types: {\n * \"Message\": [{ name: \"content\", type: \"string\" }]\n * },\n * primaryType: \"Message\",\n * message: { content: \"Hello\" },\n * }));\n * ```\n *\n * @param {TypedDataDefinition<TTypedData, TPrimaryType>} typedData The typed data to be signed\n * @returns {Promise<Hex>} A promise that resolves to a hex string representing the signed data\n */\n signTypedData = async <\n const TTypedData extends TypedData | Record<string, unknown>,\n TPrimaryType extends keyof TTypedData | \"EIP712Domain\" | string = string,\n >(\n typedData: TypedDataDefinition<TTypedData, TPrimaryType>,\n ): Promise<Hex> => {\n const account = this.inner.account ?? (await this.getAddress());\n\n const params = {\n account,\n ...typedData,\n } as SignTypedDataParameters<TTypedData, string, Account | undefined>;\n\n return this.inner.signTypedData<TTypedData, string>(params);\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"split.js","sourceRoot":"","sources":["../../../src/transport/split.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAwC,MAAM,MAAM,CAAC;AAUpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,MAA4B,EAAmB,EAAE;IACrE,MAAM,WAAW,GAAG,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QAC1D,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;YAC9B,IAAI,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,SAAS,EAAE,CAAC;gBAC9D,MAAM,IAAI,KAAK,CACb,uDAAuD,CACxD,CAAC;YACJ,CAAC;YAED,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QACpC,CAAC,CAAC,CAAC;QAEH,OAAO,KAAK,CAAC;IACf,CAAC,EAAE,IAAI,GAAG,EAAqB,CAAC,CAAC;IAEjC,OAAO,CAAC,IAAI,EAAE,EAAE,CACd,MAAM,CAAC;QACL,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;YACtB,MAAM,iBAAiB,GAAG,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACvD,IAAI,iBAAiB,IAAI,IAAI,EAAE,CAAC;gBAC9B,OAAO,iBAAiB,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAC/C,CAAC;YAED,OAAO,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC7C,CAAC;KACF,CAAC,CAAC,IAAI,CAAC,CAAC;AACb,CAAC,CAAC","sourcesContent":["import { custom, type CustomTransport, type Transport } from \"viem\";\n\nexport interface SplitTransportParams {\n overrides: {\n methods: string[];\n transport: Transport;\n }[];\n fallback: Transport;\n}\n\n/**\n * The Split Transport allows you to split RPC traffic for specific methods across\n * different RPC providers. This is done by specifying the methods you want handled\n * specially as overrides and providing a fallback transport for all other methods.\n *\n * @example\n * ```ts\n * import { createPublicClient, http } from \"viem\";\n * import { split } from \"@aa-sdk/core\";\n *\n * const bundlerMethods = [\n * \"eth_sendUserOperation\",\n * \"eth_estimateUserOperationGas\",\n * \"eth_getUserOperationReceipt\",\n * \"eth_getUserOperationByHash\",\n * \"eth_supportedEntryPoints\"\n * ];\n *\n * const clientWithSplit = createPublicClient({\n * transport: split({\n * overrides: [{\n * methods: bundlerMethods,\n * transport: http(BUNDLER_RPC_URL)\n * }],\n * fallback: http(OTHER_RPC_URL)\n * }),\n * });\n * ```\n *\n * @param {SplitTransportParams} params split transport configuration containing the methods overrides and fallback transport\n * @returns {CustomTransport} a viem Transport that splits traffic\n */\nexport const split = (params: SplitTransportParams): CustomTransport => {\n const overrideMap = params.overrides.reduce((accum, curr) => {\n curr.methods.forEach((method) => {\n if (accum.has(method) && accum.get(method) !== curr.transport) {\n throw new Error(\n \"A method cannot be handled by more than one transport\"\n );\n }\n\n accum.set(method, curr.transport);\n });\n\n return accum;\n }, new Map<string, Transport>());\n\n return (opts) =>\n custom({\n request: async (args) => {\n const transportOverride = overrideMap.get(args.method);\n if (transportOverride != null) {\n return transportOverride(opts).request(args);\n }\n\n return params.fallback(opts).request(args);\n },\n })(opts);\n};\n"]}
1
+ {"version":3,"file":"split.js","sourceRoot":"","sources":["../../../src/transport/split.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAwC,MAAM,MAAM,CAAC;AAUpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,MAA4B,EAAmB,EAAE;IACrE,MAAM,WAAW,GAAG,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QAC1D,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;YAC9B,IAAI,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,SAAS,EAAE,CAAC;gBAC9D,MAAM,IAAI,KAAK,CACb,uDAAuD,CACxD,CAAC;YACJ,CAAC;YAED,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QACpC,CAAC,CAAC,CAAC;QAEH,OAAO,KAAK,CAAC;IACf,CAAC,EAAE,IAAI,GAAG,EAAqB,CAAC,CAAC;IAEjC,OAAO,CAAC,IAAI,EAAE,EAAE,CACd,MAAM,CAAC;QACL,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;YACtB,MAAM,iBAAiB,GAAG,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACvD,IAAI,iBAAiB,IAAI,IAAI,EAAE,CAAC;gBAC9B,OAAO,iBAAiB,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAC/C,CAAC;YAED,OAAO,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC7C,CAAC;KACF,CAAC,CAAC,IAAI,CAAC,CAAC;AACb,CAAC,CAAC","sourcesContent":["import { custom, type CustomTransport, type Transport } from \"viem\";\n\nexport interface SplitTransportParams {\n overrides: {\n methods: string[];\n transport: Transport;\n }[];\n fallback: Transport;\n}\n\n/**\n * The Split Transport allows you to split RPC traffic for specific methods across\n * different RPC providers. This is done by specifying the methods you want handled\n * specially as overrides and providing a fallback transport for all other methods.\n *\n * @example\n * ```ts\n * import { createPublicClient, http } from \"viem\";\n * import { split } from \"@aa-sdk/core\";\n *\n * const bundlerMethods = [\n * \"eth_sendUserOperation\",\n * \"eth_estimateUserOperationGas\",\n * \"eth_getUserOperationReceipt\",\n * \"eth_getUserOperationByHash\",\n * \"eth_supportedEntryPoints\"\n * ];\n *\n * const clientWithSplit = createPublicClient({\n * transport: split({\n * overrides: [{\n * methods: bundlerMethods,\n * transport: http(BUNDLER_RPC_URL)\n * }],\n * fallback: http(OTHER_RPC_URL)\n * }),\n * });\n * ```\n *\n * @param {SplitTransportParams} params split transport configuration containing the methods overrides and fallback transport\n * @returns {CustomTransport} a viem Transport that splits traffic\n */\nexport const split = (params: SplitTransportParams): CustomTransport => {\n const overrideMap = params.overrides.reduce((accum, curr) => {\n curr.methods.forEach((method) => {\n if (accum.has(method) && accum.get(method) !== curr.transport) {\n throw new Error(\n \"A method cannot be handled by more than one transport\",\n );\n }\n\n accum.set(method, curr.transport);\n });\n\n return accum;\n }, new Map<string, Transport>());\n\n return (opts) =>\n custom({\n request: async (args) => {\n const transportOverride = overrideMap.get(args.method);\n if (transportOverride != null) {\n return transportOverride(opts).request(args);\n }\n\n return params.fallback(opts).request(args);\n },\n })(opts);\n};\n"]}