@aa-sdk/core 4.34.1 → 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 (215) 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 +5 -8
  38. package/dist/esm/client/smartAccountClient.js.map +1 -1
  39. package/dist/esm/client/types.js.map +1 -1
  40. package/dist/esm/ens/utils.js.map +1 -1
  41. package/dist/esm/entrypoint/0.6.d.ts +2 -2
  42. package/dist/esm/entrypoint/0.6.js.map +1 -1
  43. package/dist/esm/entrypoint/0.7.d.ts +1 -1
  44. package/dist/esm/entrypoint/0.7.js.map +1 -1
  45. package/dist/esm/entrypoint/index.d.ts +1 -1
  46. package/dist/esm/entrypoint/index.js.map +1 -1
  47. package/dist/esm/entrypoint/types.js.map +1 -1
  48. package/dist/esm/errors/account.js.map +1 -1
  49. package/dist/esm/errors/client.js.map +1 -1
  50. package/dist/esm/errors/entrypoint.js.map +1 -1
  51. package/dist/esm/errors/signer.js.map +1 -1
  52. package/dist/esm/errors/useroperation.js.map +1 -1
  53. package/dist/esm/middleware/actions.js.map +1 -1
  54. package/dist/esm/middleware/defaults/7702gasEstimator.d.ts +2 -2
  55. package/dist/esm/middleware/defaults/7702gasEstimator.js +2 -2
  56. package/dist/esm/middleware/defaults/7702gasEstimator.js.map +1 -1
  57. package/dist/esm/middleware/defaults/7702signer.d.ts +1 -1
  58. package/dist/esm/middleware/defaults/7702signer.js +1 -1
  59. package/dist/esm/middleware/defaults/7702signer.js.map +1 -1
  60. package/dist/esm/middleware/defaults/feeEstimator.js.map +1 -1
  61. package/dist/esm/middleware/defaults/gasEstimator.js.map +1 -1
  62. package/dist/esm/middleware/defaults/paymasterAndData.js.map +1 -1
  63. package/dist/esm/middleware/defaults/userOpSigner.js.map +1 -1
  64. package/dist/esm/middleware/erc7677middleware.js.map +1 -1
  65. package/dist/esm/middleware/types.js.map +1 -1
  66. package/dist/esm/signer/local-account.d.ts +2 -207
  67. package/dist/esm/signer/local-account.js.map +1 -1
  68. package/dist/esm/signer/schema.d.ts +1 -1
  69. package/dist/esm/signer/types.js.map +1 -1
  70. package/dist/esm/signer/wallet-client.d.ts +2 -207
  71. package/dist/esm/signer/wallet-client.js.map +1 -1
  72. package/dist/esm/transport/split.js +1 -1
  73. package/dist/esm/transport/split.js.map +1 -1
  74. package/dist/esm/types.js.map +1 -1
  75. package/dist/esm/utils/bigint.js.map +1 -1
  76. package/dist/esm/utils/defaults.js.map +1 -1
  77. package/dist/esm/utils/index.d.ts +2 -2
  78. package/dist/esm/utils/index.js.map +1 -1
  79. package/dist/esm/utils/schema.js.map +1 -1
  80. package/dist/esm/utils/stateOverride.js.map +1 -1
  81. package/dist/esm/utils/testUtils.js.map +1 -1
  82. package/dist/esm/utils/traceHeader.js.map +1 -1
  83. package/dist/esm/utils/types.js.map +1 -1
  84. package/dist/esm/utils/userop.d.ts +2 -2
  85. package/dist/esm/utils/userop.js +1 -1
  86. package/dist/esm/utils/userop.js.map +1 -1
  87. package/dist/esm/version.d.ts +1 -1
  88. package/dist/esm/version.js +1 -1
  89. package/dist/esm/version.js.map +1 -1
  90. package/dist/types/account/smartContractAccount.d.ts +1 -1
  91. package/dist/types/account/smartContractAccount.d.ts.map +1 -1
  92. package/dist/types/actions/bundler/estimateUserOperationGas.d.ts +3 -2
  93. package/dist/types/actions/bundler/estimateUserOperationGas.d.ts.map +1 -1
  94. package/dist/types/actions/bundler/getSupportedEntryPoints.d.ts.map +1 -1
  95. package/dist/types/actions/bundler/getUserOperationByHash.d.ts.map +1 -1
  96. package/dist/types/actions/bundler/getUserOperationReceipt.d.ts.map +1 -1
  97. package/dist/types/actions/bundler/sendRawUserOperation.d.ts +2 -1
  98. package/dist/types/actions/bundler/sendRawUserOperation.d.ts.map +1 -1
  99. package/dist/types/actions/smartAccount/buildUserOperation.d.ts.map +1 -1
  100. package/dist/types/actions/smartAccount/buildUserOperationFromTx.d.ts.map +1 -1
  101. package/dist/types/actions/smartAccount/buildUserOperationFromTxs.d.ts.map +1 -1
  102. package/dist/types/actions/smartAccount/checkGasSponsorshipEligibility.d.ts.map +1 -1
  103. package/dist/types/actions/smartAccount/dropAndReplaceUserOperation.d.ts.map +1 -1
  104. package/dist/types/actions/smartAccount/estimateUserOperationGas.d.ts.map +1 -1
  105. package/dist/types/actions/smartAccount/internal/initUserOperation.d.ts.map +1 -1
  106. package/dist/types/actions/smartAccount/internal/runMiddlewareStack.d.ts.map +1 -1
  107. package/dist/types/actions/smartAccount/internal/sendUserOperation.d.ts.map +1 -1
  108. package/dist/types/actions/smartAccount/sendTransaction.d.ts.map +1 -1
  109. package/dist/types/actions/smartAccount/sendUserOperation.d.ts.map +1 -1
  110. package/dist/types/actions/smartAccount/signUserOperation.d.ts.map +1 -1
  111. package/dist/types/actions/smartAccount/types.d.ts.map +1 -1
  112. package/dist/types/client/decorators/smartAccountClient.d.ts.map +1 -1
  113. package/dist/types/client/schema.d.ts +25 -25
  114. package/dist/types/client/schema.d.ts.map +1 -1
  115. package/dist/types/client/smartAccountClient.d.ts.map +1 -1
  116. package/dist/types/ens/utils.d.ts.map +1 -1
  117. package/dist/types/entrypoint/0.6.d.ts +2 -2
  118. package/dist/types/entrypoint/0.6.d.ts.map +1 -1
  119. package/dist/types/entrypoint/0.7.d.ts +1 -1
  120. package/dist/types/entrypoint/0.7.d.ts.map +1 -1
  121. package/dist/types/entrypoint/index.d.ts +1 -1
  122. package/dist/types/entrypoint/index.d.ts.map +1 -1
  123. package/dist/types/entrypoint/types.d.ts.map +1 -1
  124. package/dist/types/errors/useroperation.d.ts.map +1 -1
  125. package/dist/types/middleware/actions.d.ts.map +1 -1
  126. package/dist/types/middleware/defaults/7702gasEstimator.d.ts +2 -2
  127. package/dist/types/middleware/defaults/7702signer.d.ts +1 -1
  128. package/dist/types/middleware/types.d.ts.map +1 -1
  129. package/dist/types/signer/local-account.d.ts +2 -207
  130. package/dist/types/signer/local-account.d.ts.map +1 -1
  131. package/dist/types/signer/schema.d.ts +1 -1
  132. package/dist/types/signer/schema.d.ts.map +1 -1
  133. package/dist/types/signer/utils.d.ts.map +1 -1
  134. package/dist/types/signer/wallet-client.d.ts +2 -207
  135. package/dist/types/signer/wallet-client.d.ts.map +1 -1
  136. package/dist/types/transport/split.d.ts.map +1 -1
  137. package/dist/types/types.d.ts.map +1 -1
  138. package/dist/types/utils/bigint.d.ts.map +1 -1
  139. package/dist/types/utils/bytes.d.ts.map +1 -1
  140. package/dist/types/utils/defaults.d.ts.map +1 -1
  141. package/dist/types/utils/index.d.ts +2 -2
  142. package/dist/types/utils/index.d.ts.map +1 -1
  143. package/dist/types/utils/testUtils.d.ts.map +1 -1
  144. package/dist/types/utils/traceHeader.d.ts.map +1 -1
  145. package/dist/types/utils/userop.d.ts +2 -2
  146. package/dist/types/utils/userop.d.ts.map +1 -1
  147. package/dist/types/version.d.ts +1 -1
  148. package/package.json +3 -6
  149. package/src/account/smartContractAccount.ts +27 -25
  150. package/src/actions/bundler/estimateUserOperationGas.ts +2 -2
  151. package/src/actions/bundler/getSupportedEntryPoints.ts +2 -2
  152. package/src/actions/bundler/getUserOperationByHash.ts +2 -2
  153. package/src/actions/bundler/getUserOperationReceipt.ts +2 -2
  154. package/src/actions/bundler/sendRawUserOperation.ts +2 -2
  155. package/src/actions/smartAccount/buildUserOperation.ts +5 -4
  156. package/src/actions/smartAccount/buildUserOperationFromTx.ts +4 -3
  157. package/src/actions/smartAccount/buildUserOperationFromTxs.ts +9 -8
  158. package/src/actions/smartAccount/checkGasSponsorshipEligibility.ts +5 -4
  159. package/src/actions/smartAccount/dropAndReplaceUserOperation.ts +7 -6
  160. package/src/actions/smartAccount/estimateUserOperationGas.ts +5 -4
  161. package/src/actions/smartAccount/getAddress.ts +2 -2
  162. package/src/actions/smartAccount/internal/initUserOperation.ts +7 -6
  163. package/src/actions/smartAccount/internal/runMiddlewareStack.ts +13 -12
  164. package/src/actions/smartAccount/internal/sendUserOperation.ts +3 -2
  165. package/src/actions/smartAccount/sendTransaction.ts +5 -4
  166. package/src/actions/smartAccount/sendTransactions.ts +3 -3
  167. package/src/actions/smartAccount/sendUserOperation.ts +4 -3
  168. package/src/actions/smartAccount/signMessage.ts +3 -3
  169. package/src/actions/smartAccount/signTypedData.ts +3 -3
  170. package/src/actions/smartAccount/signUserOperation.ts +4 -3
  171. package/src/actions/smartAccount/types.ts +23 -15
  172. package/src/actions/smartAccount/upgradeAccount.ts +3 -3
  173. package/src/actions/smartAccount/waitForUserOperationTransacation.ts +5 -5
  174. package/src/client/addBreadcrumb.ts +1 -1
  175. package/src/client/bundlerClient.ts +5 -5
  176. package/src/client/decorators/bundlerClient.ts +7 -7
  177. package/src/client/decorators/smartAccountClient.ts +20 -18
  178. package/src/client/isSmartAccountClient.ts +4 -4
  179. package/src/client/schema.ts +2 -2
  180. package/src/client/smartAccountClient.ts +98 -104
  181. package/src/client/types.ts +2 -2
  182. package/src/ens/utils.ts +1 -1
  183. package/src/entrypoint/0.6.ts +3 -3
  184. package/src/entrypoint/0.7.ts +4 -4
  185. package/src/entrypoint/index.ts +10 -9
  186. package/src/entrypoint/types.ts +30 -28
  187. package/src/errors/account.ts +1 -1
  188. package/src/errors/client.ts +3 -3
  189. package/src/errors/entrypoint.ts +2 -2
  190. package/src/errors/signer.ts +1 -1
  191. package/src/errors/useroperation.ts +6 -3
  192. package/src/middleware/actions.ts +3 -3
  193. package/src/middleware/defaults/7702gasEstimator.ts +4 -4
  194. package/src/middleware/defaults/7702signer.ts +3 -3
  195. package/src/middleware/defaults/feeEstimator.ts +4 -4
  196. package/src/middleware/defaults/gasEstimator.ts +6 -6
  197. package/src/middleware/defaults/paymasterAndData.ts +1 -1
  198. package/src/middleware/defaults/userOpSigner.ts +2 -2
  199. package/src/middleware/erc7677middleware.ts +9 -9
  200. package/src/middleware/types.ts +7 -5
  201. package/src/signer/local-account.ts +7 -7
  202. package/src/signer/types.ts +3 -3
  203. package/src/signer/wallet-client.ts +2 -2
  204. package/src/transport/split.ts +9 -12
  205. package/src/types.ts +29 -29
  206. package/src/utils/bigint.ts +4 -4
  207. package/src/utils/defaults.ts +1 -1
  208. package/src/utils/index.ts +12 -9
  209. package/src/utils/schema.ts +2 -2
  210. package/src/utils/stateOverride.ts +4 -4
  211. package/src/utils/testUtils.ts +2 -2
  212. package/src/utils/traceHeader.ts +14 -11
  213. package/src/utils/types.ts +1 -1
  214. package/src/utils/userop.ts +17 -17
  215. package/src/version.ts +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"smartAccountClient.js","sourceRoot":"","sources":["../../../src/client/smartAccountClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,GAUP,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAG7D,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAsB,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EAGN,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,yBAAyB,GAE1B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC;AAqH3D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,wBAAw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AAE,CAAC;AAC7B,CAAC;AAgCD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,oCAAoC,CAClD,MAEC;IAED,OAAO,wBAAwB,CAAC;QAC9B,GAAG,MAAM;QACT,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK;QAC1B,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;KACjC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {\n custom,\n type Chain,\n type Client,\n type ClientConfig,\n type CustomTransport,\n type FormattedTransactionRequest,\n type PublicActions,\n type PublicRpcSchema,\n type RpcSchema,\n type Transport,\n} from \"viem\";\nimport { z } from \"zod\";\nimport type { SmartContractAccount } from \"../account/smartContractAccount.js\";\nimport type { UserOperationContext } from \"../actions/smartAccount/types.js\";\nimport { AccountNotFoundError } from \"../errors/account.js\";\nimport { ChainNotFoundError } from \"../errors/client.js\";\nimport { middlewareActions } from \"../middleware/actions.js\";\nimport type { ClientMiddleware } from \"../middleware/types.js\";\nimport type { Prettify } from \"../utils/index.js\";\nimport { ADD_BREADCRUMB } from \"./addBreadcrumb.js\";\nimport { createBundlerClient, type BundlerClient } from \"./bundlerClient.js\";\nimport {\n type BundlerActions,\n type BundlerRpcSchema,\n} from \"./decorators/bundlerClient.js\";\nimport {\n smartAccountClientActions,\n type BaseSmartAccountClientActions,\n} from \"./decorators/smartAccountClient.js\";\nimport { SmartAccountClientOptsSchema } from \"./schema.js\";\nimport type { ClientMiddlewareConfig } from \"./types.js\";\n\ntype SmartAccountClientOpts = z.output<typeof SmartAccountClientOptsSchema>;\n\nexport type SmartAccountClientConfig<\n transport extends Transport = Transport,\n chain extends Chain | undefined = Chain | undefined,\n account extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n context extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n> = Prettify<\n Pick<\n ClientConfig<transport, chain, account>,\n | \"cacheTime\"\n | \"chain\"\n | \"key\"\n | \"name\"\n | \"pollingInterval\"\n | \"transport\"\n | \"type\"\n > & {\n account?: account;\n opts?: z.input<typeof SmartAccountClientOptsSchema>;\n /**\n * A function that adds a breadcrumb to the current context\n * Note, most implementations will override the client with the default alchemy transport and this\n * leads to the fact that a transport could be overwritten and not known until later.\n *\n * @param crumb A crumb, or span is telling that we are in a next step part of a multi step action\n * @returns\n */\n addBreadCrumb?: <T>(crumb: string) => T;\n } & ClientMiddlewareConfig<context>\n>;\n\nexport type SmartAccountClientRpcSchema = [\n ...BundlerRpcSchema,\n ...PublicRpcSchema\n];\n\n// [!region SmartAccountClientActions]\nexport type SmartAccountClientActions<\n chain extends Chain | undefined = Chain | undefined,\n account extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n context extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n> = BaseSmartAccountClientActions<chain, account, context> &\n BundlerActions &\n PublicActions;\n// [!endregion SmartAccountClientActions]\n\n// [!region SmartAccountClient]\nexport type SmartAccountClient<\n transport extends Transport = Transport,\n chain extends Chain | undefined = Chain | undefined,\n account extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n actions extends Record<string, unknown> = Record<string, unknown>,\n rpcSchema extends RpcSchema = SmartAccountClientRpcSchema,\n context extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n> = Prettify<\n Client<\n transport,\n chain,\n account,\n rpcSchema,\n actions & SmartAccountClientActions<chain, account, context>\n >\n>;\n// [!endregion SmartAccountClient]\n\nexport type BaseSmartAccountClient<\n transport extends Transport = Transport,\n chain extends Chain | undefined = Chain | undefined,\n account extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n context extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n> = Prettify<\n Client<\n transport,\n chain,\n account,\n [...BundlerRpcSchema, ...PublicRpcSchema],\n {\n middleware: ClientMiddleware<context>;\n } & SmartAccountClientOpts &\n BundlerActions &\n PublicActions\n >\n>;\n\nexport function createSmartAccountClient<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n>(\n config: SmartAccountClientConfig<TTransport, TChain, TAccount, TContext>\n): SmartAccountClient<TTransport, TChain, TAccount>;\n\n/**\n * Creates a smart account client using the provided configuration. This client handles various Ethereum transactions and message signing operations.\n *\n * @example\n * ```ts\n * import { createSmartAccountClient, toSmartContractAccount } from \"@aa-sdk/core\";\n * import { http } from \"viem\";\n * import { sepolia } from \"viem/chains\";\n *\n * const client = createSmartAccountClient({\n * chain: sepolia,\n * transport: http(\"RPC_URL\"),\n * // optionally hoist the account\n * account: toSmartContractAccount(...),\n * });\n * ```\n *\n * @param {SmartAccountClientConfig} config The configuration for creating the smart account client\n * @returns {SmartAccountClient} A smart account client capable of handling transactions, message signing, and other operations on a smart account\n */\nexport function createSmartAccountClient(\n config: SmartAccountClientConfig\n): SmartAccountClient {\n const {\n key = \"account\",\n name = \"account provider\",\n transport,\n type = \"SmartAccountClient\",\n addBreadCrumb,\n ...params\n } = config;\n\n const client: SmartAccountClient = createBundlerClient({\n ...params,\n key,\n name,\n // we start out with this because the base methods for a SmartAccountClient\n // require a smart account client, but once we have completed building everything\n // we want to override this value with the one passed in by the extender\n type: \"SmartAccountClient\",\n // TODO: this needs to be tested\n transport: (opts) => {\n const rpcTransport = transport(opts);\n\n return custom(\n {\n name: \"SmartAccountClientTransport\",\n async request({ method, params }) {\n switch (method) {\n case \"eth_accounts\": {\n if (!client.account) {\n throw new AccountNotFoundError();\n }\n\n return [client.account.address];\n }\n case \"eth_sendTransaction\":\n if (!client.account) {\n throw new AccountNotFoundError();\n }\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n const [tx] = params as [FormattedTransactionRequest];\n return client.sendTransaction({\n ...tx,\n account: client.account,\n chain: client.chain,\n });\n case \"eth_sign\":\n if (!client.account) {\n throw new AccountNotFoundError();\n }\n const [address, data] = params!;\n if (\n address?.toLowerCase() !==\n client.account.address.toLowerCase()\n ) {\n throw new Error(\n \"cannot sign for address that is not the current account\"\n );\n }\n return client.signMessage({\n message: data,\n account: client.account,\n });\n case \"personal_sign\": {\n if (!client.account) {\n throw new AccountNotFoundError();\n }\n const [data, address] = params!;\n if (\n address?.toLowerCase() !==\n client.account.address.toLowerCase()\n ) {\n throw new Error(\n \"cannot sign for address that is not the current account\"\n );\n }\n return client.signMessage({\n message: data,\n account: client.account,\n });\n }\n case \"eth_signTypedData_v4\": {\n if (!client.account) {\n throw new AccountNotFoundError();\n }\n const [address, dataParams] = params!;\n if (\n address?.toLowerCase() !==\n client.account.address.toLowerCase()\n ) {\n throw new Error(\n \"cannot sign for address that is not the current account\"\n );\n }\n try {\n return client.signTypedData({\n account: client.account,\n typedData:\n typeof dataParams === \"string\"\n ? JSON.parse(dataParams)\n : dataParams,\n });\n } catch {\n throw new Error(\"invalid JSON data params\");\n }\n }\n case \"eth_chainId\":\n if (!opts.chain) {\n throw new ChainNotFoundError();\n }\n\n return opts.chain.id;\n default:\n // TODO: there's probably a number of methods we just don't support, will need to test most of them out\n // first let's get something working though\n return rpcTransport.request({ method, params });\n }\n },\n },\n { retryCount: 0 }\n )(opts);\n },\n })\n .extend(() => {\n const addBreadCrumbs = addBreadCrumb\n ? {\n [ADD_BREADCRUMB]: addBreadCrumb,\n }\n : {};\n return {\n ...SmartAccountClientOptsSchema.parse(config.opts ?? {}),\n ...addBreadCrumbs,\n };\n })\n .extend(middlewareActions(config))\n .extend(smartAccountClientActions);\n\n return { ...client, type };\n}\n\nexport function createSmartAccountClientFromExisting<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TClient extends BundlerClient<TTransport> = BundlerClient<TTransport>,\n TActions extends SmartAccountClientActions<\n TChain,\n TAccount,\n TContext\n > = SmartAccountClientActions<TChain, TAccount>,\n TRpcSchema extends SmartAccountClientRpcSchema = SmartAccountClientRpcSchema,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n>(\n config: Omit<\n SmartAccountClientConfig<Transport, TChain, TAccount, TContext>,\n \"transport\" | \"chain\"\n > & { client: TClient }\n): SmartAccountClient<\n CustomTransport,\n TChain,\n TAccount,\n TActions,\n TRpcSchema,\n TContext\n>;\n\n/**\n * Creates a smart account client using an existing client and specific configuration. This function can be used to reuse a pre-existing BundlerClient while customizing other aspects of the smart account.\n *\n * @example\n * ```ts\n * import {\n * createBundlerClient,\n * createSmartAccountClientFromExisting,\n * toSmartContractAccount\n * } from \"@aa-sdk/core\";\n *\n * const bundlerClient = createBundlerClient(...);\n * const client = createSmartAccountClientFromExisting({\n * client,\n * account: toSmartContractAccount(...),\n * })\n * ```\n *\n * @param {Omit<SmartAccountClientConfig, \"transport\" | \"chain\"> & {client: BundlerClient}} config the configuration object which includes the client\n * @returns {SmartAccountClient} A smart account client created from the existing BundlerClient\n */\nexport function createSmartAccountClientFromExisting(\n config: Omit<SmartAccountClientConfig, \"transport\" | \"chain\"> & {\n client: BundlerClient;\n }\n): SmartAccountClient {\n return createSmartAccountClient({\n ...config,\n chain: config.client.chain,\n transport: custom(config.client),\n });\n}\n"]}
1
+ {"version":3,"file":"smartAccountClient.js","sourceRoot":"","sources":["../../../src/client/smartAccountClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,GAUP,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAG7D,OAAO,EAAE,mBAAmB,EAAsB,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EAGN,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,yBAAyB,GAE1B,MAAM,o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,CAAC,CAAC;SACD,MAAM,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;SACjC,MAAM,CAAC,yBAAyB,CAAC,CAAC;IAErC,OAAO,EAAE,GAAG,MAAM,EAAE,IAAI,EAAE,CAAC;AAC7B,CAAC;AAgCD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,oCAAoC,CAClD,MAEC;IAED,OAAO,wBAAwB,CAAC;QAC9B,GAAG,MAAM;QACT,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK;QAC1B,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;KACjC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {\n custom,\n type Chain,\n type Client,\n type ClientConfig,\n type CustomTransport,\n type FormattedTransactionRequest,\n type PublicActions,\n type PublicRpcSchema,\n type RpcSchema,\n type Transport,\n} from \"viem\";\nimport { z } from \"zod\";\nimport type { SmartContractAccount } from \"../account/smartContractAccount.js\";\nimport type { UserOperationContext } from \"../actions/smartAccount/types.js\";\nimport { AccountNotFoundError } from \"../errors/account.js\";\nimport { ChainNotFoundError } from \"../errors/client.js\";\nimport { middlewareActions } from \"../middleware/actions.js\";\nimport type { ClientMiddleware } from \"../middleware/types.js\";\nimport type { Prettify } from \"../utils/index.js\";\nimport { createBundlerClient, type BundlerClient } from \"./bundlerClient.js\";\nimport {\n type BundlerActions,\n type BundlerRpcSchema,\n} from \"./decorators/bundlerClient.js\";\nimport {\n smartAccountClientActions,\n type BaseSmartAccountClientActions,\n} from \"./decorators/smartAccountClient.js\";\nimport { SmartAccountClientOptsSchema } from \"./schema.js\";\nimport type { ClientMiddlewareConfig } from \"./types.js\";\nimport { ADD_BREADCRUMB } from \"./addBreadcrumb.js\";\n\ntype SmartAccountClientOpts = z.output<typeof SmartAccountClientOptsSchema>;\n\nexport type SmartAccountClientConfig<\n transport extends Transport = Transport,\n chain extends Chain | undefined = Chain | undefined,\n account extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n context extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n> = Prettify<\n Pick<\n ClientConfig<transport, chain, account>,\n | \"cacheTime\"\n | \"chain\"\n | \"key\"\n | \"name\"\n | \"pollingInterval\"\n | \"transport\"\n | \"type\"\n > & {\n account?: account;\n opts?: z.input<typeof SmartAccountClientOptsSchema>;\n /**\n * A function that adds a breadcrumb to the current context\n * Note, most implementations will override the client with the default alchemy transport and this\n * leads to the fact that a transport could be overwritten and not known until later.\n *\n * @param crumb A crumb, or span is telling that we are in a next step part of a multi step action\n * @returns\n */\n addBreadCrumb?: <T>(crumb: string) => T;\n } & ClientMiddlewareConfig<context>\n>;\n\nexport type SmartAccountClientRpcSchema = [\n ...BundlerRpcSchema,\n ...PublicRpcSchema,\n];\n\n// [!region SmartAccountClientActions]\nexport type SmartAccountClientActions<\n chain extends Chain | undefined = Chain | undefined,\n account extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n context extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n> = BaseSmartAccountClientActions<chain, account, context> &\n BundlerActions &\n PublicActions;\n// [!endregion SmartAccountClientActions]\n\n// [!region SmartAccountClient]\nexport type SmartAccountClient<\n transport extends Transport = Transport,\n chain extends Chain | undefined = Chain | undefined,\n account extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n actions extends Record<string, unknown> = Record<string, unknown>,\n rpcSchema extends RpcSchema = SmartAccountClientRpcSchema,\n context extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n> = Prettify<\n Client<\n transport,\n chain,\n account,\n rpcSchema,\n actions & SmartAccountClientActions<chain, account, context>\n >\n>;\n// [!endregion SmartAccountClient]\n\nexport type BaseSmartAccountClient<\n transport extends Transport = Transport,\n chain extends Chain | undefined = Chain | undefined,\n account extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n context extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n> = Prettify<\n Client<\n transport,\n chain,\n account,\n [...BundlerRpcSchema, ...PublicRpcSchema],\n {\n middleware: ClientMiddleware<context>;\n } & SmartAccountClientOpts &\n BundlerActions &\n PublicActions\n >\n>;\n\nexport function createSmartAccountClient<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n>(\n config: SmartAccountClientConfig<TTransport, TChain, TAccount, TContext>,\n): SmartAccountClient<TTransport, TChain, TAccount>;\n\n/**\n * Creates a smart account client using the provided configuration. This client handles various Ethereum transactions and message signing operations.\n *\n * @example\n * ```ts\n * import { createSmartAccountClient, toSmartContractAccount } from \"@aa-sdk/core\";\n * import { http } from \"viem\";\n * import { sepolia } from \"viem/chains\";\n *\n * const client = createSmartAccountClient({\n * chain: sepolia,\n * transport: http(\"RPC_URL\"),\n * // optionally hoist the account\n * account: toSmartContractAccount(...),\n * });\n * ```\n *\n * @param {SmartAccountClientConfig} config The configuration for creating the smart account client\n * @returns {SmartAccountClient} A smart account client capable of handling transactions, message signing, and other operations on a smart account\n */\nexport function createSmartAccountClient(\n config: SmartAccountClientConfig,\n): SmartAccountClient {\n const {\n key = \"account\",\n name = \"account provider\",\n transport,\n type = \"SmartAccountClient\",\n addBreadCrumb,\n ...params\n } = config;\n\n const client: SmartAccountClient = createBundlerClient({\n ...params,\n key,\n name,\n // we start out with this because the base methods for a SmartAccountClient\n // require a smart account client, but once we have completed building everything\n // we want to override this value with the one passed in by the extender\n type: \"SmartAccountClient\",\n // TODO: this needs to be tested\n transport: (opts) => {\n const rpcTransport = transport(opts);\n\n return custom({\n name: \"SmartAccountClientTransport\",\n async request({ method, params }) {\n switch (method) {\n case \"eth_accounts\": {\n if (!client.account) {\n throw new AccountNotFoundError();\n }\n\n return [client.account.address];\n }\n case \"eth_sendTransaction\":\n if (!client.account) {\n throw new AccountNotFoundError();\n }\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n const [tx] = params as [FormattedTransactionRequest];\n return client.sendTransaction({\n ...tx,\n account: client.account,\n chain: client.chain,\n });\n case \"eth_sign\":\n if (!client.account) {\n throw new AccountNotFoundError();\n }\n const [address, data] = params!;\n if (\n address?.toLowerCase() !== client.account.address.toLowerCase()\n ) {\n throw new Error(\n \"cannot sign for address that is not the current account\",\n );\n }\n return client.signMessage({\n message: data,\n account: client.account,\n });\n case \"personal_sign\": {\n if (!client.account) {\n throw new AccountNotFoundError();\n }\n const [data, address] = params!;\n if (\n address?.toLowerCase() !== client.account.address.toLowerCase()\n ) {\n throw new Error(\n \"cannot sign for address that is not the current account\",\n );\n }\n return client.signMessage({\n message: data,\n account: client.account,\n });\n }\n case \"eth_signTypedData_v4\": {\n if (!client.account) {\n throw new AccountNotFoundError();\n }\n const [address, dataParams] = params!;\n if (\n address?.toLowerCase() !== client.account.address.toLowerCase()\n ) {\n throw new Error(\n \"cannot sign for address that is not the current account\",\n );\n }\n try {\n return client.signTypedData({\n account: client.account,\n typedData:\n typeof dataParams === \"string\"\n ? JSON.parse(dataParams)\n : dataParams,\n });\n } catch {\n throw new Error(\"invalid JSON data params\");\n }\n }\n case \"eth_chainId\":\n if (!opts.chain) {\n throw new ChainNotFoundError();\n }\n\n return opts.chain.id;\n default:\n // TODO: there's probably a number of methods we just don't support, will need to test most of them out\n // first let's get something working though\n return rpcTransport.request({ method, params });\n }\n },\n })(opts);\n },\n })\n .extend(() => {\n const addBreadCrumbs = addBreadCrumb\n ? {\n [ADD_BREADCRUMB]: addBreadCrumb,\n }\n : {};\n return {\n ...SmartAccountClientOptsSchema.parse(config.opts ?? {}),\n ...addBreadCrumbs,\n };\n })\n .extend(middlewareActions(config))\n .extend(smartAccountClientActions);\n\n return { ...client, type };\n}\n\nexport function createSmartAccountClientFromExisting<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TClient extends BundlerClient<TTransport> = BundlerClient<TTransport>,\n TActions extends SmartAccountClientActions<\n TChain,\n TAccount,\n TContext\n > = SmartAccountClientActions<TChain, TAccount>,\n TRpcSchema extends SmartAccountClientRpcSchema = SmartAccountClientRpcSchema,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n>(\n config: Omit<\n SmartAccountClientConfig<Transport, TChain, TAccount, TContext>,\n \"transport\" | \"chain\"\n > & { client: TClient },\n): SmartAccountClient<\n CustomTransport,\n TChain,\n TAccount,\n TActions,\n TRpcSchema,\n TContext\n>;\n\n/**\n * Creates a smart account client using an existing client and specific configuration. This function can be used to reuse a pre-existing BundlerClient while customizing other aspects of the smart account.\n *\n * @example\n * ```ts\n * import {\n * createBundlerClient,\n * createSmartAccountClientFromExisting,\n * toSmartContractAccount\n * } from \"@aa-sdk/core\";\n *\n * const bundlerClient = createBundlerClient(...);\n * const client = createSmartAccountClientFromExisting({\n * client,\n * account: toSmartContractAccount(...),\n * })\n * ```\n *\n * @param {Omit<SmartAccountClientConfig, \"transport\" | \"chain\"> & {client: BundlerClient}} config the configuration object which includes the client\n * @returns {SmartAccountClient} A smart account client created from the existing BundlerClient\n */\nexport function createSmartAccountClientFromExisting(\n config: Omit<SmartAccountClientConfig, \"transport\" | \"chain\"> & {\n client: BundlerClient;\n },\n): SmartAccountClient {\n return createSmartAccountClient({\n ...config,\n chain: config.client.chain,\n transport: custom(config.client),\n });\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/client/types.ts"],"names":[],"mappings":";AAqCA,sCAAsC","sourcesContent":["import type { Address } from \"abitype\";\nimport type { Hash, Hex } from \"viem\";\nimport type { z } from \"zod\";\nimport type { UserOperationContext } from \"../actions/smartAccount/types.js\";\nimport type { EntryPointVersion } from \"../entrypoint/types.js\";\nimport type { ClientMiddleware } from \"../middleware/types.js\";\nimport type { UserOperationRequest } from \"../types.js\";\nimport type { ConnectionConfigSchema } from \"./schema.js\";\n\nexport type ConnectorData = {\n chainId?: Hex;\n};\n\nexport type ConnectionConfig = z.input<typeof ConnectionConfigSchema>;\n\n// [!region SendUserOperationResult]\nexport type SendUserOperationResult<\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion\n> = {\n hash: Hash;\n request: UserOperationRequest<TEntryPointVersion>;\n};\n// [!endregion SendUserOperationResult]\n\n// [!region UpgradeToData]\nexport type UpgradeToData = {\n implAddress: Address;\n initializationData: Hex;\n};\n// [!endregion UpgradeToData]\n\n// [!region ClientMiddlewareConfig]\nexport type ClientMiddlewareConfig<\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n> = Partial<ClientMiddleware<TContext>>;\n// [!endregion ClientMiddlewareConfig]\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/client/types.ts"],"names":[],"mappings":";AAqCA,sCAAsC","sourcesContent":["import type { Address } from \"abitype\";\nimport type { Hash, Hex } from \"viem\";\nimport type { z } from \"zod\";\nimport type { UserOperationContext } from \"../actions/smartAccount/types.js\";\nimport type { EntryPointVersion } from \"../entrypoint/types.js\";\nimport type { ClientMiddleware } from \"../middleware/types.js\";\nimport type { UserOperationRequest } from \"../types.js\";\nimport type { ConnectionConfigSchema } from \"./schema.js\";\n\nexport type ConnectorData = {\n chainId?: Hex;\n};\n\nexport type ConnectionConfig = z.input<typeof ConnectionConfigSchema>;\n\n// [!region SendUserOperationResult]\nexport type SendUserOperationResult<\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion,\n> = {\n hash: Hash;\n request: UserOperationRequest<TEntryPointVersion>;\n};\n// [!endregion SendUserOperationResult]\n\n// [!region UpgradeToData]\nexport type UpgradeToData = {\n implAddress: Address;\n initializationData: Hex;\n};\n// [!endregion UpgradeToData]\n\n// [!region ClientMiddlewareConfig]\nexport type ClientMiddlewareConfig<\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n> = Partial<ClientMiddleware<TContext>>;\n// [!endregion ClientMiddlewareConfig]\n"]}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CAA4C,CAAC,CAAC;IAChE,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC","sourcesContent":["import * as chains from \"viem/chains\";\nimport { mainnet, type Chain } from \"viem/chains\";\n\nexport const ChainsById: Map<number, chains.Chain> = new Map(\n Object.values(chains).map((x) => [x.id, x])\n);\n\n/**\n * Converts a given chain ID to a coin type, following specific standards for mainnet and non-mainnet chains.\n *\n * @example\n * ```ts\n * import { convertChainIdToCoinType } from \"@aa-sdk/core\";\n * import { sepolia } from \"viem/chains\";\n *\n * const coinType = convertChainIdToCoinType(sepolia.id);\n * ```\n *\n * @param {number} chainId the blockchain chain ID that you want to convert to a coin type\n * @returns {number} the corresponding coin type for the given chain ID\n */\nexport const convertChainIdToCoinType = (chainId: number): number => {\n if (chainId === mainnet.id) {\n // this comes from [ensip-9](https://docs.ens.domains/ens-improvement-proposals/ensip-9-multichain-address-resolution)\n return 60;\n }\n\n // this is using [ENSIP-11](https://docs.ens.domains/ens-improvement-proposals/ensip-11-evmchain-address-resolution) and assumes this is how mappings are stored for non mainnet chains\n return (0x80000000 | chainId) >>> 0;\n};\n\n/**\n * Converts a coin type to a chain ID based on predefined mappings. This function follows ENSIP-9 for coin type 60 and ENSIP-11 for other coin types.\n *\n * @example\n * ```ts\n * import { convertChainIdToCoinType, convertCoinTypeToChainId } from \"@aa-sdk/core\";\n * import { sepolia } from \"viem/chains\";\n *\n * const coinType = convertChainIdToCoinType(sepolia.id);\n * const chainId = convertCoinTypeToChainId(coinType);\n * ```\n *\n * @param {number} coinType the coin type to be converted to a chain ID\n * @returns {number} the corresponding chain ID\n */\nexport const convertCoinTypeToChainId = (coinType: number): number => {\n if (coinType === 60) {\n // this comes from [ensip-9](https://docs.ens.domains/ens-improvement-proposals/ensip-9-multichain-address-resolution)\n return mainnet.id;\n }\n\n // this is using [ENSIP-11](https://docs.ens.domains/ens-improvement-proposals/ensip-11-evmchain-address-resolution) and assumes this is how mappings are stored for non mainnet chains\n return (0x7fffffff & coinType) >> 0;\n};\n\n/**\n * Converts a coin type to its corresponding blockchain chain based on a predefined mapping.\n *\n * @example\n * ```ts\n * import { convertChainIdToCoinType, convertCoinTypeToChain } from \"@aa-sdk/core\";\n * import { sepolia } from \"viem/chains\";\n *\n * const coinType = convertChainIdToCoinType(sepolia.id);\n * const chain = convertCoinTypeToChain(coinType);\n * ```\n *\n * @param {number} coinType The numerical identifier for the coin type\n * @returns {Chain} The corresponding blockchain chain\n * @throws {Error} If the coin type does not map to a supported chain\n */\nexport const convertCoinTypeToChain = (coinType: number): Chain => {\n const chainId = convertCoinTypeToChainId(coinType);\n const chain = ChainsById.get(chainId);\n if (!chain) {\n throw new Error(\"CoinType does not map to a supported chain\");\n }\n\n return chain;\n};\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/ens/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,OAAO,EAAc,MAAM,aAAa,CAAC;AAElD,MAAM,CAAC,MAAM,UAAU,GAA8B,IAAI,GAAG,CAC1D,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAC5C,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,OAAe,EAAU,EAAE;IAClE,IAAI,OAAO,KAAK,OAAO,CAAC,EAAE,EAAE,CAAC;QAC3B,sHAAsH;QACtH,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,uLAAuL;IACvL,OAAO,CAAC,UAAU,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;AACtC,CAAC,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,QAAgB,EAAU,EAAE;IACnE,IAAI,QAAQ,KAAK,EAAE,EAAE,CAAC;QACpB,sHAAsH;QACtH,OAAO,OAAO,CAAC,EAAE,CAAC;IACpB,CAAC;IAED,uLAAuL;IACvL,OAAO,CAAC,UAAU,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;AACtC,CAAC,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,QAAgB,EAAS,EAAE;IAChE,MAAM,OAAO,GAAG,wBAAwB,CAAC,QAAQ,CAAC,CAAC;IACnD,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACtC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAChE,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC","sourcesContent":["import * as chains from \"viem/chains\";\nimport { mainnet, type Chain } from \"viem/chains\";\n\nexport const ChainsById: Map<number, chains.Chain> = new Map(\n Object.values(chains).map((x) => [x.id, x]),\n);\n\n/**\n * Converts a given chain ID to a coin type, following specific standards for mainnet and non-mainnet chains.\n *\n * @example\n * ```ts\n * import { convertChainIdToCoinType } from \"@aa-sdk/core\";\n * import { sepolia } from \"viem/chains\";\n *\n * const coinType = convertChainIdToCoinType(sepolia.id);\n * ```\n *\n * @param {number} chainId the blockchain chain ID that you want to convert to a coin type\n * @returns {number} the corresponding coin type for the given chain ID\n */\nexport const convertChainIdToCoinType = (chainId: number): number => {\n if (chainId === mainnet.id) {\n // this comes from [ensip-9](https://docs.ens.domains/ens-improvement-proposals/ensip-9-multichain-address-resolution)\n return 60;\n }\n\n // this is using [ENSIP-11](https://docs.ens.domains/ens-improvement-proposals/ensip-11-evmchain-address-resolution) and assumes this is how mappings are stored for non mainnet chains\n return (0x80000000 | chainId) >>> 0;\n};\n\n/**\n * Converts a coin type to a chain ID based on predefined mappings. This function follows ENSIP-9 for coin type 60 and ENSIP-11 for other coin types.\n *\n * @example\n * ```ts\n * import { convertChainIdToCoinType, convertCoinTypeToChainId } from \"@aa-sdk/core\";\n * import { sepolia } from \"viem/chains\";\n *\n * const coinType = convertChainIdToCoinType(sepolia.id);\n * const chainId = convertCoinTypeToChainId(coinType);\n * ```\n *\n * @param {number} coinType the coin type to be converted to a chain ID\n * @returns {number} the corresponding chain ID\n */\nexport const convertCoinTypeToChainId = (coinType: number): number => {\n if (coinType === 60) {\n // this comes from [ensip-9](https://docs.ens.domains/ens-improvement-proposals/ensip-9-multichain-address-resolution)\n return mainnet.id;\n }\n\n // this is using [ENSIP-11](https://docs.ens.domains/ens-improvement-proposals/ensip-11-evmchain-address-resolution) and assumes this is how mappings are stored for non mainnet chains\n return (0x7fffffff & coinType) >> 0;\n};\n\n/**\n * Converts a coin type to its corresponding blockchain chain based on a predefined mapping.\n *\n * @example\n * ```ts\n * import { convertChainIdToCoinType, convertCoinTypeToChain } from \"@aa-sdk/core\";\n * import { sepolia } from \"viem/chains\";\n *\n * const coinType = convertChainIdToCoinType(sepolia.id);\n * const chain = convertCoinTypeToChain(coinType);\n * ```\n *\n * @param {number} coinType The numerical identifier for the coin type\n * @returns {Chain} The corresponding blockchain chain\n * @throws {Error} If the coin type does not map to a supported chain\n */\nexport const convertCoinTypeToChain = (coinType: number): Chain => {\n const chainId = convertCoinTypeToChainId(coinType);\n const chain = ChainsById.get(chainId);\n if (!chain) {\n throw new Error(\"CoinType does not map to a supported chain\");\n }\n\n return chain;\n};\n"]}
@@ -1,4 +1,4 @@
1
- import { type Address, type Hash } from "viem";
1
+ import { type Address, type Hash, type Hex } from "viem";
2
2
  import type { UserOperationRequest } from "../types.js";
3
3
  declare const _default: {
4
4
  version: "0.6.0";
@@ -1024,6 +1024,6 @@ declare const _default: {
1024
1024
  readonly type: "receive";
1025
1025
  }];
1026
1026
  getUserOperationHash: (request: UserOperationRequest<"0.6.0">, entryPointAddress: Address, chainId: number) => Hash;
1027
- packUserOperation: (request: UserOperationRequest<"0.6.0">) => `0x${string}`;
1027
+ packUserOperation: (request: UserOperationRequest<"0.6.0">) => Hex;
1028
1028
  };
1029
1029
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"0.6.js","sourceRoot":"","sources":["../../../src/entrypoint/0.6.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,WAAW,EACX,SAAS,GAKV,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAI/D,MAAM,iBAAiB,GAAG,CAAC,OAAsC,EAAO,EAAE;IACxE,MAAM,cAAc,GAAG,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACnD,MAAM,cAAc,GAAG,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACnD,MAAM,sBAAsB,GAAG,SAAS,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAEnE,OAAO,mBAAmB,CACxB;QACE,EAAE,IAAI,EAAE,SAAS,EAAE;QACnB,EAAE,IAAI,EAAE,SAAS,EAAE;QACnB,EAAE,IAAI,EAAE,SAAS,EAAE;QACnB,EAAE,IAAI,EAAE,SAAS,EAAE;QACnB,EAAE,IAAI,EAAE,SAAS,EAAE;QACnB,EAAE,IAAI,EAAE,SAAS,EAAE;QACnB,EAAE,IAAI,EAAE,SAAS,EAAE;QACnB,EAAE,IAAI,EAAE,SAAS,EAAE;QACnB,EAAE,IAAI,EAAE,SAAS,EAAE;QACnB,EAAE,IAAI,EAAE,SAAS,EAAE;KACpB,EACD;QACE,OAAO,CAAC,MAAiB;QACzB,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC;QAC1B,cAAc;QACd,cAAc;QACd,WAAW,CAAC,OAAO,CAAC,YAAY,CAAC;QACjC,WAAW,CAAC,OAAO,CAAC,oBAAoB,CAAC;QACzC,WAAW,CAAC,OAAO,CAAC,kBAAkB,CAAC;QACvC,WAAW,CAAC,OAAO,CAAC,YAAY,CAAC;QACjC,WAAW,CAAC,OAAO,CAAC,oBAAoB,CAAC;QACzC,sBAAsB;KACvB,CACF,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe;IACb,OAAO,EAAE,OAAO;IAEhB,OAAO,EAAE;QACP,OAAO,EAAE,4CAA4C;KACtD;IAED,GAAG,EAAE,gBAAgB;IAErB,oBAAoB,EAAE,CACpB,OAAsC,EACtC,iBAA0B,EAC1B,OAAe,EACT,EAAE;QACR,MAAM,OAAO,GAAG,mBAAmB,CACjC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,EAC/D;YACE,SAAS,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;YACrC,iBAAiB;YACjB,MAAM,CAAC,OAAO,CAAC;SAChB,CACF,CAAC;QAEF,OAAO,SAAS,CAAC,OAAO,CAAC,CAAC;IAC5B,CAAC;IAED,iBAAiB;CACqD,CAAC","sourcesContent":["import {\n encodeAbiParameters,\n hexToBigInt,\n keccak256,\n type Address,\n type Chain,\n type Hash,\n type Hex,\n} from \"viem\";\nimport { EntryPointAbi_v6 } from \"../abis/EntryPointAbi_v6.js\";\nimport type { UserOperationRequest } from \"../types.js\";\nimport type { SupportedEntryPoint } from \"./types.js\";\n\nconst packUserOperation = (request: UserOperationRequest<\"0.6.0\">): Hex => {\n const hashedInitCode = keccak256(request.initCode);\n const hashedCallData = keccak256(request.callData);\n const hashedPaymasterAndData = keccak256(request.paymasterAndData);\n\n return encodeAbiParameters(\n [\n { type: \"address\" },\n { type: \"uint256\" },\n { type: \"bytes32\" },\n { type: \"bytes32\" },\n { type: \"uint256\" },\n { type: \"uint256\" },\n { type: \"uint256\" },\n { type: \"uint256\" },\n { type: \"uint256\" },\n { type: \"bytes32\" },\n ],\n [\n request.sender as Address,\n hexToBigInt(request.nonce),\n hashedInitCode,\n hashedCallData,\n hexToBigInt(request.callGasLimit),\n hexToBigInt(request.verificationGasLimit),\n hexToBigInt(request.preVerificationGas),\n hexToBigInt(request.maxFeePerGas),\n hexToBigInt(request.maxPriorityFeePerGas),\n hashedPaymasterAndData,\n ]\n );\n};\n\nexport default {\n version: \"0.6.0\",\n\n address: {\n default: \"0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789\",\n },\n\n abi: EntryPointAbi_v6,\n\n getUserOperationHash: (\n request: UserOperationRequest<\"0.6.0\">,\n entryPointAddress: Address,\n chainId: number\n ): Hash => {\n const encoded = encodeAbiParameters(\n [{ type: \"bytes32\" }, { type: \"address\" }, { type: \"uint256\" }],\n [\n keccak256(packUserOperation(request)),\n entryPointAddress,\n BigInt(chainId),\n ]\n );\n\n return keccak256(encoded);\n },\n\n packUserOperation,\n} satisfies SupportedEntryPoint<\"0.6.0\", Chain, typeof EntryPointAbi_v6>;\n"]}
1
+ {"version":3,"file":"0.6.js","sourceRoot":"","sources":["../../../src/entrypoint/0.6.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,WAAW,EACX,SAAS,GAKV,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAI/D,MAAM,iBAAiB,GAAG,CAAC,OAAsC,EAAO,EAAE;IACxE,MAAM,cAAc,GAAG,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACnD,MAAM,cAAc,GAAG,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACnD,MAAM,sBAAsB,GAAG,SAAS,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAEnE,OAAO,mBAAmB,CACxB;QACE,EAAE,IAAI,EAAE,SAAS,EAAE;QACnB,EAAE,IAAI,EAAE,SAAS,EAAE;QACnB,EAAE,IAAI,EAAE,SAAS,EAAE;QACnB,EAAE,IAAI,EAAE,SAAS,EAAE;QACnB,EAAE,IAAI,EAAE,SAAS,EAAE;QACnB,EAAE,IAAI,EAAE,SAAS,EAAE;QACnB,EAAE,IAAI,EAAE,SAAS,EAAE;QACnB,EAAE,IAAI,EAAE,SAAS,EAAE;QACnB,EAAE,IAAI,EAAE,SAAS,EAAE;QACnB,EAAE,IAAI,EAAE,SAAS,EAAE;KACpB,EACD;QACE,OAAO,CAAC,MAAiB;QACzB,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC;QAC1B,cAAc;QACd,cAAc;QACd,WAAW,CAAC,OAAO,CAAC,YAAY,CAAC;QACjC,WAAW,CAAC,OAAO,CAAC,oBAAoB,CAAC;QACzC,WAAW,CAAC,OAAO,CAAC,kBAAkB,CAAC;QACvC,WAAW,CAAC,OAAO,CAAC,YAAY,CAAC;QACjC,WAAW,CAAC,OAAO,CAAC,oBAAoB,CAAC;QACzC,sBAAsB;KACvB,CACF,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe;IACb,OAAO,EAAE,OAAO;IAEhB,OAAO,EAAE;QACP,OAAO,EAAE,4CAA4C;KACtD;IAED,GAAG,EAAE,gBAAgB;IAErB,oBAAoB,EAAE,CACpB,OAAsC,EACtC,iBAA0B,EAC1B,OAAe,EACT,EAAE;QACR,MAAM,OAAO,GAAG,mBAAmB,CACjC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,EAC/D;YACE,SAAS,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;YACrC,iBAAiB;YACjB,MAAM,CAAC,OAAO,CAAC;SAChB,CACF,CAAC;QAEF,OAAO,SAAS,CAAC,OAAO,CAAC,CAAC;IAC5B,CAAC;IAED,iBAAiB;CACqD,CAAC","sourcesContent":["import {\n encodeAbiParameters,\n hexToBigInt,\n keccak256,\n type Address,\n type Chain,\n type Hash,\n type Hex,\n} from \"viem\";\nimport { EntryPointAbi_v6 } from \"../abis/EntryPointAbi_v6.js\";\nimport type { UserOperationRequest } from \"../types.js\";\nimport type { SupportedEntryPoint } from \"./types.js\";\n\nconst packUserOperation = (request: UserOperationRequest<\"0.6.0\">): Hex => {\n const hashedInitCode = keccak256(request.initCode);\n const hashedCallData = keccak256(request.callData);\n const hashedPaymasterAndData = keccak256(request.paymasterAndData);\n\n return encodeAbiParameters(\n [\n { type: \"address\" },\n { type: \"uint256\" },\n { type: \"bytes32\" },\n { type: \"bytes32\" },\n { type: \"uint256\" },\n { type: \"uint256\" },\n { type: \"uint256\" },\n { type: \"uint256\" },\n { type: \"uint256\" },\n { type: \"bytes32\" },\n ],\n [\n request.sender as Address,\n hexToBigInt(request.nonce),\n hashedInitCode,\n hashedCallData,\n hexToBigInt(request.callGasLimit),\n hexToBigInt(request.verificationGasLimit),\n hexToBigInt(request.preVerificationGas),\n hexToBigInt(request.maxFeePerGas),\n hexToBigInt(request.maxPriorityFeePerGas),\n hashedPaymasterAndData,\n ],\n );\n};\n\nexport default {\n version: \"0.6.0\",\n\n address: {\n default: \"0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789\",\n },\n\n abi: EntryPointAbi_v6,\n\n getUserOperationHash: (\n request: UserOperationRequest<\"0.6.0\">,\n entryPointAddress: Address,\n chainId: number,\n ): Hash => {\n const encoded = encodeAbiParameters(\n [{ type: \"bytes32\" }, { type: \"address\" }, { type: \"uint256\" }],\n [\n keccak256(packUserOperation(request)),\n entryPointAddress,\n BigInt(chainId),\n ],\n );\n\n return keccak256(encoded);\n },\n\n packUserOperation,\n} satisfies SupportedEntryPoint<\"0.6.0\", Chain, typeof EntryPointAbi_v6>;\n"]}
@@ -781,7 +781,7 @@ declare const _default: {
781
781
  readonly type: "receive";
782
782
  }];
783
783
  getUserOperationHash: (request: UserOperationRequest<"0.7.0">, entryPointAddress: Address, chainId: number) => Hash;
784
- packUserOperation: (request: UserOperationRequest<"0.7.0">) => `0x${string}`;
784
+ packUserOperation: (request: UserOperationRequest<"0.7.0">) => Hex;
785
785
  };
786
786
  export default _default;
787
787
  export declare function packAccountGasLimits(data: Pick<UserOperationRequest_v7, "verificationGasLimit" | "callGasLimit"> | Pick<UserOperationRequest_v7, "maxPriorityFeePerGas" | "maxFeePerGas">): Hex;
@@ -1 +1 @@
1
- {"version":3,"file":"0.7.js","sourceRoot":"","sources":["../../../src/entrypoint/0.7.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,mBAAmB,EACnB,WAAW,EACX,SAAS,EACT,SAAS,EACT,GAAG,GAKJ,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAO/D,MAAM,iBAAiB,GAAG,CAAC,OAAsC,EAAO,EAAE;IACxE,MAAM,QAAQ,GACZ,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,WAAW;QACpC,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;QAChD,CAAC,CAAC,IAAI,CAAC;IACX,MAAM,gBAAgB,GAAG,oBAAoB,CAAC;QAC5C,oBAAoB,EAAE,OAAO,CAAC,oBAAoB;QAClD,YAAY,EAAE,OAAO,CAAC,YAAY;KACnC,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,oBAAoB,CAAC;QACnC,oBAAoB,EAAE,OAAO,CAAC,oBAAoB;QAClD,YAAY,EAAE,OAAO,CAAC,YAAY;KACnC,CAAC,CAAC;IAEH,MAAM,gBAAgB,GACpB,OAAO,CAAC,SAAS,IAAI,SAAS,CAAC,OAAO,CAAC,SAAS,CAAC;QAC/C,CAAC,CAAC,iBAAiB,CAAC;YAChB,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,6BAA6B,EAAE,OAAO,CAAC,6BAA6B;YACpE,uBAAuB,EAAE,OAAO,CAAC,uBAAuB;YACxD,aAAa,EAAE,OAAO,CAAC,aAAa;SACrC,CAAC;QACJ,CAAC,CAAC,IAAI,CAAC;IAEX,OAAO,mBAAmB,CACxB;QACE,EAAE,IAAI,EAAE,SAAS,EAAE;QACnB,EAAE,IAAI,EAAE,SAAS,EA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EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;AACtE,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,EAChC,SAAS,EACT,6BAA6B,EAC7B,uBAAuB,EACvB,aAAa,GAOd;IACC,IACE,CAAC,SAAS;QACV,CAAC,6BAA6B;QAC9B,CAAC,uBAAuB;QACxB,CAAC,aAAa,EACd,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,MAAM,CAAC;QACZ,SAAS;QACT,GAAG,CAAC,6BAA6B,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;QAChD,GAAG,CAAC,uBAAuB,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;QAC1C,aAAa;KACd,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,gBAAwB;IAI7D,OAAO;QACL,oBAAoB,EAAE,QAAQ,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;QACjE,YAAY,EAAE,QAAQ,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;KACvD,CAAC;AACJ,CAAC","sourcesContent":["import {\n concat,\n encodeAbiParameters,\n hexToBigInt,\n isAddress,\n keccak256,\n pad,\n type Address,\n type Chain,\n type Hash,\n type Hex,\n} from \"viem\";\nimport { EntryPointAbi_v7 } from \"../abis/EntryPointAbi_v7.js\";\nimport type {\n UserOperationRequest,\n UserOperationRequest_v7,\n} from \"../types.js\";\nimport type { SupportedEntryPoint } from \"./types.js\";\n\nconst packUserOperation = (request: UserOperationRequest<\"0.7.0\">): Hex => {\n const initCode =\n request.factory && request.factoryData\n ? concat([request.factory, request.factoryData])\n : \"0x\";\n const accountGasLimits = packAccountGasLimits({\n verificationGasLimit: request.verificationGasLimit,\n callGasLimit: request.callGasLimit,\n });\n\n const gasFees = packAccountGasLimits({\n maxPriorityFeePerGas: request.maxPriorityFeePerGas,\n maxFeePerGas: request.maxFeePerGas,\n });\n\n const paymasterAndData =\n request.paymaster && isAddress(request.paymaster)\n ? packPaymasterData({\n paymaster: request.paymaster,\n paymasterVerificationGasLimit: request.paymasterVerificationGasLimit,\n paymasterPostOpGasLimit: request.paymasterPostOpGasLimit,\n paymasterData: request.paymasterData,\n })\n : \"0x\";\n\n return encodeAbiParameters(\n [\n { type: \"address\" },\n { type: \"uint256\" },\n { type: \"bytes32\" },\n { type: \"bytes32\" },\n { type: \"bytes32\" },\n { type: \"uint256\" },\n { type: \"bytes32\" },\n { type: \"bytes32\" },\n ],\n [\n request.sender as Address,\n hexToBigInt(request.nonce),\n keccak256(initCode),\n keccak256(request.callData),\n accountGasLimits,\n hexToBigInt(request.preVerificationGas),\n gasFees,\n keccak256(paymasterAndData),\n ]\n );\n};\n\nexport default {\n version: \"0.7.0\",\n\n address: {\n default: \"0x0000000071727De22E5E9d8BAf0edAc6f37da032\",\n },\n\n abi: EntryPointAbi_v7,\n\n getUserOperationHash: (\n request: UserOperationRequest<\"0.7.0\">,\n entryPointAddress: Address,\n chainId: number\n ): Hash => {\n const encoded = encodeAbiParameters(\n [{ type: \"bytes32\" }, { type: \"address\" }, { type: \"uint256\" }],\n [\n keccak256(packUserOperation(request)),\n entryPointAddress,\n BigInt(chainId),\n ]\n );\n\n return keccak256(encoded);\n },\n\n packUserOperation,\n} satisfies SupportedEntryPoint<\"0.7.0\", Chain, typeof EntryPointAbi_v7>;\n\nexport function packAccountGasLimits(\n data:\n | Pick<UserOperationRequest_v7, \"verificationGasLimit\" | \"callGasLimit\">\n | Pick<UserOperationRequest_v7, \"maxPriorityFeePerGas\" | \"maxFeePerGas\">\n): Hex {\n return concat(Object.values(data).map((v) => pad(v, { size: 16 })));\n}\n\nexport function packPaymasterData({\n paymaster,\n paymasterVerificationGasLimit,\n paymasterPostOpGasLimit,\n paymasterData,\n}: Pick<\n UserOperationRequest_v7,\n | \"paymaster\"\n | \"paymasterVerificationGasLimit\"\n | \"paymasterPostOpGasLimit\"\n | \"paymasterData\"\n>): Hex {\n if (\n !paymaster ||\n !paymasterVerificationGasLimit ||\n !paymasterPostOpGasLimit ||\n !paymasterData\n ) {\n return \"0x\";\n }\n return concat([\n paymaster,\n pad(paymasterVerificationGasLimit, { size: 16 }),\n pad(paymasterPostOpGasLimit, { size: 16 }),\n paymasterData,\n ]);\n}\n\nexport function unpackAccountGasLimits(accountGasLimits: string): {\n verificationGasLimit: number;\n callGasLimit: number;\n} {\n return {\n verificationGasLimit: parseInt(accountGasLimits.slice(2, 34), 16),\n callGasLimit: parseInt(accountGasLimits.slice(34), 16),\n };\n}\n"]}
1
+ {"version":3,"file":"0.7.js","sourceRoot":"","sources":["../../../src/entrypoint/0.7.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,mBAAmB,EACnB,WAAW,EACX,SAAS,EACT,SAAS,EACT,GAAG,GAKJ,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAO/D,MAAM,iBAAiB,GAAG,CAAC,OAAsC,EAAO,EAAE;IACxE,MAAM,QAAQ,GACZ,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,WAAW;QACpC,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;QAChD,CAAC,CAAC,IAAI,CAAC;IACX,MAAM,gBAAgB,GAAG,oBAAoB,CAAC;QAC5C,oBAAoB,EAAE,OAAO,CAAC,oBAAoB;QAClD,YAAY,EAAE,OAAO,CAAC,YAAY;KACnC,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,oBAAoB,CAAC;QACnC,oBAAoB,EAAE,OAAO,CAAC,oBAAoB;QAClD,YAAY,EAAE,OAAO,CAAC,YAAY;KACnC,CAAC,CAAC;IAEH,MAAM,gBAAgB,GACpB,OAAO,CAAC,SAAS,IAAI,SAAS,CAAC,OAAO,CAAC,SAAS,CAAC;QAC/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AAiB;YACjB,MAAM,CAAC,OAAO,CAAC;SAChB,CACF,CAAC;QAEF,OAAO,SAAS,CAAC,OAAO,CAAC,CAAC;IAC5B,CAAC;IAED,iBAAiB;CACqD,CAAC;AAEzE,MAAM,UAAU,oBAAoB,CAClC,IAE0E;IAE1E,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;AACtE,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,EAChC,SAAS,EACT,6BAA6B,EAC7B,uBAAuB,EACvB,aAAa,GAOd;IACC,IACE,CAAC,SAAS;QACV,CAAC,6BAA6B;QAC9B,CAAC,uBAAuB;QACxB,CAAC,aAAa,EACd,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,MAAM,CAAC;QACZ,SAAS;QACT,GAAG,CAAC,6BAA6B,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;QAChD,GAAG,CAAC,uBAAuB,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;QAC1C,aAAa;KACd,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,gBAAwB;IAI7D,OAAO;QACL,oBAAoB,EAAE,QAAQ,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;QACjE,YAAY,EAAE,QAAQ,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;KACvD,CAAC;AACJ,CAAC","sourcesContent":["import {\n concat,\n encodeAbiParameters,\n hexToBigInt,\n isAddress,\n keccak256,\n pad,\n type Address,\n type Chain,\n type Hash,\n type Hex,\n} from \"viem\";\nimport { EntryPointAbi_v7 } from \"../abis/EntryPointAbi_v7.js\";\nimport type {\n UserOperationRequest,\n UserOperationRequest_v7,\n} from \"../types.js\";\nimport type { SupportedEntryPoint } from \"./types.js\";\n\nconst packUserOperation = (request: UserOperationRequest<\"0.7.0\">): Hex => {\n const initCode =\n request.factory && request.factoryData\n ? concat([request.factory, request.factoryData])\n : \"0x\";\n const accountGasLimits = packAccountGasLimits({\n verificationGasLimit: request.verificationGasLimit,\n callGasLimit: request.callGasLimit,\n });\n\n const gasFees = packAccountGasLimits({\n maxPriorityFeePerGas: request.maxPriorityFeePerGas,\n maxFeePerGas: request.maxFeePerGas,\n });\n\n const paymasterAndData =\n request.paymaster && isAddress(request.paymaster)\n ? packPaymasterData({\n paymaster: request.paymaster,\n paymasterVerificationGasLimit: request.paymasterVerificationGasLimit,\n paymasterPostOpGasLimit: request.paymasterPostOpGasLimit,\n paymasterData: request.paymasterData,\n })\n : \"0x\";\n\n return encodeAbiParameters(\n [\n { type: \"address\" },\n { type: \"uint256\" },\n { type: \"bytes32\" },\n { type: \"bytes32\" },\n { type: \"bytes32\" },\n { type: \"uint256\" },\n { type: \"bytes32\" },\n { type: \"bytes32\" },\n ],\n [\n request.sender as Address,\n hexToBigInt(request.nonce),\n keccak256(initCode),\n keccak256(request.callData),\n accountGasLimits,\n hexToBigInt(request.preVerificationGas),\n gasFees,\n keccak256(paymasterAndData),\n ],\n );\n};\n\nexport default {\n version: \"0.7.0\",\n\n address: {\n default: \"0x0000000071727De22E5E9d8BAf0edAc6f37da032\",\n },\n\n abi: EntryPointAbi_v7,\n\n getUserOperationHash: (\n request: UserOperationRequest<\"0.7.0\">,\n entryPointAddress: Address,\n chainId: number,\n ): Hash => {\n const encoded = encodeAbiParameters(\n [{ type: \"bytes32\" }, { type: \"address\" }, { type: \"uint256\" }],\n [\n keccak256(packUserOperation(request)),\n entryPointAddress,\n BigInt(chainId),\n ],\n );\n\n return keccak256(encoded);\n },\n\n packUserOperation,\n} satisfies SupportedEntryPoint<\"0.7.0\", Chain, typeof EntryPointAbi_v7>;\n\nexport function packAccountGasLimits(\n data:\n | Pick<UserOperationRequest_v7, \"verificationGasLimit\" | \"callGasLimit\">\n | Pick<UserOperationRequest_v7, \"maxPriorityFeePerGas\" | \"maxFeePerGas\">,\n): Hex {\n return concat(Object.values(data).map((v) => pad(v, { size: 16 })));\n}\n\nexport function packPaymasterData({\n paymaster,\n paymasterVerificationGasLimit,\n paymasterPostOpGasLimit,\n paymasterData,\n}: Pick<\n UserOperationRequest_v7,\n | \"paymaster\"\n | \"paymasterVerificationGasLimit\"\n | \"paymasterPostOpGasLimit\"\n | \"paymasterData\"\n>): Hex {\n if (\n !paymaster ||\n !paymasterVerificationGasLimit ||\n !paymasterPostOpGasLimit ||\n !paymasterData\n ) {\n return \"0x\";\n }\n return concat([\n paymaster,\n pad(paymasterVerificationGasLimit, { size: 16 }),\n pad(paymasterPostOpGasLimit, { size: 16 }),\n paymasterData,\n ]);\n}\n\nexport function unpackAccountGasLimits(accountGasLimits: string): {\n verificationGasLimit: number;\n callGasLimit: number;\n} {\n return {\n verificationGasLimit: parseInt(accountGasLimits.slice(2, 34), 16),\n callGasLimit: parseInt(accountGasLimits.slice(34), 16),\n };\n}\n"]}
@@ -16,7 +16,7 @@ export declare const entryPointRegistry: EntryPointRegistry;
16
16
  * @param {*} value The value to be checked
17
17
  * @returns {boolean} true if the value is a valid key of EntryPointRegistry, false otherwise
18
18
  */
19
- export declare const isEntryPointVersion: (value: any) => value is keyof EntryPointRegistry<Chain>;
19
+ export declare const isEntryPointVersion: (value: any) => value is keyof EntryPointRegistry;
20
20
  export declare function getEntryPoint<TEntryPointVersion extends EntryPointVersion = DefaultEntryPointVersion, TChain extends Chain = Chain>(chain: TChain, options: GetEntryPointOptions<TEntryPointVersion>): EntryPointDefRegistry<TChain>[TEntryPointVersion];
21
21
  export declare function getEntryPoint<TEntryPointVersion extends DefaultEntryPointVersion = DefaultEntryPointVersion, TChain extends Chain = Chain>(chain: TChain, options?: GetEntryPointOptions<TEntryPointVersion>): EntryPointDefRegistry<TChain>[TEntryPointVersion];
22
22
  export declare function getEntryPoint<TChain extends Chain = Chain>(chain: TChain, options?: GetEntryPointOptions<DefaultEntryPointVersion>): EntryPointDefRegistry<TChain>[DefaultEntryPointVersion];
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/entrypoint/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,MAAM,MAAM,CAAC;AAClC,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,aAAa,MAAM,UAAU,CAAC;AACrC,OAAO,aAAa,MAAM,UAAU,CAAC;AASrC,MAAM,CAAC,MAAM,wBAAwB,GAA6B,OAAO,CAAC;AAE1E,MAAM,CAAC,MAAM,kBAAkB,GAAuB;IACpD,OAAO,EAAE,aAAa;IACtB,OAAO,EAAE,aAAa;CACvB,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,KAAU,EACyB,EAAE;IACrC,OAAO,MAAM,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACzD,CAAC,CAAC;AAuBF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,aAAa,CAI3B,KAAa,EACb,OAAiD;IAEjD,MAAM,EAAE,OAAO,GAAG,wBAAwB,EAAE,eAAe,EAAE,GAAG,OAAO,IAAI;QACzE,OAAO,EAAE,wBAAwB;KAClC,CAAC;IAEF,MAAM,UAAU,GAAG,kBAAkB,CAAC,OAAO,IAAI,wBAAwB,CAAC,CAAC;IAC3E,MAAM,OAAO,GACX,eAAe;QACf,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5B,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC;IAC7B,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,uBAAuB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACpD,CAAC;IAED,IAAI,UAAU,CAAC,OAAO,KAAK,OAAO,EAAE,CAAC;QACnC,OAAO;YACL,OAAO,EAAE,UAAU,CAAC,OAAO;YAC3B,OAAO;YACP,KAAK;YACL,GAAG,EAAE,UAAU,CAAC,GAAG;YACnB,oBAAoB,EAAE,CAAC,CAAC,EAAE,EAAE,CAC1B,UAAU,CAAC,oBAAoB,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC;YACvD,iBAAiB,EAAE,UAAU,CAAC,iBAAiB;SAChD,CAAC;IACJ,CAAC;SAAM,IAAI,UAAU,CAAC,OAAO,KAAK,OAAO,EAAE,CAAC;QAC1C,OAAO;YACL,OAAO,EAAE,UAAU,CAAC,OAAO;YAC3B,OAAO;YACP,KAAK;YACL,GAAG,EAAE,UAAU,CAAC,GAAG;YACnB,oBAAoB,EAAE,CAAC,CAAC,EAAE,EAAE,CAC1B,UAAU,CAAC,oBAAoB,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC;YACvD,iBAAiB,EAAE,UAAU,CAAC,iBAAiB;SAChD,CAAC;IACJ,CAAC;IAED,MAAM,IAAI,uBAAuB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AACpD,CAAC","sourcesContent":["import { type Chain } from \"viem\";\nimport { EntryPointNotFoundError } from \"../errors/entrypoint.js\";\nimport EntryPoint_v6 from \"./0.6.js\";\nimport EntryPoint_v7 from \"./0.7.js\";\nimport type {\n DefaultEntryPointVersion,\n EntryPointDefRegistry,\n EntryPointRegistry,\n EntryPointVersion,\n GetEntryPointOptions,\n} from \"./types.js\";\n\nexport const defaultEntryPointVersion: DefaultEntryPointVersion = \"0.6.0\";\n\nexport const entryPointRegistry: EntryPointRegistry = {\n \"0.6.0\": EntryPoint_v6,\n \"0.7.0\": EntryPoint_v7,\n};\n\n/**\n * Checks if the given value is a valid key of the EntryPointRegistry.\n *\n * @example\n * ```ts\n * import { isEntryPointVersion } from \"@aa-sdk/core\";\n *\n * const valid = isEntryPointVersion(\"0.6.0\");\n * const invalid = isEntryPointVersion(\"0.8.0\");\n * ```\n *\n * @param {*} value The value to be checked\n * @returns {boolean} true if the value is a valid key of EntryPointRegistry, false otherwise\n */\nexport const isEntryPointVersion = (\n value: any\n): value is keyof EntryPointRegistry => {\n return Object.keys(entryPointRegistry).includes(value);\n};\n\nexport function getEntryPoint<\n TEntryPointVersion extends EntryPointVersion = DefaultEntryPointVersion,\n TChain extends Chain = Chain\n>(\n chain: TChain,\n options: GetEntryPointOptions<TEntryPointVersion>\n): EntryPointDefRegistry<TChain>[TEntryPointVersion];\n\nexport function getEntryPoint<\n TEntryPointVersion extends DefaultEntryPointVersion = DefaultEntryPointVersion,\n TChain extends Chain = Chain\n>(\n chain: TChain,\n options?: GetEntryPointOptions<TEntryPointVersion>\n): EntryPointDefRegistry<TChain>[TEntryPointVersion];\n\nexport function getEntryPoint<TChain extends Chain = Chain>(\n chain: TChain,\n options?: GetEntryPointOptions<DefaultEntryPointVersion>\n): EntryPointDefRegistry<TChain>[DefaultEntryPointVersion];\n\n/**\n * Retrieves the entry point definition for the specified chain and version, falling back to the default version if not provided. Throws an error if the entry point address cannot be found.\n *\n * @example\n * ```ts\n * import { getEntryPoint } from \"@aa-sdk/core\";\n * import { sepolia } from \"viem/chains\";\n *\n * const entryPoint060 = getEntryPoint(sepolia);\n * const entryPoint070 = getEntryPoint(sepolia, { version: \"0.7.0\" });\n * ```\n *\n * @param {Chain} chain The chain for which the entry point is being retrieved\n * @param {GetEntryPointOptions<TEntryPointVersion>} options Options containing the version and address overrides for the entry point\n * @returns {EntryPointDefRegistry<TChain>[EntryPointVersion]} The entry point definition for the specified chain and version\n */\nexport function getEntryPoint<\n TEntryPointVersion extends EntryPointVersion,\n TChain extends Chain = Chain\n>(\n chain: TChain,\n options: GetEntryPointOptions<TEntryPointVersion>\n): EntryPointDefRegistry<TChain>[EntryPointVersion] {\n const { version = defaultEntryPointVersion, addressOverride } = options ?? {\n version: defaultEntryPointVersion,\n };\n\n const entryPoint = entryPointRegistry[version ?? defaultEntryPointVersion];\n const address =\n addressOverride ??\n entryPoint.address[chain.id] ??\n entryPoint.address.default;\n if (!address) {\n throw new EntryPointNotFoundError(chain, version);\n }\n\n if (entryPoint.version === \"0.6.0\") {\n return {\n version: entryPoint.version,\n address,\n chain,\n abi: entryPoint.abi,\n getUserOperationHash: (r) =>\n entryPoint.getUserOperationHash(r, address, chain.id),\n packUserOperation: entryPoint.packUserOperation,\n };\n } else if (entryPoint.version === \"0.7.0\") {\n return {\n version: entryPoint.version,\n address,\n chain,\n abi: entryPoint.abi,\n getUserOperationHash: (r) =>\n entryPoint.getUserOperationHash(r, address, chain.id),\n packUserOperation: entryPoint.packUserOperation,\n };\n }\n\n throw new EntryPointNotFoundError(chain, version);\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/entrypoint/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,MAAM,MAAM,CAAC;AAClC,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,aAAa,MAAM,UAAU,CAAC;AACrC,OAAO,aAAa,MAAM,UAAU,CAAC;AASrC,MAAM,CAAC,MAAM,wBAAwB,GAA6B,OAAO,CAAC;AAE1E,MAAM,CAAC,MAAM,kBAAkB,GAAuB;IACpD,OAAO,EAAE,aAAa;IACtB,OAAO,EAAE,aAAa;CACvB,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,KAAU,EACyB,EAAE;IACrC,OAAO,MAAM,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACzD,CAAC,CAAC;AAwBF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,aAAa,CAI3B,KAAa,EACb,OAAiD;IAEjD,MAAM,EAAE,OAAO,GAAG,wBAAwB,EAAE,eAAe,EAAE,GAAG,OAAO,IAAI;QACzE,OAAO,EAAE,wBAAwB;KAClC,CAAC;IAEF,MAAM,UAAU,GAAG,kBAAkB,CAAC,OAAO,IAAI,wBAAwB,CAAC,CAAC;IAC3E,MAAM,OAAO,GACX,eAAe;QACf,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5B,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC;IAC7B,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,uBAAuB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACpD,CAAC;IAED,IAAI,UAAU,CAAC,OAAO,KAAK,OAAO,EAAE,CAAC;QACnC,OAAO;YACL,OAAO,EAAE,UAAU,CAAC,OAAO;YAC3B,OAAO;YACP,KAAK;YACL,GAAG,EAAE,UAAU,CAAC,GAAG;YACnB,oBAAoB,EAAE,CAAC,CAAC,EAAE,EAAE,CAC1B,UAAU,CAAC,oBAAoB,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC;YACvD,iBAAiB,EAAE,UAAU,CAAC,iBAAiB;SAChD,CAAC;IACJ,CAAC;SAAM,IAAI,UAAU,CAAC,OAAO,KAAK,OAAO,EAAE,CAAC;QAC1C,OAAO;YACL,OAAO,EAAE,UAAU,CAAC,OAAO;YAC3B,OAAO;YACP,KAAK;YACL,GAAG,EAAE,UAAU,CAAC,GAAG;YACnB,oBAAoB,EAAE,CAAC,CAAC,EAAE,EAAE,CAC1B,UAAU,CAAC,oBAAoB,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC;YACvD,iBAAiB,EAAE,UAAU,CAAC,iBAAiB;SAChD,CAAC;IACJ,CAAC;IAED,MAAM,IAAI,uBAAuB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AACpD,CAAC","sourcesContent":["import { type Chain } from \"viem\";\nimport { EntryPointNotFoundError } from \"../errors/entrypoint.js\";\nimport EntryPoint_v6 from \"./0.6.js\";\nimport EntryPoint_v7 from \"./0.7.js\";\nimport type {\n DefaultEntryPointVersion,\n EntryPointDefRegistry,\n EntryPointRegistry,\n EntryPointVersion,\n GetEntryPointOptions,\n} from \"./types.js\";\n\nexport const defaultEntryPointVersion: DefaultEntryPointVersion = \"0.6.0\";\n\nexport const entryPointRegistry: EntryPointRegistry = {\n \"0.6.0\": EntryPoint_v6,\n \"0.7.0\": EntryPoint_v7,\n};\n\n/**\n * Checks if the given value is a valid key of the EntryPointRegistry.\n *\n * @example\n * ```ts\n * import { isEntryPointVersion } from \"@aa-sdk/core\";\n *\n * const valid = isEntryPointVersion(\"0.6.0\");\n * const invalid = isEntryPointVersion(\"0.8.0\");\n * ```\n *\n * @param {*} value The value to be checked\n * @returns {boolean} true if the value is a valid key of EntryPointRegistry, false otherwise\n */\nexport const isEntryPointVersion = (\n value: any,\n): value is keyof EntryPointRegistry => {\n return Object.keys(entryPointRegistry).includes(value);\n};\n\nexport function getEntryPoint<\n TEntryPointVersion extends EntryPointVersion = DefaultEntryPointVersion,\n TChain extends Chain = Chain,\n>(\n chain: TChain,\n options: GetEntryPointOptions<TEntryPointVersion>,\n): EntryPointDefRegistry<TChain>[TEntryPointVersion];\n\nexport function getEntryPoint<\n TEntryPointVersion extends\n DefaultEntryPointVersion = DefaultEntryPointVersion,\n TChain extends Chain = Chain,\n>(\n chain: TChain,\n options?: GetEntryPointOptions<TEntryPointVersion>,\n): EntryPointDefRegistry<TChain>[TEntryPointVersion];\n\nexport function getEntryPoint<TChain extends Chain = Chain>(\n chain: TChain,\n options?: GetEntryPointOptions<DefaultEntryPointVersion>,\n): EntryPointDefRegistry<TChain>[DefaultEntryPointVersion];\n\n/**\n * Retrieves the entry point definition for the specified chain and version, falling back to the default version if not provided. Throws an error if the entry point address cannot be found.\n *\n * @example\n * ```ts\n * import { getEntryPoint } from \"@aa-sdk/core\";\n * import { sepolia } from \"viem/chains\";\n *\n * const entryPoint060 = getEntryPoint(sepolia);\n * const entryPoint070 = getEntryPoint(sepolia, { version: \"0.7.0\" });\n * ```\n *\n * @param {Chain} chain The chain for which the entry point is being retrieved\n * @param {GetEntryPointOptions<TEntryPointVersion>} options Options containing the version and address overrides for the entry point\n * @returns {EntryPointDefRegistry<TChain>[EntryPointVersion]} The entry point definition for the specified chain and version\n */\nexport function getEntryPoint<\n TEntryPointVersion extends EntryPointVersion,\n TChain extends Chain = Chain,\n>(\n chain: TChain,\n options: GetEntryPointOptions<TEntryPointVersion>,\n): EntryPointDefRegistry<TChain>[EntryPointVersion] {\n const { version = defaultEntryPointVersion, addressOverride } = options ?? {\n version: defaultEntryPointVersion,\n };\n\n const entryPoint = entryPointRegistry[version ?? defaultEntryPointVersion];\n const address =\n addressOverride ??\n entryPoint.address[chain.id] ??\n entryPoint.address.default;\n if (!address) {\n throw new EntryPointNotFoundError(chain, version);\n }\n\n if (entryPoint.version === \"0.6.0\") {\n return {\n version: entryPoint.version,\n address,\n chain,\n abi: entryPoint.abi,\n getUserOperationHash: (r) =>\n entryPoint.getUserOperationHash(r, address, chain.id),\n packUserOperation: entryPoint.packUserOperation,\n };\n } else if (entryPoint.version === \"0.7.0\") {\n return {\n version: entryPoint.version,\n address,\n chain,\n abi: entryPoint.abi,\n getUserOperationHash: (r) =>\n entryPoint.getUserOperationHash(r, address, chain.id),\n packUserOperation: entryPoint.packUserOperation,\n };\n }\n\n throw new EntryPointNotFoundError(chain, version);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/entrypoint/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n Abi,\n Account,\n Address,\n Chain,\n GetContractParameters,\n Hash,\n Hex,\n Transport,\n} from \"viem\";\nimport type { EntryPointAbi_v6 } from \"../abis/EntryPointAbi_v6\";\nimport type { EntryPointAbi_v7 } from \"../abis/EntryPointAbi_v7\";\nimport type { UserOperationRequest } from \"../types\";\nimport type { EQ, IsOneOf, OneOf } from \"../utils\";\n\nexport interface EntryPointRegistryBase<T> {\n \"0.6.0\": T;\n \"0.7.0\": T;\n}\nexport type EntryPointVersion = keyof EntryPointRegistryBase<unknown>;\nexport type DefaultEntryPointVersion = OneOf<\"0.6.0\", EntryPointVersion>;\n\nexport type SupportedEntryPoint<\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion,\n TChain extends Chain = Chain,\n TAbi extends Abi | readonly unknown[] = Abi\n> = {\n version: TEntryPointVersion;\n address: Record<TChain[\"id\"] | \"default\", Address>;\n abi: GetContractParameters<Transport, TChain, Account, TAbi>[\"abi\"];\n\n /**\n * Generates a hash for a UserOperation valid from entry point version 0.6 onwards\n *\n * @param request - the UserOperation to get the hash for\n * @param entryPointAddress - the entry point address that will be used to execute the UserOperation\n * @param chainId - the chain on which this UserOperation will be executed\n * @returns the hash of the UserOperation\n */\n getUserOperationHash: (\n request: UserOperationRequest<TEntryPointVersion>,\n entryPointAddress: Address,\n chainId: number\n ) => Hash;\n\n /**\n * Pack the user operation data into bytes for hashing for entry point version 0.6 onwards\n * Reference:\n * v6: https://github.com/eth-infinitism/account-abstraction/blob/releases/v0.6/test/UserOp.ts#L16-L61\n * v7: https://github.com/eth-infinitism/account-abstraction/blob/releases/v0.7/test/UserOp.ts#L28-L67\n *\n * @param request - the UserOperation to get the hash for\n * @returns the hash of the UserOperation\n */\n packUserOperation: (\n userOperation: UserOperationRequest<TEntryPointVersion>\n ) => Hex;\n};\n\nexport interface EntryPointRegistry<TChain extends Chain = Chain>\n extends EntryPointRegistryBase<\n SupportedEntryPoint<EntryPointVersion, TChain, Abi>\n > {\n \"0.6.0\": SupportedEntryPoint<\"0.6.0\", TChain, typeof EntryPointAbi_v6>;\n \"0.7.0\": SupportedEntryPoint<\"0.7.0\", TChain, typeof EntryPointAbi_v7>;\n}\n\n// [!region EntryPointDef]\nexport type EntryPointDef<\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion,\n TChain extends Chain = Chain,\n TAbi extends Abi | readonly unknown[] = Abi\n> = {\n version: TEntryPointVersion;\n address: Address;\n chain: TChain;\n abi: GetContractParameters<Transport, TChain, Account, TAbi>[\"abi\"];\n getUserOperationHash: (\n request: UserOperationRequest<TEntryPointVersion>\n ) => Hex;\n packUserOperation: (\n userOperation: UserOperationRequest<TEntryPointVersion>\n ) => Hex;\n};\n// [!endregion EntryPointDef]\n\nexport interface EntryPointDefRegistry<TChain extends Chain = Chain>\n extends EntryPointRegistryBase<\n EntryPointDef<EntryPointVersion, TChain, Abi>\n > {\n \"0.6.0\": EntryPointDef<\"0.6.0\", TChain, typeof EntryPointAbi_v6>;\n \"0.7.0\": EntryPointDef<\"0.7.0\", TChain, typeof EntryPointAbi_v7>;\n}\n\nexport type GetEntryPointOptions<\n TEntryPointVersion extends EntryPointVersion = DefaultEntryPointVersion\n> = EQ<TEntryPointVersion, DefaultEntryPointVersion> extends true\n ?\n | {\n addressOverride?: Address;\n version?: OneOf<TEntryPointVersion, EntryPointVersion>;\n }\n | undefined\n : {\n addressOverride?: Address;\n version: OneOf<TEntryPointVersion, EntryPointVersion>;\n };\n\nexport type EntryPointParameter<\n TEntryPointVersion extends EntryPointVersion,\n TChain extends Chain = Chain\n> = EQ<TEntryPointVersion, DefaultEntryPointVersion> extends true\n ? {\n entryPoint?: EntryPointDef<TEntryPointVersion, TChain>;\n }\n : {\n entryPoint: IsOneOf<TEntryPointVersion, EntryPointVersion> extends true\n ? EntryPointDef<TEntryPointVersion, TChain>\n : never;\n };\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/entrypoint/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n Abi,\n Account,\n Address,\n Chain,\n GetContractParameters,\n Hash,\n Hex,\n Transport,\n} from \"viem\";\nimport type { EntryPointAbi_v6 } from \"../abis/EntryPointAbi_v6\";\nimport type { EntryPointAbi_v7 } from \"../abis/EntryPointAbi_v7\";\nimport type { UserOperationRequest } from \"../types\";\nimport type { EQ, IsOneOf, OneOf } from \"../utils\";\n\nexport interface EntryPointRegistryBase<T> {\n \"0.6.0\": T;\n \"0.7.0\": T;\n}\nexport type EntryPointVersion = keyof EntryPointRegistryBase<unknown>;\nexport type DefaultEntryPointVersion = OneOf<\"0.6.0\", EntryPointVersion>;\n\nexport type SupportedEntryPoint<\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion,\n TChain extends Chain = Chain,\n TAbi extends Abi | readonly unknown[] = Abi,\n> = {\n version: TEntryPointVersion;\n address: Record<TChain[\"id\"] | \"default\", Address>;\n abi: GetContractParameters<Transport, TChain, Account, TAbi>[\"abi\"];\n\n /**\n * Generates a hash for a UserOperation valid from entry point version 0.6 onwards\n *\n * @param request - the UserOperation to get the hash for\n * @param entryPointAddress - the entry point address that will be used to execute the UserOperation\n * @param chainId - the chain on which this UserOperation will be executed\n * @returns the hash of the UserOperation\n */\n getUserOperationHash: (\n request: UserOperationRequest<TEntryPointVersion>,\n entryPointAddress: Address,\n chainId: number,\n ) => Hash;\n\n /**\n * Pack the user operation data into bytes for hashing for entry point version 0.6 onwards\n * Reference:\n * v6: https://github.com/eth-infinitism/account-abstraction/blob/releases/v0.6/test/UserOp.ts#L16-L61\n * v7: https://github.com/eth-infinitism/account-abstraction/blob/releases/v0.7/test/UserOp.ts#L28-L67\n *\n * @param request - the UserOperation to get the hash for\n * @returns the hash of the UserOperation\n */\n packUserOperation: (\n userOperation: UserOperationRequest<TEntryPointVersion>,\n ) => Hex;\n};\n\nexport interface EntryPointRegistry<TChain extends Chain = Chain>\n extends EntryPointRegistryBase<\n SupportedEntryPoint<EntryPointVersion, TChain, Abi>\n > {\n \"0.6.0\": SupportedEntryPoint<\"0.6.0\", TChain, typeof EntryPointAbi_v6>;\n \"0.7.0\": SupportedEntryPoint<\"0.7.0\", TChain, typeof EntryPointAbi_v7>;\n}\n\n// [!region EntryPointDef]\nexport type EntryPointDef<\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion,\n TChain extends Chain = Chain,\n TAbi extends Abi | readonly unknown[] = Abi,\n> = {\n version: TEntryPointVersion;\n address: Address;\n chain: TChain;\n abi: GetContractParameters<Transport, TChain, Account, TAbi>[\"abi\"];\n getUserOperationHash: (\n request: UserOperationRequest<TEntryPointVersion>,\n ) => Hex;\n packUserOperation: (\n userOperation: UserOperationRequest<TEntryPointVersion>,\n ) => Hex;\n};\n// [!endregion EntryPointDef]\n\nexport interface EntryPointDefRegistry<TChain extends Chain = Chain>\n extends EntryPointRegistryBase<\n EntryPointDef<EntryPointVersion, TChain, Abi>\n > {\n \"0.6.0\": EntryPointDef<\"0.6.0\", TChain, typeof EntryPointAbi_v6>;\n \"0.7.0\": EntryPointDef<\"0.7.0\", TChain, typeof EntryPointAbi_v7>;\n}\n\nexport type GetEntryPointOptions<\n TEntryPointVersion extends EntryPointVersion = DefaultEntryPointVersion,\n> =\n EQ<TEntryPointVersion, DefaultEntryPointVersion> extends true\n ?\n | {\n addressOverride?: Address;\n version?: OneOf<TEntryPointVersion, EntryPointVersion>;\n }\n | undefined\n : {\n addressOverride?: Address;\n version: OneOf<TEntryPointVersion, EntryPointVersion>;\n };\n\nexport type EntryPointParameter<\n TEntryPointVersion extends EntryPointVersion,\n TChain extends Chain = Chain,\n> =\n EQ<TEntryPointVersion, DefaultEntryPointVersion> extends true\n ? {\n entryPoint?: EntryPointDef<TEntryPointVersion, TChain>;\n }\n : {\n entryPoint: IsOneOf<TEntryPointVersion, EntryPointVersion> extends true\n ? EntryPointDef<TEntryPointVersion, TChain>\n : never;\n };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"account.js","sourceRoot":"","sources":["../../../src/errors/account.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC;;GAEG;AACH,MAAM,OAAO,oBAAqB,SAAQ,SAAS;IAGjD,oDAAoD;IAEpD;;OAEG,CAAC;QACF,KAAK,CAAC,wDAAwD,CAAC,CAAC;QAPzD;;;;mBAAO,sBAAsB;WAAC;IAQvC,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,6BAA8B,SAAQ,SAAS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H,YAAY,WAAmB;QAC7B,KAAK,CAAC,mBAAmB,WAAW,+BAA+B,CAAC,CAAC;QAR9D;;;;mBAAO,2BAA2B;WAAC;IAS5C,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,iCAAkC,SAAQ,SAAS;IAG9D;;;;OAIG;IACH,YAAY,WAAmB;QAC7B,KAAK,CAAC,wCAAwC,WAAW,EAAE,CAAC,CAAC;QARtD;;;;mBAAO,mCAAmC;WAAC;IASpD,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,oBAAqB,SAAQ,SAAS;IAGjD;;;;;OAKG;IACH,YAAY,QAAgB,EAAE,MAAc;QAC1C,KAAK,CAAC,yBAAyB,QAAQ,SAAS,MAAM,EAAE,CAAC,CAAC;QATnD;;;;mBAAO,2BAA2B;WAAC;IAU5C,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,mCAAoC,SAAQ,SAAS;IAGhE;;OAEG,CAAC;QACF,KAAK,CAAC,iCAAiC,CAAC,CAAC;QALlC;;;;mBAAO,qCAAqC;WAAC;IAMtD,CAAC;CACF","sourcesContent":["import type { Chain } from \"viem\";\nimport type { EntryPointVersion } from \"../entrypoint/types.js\";\nimport { BaseError } from \"./base.js\";\n\n/**\n * This error is thrown when an account could not be found to execute a specific action. It extends the `BaseError` class.\n */\nexport class AccountNotFoundError extends BaseError {\n override name = \"AccountNotFoundError\";\n\n // TODO: extend this further using docs path as well\n\n /**\n * Constructor for initializing an error message indicating that an account could not be found to execute the specified action.\n */ constructor() {\n super(\"Could not find an Account to execute with this Action.\");\n }\n}\n\n/**\n * Represents an error that is thrown when no default factory is defined for a specific account type on a given chain and entry point version.\n * This error suggests providing an override via the `factoryAddress` parameter when creating an account.\n */\nexport class DefaultFactoryNotDefinedError extends BaseError {\n override name = \"DefaultFactoryNotDefinedError\";\n\n /**\n * Constructs an error message indicating that no default factory was found for the given account type, chain, and entry point version.\n *\n * @param {string} accountType the type of account\n * @param {Chain} chain the blockchain chain\n * @param {EntryPointVersion} version the entry point version\n */\n constructor(accountType: string, chain: Chain, version: EntryPointVersion) {\n super(\n [\n `No default factory for ${accountType} found on chain ${chain.name} for entrypoint version ${version}`,\n \"Supply an override via the `factoryAddress` parameter when creating an account\",\n ].join(\"\\n\")\n );\n }\n}\n\n/**\n * Custom error class for handling errors when getting a counterfactual address. This extends the `BaseError` class and provides a custom error message and name.\n */\nexport class GetCounterFactualAddressError extends BaseError {\n override name = \"GetCounterFactualAddressError\";\n\n /**\n * Constructor for initializing an error message indicating the failure of fetching the counter-factual address.\n */ constructor() {\n super(\"getCounterFactualAddress failed\");\n }\n}\n\n/**\n * An error class representing the condition where upgrades are not supported for a specific account type. This error extends the `BaseError` class and provides a custom error message based on the account type.\n */\nexport class UpgradesNotSupportedError extends BaseError {\n override name = \"UpgradesNotSupported\";\n\n /**\n * Error constructor for indicating that upgrades are not supported by the given account type.\n *\n * @param {string} accountType The type of account that does not support upgrades\n */\n constructor(accountType: string) {\n super(`Upgrades are not supported by ${accountType}`);\n }\n}\n\n/**\n * Error thrown when attempting to sign a transaction that is not supported by smart contracts.\n */\nexport class SignTransactionNotSupportedError extends BaseError {\n override name = \"SignTransactionNotSupported\";\n\n /**\n * Throws an error indicating that signing a transaction is not supported by smart contracts.\n *\n \n */ constructor() {\n super(`SignTransaction is not supported by smart contracts`);\n }\n}\n\n/**\n * Custom error class `FailedToGetStorageSlotError` which is used to signal a failure when attempting to retrieve a storage slot. This error includes the slot and slot descriptor in its message and inherits from `BaseError`.\n */\nexport class FailedToGetStorageSlotError extends BaseError {\n override name = \"FailedToGetStorageSlotError\";\n\n /**\n * Custom error message constructor for failing to get a specific storage slot.\n *\n * @param {string} slot The storage slot that failed to be accessed or retrieved\n * @param {string} slotDescriptor A description of the storage slot, for additional context in the error message\n */\n constructor(slot: string, slotDescriptor: string) {\n super(`Failed to get storage slot ${slot} (${slotDescriptor})`);\n }\n}\n\n/**\n * Represents an error indicating that batch execution is not supported for a specific account type.\n */\nexport class BatchExecutionNotSupportedError extends BaseError {\n override name = \"BatchExecutionNotSupportedError\";\n\n /**\n * Constructs an error message indicating that batch execution is not supported by the specified account type.\n *\n * @param {string} accountType the type of account that does not support batch execution\n */\n constructor(accountType: string) {\n super(`Batch execution is not supported by ${accountType}`);\n }\n}\n\n/**\n * Represents an error that occurs when an account requires an owner to execute but none is provided.\n */\nexport class AccountRequiresOwnerError extends BaseError {\n override name = \"AccountRequiresOwnerError\";\n\n /**\n * Constructs an error indicating that an account of the specified type requires an owner to execute.\n *\n * @param {string} accountType The type of account that requires an owner\n */\n constructor(accountType: string) {\n super(`Account of type ${accountType} requires an owner to execute`);\n }\n}\n\n/**\n * Represents an error that occurs when an attempt is made to call `UpgradeToAndCall` on an account type that does not support it. Includes the account type in the error message.\n */\nexport class UpgradeToAndCallNotSupportedError extends BaseError {\n override name = \"UpgradeToAndCallNotSupportedError\";\n\n /**\n * Constructs an error message indicating that `UpgradeToAndCall` is not supported by the specified account type.\n *\n * @param {string} accountType The type of account that does not support `UpgradeToAndCall`\n */\n constructor(accountType: string) {\n super(`UpgradeToAndCall is not supported by ${accountType}`);\n }\n}\n\n/**\n * Represents an error thrown when an account type does not match the expected type.\n */\nexport class IncorrectAccountType extends BaseError {\n override name = \"IncorrectAccountTypeError\";\n\n /**\n * Constructs an error object indicating that the expected account type does not match the actual account type.\n *\n * @param {string} expected the expected account type\n * @param {string} actual the actual account type that was received\n */\n constructor(expected: string, actual: string) {\n super(`Expected account type ${expected}, got ${actual}`);\n }\n}\n\n/**\n * Error class indicating that a smart account operation requires a signer.\n */\nexport class SmartAccountWithSignerRequiredError extends BaseError {\n override name = \"SmartAccountWithSignerRequiredError\";\n\n /**\n * Initializes a new instance of the error class with a predefined error message indicating that a smart account requires a signer.\n */ constructor() {\n super(\"Smart account requires a signer\");\n }\n}\n"]}
1
+ {"version":3,"file":"account.js","sourceRoot":"","sources":["../../../src/errors/account.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,W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MAAM,OAAO,+BAAgC,SAAQ,SAAS;IAG5D;;;;OAIG;IACH,YAAY,WAAmB;QAC7B,KAAK,CAAC,uCAAuC,WAAW,EAAE,CAAC,CAAC;QARrD;;;;mBAAO,iCAAiC;WAAC;IASlD,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,yBAA0B,SAAQ,SAAS;IAGtD;;;;OAIG;IACH,YAAY,WAAmB;QAC7B,KAAK,CAAC,mBAAmB,WAAW,+BAA+B,CAAC,CAAC;QAR9D;;;;mBAAO,2BAA2B;WAAC;IAS5C,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,iCAAkC,SAAQ,SAAS;IAG9D;;;;OAIG;IACH,YAAY,WAAmB;QAC7B,KAAK,CAAC,wCAAwC,WAAW,EAAE,CAAC,CAAC;QARtD;;;;mBAAO,mCAAmC;WAAC;IASpD,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,oBAAqB,SAAQ,SAAS;IAGjD;;;;;OAKG;IACH,YAAY,QAAgB,EAAE,MAAc;QAC1C,KAAK,CAAC,yBAAyB,QAAQ,SAAS,MAAM,EAAE,CAAC,CAAC;QATnD;;;;mBAAO,2BAA2B;WAAC;IAU5C,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,mCAAoC,SAAQ,SAAS;IAGhE;;OAEG,CAAC;QACF,KAAK,CAAC,iCAAiC,CAAC,CAAC;QALlC;;;;mBAAO,qCAAqC;WAAC;IAMtD,CAAC;CACF","sourcesContent":["import type { Chain } from \"viem\";\nimport type { EntryPointVersion } from \"../entrypoint/types.js\";\nimport { BaseError } from \"./base.js\";\n\n/**\n * This error is thrown when an account could not be found to execute a specific action. It extends the `BaseError` class.\n */\nexport class AccountNotFoundError extends BaseError {\n override name = \"AccountNotFoundError\";\n\n // TODO: extend this further using docs path as well\n\n /**\n * Constructor for initializing an error message indicating that an account could not be found to execute the specified action.\n */ constructor() {\n super(\"Could not find an Account to execute with this Action.\");\n }\n}\n\n/**\n * Represents an error that is thrown when no default factory is defined for a specific account type on a given chain and entry point version.\n * This error suggests providing an override via the `factoryAddress` parameter when creating an account.\n */\nexport class DefaultFactoryNotDefinedError extends BaseError {\n override name = \"DefaultFactoryNotDefinedError\";\n\n /**\n * Constructs an error message indicating that no default factory was found for the given account type, chain, and entry point version.\n *\n * @param {string} accountType the type of account\n * @param {Chain} chain the blockchain chain\n * @param {EntryPointVersion} version the entry point version\n */\n constructor(accountType: string, chain: Chain, version: EntryPointVersion) {\n super(\n [\n `No default factory for ${accountType} found on chain ${chain.name} for entrypoint version ${version}`,\n \"Supply an override via the `factoryAddress` parameter when creating an account\",\n ].join(\"\\n\"),\n );\n }\n}\n\n/**\n * Custom error class for handling errors when getting a counterfactual address. This extends the `BaseError` class and provides a custom error message and name.\n */\nexport class GetCounterFactualAddressError extends BaseError {\n override name = \"GetCounterFactualAddressError\";\n\n /**\n * Constructor for initializing an error message indicating the failure of fetching the counter-factual address.\n */ constructor() {\n super(\"getCounterFactualAddress failed\");\n }\n}\n\n/**\n * An error class representing the condition where upgrades are not supported for a specific account type. This error extends the `BaseError` class and provides a custom error message based on the account type.\n */\nexport class UpgradesNotSupportedError extends BaseError {\n override name = \"UpgradesNotSupported\";\n\n /**\n * Error constructor for indicating that upgrades are not supported by the given account type.\n *\n * @param {string} accountType The type of account that does not support upgrades\n */\n constructor(accountType: string) {\n super(`Upgrades are not supported by ${accountType}`);\n }\n}\n\n/**\n * Error thrown when attempting to sign a transaction that is not supported by smart contracts.\n */\nexport class SignTransactionNotSupportedError extends BaseError {\n override name = \"SignTransactionNotSupported\";\n\n /**\n * Throws an error indicating that signing a transaction is not supported by smart contracts.\n *\n \n */ constructor() {\n super(`SignTransaction is not supported by smart contracts`);\n }\n}\n\n/**\n * Custom error class `FailedToGetStorageSlotError` which is used to signal a failure when attempting to retrieve a storage slot. This error includes the slot and slot descriptor in its message and inherits from `BaseError`.\n */\nexport class FailedToGetStorageSlotError extends BaseError {\n override name = \"FailedToGetStorageSlotError\";\n\n /**\n * Custom error message constructor for failing to get a specific storage slot.\n *\n * @param {string} slot The storage slot that failed to be accessed or retrieved\n * @param {string} slotDescriptor A description of the storage slot, for additional context in the error message\n */\n constructor(slot: string, slotDescriptor: string) {\n super(`Failed to get storage slot ${slot} (${slotDescriptor})`);\n }\n}\n\n/**\n * Represents an error indicating that batch execution is not supported for a specific account type.\n */\nexport class BatchExecutionNotSupportedError extends BaseError {\n override name = \"BatchExecutionNotSupportedError\";\n\n /**\n * Constructs an error message indicating that batch execution is not supported by the specified account type.\n *\n * @param {string} accountType the type of account that does not support batch execution\n */\n constructor(accountType: string) {\n super(`Batch execution is not supported by ${accountType}`);\n }\n}\n\n/**\n * Represents an error that occurs when an account requires an owner to execute but none is provided.\n */\nexport class AccountRequiresOwnerError extends BaseError {\n override name = \"AccountRequiresOwnerError\";\n\n /**\n * Constructs an error indicating that an account of the specified type requires an owner to execute.\n *\n * @param {string} accountType The type of account that requires an owner\n */\n constructor(accountType: string) {\n super(`Account of type ${accountType} requires an owner to execute`);\n }\n}\n\n/**\n * Represents an error that occurs when an attempt is made to call `UpgradeToAndCall` on an account type that does not support it. Includes the account type in the error message.\n */\nexport class UpgradeToAndCallNotSupportedError extends BaseError {\n override name = \"UpgradeToAndCallNotSupportedError\";\n\n /**\n * Constructs an error message indicating that `UpgradeToAndCall` is not supported by the specified account type.\n *\n * @param {string} accountType The type of account that does not support `UpgradeToAndCall`\n */\n constructor(accountType: string) {\n super(`UpgradeToAndCall is not supported by ${accountType}`);\n }\n}\n\n/**\n * Represents an error thrown when an account type does not match the expected type.\n */\nexport class IncorrectAccountType extends BaseError {\n override name = \"IncorrectAccountTypeError\";\n\n /**\n * Constructs an error object indicating that the expected account type does not match the actual account type.\n *\n * @param {string} expected the expected account type\n * @param {string} actual the actual account type that was received\n */\n constructor(expected: string, actual: string) {\n super(`Expected account type ${expected}, got ${actual}`);\n }\n}\n\n/**\n * Error class indicating that a smart account operation requires a signer.\n */\nexport class SmartAccountWithSignerRequiredError extends BaseError {\n override name = \"SmartAccountWithSignerRequiredError\";\n\n /**\n * Initializes a new instance of the error class with a predefined error message indicating that a smart account requires a signer.\n */ constructor() {\n super(\"Smart account requires a signer\");\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/errors/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC;;GAEG;AACH,MAAM,OAAO,uBAAwB,SAAQ,SAAS;IAGpD;;;;;;OAMG;IACH,YAAY,cAAsB,EAAE,MAAc,EAAE,MAAc;QAChE,KAAK,CACH;YACE,mBAAmB,MAAM,CAAC,IAAI,cAAc,cAAc,GAAG;YAC7D,qEAAqE,MAAM,IAAI;SAChF,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;QAfK;;;;mBAAO,yBAAyB;WAAC;IAgB1C,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,SAAS;IAG/C;;;;OAIG;IACH,YAAY,MAAe;QACzB,KAAK,CAAC,mBAAmB,MAAM,EAAE,CAAC,CAAC;QAR5B;;;;mBAAO,oBAAoB;WAAC;IASrC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,SAAS;IAG/C;;OAEG;IACH;QACE,KAAK,CAAC,iCAAiC,CAAC,CAAC;QANlC;;;;mBAAO,oBAAoB;WAAC;IAOrC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,oBAAqB,SAAQ,SAAS;IAGjD;;;;OAIG;IACH,YAAY,QAAgB;QAC1B,KAAK,CACH,qBAAqB,QAAQ,gDAAgD,CAC9E,CAAC;QAVK;;;;mBAAO,sBAAsB;WAAC;IAWvC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,oBAAqB,SAAQ,SAAS;IAGjD;;;;OAIG;IACH,YAAY,QAAgB;QAC1B,KAAK,CACH,gBAAgB,QAAQ,6CAA6C,CACtE,CAAC;QAVK;;;;mBAAO,sBAAsB;WAAC;IAWvC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,qBAAsB,SAAQ,SAAS;IAGlD;;OAEG;IACH;QACE,KAAK,CAAC,4DAA4D,CAAC,CAAC;QAN7D;;;;mBAAO,uBAAuB;WAAC;IAOxC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,2BAA4B,SAAQ,SAAS;IAGxD;;OAEG;IACH;QACE,KAAK,CAAC,4DAA4D,CAAC,CAAC;QAN7D;;;;mBAAO,6BAA6B;WAAC;IAO9C,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,0BAA2B,SAAQ,SAAS;IAGvD;;OAEG;IACH;QACE,KAAK,CAAC,+CAA+C,CAAC,CAAC;QANhD;;;;mBAAO,4BAA4B;WAAC;IAO7C,CAAC;CACF","sourcesContent":["import type { Client } from \"viem\";\nimport { BaseError } from \"./base.js\";\n\n/**\n * Represents an error thrown when a client is not compatible with the expected client type for a specific method. The error message provides guidance on how to create a compatible client.\n */\nexport class IncompatibleClientError extends BaseError {\n override name = \"IncompatibleClientError\";\n\n /**\n * Throws an error when the client type does not match the expected client type.\n *\n * @param {string} expectedClient The expected type of the client.\n * @param {string} method The method that was called.\n * @param {Client} client The client instance.\n */\n constructor(expectedClient: string, method: string, client: Client) {\n super(\n [\n `Client of type (${client.type}) is not a ${expectedClient}.`,\n `Create one with \\`createSmartAccountClient\\` first before using \\`${method}\\``,\n ].join(\"\\n\")\n );\n }\n}\n\n/**\n * Represents an error that occurs when an invalid RPC URL is provided. This class extends the `BaseError` class and includes the invalid URL in the error message.\n */\nexport class InvalidRpcUrlError extends BaseError {\n override name = \"InvalidRpcUrlError\";\n\n /**\n * Creates an instance of an error with a message indicating an invalid RPC URL.\n *\n * @param {string} [rpcUrl] The invalid RPC URL that caused the error\n */\n constructor(rpcUrl?: string) {\n super(`Invalid RPC URL ${rpcUrl}`);\n }\n}\n\n/**\n * Error class representing a \"Chain Not Found\" error, typically thrown when no chain is supplied to the client.\n */\nexport class ChainNotFoundError extends BaseError {\n override name = \"ChainNotFoundError\";\n\n /**\n * Initializes a new instance of the error message with a default message indicating that no chain was supplied to the client.\n */\n constructor() {\n super(\"No chain supplied to the client\");\n }\n}\n\n/**\n * Error class denoting that the provided entity id is invalid because it's too large.\n */\nexport class InvalidEntityIdError extends BaseError {\n override name = \"InvalidEntityIdError\";\n\n /**\n * Initializes a new instance of the error message with a default message indicating that the entity id is invalid because it's too large.\n *\n * @param {number} entityId the invalid entityId used\n */\n constructor(entityId: number) {\n super(\n `Entity ID used is ${entityId}, but must be less than or equal to uint32.max`\n );\n }\n}\n\n/**\n * Error class denoting that the nonce key is invalid because its too large.\n */\nexport class InvalidNonceKeyError extends BaseError {\n override name = \"InvalidNonceKeyError\";\n\n /**\n * Initializes a new instance of the error message with a default message indicating that the nonce key is invalid.\n *\n * @param {bigint} nonceKey the invalid nonceKey used\n */\n constructor(nonceKey: bigint) {\n super(\n `Nonce key is ${nonceKey} but has to be less than or equal to 2**152`\n );\n }\n}\n\n/**\n * Error class denoting that the provided entity id is invalid because it's overriding the native entity id.\n */\nexport class EntityIdOverrideError extends BaseError {\n override name = \"EntityIdOverrideError\";\n\n /**\n * Initializes a new instance of the error message with a default message indicating that the nonce key is invalid.\n */\n constructor() {\n super(`EntityId of 0 is reserved for the owner and cannot be used`);\n }\n}\n\n/**\n * Error class denoting that the provided ma v2 account mode is invalid.\n */\nexport class InvalidModularAccountV2Mode extends BaseError {\n override name = \"InvalidModularAccountV2Mode\";\n\n /**\n * Initializes a new instance of the error message with a default message indicating that the provided ma v2 account mode is invalid.\n */\n constructor() {\n super(`The provided account mode is invalid for ModularAccount V2`);\n }\n}\n\n/**\n * Error class denoting that the deferred action nonce used is invalid.\n */\nexport class InvalidDeferredActionNonce extends BaseError {\n override name = \"InvalidDeferredActionNonce\";\n\n /**\n * Initializes a new instance of the error message with a default message indicating that the provided deferred action nonce is invalid.\n */\n constructor() {\n super(`The provided deferred action nonce is invalid`);\n }\n}\n"]}
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/errors/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC;;GAEG;AACH,MAAM,OAAO,uBAAwB,SAAQ,SAAS;IAGpD;;;;;;OAMG;IACH,YAAY,cAAsB,EAAE,MAAc,EAAE,MAAc;QAChE,KAAK,CACH;YACE,mBAAmB,MAAM,CAAC,IAAI,cAAc,cAAc,GAAG;YAC7D,qEAAqE,MAAM,IAAI;SAChF,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;QAfK;;;;mBAAO,yBAAyB;WAAC;IAgB1C,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,SAAS;IAG/C;;;;OAIG;IACH,YAAY,MAAe;QACzB,KAAK,CAAC,mBAAmB,MAAM,EAAE,CAAC,CAAC;QAR5B;;;;mBAAO,oBAAoB;WAAC;IASrC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,SAAS;IAG/C;;OAEG;IACH;QACE,KAAK,CAAC,iCAAiC,CAAC,CAAC;QANlC;;;;mBAAO,oBAAoB;WAAC;IAOrC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,oBAAqB,SAAQ,SAAS;IAGjD;;;;OAIG;IACH,YAAY,QAAgB;QAC1B,KAAK,CACH,qBAAqB,QAAQ,gDAAgD,CAC9E,CAAC;QAVK;;;;mBAAO,sBAAsB;WAAC;IAWvC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,oBAAqB,SAAQ,SAAS;IAGjD;;;;OAIG;IACH,YAAY,QAAgB;QAC1B,KAAK,CACH,gBAAgB,QAAQ,6CAA6C,CACtE,CAAC;QAVK;;;;mBAAO,sBAAsB;WAAC;IAWvC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,qBAAsB,SAAQ,SAAS;IAGlD;;OAEG;IACH;QACE,KAAK,CAAC,4DAA4D,CAAC,CAAC;QAN7D;;;;mBAAO,uBAAuB;WAAC;IAOxC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,2BAA4B,SAAQ,SAAS;IAGxD;;OAEG;IACH;QACE,KAAK,CAAC,4DAA4D,CAAC,CAAC;QAN7D;;;;mBAAO,6BAA6B;WAAC;IAO9C,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,0BAA2B,SAAQ,SAAS;IAGvD;;OAEG;IACH;QACE,KAAK,CAAC,+CAA+C,CAAC,CAAC;QANhD;;;;mBAAO,4BAA4B;WAAC;IAO7C,CAAC;CACF","sourcesContent":["import type { Client } from \"viem\";\nimport { BaseError } from \"./base.js\";\n\n/**\n * Represents an error thrown when a client is not compatible with the expected client type for a specific method. The error message provides guidance on how to create a compatible client.\n */\nexport class IncompatibleClientError extends BaseError {\n override name = \"IncompatibleClientError\";\n\n /**\n * Throws an error when the client type does not match the expected client type.\n *\n * @param {string} expectedClient The expected type of the client.\n * @param {string} method The method that was called.\n * @param {Client} client The client instance.\n */\n constructor(expectedClient: string, method: string, client: Client) {\n super(\n [\n `Client of type (${client.type}) is not a ${expectedClient}.`,\n `Create one with \\`createSmartAccountClient\\` first before using \\`${method}\\``,\n ].join(\"\\n\"),\n );\n }\n}\n\n/**\n * Represents an error that occurs when an invalid RPC URL is provided. This class extends the `BaseError` class and includes the invalid URL in the error message.\n */\nexport class InvalidRpcUrlError extends BaseError {\n override name = \"InvalidRpcUrlError\";\n\n /**\n * Creates an instance of an error with a message indicating an invalid RPC URL.\n *\n * @param {string} [rpcUrl] The invalid RPC URL that caused the error\n */\n constructor(rpcUrl?: string) {\n super(`Invalid RPC URL ${rpcUrl}`);\n }\n}\n\n/**\n * Error class representing a \"Chain Not Found\" error, typically thrown when no chain is supplied to the client.\n */\nexport class ChainNotFoundError extends BaseError {\n override name = \"ChainNotFoundError\";\n\n /**\n * Initializes a new instance of the error message with a default message indicating that no chain was supplied to the client.\n */\n constructor() {\n super(\"No chain supplied to the client\");\n }\n}\n\n/**\n * Error class denoting that the provided entity id is invalid because it's too large.\n */\nexport class InvalidEntityIdError extends BaseError {\n override name = \"InvalidEntityIdError\";\n\n /**\n * Initializes a new instance of the error message with a default message indicating that the entity id is invalid because it's too large.\n *\n * @param {number} entityId the invalid entityId used\n */\n constructor(entityId: number) {\n super(\n `Entity ID used is ${entityId}, but must be less than or equal to uint32.max`,\n );\n }\n}\n\n/**\n * Error class denoting that the nonce key is invalid because its too large.\n */\nexport class InvalidNonceKeyError extends BaseError {\n override name = \"InvalidNonceKeyError\";\n\n /**\n * Initializes a new instance of the error message with a default message indicating that the nonce key is invalid.\n *\n * @param {bigint} nonceKey the invalid nonceKey used\n */\n constructor(nonceKey: bigint) {\n super(\n `Nonce key is ${nonceKey} but has to be less than or equal to 2**152`,\n );\n }\n}\n\n/**\n * Error class denoting that the provided entity id is invalid because it's overriding the native entity id.\n */\nexport class EntityIdOverrideError extends BaseError {\n override name = \"EntityIdOverrideError\";\n\n /**\n * Initializes a new instance of the error message with a default message indicating that the nonce key is invalid.\n */\n constructor() {\n super(`EntityId of 0 is reserved for the owner and cannot be used`);\n }\n}\n\n/**\n * Error class denoting that the provided ma v2 account mode is invalid.\n */\nexport class InvalidModularAccountV2Mode extends BaseError {\n override name = \"InvalidModularAccountV2Mode\";\n\n /**\n * Initializes a new instance of the error message with a default message indicating that the provided ma v2 account mode is invalid.\n */\n constructor() {\n super(`The provided account mode is invalid for ModularAccount V2`);\n }\n}\n\n/**\n * Error class denoting that the deferred action nonce used is invalid.\n */\nexport class InvalidDeferredActionNonce extends BaseError {\n override name = \"InvalidDeferredActionNonce\";\n\n /**\n * Initializes a new instance of the error message with a default message indicating that the provided deferred action nonce is invalid.\n */\n constructor() {\n super(`The provided deferred action nonce is invalid`);\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"entrypoint.js","sourceRoot":"","sources":["../../../src/errors/entrypoint.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC;;GAEG;AACH,MAAM,OAAO,uBAAwB,SAAQ,SAAS;IAGpD;;;;;OAKG;IACH,YAAY,KAAY,EAAE,iBAAsB;QAC9C,KAAK,CACH;YACE,2BAA2B,iBAAiB,eAAe,KAAK,CAAC,IAAI,GAAG;YACxE,qBAAqB;SACtB,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;QAdK;;;;mBAAO,yBAAyB;WAAC;IAe1C,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,sBAAuB,SAAQ,SAAS;IAGnD;;;;;OAKG;IACH,YAAY,KAAY,EAAE,iBAAsB;QAC9C,KAAK,CACH,2CAA2C,iBAAiB,QAAQ,KAAK,CAAC,IAAI,GAAG,CAClF,CAAC;QAXK;;;;mBAAO,wBAAwB;WAAC;IAYzC,CAAC;CACF","sourcesContent":["import type { Chain } from \"viem\";\nimport { BaseError } from \"./base.js\";\n\n/**\n * Represents an error thrown when an entry point is not found for a specific chain and entry point version. This error indicates that a default entry point does not exist for the given chain and version, and suggests providing an override.\n */\nexport class EntryPointNotFoundError extends BaseError {\n override name = \"EntryPointNotFoundError\";\n\n /**\n * Constructs an error message indicating that no default entry point exists for the given chain and entry point version.\n *\n * @param {Chain} chain The blockchain network for which the entry point is being queried\n * @param {any} entryPointVersion The version of the entry point for which no default exists\n */\n constructor(chain: Chain, entryPointVersion: any) {\n super(\n [\n `No default entry point v${entryPointVersion} exists for ${chain.name}.`,\n `Supply an override.`,\n ].join(\"\\n\")\n );\n }\n}\n\n/**\n * Represents an error thrown when an invalid entry point version is encountered for a specific chain. This error extends the `BaseError` class.\n */\nexport class InvalidEntryPointError extends BaseError {\n override name = \"InvalidEntryPointError\";\n\n /**\n * Constructs an error indicating an invalid entry point version for a specific chain.\n *\n * @param {Chain} chain The chain object containing information about the blockchain\n * @param {any} entryPointVersion The entry point version that is invalid\n */\n constructor(chain: Chain, entryPointVersion: any) {\n super(\n `Invalid entry point: unexpected version ${entryPointVersion} for ${chain.name}.`\n );\n }\n}\n"]}
1
+ {"version":3,"file":"entrypoint.js","sourceRoot":"","sources":["../../../src/errors/entrypoint.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC;;GAEG;AACH,MAAM,OAAO,uBAAwB,SAAQ,SAAS;IAGpD;;;;;OAKG;IACH,YAAY,KAAY,EAAE,iBAAsB;QAC9C,KAAK,CACH;YACE,2BAA2B,iBAAiB,eAAe,KAAK,CAAC,IAAI,GAAG;YACxE,qBAAqB;SACtB,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;QAdK;;;;mBAAO,yBAAyB;WAAC;IAe1C,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,sBAAuB,SAAQ,SAAS;IAGnD;;;;;OAKG;IACH,YAAY,KAAY,EAAE,iBAAsB;QAC9C,KAAK,CACH,2CAA2C,iBAAiB,QAAQ,KAAK,CAAC,IAAI,GAAG,CAClF,CAAC;QAXK;;;;mBAAO,wBAAwB;WAAC;IAYzC,CAAC;CACF","sourcesContent":["import type { Chain } from \"viem\";\nimport { BaseError } from \"./base.js\";\n\n/**\n * Represents an error thrown when an entry point is not found for a specific chain and entry point version. This error indicates that a default entry point does not exist for the given chain and version, and suggests providing an override.\n */\nexport class EntryPointNotFoundError extends BaseError {\n override name = \"EntryPointNotFoundError\";\n\n /**\n * Constructs an error message indicating that no default entry point exists for the given chain and entry point version.\n *\n * @param {Chain} chain The blockchain network for which the entry point is being queried\n * @param {any} entryPointVersion The version of the entry point for which no default exists\n */\n constructor(chain: Chain, entryPointVersion: any) {\n super(\n [\n `No default entry point v${entryPointVersion} exists for ${chain.name}.`,\n `Supply an override.`,\n ].join(\"\\n\"),\n );\n }\n}\n\n/**\n * Represents an error thrown when an invalid entry point version is encountered for a specific chain. This error extends the `BaseError` class.\n */\nexport class InvalidEntryPointError extends BaseError {\n override name = \"InvalidEntryPointError\";\n\n /**\n * Constructs an error indicating an invalid entry point version for a specific chain.\n *\n * @param {Chain} chain The chain object containing information about the blockchain\n * @param {any} entryPointVersion The entry point version that is invalid\n */\n constructor(chain: Chain, entryPointVersion: any) {\n super(\n `Invalid entry point: unexpected version ${entryPointVersion} for ${chain.name}.`,\n );\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"signer.js","sourceRoot":"","sources":["../../../src/errors/signer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC;;GAEG;AACH,MAAM,OAAO,sBAAuB,SAAQ,SAAS;IAGnD;;;;OAIG;IACH,YAAY,UAAmB;QAC7B,KAAK,CACH;YACE,6DAA6D;YAC7D,UAAU,IAAI,gCAAgC;SAC/C,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;QAbK;;;;mBAAO,wBAAwB;WAAC;IAczC,CAAC;CACF","sourcesContent":["import { BaseError } from \"./base.js\";\n\n/**\n * Represents an error thrown when an invalid signer type is provided to the SmartAccountSigner.\n */\nexport class InvalidSignerTypeError extends BaseError {\n override name = \"InvalidSignerTypeError\";\n\n /**\n * Constructs an error message when an invalid signer type is passed to SmartAccountSigner.\n *\n * @param {string} [signerType] An optional parameter specifying the signer type. If not provided, a default error message will be used.\n */\n constructor(signerType?: string) {\n super(\n [\n \"Invalid signer type parameter passed to SmartAccountSigner.\",\n signerType ?? \"A signerType must be provided.\",\n ].join(\"\\n\")\n );\n }\n}\n"]}
1
+ {"version":3,"file":"signer.js","sourceRoot":"","sources":["../../../src/errors/signer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC;;GAEG;AACH,MAAM,OAAO,sBAAuB,SAAQ,SAAS;IAGnD;;;;OAIG;IACH,YAAY,UAAmB;QAC7B,KAAK,CACH;YACE,6DAA6D;YAC7D,UAAU,IAAI,gCAAgC;SAC/C,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;QAbK;;;;mBAAO,wBAAwB;WAAC;IAczC,CAAC;CACF","sourcesContent":["import { BaseError } from \"./base.js\";\n\n/**\n * Represents an error thrown when an invalid signer type is provided to the SmartAccountSigner.\n */\nexport class InvalidSignerTypeError extends BaseError {\n override name = \"InvalidSignerTypeError\";\n\n /**\n * Constructs an error message when an invalid signer type is passed to SmartAccountSigner.\n *\n * @param {string} [signerType] An optional parameter specifying the signer type. If not provided, a default error message will be used.\n */\n constructor(signerType?: string) {\n super(\n [\n \"Invalid signer type parameter passed to SmartAccountSigner.\",\n signerType ?? \"A signerType must be provided.\",\n ].join(\"\\n\"),\n );\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"useroperation.js","sourceRoot":"","sources":["../../../src/errors/useroperation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,6DAA6D;AAE7D;;;;GAIG;AACH,MAAM,OAAO,yBAA0B,SAAQ,SAAS;IAKtD;;;;;;OAMG;IACH,YAAY,EAAuB;QACjC,KAAK,CACH,yFAAyF,IAAI,CAAC,SAAS,CACrG,EAAE,EACF,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CACd,OAAO,KAAK,KAAK,QAAQ;YACvB,CAAC,CAAC;gBACE,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,KAAK,CAAC,QAAQ,EAAE;aACxB;YACH,CAAC,CAAC,KAAK,EACX,CAAC,CACF,EAAE,CACJ,CAAC;QAxBJ;;WAEG;QACM;;;;mBAAO,2BAA2B;WAAC;IAsB5C,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,OAAO,yBAA0B,SAAQ,SAAS;IACtD;;;OAGG;IACH,YAAmB,OAA6B,EAAE,KAAY;QAC5D,KAAK,CAAC,kCAAkC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QAD/C;;;;mBAAO,OAAO;WAAsB;IAEhD,CAAC;CACF","sourcesContent":["import type { UserOperationRequest, UserOperationStruct } from \"../types.js\";\nimport { BaseError } from \"./base.js\";\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\n/**\n * Thrown when a UserOperationStruct is not a valid request\n *\n * extends viem BaseError\n */\nexport class InvalidUserOperationError extends BaseError {\n /**\n * @inheritdoc\n */\n override name = \"InvalidUserOperationError\";\n /**\n * Creates an instance of InvalidUserOperationError.\n *\n * InvalidUserOperationError constructor\n *\n * @param {UserOperationStruct} uo the invalid user operation struct\n */\n constructor(uo: UserOperationStruct) {\n super(\n `Request is missing parameters. All properties on UserOperationStruct must be set. uo: ${JSON.stringify(\n uo,\n (_key, value) =>\n typeof value === \"bigint\"\n ? {\n type: \"bigint\",\n value: value.toString(),\n }\n : value,\n 2\n )}`\n );\n }\n}\n\n/**\n * Error thrown when waiting for user operation request to be mined.\n *\n * Includes the internal error as well as the request that failed. This request\n * can then be used with dropAndReplaceUserOperation to retry the operation.\n */\nexport class WaitForUserOperationError extends BaseError {\n /**\n * @param {UserOperationRequest} request the user operation request that failed\n * @param {Error} error the underlying error that caused the failure\n */\n constructor(public request: UserOperationRequest, error: Error) {\n super(`Failed to find User Operation: ${error.message}`);\n }\n}\n"]}
1
+ {"version":3,"file":"useroperation.js","sourceRoot":"","sources":["../../../src/errors/useroperation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,6DAA6D;AAE7D;;;;GAIG;AACH,MAAM,OAAO,yBAA0B,SAAQ,SAAS;IAKtD;;;;;;OAMG;IACH,YAAY,EAAuB;QACjC,KAAK,CACH,yFAAyF,IAAI,CAAC,SAAS,CACrG,EAAE,EACF,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CACd,OAAO,KAAK,KAAK,QAAQ;YACvB,CAAC,CAAC;gBACE,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,KAAK,CAAC,QAAQ,EAAE;aACxB;YACH,CAAC,CAAC,KAAK,EACX,CAAC,CACF,EAAE,CACJ,CAAC;QAxBJ;;WAEG;QACM;;;;mBAAO,2BAA2B;WAAC;IAsB5C,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,OAAO,yBAA0B,SAAQ,SAAS;IACtD;;;OAGG;IACH,YACS,OAA6B,EACpC,KAAY;QAEZ,KAAK,CAAC,kCAAkC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QAHzD;;;;mBAAO,OAAO;WAAsB;IAItC,CAAC;CACF","sourcesContent":["import type { UserOperationRequest, UserOperationStruct } from \"../types.js\";\nimport { BaseError } from \"./base.js\";\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\n/**\n * Thrown when a UserOperationStruct is not a valid request\n *\n * extends viem BaseError\n */\nexport class InvalidUserOperationError extends BaseError {\n /**\n * @inheritdoc\n */\n override name = \"InvalidUserOperationError\";\n /**\n * Creates an instance of InvalidUserOperationError.\n *\n * InvalidUserOperationError constructor\n *\n * @param {UserOperationStruct} uo the invalid user operation struct\n */\n constructor(uo: UserOperationStruct) {\n super(\n `Request is missing parameters. All properties on UserOperationStruct must be set. uo: ${JSON.stringify(\n uo,\n (_key, value) =>\n typeof value === \"bigint\"\n ? {\n type: \"bigint\",\n value: value.toString(),\n }\n : value,\n 2,\n )}`,\n );\n }\n}\n\n/**\n * Error thrown when waiting for user operation request to be mined.\n *\n * Includes the internal error as well as the request that failed. This request\n * can then be used with dropAndReplaceUserOperation to retry the operation.\n */\nexport class WaitForUserOperationError extends BaseError {\n /**\n * @param {UserOperationRequest} request the user operation request that failed\n * @param {Error} error the underlying error that caused the failure\n */\n constructor(\n public request: UserOperationRequest,\n error: Error,\n ) {\n super(`Failed to find User Operation: ${error.message}`);\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"actions.js","sourceRoot":"","sources":["../../../src/middleware/actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAMN,MAAM,MAAM,CAAC;AAOd,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAwBrD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAC5B,CAAC,SAAiC,EAAE,EAAE,CACtC,CAOE,MAAsD,EACpB,EAAE,CAAC,CAAC;IACtC,UAAU,EAAE;QACV,gBAAgB,EAAE,SAAS,CAAC,gBAAgB,IAAI,cAAc;QAC9D,qBAAqB,EACnB,SAAS,CAAC,qBAAqB,IAAI,uBAAuB;QAC5D,YAAY,EAAE,SAAS,CAAC,YAAY,IAAI,mBAAmB,CAAC,MAAM,CAAC;QACnE,YAAY,EAAE,SAAS,CAAC,YAAY,IAAI,mBAAmB,CAAC,MAAM,CAAC;QACnE,gBAAgB,EAAE,SAAS,CAAC,gBAAgB,IAAI,uBAAuB;QACvE,sBAAsB,EACpB,SAAS,CAAC,sBAAsB,IAAI,cAAc;QACpD,iBAAiB,EAAE,SAAS,CAAC,iBAAiB,IAAI,mBAAmB;KACtE;CACF,CAAC,CAAC","sourcesContent":["import {\n type Chain,\n type Client,\n type PublicActions,\n type PublicRpcSchema,\n type Transport,\n} from \"viem\";\nimport type { SmartContractAccount } from \"../account/smartContractAccount.js\";\nimport type {\n BundlerActions,\n BundlerRpcSchema,\n} from \"../client/decorators/bundlerClient.js\";\nimport type { ClientMiddlewareConfig } from \"../client/types.js\";\nimport { defaultFeeEstimator } from \"./defaults/feeEstimator.js\";\nimport { defaultGasEstimator } from \"./defaults/gasEstimator.js\";\nimport { defaultPaymasterAndData } from \"./defaults/paymasterAndData.js\";\nimport { defaultUserOpSigner } from \"./defaults/userOpSigner.js\";\nimport { noopMiddleware } from \"./noopMiddleware.js\";\nimport type { ClientMiddleware } from \"./types.js\";\n\n/**\n * Middleware client type\n *\n * @template {Transport} TTransport\n * @template {Chain | undefined} TChain\n * @template {SmartContractAccount | undefined} TAccount\n */\nexport type MiddlewareClient<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined\n> = Client<\n TTransport,\n TChain,\n TAccount,\n [...BundlerRpcSchema, ...PublicRpcSchema],\n PublicActions & BundlerActions\n>;\n\n/**\n * function that takes in ClientMiddlewareConfig used during client initiation\n * and returns the middleware actions object that the smart account client extends with\n *\n * @param {ClientMiddlewareConfig} overrides config used during client initiation for overriding default middlewares\n * @returns {(client: MiddlewareClient<TTransport, TChain, TAccount>) => { middleware: ClientMiddleware }} middleware actions object\n */\nexport const middlewareActions =\n (overrides: ClientMiddlewareConfig) =>\n <\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined\n >(\n client: MiddlewareClient<TTransport, TChain, TAccount>\n ): { middleware: ClientMiddleware } => ({\n middleware: {\n customMiddleware: overrides.customMiddleware ?? noopMiddleware,\n dummyPaymasterAndData:\n overrides.dummyPaymasterAndData ?? defaultPaymasterAndData,\n feeEstimator: overrides.feeEstimator ?? defaultFeeEstimator(client),\n gasEstimator: overrides.gasEstimator ?? defaultGasEstimator(client),\n paymasterAndData: overrides.paymasterAndData ?? defaultPaymasterAndData,\n userOperationSimulator:\n overrides.userOperationSimulator ?? noopMiddleware,\n signUserOperation: overrides.signUserOperation ?? defaultUserOpSigner,\n },\n });\n"]}
1
+ {"version":3,"file":"actions.js","sourceRoot":"","sources":["../../../src/middleware/actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAMN,MAAM,MAAM,CAAC;AAOd,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAwBrD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAC5B,CAAC,SAAiC,EAAE,EAAE,CACtC,CAOE,MAAsD,EACpB,EAAE,CAAC,CAAC;IACtC,UAAU,EAAE;QACV,gBAAgB,EAAE,SAAS,CAAC,gBAAgB,IAAI,cAAc;QAC9D,qBAAqB,EACnB,SAAS,CAAC,qBAAqB,IAAI,uBAAuB;QAC5D,YAAY,EAAE,SAAS,CAAC,YAAY,IAAI,mBAAmB,CAAC,MAAM,CAAC;QACnE,YAAY,EAAE,SAAS,CAAC,YAAY,IAAI,mBAAmB,CAAC,MAAM,CAAC;QACnE,gBAAgB,EAAE,SAAS,CAAC,gBAAgB,IAAI,uBAAuB;QACvE,sBAAsB,EACpB,SAAS,CAAC,sBAAsB,IAAI,cAAc;QACpD,iBAAiB,EAAE,SAAS,CAAC,iBAAiB,IAAI,mBAAmB;KACtE;CACF,CAAC,CAAC","sourcesContent":["import {\n type Chain,\n type Client,\n type PublicActions,\n type PublicRpcSchema,\n type Transport,\n} from \"viem\";\nimport type { SmartContractAccount } from \"../account/smartContractAccount.js\";\nimport type {\n BundlerActions,\n BundlerRpcSchema,\n} from \"../client/decorators/bundlerClient.js\";\nimport type { ClientMiddlewareConfig } from \"../client/types.js\";\nimport { defaultFeeEstimator } from \"./defaults/feeEstimator.js\";\nimport { defaultGasEstimator } from \"./defaults/gasEstimator.js\";\nimport { defaultPaymasterAndData } from \"./defaults/paymasterAndData.js\";\nimport { defaultUserOpSigner } from \"./defaults/userOpSigner.js\";\nimport { noopMiddleware } from \"./noopMiddleware.js\";\nimport type { ClientMiddleware } from \"./types.js\";\n\n/**\n * Middleware client type\n *\n * @template {Transport} TTransport\n * @template {Chain | undefined} TChain\n * @template {SmartContractAccount | undefined} TAccount\n */\nexport type MiddlewareClient<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n> = Client<\n TTransport,\n TChain,\n TAccount,\n [...BundlerRpcSchema, ...PublicRpcSchema],\n PublicActions & BundlerActions\n>;\n\n/**\n * function that takes in ClientMiddlewareConfig used during client initiation\n * and returns the middleware actions object that the smart account client extends with\n *\n * @param {ClientMiddlewareConfig} overrides config used during client initiation for overriding default middlewares\n * @returns {(client: MiddlewareClient<TTransport, TChain, TAccount>) => { middleware: ClientMiddleware }} middleware actions object\n */\nexport const middlewareActions =\n (overrides: ClientMiddlewareConfig) =>\n <\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n >(\n client: MiddlewareClient<TTransport, TChain, TAccount>,\n ): { middleware: ClientMiddleware } => ({\n middleware: {\n customMiddleware: overrides.customMiddleware ?? noopMiddleware,\n dummyPaymasterAndData:\n overrides.dummyPaymasterAndData ?? defaultPaymasterAndData,\n feeEstimator: overrides.feeEstimator ?? defaultFeeEstimator(client),\n gasEstimator: overrides.gasEstimator ?? defaultGasEstimator(client),\n paymasterAndData: overrides.paymasterAndData ?? defaultPaymasterAndData,\n userOperationSimulator:\n overrides.userOperationSimulator ?? noopMiddleware,\n signUserOperation: overrides.signUserOperation ?? defaultUserOpSigner,\n },\n });\n"]}
@@ -30,7 +30,7 @@ import type { ClientMiddlewareFn } from "../types";
30
30
  * }
31
31
  * ```
32
32
  *
33
- * @param {ClientMiddlewareFn} [gasEstimator] Optional custom gas estimator function
34
- * @returns {Function} A function that takes user operation struct and parameters, estimates gas usage, and returns the user operation with gas limits.
33
+ * @param {ClientMiddlewareFn} gasEstimator Optional custom gas estimator function
34
+ * @returns {ClientMiddlewareFn} A function that takes user operation struct and parameters, estimates gas usage, and returns the user operation with gas limits.
35
35
  */
36
36
  export declare const default7702GasEstimator: (gasEstimator?: ClientMiddlewareFn) => ClientMiddlewareFn;
@@ -32,8 +32,8 @@ import { defaultGasEstimator } from "./gasEstimator.js";
32
32
  * }
33
33
  * ```
34
34
  *
35
- * @param {ClientMiddlewareFn} [gasEstimator] Optional custom gas estimator function
36
- * @returns {Function} A function that takes user operation struct and parameters, estimates gas usage, and returns the user operation with gas limits.
35
+ * @param {ClientMiddlewareFn} gasEstimator Optional custom gas estimator function
36
+ * @returns {ClientMiddlewareFn} A function that takes user operation struct and parameters, estimates gas usage, and returns the user operation with gas limits.
37
37
  */
38
38
  export const default7702GasEstimator = (gasEstimator) => async (struct, params) => {
39
39
  const gasEstimator_ = gasEstimator ?? defaultGasEstimator(params.client);
@@ -1 +1 @@
1
- {"version":3,"file":"7702gasEstimator.js","sourceRoot":"","sources":["../../../../src/middleware/defaults/7702gasEstimator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAG/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAGlC,CAAC,YAAiC,EAAE,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;IAC9D,MAAM,aAAa,GAAG,YAAY,IAAI,mBAAmB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAEzE,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC;IACxD,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,oBAAoB,EAAE,CAAC;IACnC,CAAC;IAED,MAAM,UAAU,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAC3C,IAAI,UAAU,CAAC,OAAO,KAAK,OAAO,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CACb,2DAA2D,CAC5D,CAAC;IACJ,CAAC;IAED,MAAM,qBAAqB,GAAG,MAAM,OAAO,CAAC,wBAAwB,EAAE,CAAC;IAEvE,+FAA+F;IAE9F,MAAuC,CAAC,WAAW,GAAG;QACrD,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,KAAK;QACZ,OAAO,EAAE,qBAAqB;QAC9B,CAAC,EAAE,QAAQ,EAAE,mBAAmB;QAChC,CAAC,EAAE,QAAQ;QACX,OAAO,EAAE,KAAK;KACf,CAAC;IAEF,OAAO,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AACvC,CAAC,CAAC","sourcesContent":["import { zeroHash } from \"viem\";\nimport { AccountNotFoundError } from \"../../errors/account.js\";\nimport type { UserOperationStruct } from \"../../types.js\";\nimport type { ClientMiddlewareFn } from \"../types\";\nimport { defaultGasEstimator } from \"./gasEstimator.js\";\n\n/**\n * A middleware function to estimate the gas usage of a user operation when using an EIP-7702 delegated account. Has an optional custom gas estimator.\n * This function is only compatible with accounts using EntryPoint v0.7.0, and the account must have an implementation address defined in `getImplementationAddress()`.\n *\n * @example\n * ```ts twoslash\n * import {\n * default7702GasEstimator,\n * default7702UserOpSigner,\n * createSmartAccountClient,\n * type SmartAccountClient,\n * } from \"@aa-sdk/core\";\n * import {\n * createModularAccountV2,\n * type CreateModularAccountV2ClientParams,\n * } from \"@account-kit/smart-contracts\";\n *\n * async function createSMA7702AccountClient(\n * config: CreateModularAccountV2ClientParams\n * ): Promise<SmartAccountClient> {\n * const sma7702Account = await createModularAccountV2({ ...config, mode: \"7702\" });\n *\n * return createSmartAccountClient({\n * account: sma7702Account,\n * gasEstimator: default7702GasEstimator(config.gasEstimator),\n * signUserOperation: default7702UserOpSigner(config.signUserOperation),\n * ...config,\n * });\n * }\n * ```\n *\n * @param {ClientMiddlewareFn} [gasEstimator] Optional custom gas estimator function\n * @returns {Function} A function that takes user operation struct and parameters, estimates gas usage, and returns the user operation with gas limits.\n */\nexport const default7702GasEstimator: (\n gasEstimator?: ClientMiddlewareFn\n) => ClientMiddlewareFn =\n (gasEstimator?: ClientMiddlewareFn) => async (struct, params) => {\n const gasEstimator_ = gasEstimator ?? defaultGasEstimator(params.client);\n\n const account = params.account ?? params.client.account;\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n const entryPoint = account.getEntryPoint();\n if (entryPoint.version !== \"0.7.0\") {\n throw new Error(\n \"This middleware is only compatible with EntryPoint v0.7.0\"\n );\n }\n\n const implementationAddress = await account.getImplementationAddress();\n\n // Note: does not omit the delegation from estimation if the account is already 7702 delegated.\n\n (struct as UserOperationStruct<\"0.7.0\">).eip7702Auth = {\n chainId: \"0x0\",\n nonce: \"0x0\",\n address: implementationAddress,\n r: zeroHash, // aka `bytes32(0)`\n s: zeroHash,\n yParity: \"0x0\",\n };\n\n return gasEstimator_(struct, params);\n };\n"]}
1
+ {"version":3,"file":"7702gasEstimator.js","sourceRoot":"","sources":["../../../../src/middleware/defaults/7702gasEstimator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAG/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAGlC,CAAC,YAAiC,EAAE,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;IAC9D,MAAM,aAAa,GAAG,YAAY,IAAI,mBAAmB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAEzE,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC;IACxD,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,oBAAoB,EAAE,CAAC;IACnC,CAAC;IAED,MAAM,UAAU,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAC3C,IAAI,UAAU,CAAC,OAAO,KAAK,OAAO,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CACb,2DAA2D,CAC5D,CAAC;IACJ,CAAC;IAED,MAAM,qBAAqB,GAAG,MAAM,OAAO,CAAC,wBAAwB,EAAE,CAAC;IAEvE,+FAA+F;IAE9F,MAAuC,CAAC,WAAW,GAAG;QACrD,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,KAAK;QACZ,OAAO,EAAE,qBAAqB;QAC9B,CAAC,EAAE,QAAQ,EAAE,mBAAmB;QAChC,CAAC,EAAE,QAAQ;QACX,OAAO,EAAE,KAAK;KACf,CAAC;IAEF,OAAO,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AACvC,CAAC,CAAC","sourcesContent":["import { zeroHash } from \"viem\";\nimport { AccountNotFoundError } from \"../../errors/account.js\";\nimport type { UserOperationStruct } from \"../../types.js\";\nimport type { ClientMiddlewareFn } from \"../types\";\nimport { defaultGasEstimator } from \"./gasEstimator.js\";\n\n/**\n * A middleware function to estimate the gas usage of a user operation when using an EIP-7702 delegated account. Has an optional custom gas estimator.\n * This function is only compatible with accounts using EntryPoint v0.7.0, and the account must have an implementation address defined in `getImplementationAddress()`.\n *\n * @example\n * ```ts twoslash\n * import {\n * default7702GasEstimator,\n * default7702UserOpSigner,\n * createSmartAccountClient,\n * type SmartAccountClient,\n * } from \"@aa-sdk/core\";\n * import {\n * createModularAccountV2,\n * type CreateModularAccountV2ClientParams,\n * } from \"@account-kit/smart-contracts\";\n *\n * async function createSMA7702AccountClient(\n * config: CreateModularAccountV2ClientParams\n * ): Promise<SmartAccountClient> {\n * const sma7702Account = await createModularAccountV2({ ...config, mode: \"7702\" });\n *\n * return createSmartAccountClient({\n * account: sma7702Account,\n * gasEstimator: default7702GasEstimator(config.gasEstimator),\n * signUserOperation: default7702UserOpSigner(config.signUserOperation),\n * ...config,\n * });\n * }\n * ```\n *\n * @param {ClientMiddlewareFn} gasEstimator Optional custom gas estimator function\n * @returns {ClientMiddlewareFn} A function that takes user operation struct and parameters, estimates gas usage, and returns the user operation with gas limits.\n */\nexport const default7702GasEstimator: (\n gasEstimator?: ClientMiddlewareFn,\n) => ClientMiddlewareFn =\n (gasEstimator?: ClientMiddlewareFn) => async (struct, params) => {\n const gasEstimator_ = gasEstimator ?? defaultGasEstimator(params.client);\n\n const account = params.account ?? params.client.account;\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n const entryPoint = account.getEntryPoint();\n if (entryPoint.version !== \"0.7.0\") {\n throw new Error(\n \"This middleware is only compatible with EntryPoint v0.7.0\",\n );\n }\n\n const implementationAddress = await account.getImplementationAddress();\n\n // Note: does not omit the delegation from estimation if the account is already 7702 delegated.\n\n (struct as UserOperationStruct<\"0.7.0\">).eip7702Auth = {\n chainId: \"0x0\",\n nonce: \"0x0\",\n address: implementationAddress,\n r: zeroHash, // aka `bytes32(0)`\n s: zeroHash,\n yParity: \"0x0\",\n };\n\n return gasEstimator_(struct, params);\n };\n"]}
@@ -32,6 +32,6 @@ import type { ClientMiddlewareFn } from "../types";
32
32
  * ```
33
33
  *
34
34
  * @param {ClientMiddlewareFn} [userOpSigner] Optional user operation signer function
35
- * @returns {Function} A middleware function that signs EIP-7702 authorization tuples if necessary, and also uses the provided or default user operation signer to generate the user op signature.
35
+ * @returns {ClientMiddlewareFn} A middleware function that signs EIP-7702 authorization tuples if necessary, and also uses the provided or default user operation signer to generate the user op signature.
36
36
  */
37
37
  export declare const default7702UserOpSigner: (userOpSigner?: ClientMiddlewareFn) => ClientMiddlewareFn;
@@ -36,7 +36,7 @@ import { defaultUserOpSigner } from "./userOpSigner.js";
36
36
  * ```
37
37
  *
38
38
  * @param {ClientMiddlewareFn} [userOpSigner] Optional user operation signer function
39
- * @returns {Function} A middleware function that signs EIP-7702 authorization tuples if necessary, and also uses the provided or default user operation signer to generate the user op signature.
39
+ * @returns {ClientMiddlewareFn} A middleware function that signs EIP-7702 authorization tuples if necessary, and also uses the provided or default user operation signer to generate the user op signature.
40
40
  */
41
41
  export const default7702UserOpSigner = (userOpSigner) => async (struct, params) => {
42
42
  const userOpSigner_ = userOpSigner ?? defaultUserOpSigner;
@@ -1 +1 @@
1
- {"version":3,"file":"7702signer.js","sourceRoot":"","sources":["../../../../src/middleware/defaults/7702signer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AACjF,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAGlC,CAAC,YAAiC,EAAE,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;IAC9D,MAAM,aAAa,GAAG,YAAY,IAAI,mBAAmB,CAAC;IAE1D,MAAM,EAAE,GAAG,MAAM,aAAa,CAC5B;QACE,GAAG,MAAM;QACT,sCAAsC;QACtC,WAAW,EAAE,SAAS;KACvB,EACD,MAAM,CACP,CAAC;IAEF,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC;IACxD,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IAE1B,IAAI,CAAC,OAAO,IAAI,CAAC,wBAAwB,CAAC,OAAO,CAAC,EAAE,CAAC;QACnD,MAAM,IAAI,oBAAoB,EAAE,CAAC;IACnC,CAAC;IAED,MAAM,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IAEnC,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE,CAAC;QAC9B,OAAO,EAAE,CAAC;IACZ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AAC,CAAC","sourcesContent":["import { toHex } from \"viem\";\nimport { isSmartAccountWithSigner } from \"../../account/smartContractAccount.js\";\nimport { AccountNotFoundError } from \"../../errors/account.js\";\nimport { ChainNotFoundError } from \"../../errors/client.js\";\nimport type { ClientMiddlewareFn } from \"../types\";\nimport { defaultUserOpSigner } from \"./userOpSigner.js\";\n\n/**\n * Provides a default middleware function for signing user operations with a client account when using EIP-7702 delegated accounts.\n * If the signer doesn't support `signAuthorization`, then this just runs the provided `signUserOperation` middleware.\n * This function is only compatible with accounts using EntryPoint v0.7.0, and the account must have an implementation address defined in `getImplementationAddress()`.\n *\n * @example\n * ```ts twoslash\n * import {\n * default7702GasEstimator,\n * default7702UserOpSigner,\n * createSmartAccountClient,\n * type SmartAccountClient,\n * } from \"@aa-sdk/core\";\n * import {\n * createModularAccountV2,\n * type CreateModularAccountV2ClientParams,\n * } from \"@account-kit/smart-contracts\";\n *\n * async function createSMA7702AccountClient(\n * config: CreateModularAccountV2ClientParams\n * ): Promise<SmartAccountClient> {\n * const sma7702Account = await createModularAccountV2({ ...config, mode: \"7702\" });\n *\n * return createSmartAccountClient({\n * account: sma7702Account,\n * gasEstimator: default7702GasEstimator(config.gasEstimator),\n * signUserOperation: default7702UserOpSigner(config.signUserOperation),\n * ...config,\n * });\n * }\n * ```\n *\n * @param {ClientMiddlewareFn} [userOpSigner] Optional user operation signer function\n * @returns {Function} A middleware function that signs EIP-7702 authorization tuples if necessary, and also uses the provided or default user operation signer to generate the user op signature.\n */\nexport const default7702UserOpSigner: (\n userOpSigner?: ClientMiddlewareFn\n) => ClientMiddlewareFn =\n (userOpSigner?: ClientMiddlewareFn) => async (struct, params) => {\n const userOpSigner_ = userOpSigner ?? defaultUserOpSigner;\n\n const uo = await userOpSigner_(\n {\n ...struct,\n // Strip out the dummy eip7702 fields.\n eip7702Auth: undefined,\n },\n params\n );\n\n const account = params.account ?? params.client.account;\n const { client } = params;\n\n if (!account || !isSmartAccountWithSigner(account)) {\n throw new AccountNotFoundError();\n }\n\n const signer = account.getSigner();\n\n if (!signer.signAuthorization) {\n return uo;\n }\n\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n\n const code = (await client.getCode({ address: account.address })) ?? \"0x\";\n\n const implAddress = await account.getImplementationAddress();\n\n const expectedCode = \"0xef0100\" + implAddress.slice(2);\n\n if (code.toLowerCase() === expectedCode.toLowerCase()) {\n // If the delegation already matches the expected, then we don't need to sign and include an authorization tuple.\n return uo;\n }\n\n const accountNonce = await params.client.getTransactionCount({\n address: account.address,\n });\n\n const authSignature = await signer.signAuthorization({\n chainId: client.chain.id,\n contractAddress: implAddress,\n nonce: accountNonce,\n });\n\n const { r, s } = authSignature;\n\n const yParity = authSignature.yParity ?? authSignature.v - 27n;\n\n return {\n ...uo,\n eip7702Auth: {\n // deepHexlify doesn't encode number(0) correctly, it returns \"0x\"\n chainId: toHex(client.chain.id),\n nonce: toHex(accountNonce),\n address: implAddress,\n r,\n s,\n yParity: toHex(yParity),\n },\n };\n };\n"]}
1
+ {"version":3,"file":"7702signer.js","sourceRoot":"","sources":["../../../../src/middleware/defaults/7702signer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AACjF,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAGlC,CAAC,YAAiC,EAAE,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;IAC9D,MAAM,aAAa,GAAG,YAAY,IAAI,mBAAmB,CAAC;IAE1D,MAAM,EAAE,GAAG,MAAM,aAAa,CAC5B;QAC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;QAC5B,KAAK,EAAE,YAAY;KACpB,CAAC,CAAC;IAEH,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,aAAa,CAAC;IAE/B,MAAM,OAAO,GAAG,aAAa,CAAC,OAAO,IAAI,aAAa,CAAC,CAAC,GAAG,GAAG,CAAC;IAE/D,OAAO;QACL,GAAG,EAAE;QACL,WAAW,EAAE;YACX,kEAAkE;YAClE,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;YAC/B,KAAK,EAAE,KAAK,CAAC,YAAY,CAAC;YAC1B,OAAO,EAAE,WAAW;YACpB,CAAC;YACD,CAAC;YACD,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC;SACxB;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { toHex } from \"viem\";\nimport { isSmartAccountWithSigner } from \"../../account/smartContractAccount.js\";\nimport { AccountNotFoundError } from \"../../errors/account.js\";\nimport { ChainNotFoundError } from \"../../errors/client.js\";\nimport type { ClientMiddlewareFn } from \"../types\";\nimport { defaultUserOpSigner } from \"./userOpSigner.js\";\n\n/**\n * Provides a default middleware function for signing user operations with a client account when using EIP-7702 delegated accounts.\n * If the signer doesn't support `signAuthorization`, then this just runs the provided `signUserOperation` middleware.\n * This function is only compatible with accounts using EntryPoint v0.7.0, and the account must have an implementation address defined in `getImplementationAddress()`.\n *\n * @example\n * ```ts twoslash\n * import {\n * default7702GasEstimator,\n * default7702UserOpSigner,\n * createSmartAccountClient,\n * type SmartAccountClient,\n * } from \"@aa-sdk/core\";\n * import {\n * createModularAccountV2,\n * type CreateModularAccountV2ClientParams,\n * } from \"@account-kit/smart-contracts\";\n *\n * async function createSMA7702AccountClient(\n * config: CreateModularAccountV2ClientParams\n * ): Promise<SmartAccountClient> {\n * const sma7702Account = await createModularAccountV2({ ...config, mode: \"7702\" });\n *\n * return createSmartAccountClient({\n * account: sma7702Account,\n * gasEstimator: default7702GasEstimator(config.gasEstimator),\n * signUserOperation: default7702UserOpSigner(config.signUserOperation),\n * ...config,\n * });\n * }\n * ```\n *\n * @param {ClientMiddlewareFn} [userOpSigner] Optional user operation signer function\n * @returns {ClientMiddlewareFn} A middleware function that signs EIP-7702 authorization tuples if necessary, and also uses the provided or default user operation signer to generate the user op signature.\n */\nexport const default7702UserOpSigner: (\n userOpSigner?: ClientMiddlewareFn,\n) => ClientMiddlewareFn =\n (userOpSigner?: ClientMiddlewareFn) => async (struct, params) => {\n const userOpSigner_ = userOpSigner ?? defaultUserOpSigner;\n\n const uo = await userOpSigner_(\n {\n ...struct,\n // Strip out the dummy eip7702 fields.\n eip7702Auth: undefined,\n },\n params,\n );\n\n const account = params.account ?? params.client.account;\n const { client } = params;\n\n if (!account || !isSmartAccountWithSigner(account)) {\n throw new AccountNotFoundError();\n }\n\n const signer = account.getSigner();\n\n if (!signer.signAuthorization) {\n return uo;\n }\n\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n\n const code = (await client.getCode({ address: account.address })) ?? \"0x\";\n\n const implAddress = await account.getImplementationAddress();\n\n const expectedCode = \"0xef0100\" + implAddress.slice(2);\n\n if (code.toLowerCase() === expectedCode.toLowerCase()) {\n // If the delegation already matches the expected, then we don't need to sign and include an authorization tuple.\n return uo;\n }\n\n const accountNonce = await params.client.getTransactionCount({\n address: account.address,\n });\n\n const authSignature = await signer.signAuthorization({\n chainId: client.chain.id,\n contractAddress: implAddress,\n nonce: accountNonce,\n });\n\n const { r, s } = authSignature;\n\n const yParity = authSignature.yParity ?? authSignature.v - 27n;\n\n return {\n ...uo,\n eip7702Auth: {\n // deepHexlify doesn't encode number(0) correctly, it returns \"0x\"\n chainId: toHex(client.chain.id),\n nonce: toHex(accountNonce),\n address: implAddress,\n r,\n s,\n yParity: toHex(yParity),\n },\n };\n };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"feeEstimator.js","sourceRoot":"","sources":["../../../../src/middleware/defaults/feeEstimator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,8BAA8B,EAAE,MAAM,sBAAsB,CAAC;AAItE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,mBAAmB,CACjC,MAAS;IAET,OAAO,KAAK,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,EAAE,EAAE;QACjD,4EAA4E;QAC5E,iGAAiG;QACjG,EAAE;QACF,iGAAiG;QACjG,iEAAiE;QACjE,EAAE;QACF,8EAA8E;QAC9E,mEAAmE;QAEnE,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,kBAAkB,EAAE,CAAC;QAClD,IAAI,CAAC,OAAO,CAAC,YAAY,IAAI,OAAO,CAAC,oBAAoB,IAAI,IAAI,EAAE,CAAC;YAClE,MAAM,IAAI,KAAK,CACb,yDAAyD,CAC1D,CAAC;QACJ,CAAC;QAED,IAAI,oBAAoB,GACtB,MAAM,MAAM,CAAC,4BAA4B,EAAE,CAAC;QAE9C,oBAAoB,GAAG,8BAA8B,CACnD,oBAAoB,EACpB,SAAS,EAAE,oBAAoB,EAC/B,UAAU,EAAE,oBAAoB,CACjC,CAAC;QAEF,IAAI,YAAY,GACd,OAAO,CAAC,YAAY;YACpB,OAAO,CAAC,oBAAoB;YAC5B,MAAM,CAAC,oBAAoB,CAAC,CAAC;QAE/B,YAAY,GAAG,8BAA8B,CAC3C,YAAY,EACZ,SAAS,EAAE,YAAY,EACvB,UAAU,EAAE,YAAY,CACzB,CAAC;QAEF,MAAM,CAAC,YAAY,GAAG,YAAY,CAAC;QACnC,MAAM,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;QACnD,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import type { BigNumberish } from \"../../types\";\nimport { applyUserOpOverrideOrFeeOption } from \"../../utils/index.js\";\nimport type { MiddlewareClient } from \"../actions\";\nimport type { ClientMiddlewareFn } from \"../types\";\n\n/**\n * Default fee estimator middleware function that estimates the maximum fee per gas and maximum priority fee per gas for a given client and applies the necessary overrides and fee options.\n *\n * @example\n * ```ts\n * import { createSmartAccountClient, defaultFeeEstimator, createBundlerClient } from \"@aa-sdk/core\";\n *\n * const bundlerClient = createBundlerClient(...);\n *\n * // NOTE: this is already provided by the smart account client\n * const client = createSmartAccountClient({\n * feeEstimator: defaultFeeEstimator(bundlerClient),\n * ...otherParams\n * });\n * ```\n *\n * @template {MiddlewareClient} C The type of the client\n * @param {C} client The client to perform the fee estimation\n * @returns {ClientMiddlewareFn} A middleware function that takes in the struct and options, estimates the fees, and updates the struct with the estimated fees\n */\nexport function defaultFeeEstimator<C extends MiddlewareClient>(\n client: C\n): ClientMiddlewareFn {\n return async (struct, { overrides, feeOptions }) => {\n // maxFeePerGas must be at least the sum of maxPriorityFeePerGas and baseFee\n // so we need to accommodate for the fee option applied maxPriorityFeePerGas for the maxFeePerGas\n //\n // Note that if maxFeePerGas is not at least the sum of maxPriorityFeePerGas and required baseFee\n // after applying the fee options, then the transaction will fail\n //\n // Refer to https://docs.alchemy.com/docs/maxpriorityfeepergas-vs-maxfeepergas\n // for more information about maxFeePerGas and maxPriorityFeePerGas\n\n const feeData = await client.estimateFeesPerGas();\n if (!feeData.maxFeePerGas || feeData.maxPriorityFeePerGas == null) {\n throw new Error(\n \"feeData is missing maxFeePerGas or maxPriorityFeePerGas\"\n );\n }\n\n let maxPriorityFeePerGas: BigNumberish =\n await client.estimateMaxPriorityFeePerGas();\n\n maxPriorityFeePerGas = applyUserOpOverrideOrFeeOption(\n maxPriorityFeePerGas,\n overrides?.maxPriorityFeePerGas,\n feeOptions?.maxPriorityFeePerGas\n );\n\n let maxFeePerGas: BigNumberish =\n feeData.maxFeePerGas -\n feeData.maxPriorityFeePerGas +\n BigInt(maxPriorityFeePerGas);\n\n maxFeePerGas = applyUserOpOverrideOrFeeOption(\n maxFeePerGas,\n overrides?.maxFeePerGas,\n feeOptions?.maxFeePerGas\n );\n\n struct.maxFeePerGas = maxFeePerGas;\n struct.maxPriorityFeePerGas = maxPriorityFeePerGas;\n return struct;\n };\n}\n"]}
1
+ {"version":3,"file":"feeEstimator.js","sourceRoot":"","sources":["../../../../src/middleware/defaults/feeEstimator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,8BAA8B,EAAE,MAAM,sBAAsB,CAAC;AAItE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,mBAAmB,CACjC,MAAS;IAET,OAAO,KAAK,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,EAAE,EAAE;QACjD,4EAA4E;QAC5E,iGAAiG;QACjG,EAAE;QACF,iGAAiG;QACjG,iEAAiE;QACjE,EAAE;QACF,8EAA8E;QAC9E,mEAAmE;QAEnE,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,kBAAkB,EAAE,CAAC;QAClD,IAAI,CAAC,OAAO,CAAC,YAAY,IAAI,OAAO,CAAC,oBAAoB,IAAI,IAAI,EAAE,CAAC;YAClE,MAAM,IAAI,KAAK,CACb,yDAAyD,CAC1D,CAAC;QACJ,CAAC;QAED,IAAI,oBAAoB,GACtB,MAAM,MAAM,CAAC,4BAA4B,EAAE,CAAC;QAE9C,oBAAoB,GAAG,8BAA8B,CACnD,oBAAoB,EACpB,SAAS,EAAE,oBAAoB,EAC/B,UAAU,EAAE,oBAAoB,CACjC,CAAC;QAEF,IAAI,YAAY,GACd,OAAO,CAAC,YAAY;YACpB,OAAO,CAAC,oBAAoB;YAC5B,MAAM,CAAC,oBAAoB,CAAC,CAAC;QAE/B,YAAY,GAAG,8BAA8B,CAC3C,YAAY,EACZ,SAAS,EAAE,YAAY,EACvB,UAAU,EAAE,YAAY,CACzB,CAAC;QAEF,MAAM,CAAC,YAAY,GAAG,YAAY,CAAC;QACnC,MAAM,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;QACnD,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import type { BigNumberish } from \"../../types\";\nimport { applyUserOpOverrideOrFeeOption } from \"../../utils/index.js\";\nimport type { MiddlewareClient } from \"../actions\";\nimport type { ClientMiddlewareFn } from \"../types\";\n\n/**\n * Default fee estimator middleware function that estimates the maximum fee per gas and maximum priority fee per gas for a given client and applies the necessary overrides and fee options.\n *\n * @example\n * ```ts\n * import { createSmartAccountClient, defaultFeeEstimator, createBundlerClient } from \"@aa-sdk/core\";\n *\n * const bundlerClient = createBundlerClient(...);\n *\n * // NOTE: this is already provided by the smart account client\n * const client = createSmartAccountClient({\n * feeEstimator: defaultFeeEstimator(bundlerClient),\n * ...otherParams\n * });\n * ```\n *\n * @template {MiddlewareClient} C The type of the client\n * @param {C} client The client to perform the fee estimation\n * @returns {ClientMiddlewareFn} A middleware function that takes in the struct and options, estimates the fees, and updates the struct with the estimated fees\n */\nexport function defaultFeeEstimator<C extends MiddlewareClient>(\n client: C,\n): ClientMiddlewareFn {\n return async (struct, { overrides, feeOptions }) => {\n // maxFeePerGas must be at least the sum of maxPriorityFeePerGas and baseFee\n // so we need to accommodate for the fee option applied maxPriorityFeePerGas for the maxFeePerGas\n //\n // Note that if maxFeePerGas is not at least the sum of maxPriorityFeePerGas and required baseFee\n // after applying the fee options, then the transaction will fail\n //\n // Refer to https://docs.alchemy.com/docs/maxpriorityfeepergas-vs-maxfeepergas\n // for more information about maxFeePerGas and maxPriorityFeePerGas\n\n const feeData = await client.estimateFeesPerGas();\n if (!feeData.maxFeePerGas || feeData.maxPriorityFeePerGas == null) {\n throw new Error(\n \"feeData is missing maxFeePerGas or maxPriorityFeePerGas\",\n );\n }\n\n let maxPriorityFeePerGas: BigNumberish =\n await client.estimateMaxPriorityFeePerGas();\n\n maxPriorityFeePerGas = applyUserOpOverrideOrFeeOption(\n maxPriorityFeePerGas,\n overrides?.maxPriorityFeePerGas,\n feeOptions?.maxPriorityFeePerGas,\n );\n\n let maxFeePerGas: BigNumberish =\n feeData.maxFeePerGas -\n feeData.maxPriorityFeePerGas +\n BigInt(maxPriorityFeePerGas);\n\n maxFeePerGas = applyUserOpOverrideOrFeeOption(\n maxFeePerGas,\n overrides?.maxFeePerGas,\n feeOptions?.maxFeePerGas,\n );\n\n struct.maxFeePerGas = maxFeePerGas;\n struct.maxPriorityFeePerGas = maxPriorityFeePerGas;\n return struct;\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"gasEstimator.js","sourceRoot":"","sources":["../../../../src/middleware/defaults/gasEstimator.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAC;AAIvE;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAG9B,CAAC,MAAwB,EAAsB,EAAE,CACjD,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,EAAE,EAAE;IACnD,MAAM,OAAO,GAAG,WAAW,CAAC,MAAM,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC;IAE7D,MAAM,SAAS,GAAG,MAAM,MAAM,CAAC,wBAAwB,CACrD,OAAO,EACP,OAAO,CAAC,aAAa,EAAE,CAAC,OAAO,EAC/B,SAAS,EAAE,aAAa,CACzB,CAAC;IAEF,MAAM,YAAY,GAAG,8BAA8B,CACjD,SAAS,CAAC,YAAY,EACtB,SAAS,EAAE,YAAY,EACvB,UAAU,EAAE,YAAY,CACzB,CAAC;IACF,MAAM,oBAAoB,GAAG,8BAA8B,CACzD,SAAS,CAAC,oBAAoB,EAC9B,SAAS,EAAE,oBAAoB,EAC/B,UAAU,EAAE,oBAAoB,CACjC,CAAC;IACF,MAAM,kBAAkB,GAAG,8BAA8B,CACvD,SAAS,CAAC,kBAAkB,EAC5B,SAAS,EAAE,kBAAkB,EAC7B,UAAU,EAAE,kBAAkB,CAC/B,CAAC;IAEF,MAAM,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,MAAM,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;IACnD,MAAM,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;IAE/C,MAAM,UAAU,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAC3C,IAAI,UAAU,CAAC,OAAO,KAAK,OAAO,EAAE,CAAC;QACnC,MAAM,6BAA6B,GAAG,8BAA8B,CAClE,SAAS,CAAC,6BAA6B,EACtC,SAA6C;YAC5C,EAAE,6BAA6B,EAChC,UAA+C;YAC9C,EAAE,6BAA6B,CAClC,CAAC;QACF,MAAM,KAAK,GAAG,MAAsC,CAAC;QAErD,KAAK,CAAC,6BAA6B,GAAG,6BAA6B,CAAC;QAEpE,KAAK,CAAC,uBAAuB;YAC3B,KAAK,CAAC,uBAAuB,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAC3E,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC","sourcesContent":["import type {\n UserOperationFeeOptions,\n UserOperationOverrides,\n UserOperationStruct,\n} from \"../../types.js\";\nimport { deepHexlify, resolveProperties } from \"../../utils/index.js\";\nimport { applyUserOpOverrideOrFeeOption } from \"../../utils/userop.js\";\nimport type { MiddlewareClient } from \"../actions.js\";\nimport type { ClientMiddlewareFn } from \"../types.js\";\n\n/**\n * Description default gas estimator middleware for `SmartAccountClient`\n * You can override this middleware with your custom gas estimator middleware\n * by passing it to the client constructor\n *\n * @param {MiddlewareClient} client smart account client instance to apply the middleware to\n * @returns {ClientMiddlewareFn} middleware execution function used to estimate gas for user operations\n */\nexport const defaultGasEstimator: <C extends MiddlewareClient>(\n client: C\n) => ClientMiddlewareFn =\n (client: MiddlewareClient): ClientMiddlewareFn =>\n async (struct, { account, overrides, feeOptions }) => {\n const request = deepHexlify(await resolveProperties(struct));\n\n const estimates = await client.estimateUserOperationGas(\n request,\n account.getEntryPoint().address,\n overrides?.stateOverride\n );\n\n const callGasLimit = applyUserOpOverrideOrFeeOption(\n estimates.callGasLimit,\n overrides?.callGasLimit,\n feeOptions?.callGasLimit\n );\n const verificationGasLimit = applyUserOpOverrideOrFeeOption(\n estimates.verificationGasLimit,\n overrides?.verificationGasLimit,\n feeOptions?.verificationGasLimit\n );\n const preVerificationGas = applyUserOpOverrideOrFeeOption(\n estimates.preVerificationGas,\n overrides?.preVerificationGas,\n feeOptions?.preVerificationGas\n );\n\n struct.callGasLimit = callGasLimit;\n struct.verificationGasLimit = verificationGasLimit;\n struct.preVerificationGas = preVerificationGas;\n\n const entryPoint = account.getEntryPoint();\n if (entryPoint.version === \"0.7.0\") {\n const paymasterVerificationGasLimit = applyUserOpOverrideOrFeeOption(\n estimates.paymasterVerificationGasLimit,\n (overrides as UserOperationOverrides<\"0.7.0\">)\n ?.paymasterVerificationGasLimit,\n (feeOptions as UserOperationFeeOptions<\"0.7.0\">)\n ?.paymasterVerificationGasLimit\n );\n const uo_v7 = struct as UserOperationStruct<\"0.7.0\">;\n\n uo_v7.paymasterVerificationGasLimit = paymasterVerificationGasLimit;\n\n uo_v7.paymasterPostOpGasLimit =\n uo_v7.paymasterPostOpGasLimit ?? (uo_v7.paymaster ? \"0x0\" : undefined);\n }\n\n return struct;\n };\n"]}
1
+ {"version":3,"file":"gasEstimator.js","sourceRoot":"","sources":["../../../../src/middleware/defaults/gasEstimator.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAC;AAIvE;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAG9B,CAAC,MAAwB,EAAsB,EAAE,CACjD,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,EAAE,EAAE;IACnD,MAAM,OAAO,GAAG,WAAW,CAAC,MAAM,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC;IAE7D,MAAM,SAAS,GAAG,MAAM,MAAM,CAAC,wBAAwB,CACrD,OAAO,EACP,OAAO,CAAC,aAAa,EAAE,CAAC,OAAO,EAC/B,SAAS,EAAE,aAAa,CACzB,CAAC;IAEF,MAAM,YAAY,GAAG,8BAA8B,CACjD,SAAS,CAAC,YAAY,EACtB,SAAS,EAAE,YAAY,EACvB,UAAU,EAAE,YAAY,CACzB,CAAC;IACF,MAAM,oBAAoB,GAAG,8BAA8B,CACzD,SAAS,CAAC,oBAAoB,EAC9B,SAAS,EAAE,oBAAoB,EAC/B,UAAU,EAAE,oBAAoB,CACjC,CAAC;IACF,MAAM,kBAAkB,GAAG,8BAA8B,CACvD,SAAS,CAAC,kBAAkB,EAC5B,SAAS,EAAE,kBAAkB,EAC7B,UAAU,EAAE,kBAAkB,CAC/B,CAAC;IAEF,MAAM,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,MAAM,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;IACnD,MAAM,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;IAE/C,MAAM,UAAU,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAC3C,IAAI,UAAU,CAAC,OAAO,KAAK,OAAO,EAAE,CAAC;QACnC,MAAM,6BAA6B,GAAG,8BAA8B,CAClE,SAAS,CAAC,6BAA6B,EACtC,SAA6C;YAC5C,EAAE,6BAA6B,EAChC,UAA+C;YAC9C,EAAE,6BAA6B,CAClC,CAAC;QACF,MAAM,KAAK,GAAG,MAAsC,CAAC;QAErD,KAAK,CAAC,6BAA6B,GAAG,6BAA6B,CAAC;QAEpE,KAAK,CAAC,uBAAuB;YAC3B,KAAK,CAAC,uBAAuB,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAC3E,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC","sourcesContent":["import type {\n UserOperationFeeOptions,\n UserOperationOverrides,\n UserOperationStruct,\n} from \"../../types.js\";\nimport { deepHexlify, resolveProperties } from \"../../utils/index.js\";\nimport { applyUserOpOverrideOrFeeOption } from \"../../utils/userop.js\";\nimport type { MiddlewareClient } from \"../actions.js\";\nimport type { ClientMiddlewareFn } from \"../types.js\";\n\n/**\n * Description default gas estimator middleware for `SmartAccountClient`\n * You can override this middleware with your custom gas estimator middleware\n * by passing it to the client constructor\n *\n * @param {MiddlewareClient} client smart account client instance to apply the middleware to\n * @returns {ClientMiddlewareFn} middleware execution function used to estimate gas for user operations\n */\nexport const defaultGasEstimator: <C extends MiddlewareClient>(\n client: C,\n) => ClientMiddlewareFn =\n (client: MiddlewareClient): ClientMiddlewareFn =>\n async (struct, { account, overrides, feeOptions }) => {\n const request = deepHexlify(await resolveProperties(struct));\n\n const estimates = await client.estimateUserOperationGas(\n request,\n account.getEntryPoint().address,\n overrides?.stateOverride,\n );\n\n const callGasLimit = applyUserOpOverrideOrFeeOption(\n estimates.callGasLimit,\n overrides?.callGasLimit,\n feeOptions?.callGasLimit,\n );\n const verificationGasLimit = applyUserOpOverrideOrFeeOption(\n estimates.verificationGasLimit,\n overrides?.verificationGasLimit,\n feeOptions?.verificationGasLimit,\n );\n const preVerificationGas = applyUserOpOverrideOrFeeOption(\n estimates.preVerificationGas,\n overrides?.preVerificationGas,\n feeOptions?.preVerificationGas,\n );\n\n struct.callGasLimit = callGasLimit;\n struct.verificationGasLimit = verificationGasLimit;\n struct.preVerificationGas = preVerificationGas;\n\n const entryPoint = account.getEntryPoint();\n if (entryPoint.version === \"0.7.0\") {\n const paymasterVerificationGasLimit = applyUserOpOverrideOrFeeOption(\n estimates.paymasterVerificationGasLimit,\n (overrides as UserOperationOverrides<\"0.7.0\">)\n ?.paymasterVerificationGasLimit,\n (feeOptions as UserOperationFeeOptions<\"0.7.0\">)\n ?.paymasterVerificationGasLimit,\n );\n const uo_v7 = struct as UserOperationStruct<\"0.7.0\">;\n\n uo_v7.paymasterVerificationGasLimit = paymasterVerificationGasLimit;\n\n uo_v7.paymasterPostOpGasLimit =\n uo_v7.paymasterPostOpGasLimit ?? (uo_v7.paymaster ? \"0x0\" : undefined);\n }\n\n return struct;\n };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"paymasterAndData.js","sourceRoot":"","sources":["../../../../src/middleware/defaults/paymasterAndData.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAuB,KAAK,EAC9D,MAAM,EACN,EAAE,OAAO,EAAE,EACX,EAAE;IACF,MAAM,UAAU,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAC3C,IAAI,UAAU,CAAC,OAAO,KAAK,OAAO,EAAE,CAAC;QAClC,MAAuC,CAAC,gBAAgB,GAAG,IAAI,CAAC;IACnE,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC","sourcesContent":["import type { UserOperationStruct } from \"../../types\";\nimport type { ClientMiddlewareFn } from \"../types\";\n\n/**\n * Middleware function that sets the `paymasterAndData` field in the given struct based on the entry point version of the account.\n * This is the default used by `createSmartAccountClient` and is not necessary to be used directly.\n *\n * @param {UserOperationStruct} struct the user operation structure to be modified\n * @param {{ account: Account }} context an object containing the account information\n * @returns {Promise<UserOperationStruct>} a promise that resolves to the modified user operation structure\n */\nexport const defaultPaymasterAndData: ClientMiddlewareFn = async (\n struct,\n { account }\n) => {\n const entryPoint = account.getEntryPoint();\n if (entryPoint.version === \"0.6.0\") {\n (struct as UserOperationStruct<\"0.6.0\">).paymasterAndData = \"0x\";\n }\n return struct;\n};\n"]}
1
+ {"version":3,"file":"paymasterAndData.js","sourceRoot":"","sources":["../../../../src/middleware/defaults/paymasterAndData.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAuB,KAAK,EAC9D,MAAM,EACN,EAAE,OAAO,EAAE,EACX,EAAE;IACF,MAAM,UAAU,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAC3C,IAAI,UAAU,CAAC,OAAO,KAAK,OAAO,EAAE,CAAC;QAClC,MAAuC,CAAC,gBAAgB,GAAG,IAAI,CAAC;IACnE,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC","sourcesContent":["import type { UserOperationStruct } from \"../../types\";\nimport type { ClientMiddlewareFn } from \"../types\";\n\n/**\n * Middleware function that sets the `paymasterAndData` field in the given struct based on the entry point version of the account.\n * This is the default used by `createSmartAccountClient` and is not necessary to be used directly.\n *\n * @param {UserOperationStruct} struct the user operation structure to be modified\n * @param {{ account: Account }} context an object containing the account information\n * @returns {Promise<UserOperationStruct>} a promise that resolves to the modified user operation structure\n */\nexport const defaultPaymasterAndData: ClientMiddlewareFn = async (\n struct,\n { account },\n) => {\n const entryPoint = account.getEntryPoint();\n if (entryPoint.version === \"0.6.0\") {\n (struct as UserOperationStruct<\"0.6.0\">).paymasterAndData = \"0x\";\n }\n return struct;\n};\n"]}