@aa-sdk/core 4.0.0-alpha.1 → 4.0.0-alpha.10

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 (263) hide show
  1. package/dist/cjs/account/smartContractAccount.d.ts +9 -3
  2. package/dist/cjs/account/smartContractAccount.js +11 -6
  3. package/dist/cjs/account/smartContractAccount.js.map +1 -1
  4. package/dist/cjs/actions/smartAccount/buildUserOperationFromTx.js.map +1 -1
  5. package/dist/cjs/actions/smartAccount/buildUserOperationFromTxs.js.map +1 -1
  6. package/dist/cjs/actions/smartAccount/checkGasSponsorshipEligibility.js.map +1 -1
  7. package/dist/cjs/actions/smartAccount/estimateUserOperationGas.js.map +1 -1
  8. package/dist/cjs/actions/smartAccount/internal/initUserOperation.js.map +1 -1
  9. package/dist/cjs/actions/smartAccount/internal/runMiddlewareStack.js.map +1 -1
  10. package/dist/cjs/actions/smartAccount/internal/sendUserOperation.js.map +1 -1
  11. package/dist/cjs/actions/smartAccount/sendUserOperation.js.map +1 -1
  12. package/dist/cjs/client/bundlerClient.js.map +1 -1
  13. package/dist/cjs/client/decorators/bundlerClient.js.map +1 -1
  14. package/dist/cjs/client/isSmartAccountClient.js.map +1 -1
  15. package/dist/cjs/client/types.d.ts +2 -7
  16. package/dist/cjs/client/types.js.map +1 -1
  17. package/dist/cjs/ens/utils.d.ts +1 -1
  18. package/dist/cjs/ens/utils.js +3 -3
  19. package/dist/cjs/ens/utils.js.map +1 -1
  20. package/dist/cjs/errors/account.js.map +1 -1
  21. package/dist/cjs/errors/client.js.map +1 -1
  22. package/dist/cjs/errors/entrypoint.js.map +1 -1
  23. package/dist/cjs/errors/signer.js.map +1 -1
  24. package/dist/cjs/errors/transaction.js.map +1 -1
  25. package/dist/cjs/errors/useroperation.js.map +1 -1
  26. package/dist/cjs/index.d.ts +3 -6
  27. package/dist/cjs/index.js +38 -64
  28. package/dist/cjs/index.js.map +1 -1
  29. package/dist/cjs/logger.js.map +1 -1
  30. package/dist/cjs/middleware/actions.js +2 -18
  31. package/dist/cjs/middleware/actions.js.map +1 -1
  32. package/dist/cjs/middleware/defaults/gasEstimator.js +4 -2
  33. package/dist/cjs/middleware/defaults/gasEstimator.js.map +1 -1
  34. package/dist/cjs/middleware/erc7677middleware.d.ts +40 -0
  35. package/dist/cjs/middleware/erc7677middleware.js +77 -0
  36. package/dist/cjs/middleware/erc7677middleware.js.map +1 -0
  37. package/dist/cjs/middleware/noopMiddleware.d.ts +2 -1
  38. package/dist/cjs/middleware/noopMiddleware.js.map +1 -1
  39. package/dist/cjs/middleware/types.d.ts +3 -2
  40. package/dist/cjs/middleware/types.js.map +1 -1
  41. package/dist/cjs/signer/local-account.d.ts +44 -44
  42. package/dist/cjs/signer/local-account.js.map +1 -1
  43. package/dist/cjs/signer/wallet-client.d.ts +44 -44
  44. package/dist/cjs/signer/wallet-client.js.map +1 -1
  45. package/dist/cjs/transport/split.js.map +1 -1
  46. package/dist/cjs/utils/bigint.js.map +1 -1
  47. package/dist/cjs/utils/bytes.js.map +1 -1
  48. package/dist/cjs/utils/defaults.d.ts +2 -4
  49. package/dist/cjs/utils/defaults.js +5 -45
  50. package/dist/cjs/utils/defaults.js.map +1 -1
  51. package/dist/cjs/utils/index.d.ts +0 -3
  52. package/dist/cjs/utils/index.js +1 -25
  53. package/dist/cjs/utils/index.js.map +1 -1
  54. package/dist/cjs/utils/types.js.map +1 -1
  55. package/dist/cjs/utils/userop.js.map +1 -1
  56. package/dist/cjs/version.d.ts +1 -1
  57. package/dist/cjs/version.js +1 -1
  58. package/dist/cjs/version.js.map +1 -1
  59. package/dist/esm/account/smartContractAccount.d.ts +9 -3
  60. package/dist/esm/account/smartContractAccount.js +6 -1
  61. package/dist/esm/account/smartContractAccount.js.map +1 -1
  62. package/dist/esm/actions/smartAccount/buildUserOperationFromTx.js.map +1 -1
  63. package/dist/esm/actions/smartAccount/buildUserOperationFromTxs.js.map +1 -1
  64. package/dist/esm/actions/smartAccount/checkGasSponsorshipEligibility.js.map +1 -1
  65. package/dist/esm/actions/smartAccount/estimateUserOperationGas.js.map +1 -1
  66. package/dist/esm/actions/smartAccount/internal/initUserOperation.js.map +1 -1
  67. package/dist/esm/actions/smartAccount/internal/runMiddlewareStack.js.map +1 -1
  68. package/dist/esm/actions/smartAccount/internal/sendUserOperation.js.map +1 -1
  69. package/dist/esm/actions/smartAccount/sendUserOperation.js.map +1 -1
  70. package/dist/esm/client/bundlerClient.js.map +1 -1
  71. package/dist/esm/client/decorators/bundlerClient.js.map +1 -1
  72. package/dist/esm/client/isSmartAccountClient.js.map +1 -1
  73. package/dist/esm/client/types.d.ts +2 -7
  74. package/dist/esm/client/types.js.map +1 -1
  75. package/dist/esm/ens/utils.d.ts +1 -1
  76. package/dist/esm/ens/utils.js +1 -1
  77. package/dist/esm/ens/utils.js.map +1 -1
  78. package/dist/esm/errors/account.js.map +1 -1
  79. package/dist/esm/errors/client.js.map +1 -1
  80. package/dist/esm/errors/entrypoint.js.map +1 -1
  81. package/dist/esm/errors/signer.js.map +1 -1
  82. package/dist/esm/errors/transaction.js.map +1 -1
  83. package/dist/esm/errors/useroperation.js.map +1 -1
  84. package/dist/esm/index.d.ts +3 -6
  85. package/dist/esm/index.js +2 -4
  86. package/dist/esm/index.js.map +1 -1
  87. package/dist/esm/logger.js.map +1 -1
  88. package/dist/esm/middleware/actions.js +3 -18
  89. package/dist/esm/middleware/actions.js.map +1 -1
  90. package/dist/esm/middleware/defaults/gasEstimator.js +4 -2
  91. package/dist/esm/middleware/defaults/gasEstimator.js.map +1 -1
  92. package/dist/esm/middleware/erc7677middleware.d.ts +40 -0
  93. package/dist/esm/middleware/erc7677middleware.js +73 -0
  94. package/dist/esm/middleware/erc7677middleware.js.map +1 -0
  95. package/dist/esm/middleware/noopMiddleware.d.ts +2 -1
  96. package/dist/esm/middleware/noopMiddleware.js.map +1 -1
  97. package/dist/esm/middleware/types.d.ts +3 -2
  98. package/dist/esm/middleware/types.js.map +1 -1
  99. package/dist/esm/signer/local-account.d.ts +44 -44
  100. package/dist/esm/signer/local-account.js.map +1 -1
  101. package/dist/esm/signer/wallet-client.d.ts +44 -44
  102. package/dist/esm/signer/wallet-client.js.map +1 -1
  103. package/dist/esm/transport/split.js.map +1 -1
  104. package/dist/esm/utils/bigint.js.map +1 -1
  105. package/dist/esm/utils/bytes.js.map +1 -1
  106. package/dist/esm/utils/defaults.d.ts +2 -4
  107. package/dist/esm/utils/defaults.js +1 -40
  108. package/dist/esm/utils/defaults.js.map +1 -1
  109. package/dist/esm/utils/index.d.ts +0 -3
  110. package/dist/esm/utils/index.js +0 -11
  111. package/dist/esm/utils/index.js.map +1 -1
  112. package/dist/esm/utils/types.js.map +1 -1
  113. package/dist/esm/utils/userop.js.map +1 -1
  114. package/dist/esm/version.d.ts +1 -1
  115. package/dist/esm/version.js +1 -1
  116. package/dist/esm/version.js.map +1 -1
  117. package/dist/types/account/smartContractAccount.d.ts +17 -11
  118. package/dist/types/account/smartContractAccount.d.ts.map +1 -1
  119. package/dist/types/actions/smartAccount/buildUserOperationFromTx.d.ts +33 -33
  120. package/dist/types/actions/smartAccount/buildUserOperationFromTxs.d.ts +43 -59
  121. package/dist/types/actions/smartAccount/buildUserOperationFromTxs.d.ts.map +1 -1
  122. package/dist/types/actions/smartAccount/checkGasSponsorshipEligibility.d.ts +18 -18
  123. package/dist/types/actions/smartAccount/estimateUserOperationGas.d.ts +3 -3
  124. package/dist/types/actions/smartAccount/internal/initUserOperation.d.ts +3 -4
  125. package/dist/types/actions/smartAccount/internal/initUserOperation.d.ts.map +1 -1
  126. package/dist/types/actions/smartAccount/internal/runMiddlewareStack.d.ts +0 -14
  127. package/dist/types/actions/smartAccount/internal/runMiddlewareStack.d.ts.map +1 -1
  128. package/dist/types/actions/smartAccount/internal/sendUserOperation.d.ts +0 -7
  129. package/dist/types/actions/smartAccount/internal/sendUserOperation.d.ts.map +1 -1
  130. package/dist/types/actions/smartAccount/sendUserOperation.d.ts +17 -3
  131. package/dist/types/actions/smartAccount/sendUserOperation.d.ts.map +1 -1
  132. package/dist/types/client/bundlerClient.d.ts +2 -2
  133. package/dist/types/client/decorators/bundlerClient.d.ts +8 -8
  134. package/dist/types/client/isSmartAccountClient.d.ts +4 -4
  135. package/dist/types/client/types.d.ts +2 -7
  136. package/dist/types/client/types.d.ts.map +1 -1
  137. package/dist/types/ens/utils.d.ts +1 -1
  138. package/dist/types/ens/utils.d.ts.map +1 -1
  139. package/dist/types/errors/account.d.ts +53 -4
  140. package/dist/types/errors/account.d.ts.map +1 -1
  141. package/dist/types/errors/client.d.ts +15 -0
  142. package/dist/types/errors/client.d.ts.map +1 -1
  143. package/dist/types/errors/entrypoint.d.ts +12 -0
  144. package/dist/types/errors/entrypoint.d.ts.map +1 -1
  145. package/dist/types/errors/signer.d.ts +5 -0
  146. package/dist/types/errors/signer.d.ts.map +1 -1
  147. package/dist/types/errors/transaction.d.ts +8 -1
  148. package/dist/types/errors/transaction.d.ts.map +1 -1
  149. package/dist/types/errors/useroperation.d.ts +5 -5
  150. package/dist/types/errors/useroperation.d.ts.map +1 -1
  151. package/dist/types/index.d.ts +3 -6
  152. package/dist/types/index.d.ts.map +1 -1
  153. package/dist/types/logger.d.ts +88 -0
  154. package/dist/types/logger.d.ts.map +1 -1
  155. package/dist/types/middleware/actions.d.ts +3 -3
  156. package/dist/types/middleware/actions.d.ts.map +1 -1
  157. package/dist/types/middleware/defaults/gasEstimator.d.ts +2 -2
  158. package/dist/types/middleware/defaults/gasEstimator.d.ts.map +1 -1
  159. package/dist/types/middleware/erc7677middleware.d.ts +62 -0
  160. package/dist/types/middleware/erc7677middleware.d.ts.map +1 -0
  161. package/dist/types/middleware/noopMiddleware.d.ts +4 -4
  162. package/dist/types/middleware/noopMiddleware.d.ts.map +1 -1
  163. package/dist/types/middleware/types.d.ts +3 -2
  164. package/dist/types/middleware/types.d.ts.map +1 -1
  165. package/dist/types/signer/local-account.d.ts +137 -45
  166. package/dist/types/signer/local-account.d.ts.map +1 -1
  167. package/dist/types/signer/wallet-client.d.ts +133 -44
  168. package/dist/types/signer/wallet-client.d.ts.map +1 -1
  169. package/dist/types/transport/split.d.ts +2 -2
  170. package/dist/types/utils/bigint.d.ts +14 -14
  171. package/dist/types/utils/bigint.d.ts.map +1 -1
  172. package/dist/types/utils/bytes.d.ts +5 -5
  173. package/dist/types/utils/defaults.d.ts +2 -12
  174. package/dist/types/utils/defaults.d.ts.map +1 -1
  175. package/dist/types/utils/index.d.ts +12 -22
  176. package/dist/types/utils/index.d.ts.map +1 -1
  177. package/dist/types/utils/types.d.ts +2 -2
  178. package/dist/types/utils/userop.d.ts +33 -33
  179. package/dist/types/version.d.ts +1 -1
  180. package/dist/types/version.d.ts.map +1 -1
  181. package/package.json +4 -3
  182. package/src/account/smartContractAccount.ts +19 -13
  183. package/src/actions/smartAccount/buildUserOperationFromTx.ts +35 -35
  184. package/src/actions/smartAccount/buildUserOperationFromTxs.ts +44 -60
  185. package/src/actions/smartAccount/checkGasSponsorshipEligibility.ts +19 -19
  186. package/src/actions/smartAccount/estimateUserOperationGas.ts +3 -3
  187. package/src/actions/smartAccount/internal/initUserOperation.ts +3 -4
  188. package/src/actions/smartAccount/internal/runMiddlewareStack.ts +0 -22
  189. package/src/actions/smartAccount/internal/sendUserOperation.ts +0 -7
  190. package/src/actions/smartAccount/sendUserOperation.ts +17 -3
  191. package/src/client/bundlerClient.ts +2 -2
  192. package/src/client/decorators/bundlerClient.ts +8 -8
  193. package/src/client/isSmartAccountClient.ts +4 -4
  194. package/src/client/types.ts +2 -15
  195. package/src/ens/utils.ts +1 -2
  196. package/src/errors/account.ts +64 -4
  197. package/src/errors/client.ts +18 -0
  198. package/src/errors/entrypoint.ts +12 -0
  199. package/src/errors/signer.ts +6 -0
  200. package/src/errors/transaction.ts +10 -1
  201. package/src/errors/useroperation.ts +5 -6
  202. package/src/index.ts +2 -31
  203. package/src/logger.ts +88 -0
  204. package/src/middleware/actions.ts +6 -27
  205. package/src/middleware/defaults/gasEstimator.ts +9 -5
  206. package/src/middleware/erc7677middleware.ts +201 -0
  207. package/src/middleware/noopMiddleware.ts +6 -4
  208. package/src/middleware/types.ts +16 -7
  209. package/src/signer/local-account.ts +94 -2
  210. package/src/signer/wallet-client.ts +89 -0
  211. package/src/transport/split.ts +2 -2
  212. package/src/utils/bigint.ts +15 -15
  213. package/src/utils/bytes.ts +5 -5
  214. package/src/utils/defaults.ts +3 -76
  215. package/src/utils/index.ts +12 -35
  216. package/src/utils/types.ts +2 -2
  217. package/src/utils/userop.ts +33 -33
  218. package/src/version.ts +1 -1
  219. package/dist/cjs/account/base.d.ts +0 -49
  220. package/dist/cjs/account/base.js +0 -257
  221. package/dist/cjs/account/base.js.map +0 -1
  222. package/dist/cjs/account/schema.d.ts +0 -100
  223. package/dist/cjs/account/schema.js +0 -43
  224. package/dist/cjs/account/schema.js.map +0 -1
  225. package/dist/cjs/account/simple.d.ts +0 -14
  226. package/dist/cjs/account/simple.js +0 -119
  227. package/dist/cjs/account/simple.js.map +0 -1
  228. package/dist/cjs/account/types.d.ts +0 -30
  229. package/dist/cjs/account/types.js +0 -3
  230. package/dist/cjs/account/types.js.map +0 -1
  231. package/dist/cjs/chains/index.d.ts +0 -20
  232. package/dist/cjs/chains/index.js +0 -169
  233. package/dist/cjs/chains/index.js.map +0 -1
  234. package/dist/esm/account/base.d.ts +0 -49
  235. package/dist/esm/account/base.js +0 -253
  236. package/dist/esm/account/base.js.map +0 -1
  237. package/dist/esm/account/schema.d.ts +0 -100
  238. package/dist/esm/account/schema.js +0 -35
  239. package/dist/esm/account/schema.js.map +0 -1
  240. package/dist/esm/account/simple.d.ts +0 -14
  241. package/dist/esm/account/simple.js +0 -115
  242. package/dist/esm/account/simple.js.map +0 -1
  243. package/dist/esm/account/types.d.ts +0 -30
  244. package/dist/esm/account/types.js +0 -2
  245. package/dist/esm/account/types.js.map +0 -1
  246. package/dist/esm/chains/index.d.ts +0 -20
  247. package/dist/esm/chains/index.js +0 -166
  248. package/dist/esm/chains/index.js.map +0 -1
  249. package/dist/types/account/base.d.ts +0 -128
  250. package/dist/types/account/base.d.ts.map +0 -1
  251. package/dist/types/account/schema.d.ts +0 -101
  252. package/dist/types/account/schema.d.ts.map +0 -1
  253. package/dist/types/account/simple.d.ts +0 -15
  254. package/dist/types/account/simple.d.ts.map +0 -1
  255. package/dist/types/account/types.d.ts +0 -144
  256. package/dist/types/account/types.d.ts.map +0 -1
  257. package/dist/types/chains/index.d.ts +0 -21
  258. package/dist/types/chains/index.d.ts.map +0 -1
  259. package/src/account/base.ts +0 -415
  260. package/src/account/schema.ts +0 -51
  261. package/src/account/simple.ts +0 -221
  262. package/src/account/types.ts +0 -184
  263. package/src/chains/index.ts +0 -194
@@ -0,0 +1,73 @@
1
+ import { toHex, } from "viem";
2
+ import { ChainNotFoundError } from "../errors/client.js";
3
+ import { deepHexlify, resolveProperties, } from "../utils/index.js";
4
+ export function erc7677Middleware(params) {
5
+ const dummyPaymasterAndData = async (uo, { client, account, feeOptions, overrides }) => {
6
+ const userOp = deepHexlify(await resolveProperties(uo));
7
+ userOp.maxFeePerGas = "0x0";
8
+ userOp.maxPriorityFeePerGas = "0x0";
9
+ userOp.callGasLimit = "0x0";
10
+ userOp.verificationGasLimit = "0x0";
11
+ userOp.preVerificationGas = "0x0";
12
+ const entrypoint = account.getEntryPoint();
13
+ if (entrypoint.version === "0.7.0") {
14
+ userOp.paymasterVerificationGasLimit = "0x0";
15
+ userOp.paymasterPostOpGasLimit = "0x0";
16
+ }
17
+ const context = (typeof params?.context === "function"
18
+ ? await params?.context(userOp, { overrides, feeOptions })
19
+ : params?.context) ?? {};
20
+ if (!client.chain) {
21
+ throw new ChainNotFoundError();
22
+ }
23
+ const erc7677client = client;
24
+ const { paymaster, paymasterAndData, paymasterData, paymasterPostOpGasLimit, paymasterVerificationGasLimit, } = await erc7677client.request({
25
+ method: "pm_getPaymasterStubData",
26
+ params: [userOp, entrypoint.address, toHex(client.chain.id), context],
27
+ });
28
+ if (entrypoint.version === "0.6.0") {
29
+ return {
30
+ ...uo,
31
+ paymasterAndData,
32
+ };
33
+ }
34
+ return {
35
+ ...uo,
36
+ paymaster,
37
+ paymasterData,
38
+ paymasterPostOpGasLimit,
39
+ paymasterVerificationGasLimit,
40
+ };
41
+ };
42
+ const paymasterAndData = async (uo, { client, account, feeOptions, overrides }) => {
43
+ const userOp = deepHexlify(await resolveProperties(uo));
44
+ const context = (typeof params?.context === "function"
45
+ ? await params?.context(userOp, { overrides, feeOptions })
46
+ : params?.context) ?? {};
47
+ if (!client.chain) {
48
+ throw new ChainNotFoundError();
49
+ }
50
+ const erc7677client = client;
51
+ const entrypoint = account.getEntryPoint();
52
+ const { paymaster, paymasterAndData, paymasterData } = await erc7677client.request({
53
+ method: "pm_getPaymasterData",
54
+ params: [userOp, entrypoint.address, toHex(client.chain.id), context],
55
+ });
56
+ if (entrypoint.version === "0.6.0") {
57
+ return {
58
+ ...uo,
59
+ paymasterAndData,
60
+ };
61
+ }
62
+ return {
63
+ ...uo,
64
+ paymaster,
65
+ paymasterData,
66
+ };
67
+ };
68
+ return {
69
+ dummyPaymasterAndData,
70
+ paymasterAndData,
71
+ };
72
+ }
73
+ //# sourceMappingURL=erc7677middleware.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"erc7677middleware.js","sourceRoot":"","sources":["../../../src/middleware/erc7677middleware.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,GAMN,MAAM,MAAM,CAAC;AAGd,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAOzD,OAAO,EACL,WAAW,EACX,iBAAiB,GAElB,MAAM,mBAAmB,CAAC;AAyE3B,MAAM,UAAU,iBAAiB,CAK/B,MAA0C;IAE1C,MAAM,qBAAqB,GAAuB,KAAK,EACrD,EAAE,EACF,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,EAC1C,EAAE;QACF,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,iBAAiB,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KACjB,CAAC;AACJ,CAAC","sourcesContent":["import {\n toHex,\n type Address,\n type Chain,\n type Client,\n type Hex,\n type Transport,\n} from \"viem\";\nimport type { ClientMiddlewareConfig } from \"../client/types\";\nimport type { EntryPointVersion } from \"../entrypoint/types\";\nimport { ChainNotFoundError } from \"../errors/client.js\";\nimport type {\n UserOperationFeeOptions,\n UserOperationOverrides,\n UserOperationRequest,\n UserOperationStruct,\n} from \"../types\";\nimport {\n deepHexlify,\n resolveProperties,\n type Deferrable,\n} from \"../utils/index.js\";\nimport type { ClientMiddlewareFn } from \"./types\";\n\nexport type Erc7677RpcSchema = [\n {\n Method: \"pm_getPaymasterStubData\";\n Parameters: [UserOperationRequest, Address, Hex, Record<string, any>];\n ReturnType: {\n sponsor?: { name: string; icon?: string }; // Sponsor info\n paymaster?: Address; // Paymaster address (entrypoint v0.7)\n paymasterData?: Hex; // Paymaster data (entrypoint v0.7)\n paymasterVerificationGasLimit?: Hex; // Paymaster validation gas (entrypoint v0.7)\n paymasterPostOpGasLimit?: Hex; // Paymaster post-op gas (entrypoint v0.7)\n paymasterAndData?: Hex; // Paymaster and data (entrypoint v0.6)\n isFinal?: boolean; // Indicates that the caller does not need to call pm_getPaymasterData\n };\n },\n {\n Method: \"pm_getPaymasterData\";\n Parameters: [UserOperationRequest, Address, Hex, Record<string, any>];\n ReturnType: {\n paymaster?: Address; // Paymaster address (entrypoint v0.7)\n paymasterData?: Hex; // Paymaster data (entrypoint v0.7)\n paymasterAndData?: Hex; // Paymaster and data (entrypoint v0.6)\n };\n }\n];\n\nexport type Erc7677Client<T extends Transport = Transport> = Client<\n T,\n Chain,\n undefined,\n Erc7677RpcSchema\n>;\n\nexport type Erc7677MiddlewareParams<\n TContext extends Record<string, any> | undefined =\n | Record<string, any>\n | undefined,\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion\n> = {\n context?:\n | ((\n struct: Deferrable<UserOperationStruct<TEntryPointVersion>>,\n args: {\n overrides?: UserOperationOverrides<TEntryPointVersion>;\n feeOptions?: UserOperationFeeOptions;\n }\n ) => Promise<TContext>)\n | TContext;\n};\n\n/**\n * Middleware function for interacting with ERC-7677 enabled clients. It supports resolving paymaster and data fields for user operations.\n * This middleware assumes that your RPC provider supports the ERC-7677 methods (pm_getPaymasterStubData and pm_getPaymasterData).\n *\n * @example\n * ```ts\n * import { createSmartAccountClient, erc7677Middleware } from \"@aa-sdk/core\";\n * import { http } from \"viem\";\n * import { sepolia } from \"viem/chains\";\n *\n * const client = createSmartAccountClient({\n * transport: http(\"rpc-url\"),\n * chain: sepolia,\n * // this assumes that your RPC provider supports the ERC-7677 methods AND takes no context\n * ...erc7677Middleware(),\n * })\n * ```\n *\n * @param {Erc7677MiddlewareParams<TContext>} params Middleware parameters including context function or object. Context can be resolved dynamically by passing in a function which takes in the context at the time of sending a user op\n * @returns {Pick<ClientMiddlewareConfig, \"dummyPaymasterAndData\" | \"paymasterAndData\">} An object containing middleware functions `dummyPaymasterAndData` and `paymasterAndData` for processing user operations with the paymaster data\n */\nexport function erc7677Middleware<\n TContext extends Record<string, any> | undefined =\n | Record<string, any>\n | undefined\n>(\n params?: Erc7677MiddlewareParams<TContext>\n): Pick<ClientMiddlewareConfig, \"dummyPaymasterAndData\" | \"paymasterAndData\"> {\n const dummyPaymasterAndData: ClientMiddlewareFn = async (\n uo,\n { client, account, feeOptions, overrides }\n ) => {\n const userOp = deepHexlify(await resolveProperties(uo));\n\n // Those values will be set after fee estimation.\n userOp.maxFeePerGas = \"0x0\";\n userOp.maxPriorityFeePerGas = \"0x0\";\n userOp.callGasLimit = \"0x0\";\n userOp.verificationGasLimit = \"0x0\";\n userOp.preVerificationGas = \"0x0\";\n\n const entrypoint = account.getEntryPoint();\n\n if (entrypoint.version === \"0.7.0\") {\n userOp.paymasterVerificationGasLimit = \"0x0\";\n userOp.paymasterPostOpGasLimit = \"0x0\";\n }\n\n const context =\n (typeof params?.context === \"function\"\n ? await params?.context(userOp, { overrides, feeOptions })\n : params?.context) ?? {};\n\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n\n const erc7677client = client as Erc7677Client;\n // TODO: probably need to handle the sponsor and isFinal fields\n const {\n paymaster,\n paymasterAndData,\n paymasterData,\n paymasterPostOpGasLimit,\n paymasterVerificationGasLimit,\n } = await erc7677client.request({\n method: \"pm_getPaymasterStubData\",\n params: [userOp, entrypoint.address, toHex(client.chain.id), context],\n });\n\n if (entrypoint.version === \"0.6.0\") {\n return {\n ...uo,\n paymasterAndData,\n };\n }\n\n return {\n ...uo,\n paymaster,\n paymasterData,\n paymasterPostOpGasLimit,\n paymasterVerificationGasLimit,\n };\n };\n\n const paymasterAndData: ClientMiddlewareFn = async (\n uo,\n { client, account, feeOptions, overrides }\n ) => {\n const userOp = deepHexlify(await resolveProperties(uo));\n const context =\n (typeof params?.context === \"function\"\n ? await params?.context(userOp, { overrides, feeOptions })\n : params?.context) ?? {};\n\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n\n const erc7677client = client as Erc7677Client;\n\n const entrypoint = account.getEntryPoint();\n const { paymaster, paymasterAndData, paymasterData } =\n await erc7677client.request({\n method: \"pm_getPaymasterData\",\n params: [userOp, entrypoint.address, toHex(client.chain.id), context],\n });\n\n if (entrypoint.version === \"0.6.0\") {\n return {\n ...uo,\n paymasterAndData,\n };\n }\n\n return {\n ...uo,\n paymaster,\n paymasterData,\n };\n };\n\n return {\n dummyPaymasterAndData,\n paymasterAndData,\n };\n}\n"]}
@@ -1,2 +1,3 @@
1
+ import type { UserOperationContext } from "../actions/smartAccount/types";
1
2
  import type { ClientMiddlewareFn } from "./types";
2
- export declare const noopMiddleware: ClientMiddlewareFn;
3
+ export declare const noopMiddleware: ClientMiddlewareFn<UserOperationContext | undefined>;
@@ -1 +1 @@
1
- {"version":3,"file":"noopMiddleware.js","sourceRoot":"","sources":["../../../src/middleware/noopMiddleware.ts"],"names":[],"mappings":"AASA,MAAM,CAAC,MAAM,cAAc,GAAuB,KAAK,EAAE,IAAI,EAAE,EAAE;IAC/D,OAAO,IAAI,CAAC;AACd,CAAC,CAAC","sourcesContent":["import type { ClientMiddlewareFn } from \"./types\";\n\n/**\n * Noop middleware that does nothing and passes the arguments through\n *\n * @async\n * @param args the client middleware arguments passed to the middleware\n * @returns the arguments passed to the middleware and returned as is without modification\n */\nexport const noopMiddleware: ClientMiddlewareFn = async (args) => {\n return args;\n};\n"]}
1
+ {"version":3,"file":"noopMiddleware.js","sourceRoot":"","sources":["../../../src/middleware/noopMiddleware.ts"],"names":[],"mappings":"AASA,MAAM,CAAC,MAAM,cAAc,GAEvB,KAAK,EAAE,IAAI,EAAE,EAAE;IACjB,OAAO,IAAI,CAAC;AACd,CAAC,CAAC","sourcesContent":["import type { UserOperationContext } from \"../actions/smartAccount/types\";\nimport type { ClientMiddlewareFn } from \"./types\";\n\n/**\n * Noop middleware that does nothing and passes the arguments through\n *\n * @param {Deferrable<UserOperationStruct<TEntryPointVersion>>} args the client middleware arguments passed to the middleware\n * @returns {Promise<Deferrable<UserOperationStruct<TEntryPointVersion>>>} the arguments passed to the middleware and returned as is without modification\n */\nexport const noopMiddleware: ClientMiddlewareFn<\n UserOperationContext | undefined\n> = async (args) => {\n return args;\n};\n"]}
@@ -3,13 +3,14 @@ import type { UserOperationContext } from "../actions/smartAccount/types";
3
3
  import type { UserOperationFeeOptions, UserOperationOverrides, UserOperationStruct } from "../types";
4
4
  import type { Deferrable } from "../utils";
5
5
  import type { MiddlewareClient } from "./actions";
6
- export type ClientMiddlewareFn<TContext extends UserOperationContext | undefined = UserOperationContext | undefined> = <TAccount extends SmartContractAccount, C extends MiddlewareClient, TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>>(struct: Deferrable<UserOperationStruct<TEntryPointVersion>>, args: {
6
+ export type ClientMiddlewareArgs<TAccount extends SmartContractAccount, C extends MiddlewareClient, TContext extends UserOperationContext | undefined = UserOperationContext | undefined, TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>> = {
7
7
  overrides?: UserOperationOverrides<TEntryPointVersion>;
8
8
  context?: TContext;
9
9
  feeOptions?: UserOperationFeeOptions;
10
10
  account: TAccount;
11
11
  client: C;
12
- }) => Promise<Deferrable<UserOperationStruct<TEntryPointVersion>>>;
12
+ };
13
+ export type ClientMiddlewareFn<TContext extends UserOperationContext | undefined = UserOperationContext | undefined> = <TAccount extends SmartContractAccount, C extends MiddlewareClient, TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>>(struct: Deferrable<UserOperationStruct<TEntryPointVersion>>, args: ClientMiddlewareArgs<TAccount, C, TContext, TEntryPointVersion>) => Promise<Deferrable<UserOperationStruct<TEntryPointVersion>>>;
13
14
  export type ClientMiddleware<TContext extends UserOperationContext | undefined = UserOperationContext | undefined> = {
14
15
  dummyPaymasterAndData: ClientMiddlewareFn<TContext>;
15
16
  feeEstimator: ClientMiddlewareFn<TContext>;
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/middleware/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n GetEntryPointFromAccount,\n SmartContractAccount,\n} from \"../account/smartContractAccount\";\nimport type { UserOperationContext } from \"../actions/smartAccount/types\";\nimport type {\n UserOperationFeeOptions,\n UserOperationOverrides,\n UserOperationStruct,\n} from \"../types\";\nimport type { Deferrable } from \"../utils\";\nimport type { MiddlewareClient } from \"./actions\";\n\n// [!region ClientMiddlewareFn]\nexport type ClientMiddlewareFn<\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n> = <\n TAccount extends SmartContractAccount,\n C extends MiddlewareClient,\n TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>\n>(\n struct: Deferrable<UserOperationStruct<TEntryPointVersion>>,\n args: {\n overrides?: UserOperationOverrides<TEntryPointVersion>;\n context?: TContext;\n feeOptions?: UserOperationFeeOptions;\n account: TAccount;\n client: C;\n }\n) => Promise<Deferrable<UserOperationStruct<TEntryPointVersion>>>;\n// [!endregion ClientMiddlewareFn]\n\n// [!region ClientMiddleware]\nexport type ClientMiddleware<\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n> = {\n dummyPaymasterAndData: ClientMiddlewareFn<TContext>;\n feeEstimator: ClientMiddlewareFn<TContext>;\n gasEstimator: ClientMiddlewareFn<TContext>;\n customMiddleware: ClientMiddlewareFn<TContext>;\n paymasterAndData: ClientMiddlewareFn<TContext>;\n userOperationSimulator: ClientMiddlewareFn<TContext>;\n signUserOperation: ClientMiddlewareFn<TContext>;\n};\n// [!endregion ClientMiddleware]\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/middleware/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n GetEntryPointFromAccount,\n SmartContractAccount,\n} from \"../account/smartContractAccount\";\nimport type { UserOperationContext } from \"../actions/smartAccount/types\";\nimport type {\n UserOperationFeeOptions,\n UserOperationOverrides,\n UserOperationStruct,\n} from \"../types\";\nimport type { Deferrable } from \"../utils\";\nimport type { MiddlewareClient } from \"./actions\";\n\nexport type ClientMiddlewareArgs<\n TAccount extends SmartContractAccount,\n C extends MiddlewareClient,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>\n> = {\n overrides?: UserOperationOverrides<TEntryPointVersion>;\n context?: TContext;\n feeOptions?: UserOperationFeeOptions;\n account: TAccount;\n client: C;\n};\n\n// [!region ClientMiddlewareFn]\nexport type ClientMiddlewareFn<\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n> = <\n TAccount extends SmartContractAccount,\n C extends MiddlewareClient,\n TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>\n>(\n struct: Deferrable<UserOperationStruct<TEntryPointVersion>>,\n args: ClientMiddlewareArgs<TAccount, C, TContext, TEntryPointVersion>\n) => Promise<Deferrable<UserOperationStruct<TEntryPointVersion>>>;\n// [!endregion ClientMiddlewareFn]\n\n// [!region ClientMiddleware]\nexport type ClientMiddleware<\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n> = {\n dummyPaymasterAndData: ClientMiddlewareFn<TContext>;\n feeEstimator: ClientMiddlewareFn<TContext>;\n gasEstimator: ClientMiddlewareFn<TContext>;\n customMiddleware: ClientMiddlewareFn<TContext>;\n paymasterAndData: ClientMiddlewareFn<TContext>;\n userOperationSimulator: ClientMiddlewareFn<TContext>;\n signUserOperation: ClientMiddlewareFn<TContext>;\n};\n// [!endregion ClientMiddleware]\n"]}
@@ -32,31 +32,31 @@ export declare class LocalAccountSigner<T extends HDAccount | PrivateKeyAccount
32
32
  [x: `bytes9[${string}]`]: undefined;
33
33
  [x: `bytes10[${string}]`]: undefined;
34
34
  [x: `bytes25[${string}]`]: undefined;
35
+ [x: `bytes31[${string}]`]: undefined;
36
+ [x: `bytes30[${string}]`]: undefined;
37
+ [x: `bytes29[${string}]`]: undefined;
38
+ [x: `bytes28[${string}]`]: undefined;
39
+ [x: `bytes27[${string}]`]: undefined;
40
+ [x: `bytes26[${string}]`]: undefined;
41
+ [x: `bytes24[${string}]`]: undefined;
42
+ [x: `bytes23[${string}]`]: undefined;
43
+ [x: `bytes22[${string}]`]: undefined;
44
+ [x: `bytes21[${string}]`]: undefined;
45
+ [x: `bytes20[${string}]`]: undefined;
46
+ [x: `bytes19[${string}]`]: undefined;
35
47
  [x: `bytes18[${string}]`]: undefined;
36
- [x: `bytes12[${string}]`]: undefined;
37
- [x: `bytes13[${string}]`]: undefined;
38
- [x: `bytes14[${string}]`]: undefined;
39
- [x: `bytes15[${string}]`]: undefined;
40
- [x: `bytes16[${string}]`]: undefined;
41
48
  [x: `bytes17[${string}]`]: undefined;
42
- [x: `bytes19[${string}]`]: undefined;
43
- [x: `bytes20[${string}]`]: undefined;
44
- [x: `bytes21[${string}]`]: undefined;
45
- [x: `bytes22[${string}]`]: undefined;
46
- [x: `bytes23[${string}]`]: undefined;
47
- [x: `bytes24[${string}]`]: undefined;
48
- [x: `bytes26[${string}]`]: undefined;
49
- [x: `bytes27[${string}]`]: undefined;
50
- [x: `bytes28[${string}]`]: undefined;
51
- [x: `bytes29[${string}]`]: undefined;
52
- [x: `bytes30[${string}]`]: undefined;
53
- [x: `bytes31[${string}]`]: undefined;
49
+ [x: `bytes16[${string}]`]: undefined;
50
+ [x: `bytes15[${string}]`]: undefined;
51
+ [x: `bytes14[${string}]`]: undefined;
52
+ [x: `bytes13[${string}]`]: undefined;
53
+ [x: `bytes12[${string}]`]: undefined;
54
54
  [x: `int[${string}]`]: undefined;
55
55
  [x: `int8[${string}]`]: undefined;
56
- [x: `int16[${string}]`]: undefined;
57
- [x: `int24[${string}]`]: undefined;
58
- [x: `int32[${string}]`]: undefined;
59
56
  [x: `int40[${string}]`]: undefined;
57
+ [x: `int32[${string}]`]: undefined;
58
+ [x: `int24[${string}]`]: undefined;
59
+ [x: `int16[${string}]`]: undefined;
60
60
  [x: `int48[${string}]`]: undefined;
61
61
  [x: `int56[${string}]`]: undefined;
62
62
  [x: `int64[${string}]`]: undefined;
@@ -85,9 +85,9 @@ export declare class LocalAccountSigner<T extends HDAccount | PrivateKeyAccount
85
85
  [x: `int248[${string}]`]: undefined;
86
86
  [x: `int256[${string}]`]: undefined;
87
87
  [x: `uint[${string}]`]: undefined;
88
- [x: `uint16[${string}]`]: undefined;
89
- [x: `uint24[${string}]`]: undefined;
90
88
  [x: `uint40[${string}]`]: undefined;
89
+ [x: `uint24[${string}]`]: undefined;
90
+ [x: `uint16[${string}]`]: undefined;
91
91
  [x: `uint56[${string}]`]: undefined;
92
92
  [x: `uint72[${string}]`]: undefined;
93
93
  [x: `uint80[${string}]`]: undefined;
@@ -134,30 +134,30 @@ export declare class LocalAccountSigner<T extends HDAccount | PrivateKeyAccount
134
134
  bytes9?: undefined;
135
135
  bytes10?: undefined;
136
136
  bytes25?: undefined;
137
+ bytes31?: undefined;
138
+ bytes30?: undefined;
139
+ bytes29?: undefined;
140
+ bytes28?: undefined;
141
+ bytes27?: undefined;
142
+ bytes26?: undefined;
143
+ bytes24?: undefined;
144
+ bytes23?: undefined;
145
+ bytes22?: undefined;
146
+ bytes21?: undefined;
147
+ bytes20?: undefined;
148
+ bytes19?: undefined;
137
149
  bytes18?: undefined;
138
- bytes12?: undefined;
139
- bytes13?: undefined;
140
- bytes14?: undefined;
141
- bytes15?: undefined;
142
- bytes16?: undefined;
143
150
  bytes17?: undefined;
144
- bytes19?: undefined;
145
- bytes20?: undefined;
146
- bytes21?: undefined;
147
- bytes22?: undefined;
148
- bytes23?: undefined;
149
- bytes24?: undefined;
150
- bytes26?: undefined;
151
- bytes27?: undefined;
152
- bytes28?: undefined;
153
- bytes29?: undefined;
154
- bytes30?: undefined;
155
- bytes31?: undefined;
151
+ bytes16?: undefined;
152
+ bytes15?: undefined;
153
+ bytes14?: undefined;
154
+ bytes13?: undefined;
155
+ bytes12?: undefined;
156
156
  int8?: undefined;
157
- int16?: undefined;
158
- int24?: undefined;
159
- int32?: undefined;
160
157
  int40?: undefined;
158
+ int32?: undefined;
159
+ int24?: undefined;
160
+ int16?: undefined;
161
161
  int48?: undefined;
162
162
  int56?: undefined;
163
163
  int64?: undefined;
@@ -185,9 +185,9 @@ export declare class LocalAccountSigner<T extends HDAccount | PrivateKeyAccount
185
185
  int240?: undefined;
186
186
  int248?: undefined;
187
187
  int256?: undefined;
188
- uint16?: undefined;
189
- uint24?: undefined;
190
188
  uint40?: undefined;
189
+ uint24?: undefined;
190
+ uint16?: undefined;
191
191
  uint56?: undefined;
192
192
  uint72?: undefined;
193
193
  uint80?: undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"local-account.js","sourceRoot":"","sources":["../../../src/signer/local-account.ts"],"names":[],"mappings":"AAAA,OAAO,EASN,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAMvE,MAAM,OAAO,kBAAkB;IAO7B,YAAY,KAAQ;QAHpB;;;;;WAAS;QACT;;;;;WAAmB;QAOV;;;;mBAAoE,CAC3E,OAAO,EACP,EAAE;gBACF,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;YAC7C,CAAC;WAAC;QAEO;;;;mBAAgB,KAAK,EAI5B,MAAqD,EACvC,EAAE;gBAChB,OAAO,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;YAC1C,CAAC;WAAC;QAEO;;;;mBAA2C,KAAK,IAAI,EAAE;gBAC7D,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;YAC5B,CAAC;WAAC;QArBA,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC;IAC/B,CAAC;IAqBD,MAAM,CAAC,uBAAuB,CAC5B,GAAW,EACX,IAAgB;QAEhB,MAAM,MAAM,GAAG,iBAAiB,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QAC5C,OAAO,IAAI,kBAAkB,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;IAED,MAAM,CAAC,yBAAyB,CAC9B,GAAQ;QAER,MAAM,MAAM,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC;QACxC,OAAO,IAAI,kBAAkB,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;CACF","sourcesContent":["import {\n type HDAccount,\n type HDOptions,\n type Hex,\n type LocalAccount,\n type PrivateKeyAccount,\n type SignableMessage,\n type TypedData,\n type TypedDataDefinition,\n} from \"viem\";\nimport { mnemonicToAccount, privateKeyToAccount } from \"viem/accounts\";\nimport type { SmartAccountSigner } from \"./types.js\";\n\n/**\n * Represents a local account signer and provides methods to sign messages and transactions, as well as static methods to create the signer from mnemonic or private key.\n */\nexport class LocalAccountSigner<\n T extends HDAccount | PrivateKeyAccount | LocalAccount\n> implements SmartAccountSigner<T>\n{\n inner: T;\n signerType: string;\n\n constructor(inner: T) {\n this.inner = inner;\n this.signerType = inner.type; // type: \"local\"\n }\n\n readonly signMessage: (message: SignableMessage) => Promise<`0x${string}`> = (\n message\n ) => {\n return this.inner.signMessage({ message });\n };\n\n readonly signTypedData = async <\n const TTypedData extends TypedData | { [key: string]: unknown },\n TPrimaryType extends string = string\n >(\n params: TypedDataDefinition<TTypedData, TPrimaryType>\n ): Promise<Hex> => {\n return this.inner.signTypedData(params);\n };\n\n readonly getAddress: () => Promise<`0x${string}`> = async () => {\n return this.inner.address;\n };\n\n static mnemonicToAccountSigner(\n key: string,\n opts?: HDOptions\n ): LocalAccountSigner<HDAccount> {\n const signer = mnemonicToAccount(key, opts);\n return new LocalAccountSigner(signer);\n }\n\n static privateKeyToAccountSigner(\n key: Hex\n ): LocalAccountSigner<PrivateKeyAccount> {\n const signer = privateKeyToAccount(key);\n return new LocalAccountSigner(signer);\n }\n}\n"]}
1
+ {"version":3,"file":"local-account.js","sourceRoot":"","sources":["../../../src/signer/local-account.ts"],"names":[],"mappings":"AAAA,OAAO,EASN,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAMvE,MAAM,OAAO,kBAAkB;IAsB7B,YAAY,KAAQ;QAlBpB;;;;;WAAS;QACT;;;;;WAAmB;QAqCV;;;;mBAAoE,CAC3E,OAAO,EACP,EAAE;gBACF,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;YAC7C,CAAC;WAAC;QAsBO;;;;mBAAgB,KAAK,EAI5B,MAAqD,EACvC,EAAE;gBAChB,OAAO,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;YAC1C,CAAC;WAAC;QAgBO;;;;mBAAa,KAAK,IAA4B,EAAE;gBACvD,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;YAC5B,CAAC;WAAC;QAtEA,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC;IAC/B,CAAC;IAqFD,MAAM,CAAC,uBAAuB,CAC5B,GAAW,EACX,IAAgB;QAEhB,MAAM,MAAM,GAAG,iBAAiB,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QAC5C,OAAO,IAAI,kBAAkB,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;IAeG,MAAM,CAAC,yBAAyB,CAClC,GAAQ;QAER,MAAM,MAAM,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC;QACxC,OAAO,IAAI,kBAAkB,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;CACF","sourcesContent":["import {\n type HDAccount,\n type HDOptions,\n type Hex,\n type LocalAccount,\n type PrivateKeyAccount,\n type SignableMessage,\n type TypedData,\n type TypedDataDefinition,\n} from \"viem\";\nimport { mnemonicToAccount, privateKeyToAccount } from \"viem/accounts\";\nimport type { SmartAccountSigner } from \"./types.js\";\n\n/**\n * Represents a local account signer and provides methods to sign messages and transactions, as well as static methods to create the signer from mnemonic or private key.\n */\nexport class LocalAccountSigner<\n T extends HDAccount | PrivateKeyAccount | LocalAccount\n> implements SmartAccountSigner<T>\n{\n inner: T;\n signerType: string;\n\n /**\n * A function to initialize an object with an inner parameter and derive a signerType from it.\n *\n * @example\n * ```ts\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { privateKeyToAccount, generatePrivateKey } from \"viem\";\n *\n * const signer = new LocalAccountSigner(\n * privateKeyToAccount(generatePrivateKey()),\n * );\n * ```\n *\n * @param {T} inner The inner parameter containing the necessary data\n */\n constructor(inner: T) {\n this.inner = inner;\n this.signerType = inner.type; // type: \"local\"\n }\n\n /**\n * Signs the provided message using the inner signMessage function.\n *\n * @example\n * ```ts\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { generatePrivateKey } from \"viem\";\n *\n * const signer = LocalAccountSigner.mnemonicToAccountSigner(generatePrivateKey());\n * const signature = await signer.signMessage(\"Hello, world!\");\n * ```\n *\n * @param {string} message The message to be signed\n * @returns {Promise<any>} A promise that resolves to the signed message\n */\n readonly signMessage: (message: SignableMessage) => Promise<`0x${string}`> = (\n message\n ) => {\n return this.inner.signMessage({ message });\n };\n\n /**\n * Signs typed data using the given parameters.\n *\n * @example\n * ```ts\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { generatePrivateKey } from \"viem\";\n *\n * const signer = LocalAccountSigner.mnemonicToAccountSigner(generatePrivateKey());\n * const signature = await signer.signTypedData({\n * domain: {},\n * types: {},\n * primaryType: \"\",\n * message: {},\n * });\n * ```\n *\n * @param {TypedDataDefinition<TTypedData, TPrimaryType>} params The parameters defining the typed data and primary type\n * @returns {Promise<Hex>} A promise that resolves to the signed data in hexadecimal format\n */\n readonly signTypedData = async <\n const TTypedData extends TypedData | { [key: string]: unknown },\n TPrimaryType extends string = string\n >(\n params: TypedDataDefinition<TTypedData, TPrimaryType>\n ): Promise<Hex> => {\n return this.inner.signTypedData(params);\n };\n\n /**\n * Returns the address of the inner object in a specific hexadecimal format.\n *\n * @example\n * ```ts\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { generatePrivateKey } from \"viem\";\n *\n * const signer = LocalAccountSigner.mnemonicToAccountSigner(generatePrivateKey());\n * const address = await signer.getAddress();\n * ```\n *\n * @returns {Promise<Hex>} A promise that resolves to the address in the format `0x{string}`\n */\n readonly getAddress = async (): Promise<`0x${string}`> => {\n return this.inner.address;\n };\n\n /**\n * Creates a LocalAccountSigner using the provided mnemonic key and optional HD options.\n *\n * @example\n * ```ts\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { generateMnemonic } from \"viem\";\n *\n * const signer = LocalAccountSigner.mnemonicToAccountSigner(generateMnemonic());\n * ```\n *\n * @param {string} key The mnemonic key to derive the account from.\n * @param {HDOptions} [opts] Optional HD options for deriving the account.\n * @returns {LocalAccountSigner<HDAccount>} A LocalAccountSigner object for the derived account.\n */\n static mnemonicToAccountSigner(\n key: string,\n opts?: HDOptions\n ): LocalAccountSigner<HDAccount> {\n const signer = mnemonicToAccount(key, opts);\n return new LocalAccountSigner(signer);\n }\n\n /**\n * Creates a `LocalAccountSigner` instance using the provided private key.\n *\n * @example\n * ```ts\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { generatePrivateKey } from \"viem\";\n *\n * const signer = LocalAccountSigner.mnemonicToAccountSigner(generatePrivateKey());\n * ```\n *\n * @param {Hex} key The private key in hexadecimal format\n * @returns {LocalAccountSigner<PrivateKeyAccount>} An instance of `LocalAccountSigner` initialized with the provided private key\n */ static privateKeyToAccountSigner(\n key: Hex\n ): LocalAccountSigner<PrivateKeyAccount> {\n const signer = privateKeyToAccount(key);\n return new LocalAccountSigner(signer);\n }\n}\n"]}
@@ -33,31 +33,31 @@ export declare class WalletClientSigner implements SmartAccountSigner<WalletClie
33
33
  [x: `bytes9[${string}]`]: undefined;
34
34
  [x: `bytes10[${string}]`]: undefined;
35
35
  [x: `bytes25[${string}]`]: undefined;
36
+ [x: `bytes31[${string}]`]: undefined;
37
+ [x: `bytes30[${string}]`]: undefined;
38
+ [x: `bytes29[${string}]`]: undefined;
39
+ [x: `bytes28[${string}]`]: undefined;
40
+ [x: `bytes27[${string}]`]: undefined;
41
+ [x: `bytes26[${string}]`]: undefined;
42
+ [x: `bytes24[${string}]`]: undefined;
43
+ [x: `bytes23[${string}]`]: undefined;
44
+ [x: `bytes22[${string}]`]: undefined;
45
+ [x: `bytes21[${string}]`]: undefined;
46
+ [x: `bytes20[${string}]`]: undefined;
47
+ [x: `bytes19[${string}]`]: undefined;
36
48
  [x: `bytes18[${string}]`]: undefined;
37
- [x: `bytes12[${string}]`]: undefined;
38
- [x: `bytes13[${string}]`]: undefined;
39
- [x: `bytes14[${string}]`]: undefined;
40
- [x: `bytes15[${string}]`]: undefined;
41
- [x: `bytes16[${string}]`]: undefined;
42
49
  [x: `bytes17[${string}]`]: undefined;
43
- [x: `bytes19[${string}]`]: undefined;
44
- [x: `bytes20[${string}]`]: undefined;
45
- [x: `bytes21[${string}]`]: undefined;
46
- [x: `bytes22[${string}]`]: undefined;
47
- [x: `bytes23[${string}]`]: undefined;
48
- [x: `bytes24[${string}]`]: undefined;
49
- [x: `bytes26[${string}]`]: undefined;
50
- [x: `bytes27[${string}]`]: undefined;
51
- [x: `bytes28[${string}]`]: undefined;
52
- [x: `bytes29[${string}]`]: undefined;
53
- [x: `bytes30[${string}]`]: undefined;
54
- [x: `bytes31[${string}]`]: undefined;
50
+ [x: `bytes16[${string}]`]: undefined;
51
+ [x: `bytes15[${string}]`]: undefined;
52
+ [x: `bytes14[${string}]`]: undefined;
53
+ [x: `bytes13[${string}]`]: undefined;
54
+ [x: `bytes12[${string}]`]: undefined;
55
55
  [x: `int[${string}]`]: undefined;
56
56
  [x: `int8[${string}]`]: undefined;
57
- [x: `int16[${string}]`]: undefined;
58
- [x: `int24[${string}]`]: undefined;
59
- [x: `int32[${string}]`]: undefined;
60
57
  [x: `int40[${string}]`]: undefined;
58
+ [x: `int32[${string}]`]: undefined;
59
+ [x: `int24[${string}]`]: undefined;
60
+ [x: `int16[${string}]`]: undefined;
61
61
  [x: `int48[${string}]`]: undefined;
62
62
  [x: `int56[${string}]`]: undefined;
63
63
  [x: `int64[${string}]`]: undefined;
@@ -86,9 +86,9 @@ export declare class WalletClientSigner implements SmartAccountSigner<WalletClie
86
86
  [x: `int248[${string}]`]: undefined;
87
87
  [x: `int256[${string}]`]: undefined;
88
88
  [x: `uint[${string}]`]: undefined;
89
- [x: `uint16[${string}]`]: undefined;
90
- [x: `uint24[${string}]`]: undefined;
91
89
  [x: `uint40[${string}]`]: undefined;
90
+ [x: `uint24[${string}]`]: undefined;
91
+ [x: `uint16[${string}]`]: undefined;
92
92
  [x: `uint56[${string}]`]: undefined;
93
93
  [x: `uint72[${string}]`]: undefined;
94
94
  [x: `uint80[${string}]`]: undefined;
@@ -135,30 +135,30 @@ export declare class WalletClientSigner implements SmartAccountSigner<WalletClie
135
135
  bytes9?: undefined;
136
136
  bytes10?: undefined;
137
137
  bytes25?: undefined;
138
+ bytes31?: undefined;
139
+ bytes30?: undefined;
140
+ bytes29?: undefined;
141
+ bytes28?: undefined;
142
+ bytes27?: undefined;
143
+ bytes26?: undefined;
144
+ bytes24?: undefined;
145
+ bytes23?: undefined;
146
+ bytes22?: undefined;
147
+ bytes21?: undefined;
148
+ bytes20?: undefined;
149
+ bytes19?: undefined;
138
150
  bytes18?: undefined;
139
- bytes12?: undefined;
140
- bytes13?: undefined;
141
- bytes14?: undefined;
142
- bytes15?: undefined;
143
- bytes16?: undefined;
144
151
  bytes17?: undefined;
145
- bytes19?: undefined;
146
- bytes20?: undefined;
147
- bytes21?: undefined;
148
- bytes22?: undefined;
149
- bytes23?: undefined;
150
- bytes24?: undefined;
151
- bytes26?: undefined;
152
- bytes27?: undefined;
153
- bytes28?: undefined;
154
- bytes29?: undefined;
155
- bytes30?: undefined;
156
- bytes31?: undefined;
152
+ bytes16?: undefined;
153
+ bytes15?: undefined;
154
+ bytes14?: undefined;
155
+ bytes13?: undefined;
156
+ bytes12?: undefined;
157
157
  int8?: undefined;
158
- int16?: undefined;
159
- int24?: undefined;
160
- int32?: undefined;
161
158
  int40?: undefined;
159
+ int32?: undefined;
160
+ int24?: undefined;
161
+ int16?: undefined;
162
162
  int48?: undefined;
163
163
  int56?: undefined;
164
164
  int64?: undefined;
@@ -186,9 +186,9 @@ export declare class WalletClientSigner implements SmartAccountSigner<WalletClie
186
186
  int240?: undefined;
187
187
  int248?: undefined;
188
188
  int256?: undefined;
189
- uint16?: undefined;
190
- uint24?: undefined;
191
189
  uint40?: undefined;
190
+ uint24?: undefined;
191
+ uint16?: undefined;
192
192
  uint56?: undefined;
193
193
  uint72?: undefined;
194
194
  uint80?: undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"wallet-client.js","sourceRoot":"","sources":["../../../src/signer/wallet-client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,GAMX,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAM7D,MAAM,OAAO,kBAAkB;IAI7B,YAAY,MAAoB,EAAE,UAAkB;QAHpD;;;;;WAAmB;QACnB;;;;;WAAoB;QAUpB;;;;mBAA2C,KAAK,IAAI,EAAE;gBACpD,IAAI,SAAS,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC;gBAChD,OAAO,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;YAClC,CAAC;WAAC;QAEO;;;;mBACP,KAAK,EAAE,OAAO,EAAE,EAAE;gBAChB,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;gBAEhE,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;YACtD,CAAC;WAAC;QAEJ;;;;mBAAgB,KAAK,EAInB,SAAwD,EAC1C,EAAE;gBAChB,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;gBAEhE,OAAO,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC;oBAC9B,OAAO;oBACP,GAAG,SAAS;iBACb,CAAC,CAAC;YACL,CAAC;WAAC;QA/BA,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC;QACpB,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,MAAM,IAAI,sBAAsB,CAAC,UAAU,CAAC,CAAC;QAC/C,CAAC;QACD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;CA2BF","sourcesContent":["import {\n getAddress,\n type Hex,\n type SignableMessage,\n type TypedData,\n type TypedDataDefinition,\n type WalletClient,\n} from \"viem\";\nimport { InvalidSignerTypeError } from \"../errors/signer.js\";\nimport type { SmartAccountSigner } from \"./types\";\n\n/**\n * Represents a wallet client signer for smart accounts, providing methods to get the address, sign messages, and sign typed data.\n */\nexport class WalletClientSigner implements SmartAccountSigner<WalletClient> {\n signerType: string;\n inner: WalletClient;\n\n constructor(client: WalletClient, signerType: string) {\n this.inner = client;\n if (!signerType) {\n throw new InvalidSignerTypeError(signerType);\n }\n this.signerType = signerType;\n }\n\n getAddress: () => Promise<`0x${string}`> = async () => {\n let addresses = await this.inner.getAddresses();\n return getAddress(addresses[0]);\n };\n\n readonly signMessage: (message: SignableMessage) => Promise<`0x${string}`> =\n async (message) => {\n const account = this.inner.account ?? (await this.getAddress());\n\n return this.inner.signMessage({ message, account });\n };\n\n signTypedData = async <\n const TTypedData extends TypedData | { [key: string]: unknown },\n TPrimaryType extends string = string\n >(\n typedData: TypedDataDefinition<TTypedData, TPrimaryType>\n ): Promise<Hex> => {\n const account = this.inner.account ?? (await this.getAddress());\n\n return this.inner.signTypedData({\n account,\n ...typedData,\n });\n };\n}\n"]}
1
+ {"version":3,"file":"wallet-client.js","sourceRoot":"","sources":["../../../src/signer/wallet-client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,GAMX,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAM7D,MAAM,OAAO,kBAAkB;IAyB7B,YAAY,MAAoB,EAAE,UAAkB;QAxBpD;;;;;WAAmB;QACnB;;;;;WAAoB;QAmDpB;;;;mBAA2C,KAAK,IAAI,EAAE;gBACpD,IAAI,SAAS,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC;gBAChD,OAAO,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;YAClC,CAAC;WAAC;QAuBO;;;;mBACP,KAAK,EAAE,OAAO,EAAE,EAAE;gBAChB,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;gBAEhE,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;YACtD,CAAC;WAAC;QA6BJ;;;;mBAAgB,KAAK,EAInB,SAAwD,EAC1C,EAAE;gBAChB,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;gBAEhE,OAAO,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC;oBAC9B,OAAO;oBACP,GAAG,SAAS;iBACb,CAAC,CAAC;YACL,CAAC;WAAC;QAnGA,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC;QACpB,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,MAAM,IAAI,sBAAsB,CAAC,UAAU,CAAC,CAAC;QAC/C,CAAC;QACD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;CA+FF","sourcesContent":["import {\n getAddress,\n type Hex,\n type SignableMessage,\n type TypedData,\n type TypedDataDefinition,\n type WalletClient,\n} from \"viem\";\nimport { InvalidSignerTypeError } from \"../errors/signer.js\";\nimport type { SmartAccountSigner } from \"./types\";\n\n/**\n * Represents a wallet client signer for smart accounts, providing methods to get the address, sign messages, and sign typed data.\n */\nexport class WalletClientSigner implements SmartAccountSigner<WalletClient> {\n signerType: string;\n inner: WalletClient;\n\n /**\n * Initializes a signer with a given wallet client and signer type.\n *\n * @example\n * ```ts\n * import { WalletClientSigner } from \"@aa-sdk/core\";\n * import { createWalletClient, custom } from 'viem'\n * import { mainnet } from 'viem/chains'\n *\n * const client = createWalletClient({\n * chain: mainnet,\n * transport: custom(window.ethereum!)\n * });\n *\n * const signer = new WalletClientSigner(client, 'wallet');\n * ```\n *\n * @param {WalletClient} client The wallet client to interact with\n * @param {string} signerType The type of signer; must be a valid signer type, otherwise an error will be thrown\n * @throws {InvalidSignerTypeError} If the signer type is invalid\n */\n constructor(client: WalletClient, signerType: string) {\n this.inner = client;\n if (!signerType) {\n throw new InvalidSignerTypeError(signerType);\n }\n this.signerType = signerType;\n }\n\n /**\n * Asynchronously retrieves addresses from the inner object and returns the first address after applying the `getAddress` function.\n *\n * @example\n * ```ts\n * import { WalletClientSigner } from \"@aa-sdk/core\";\n * import { createWalletClient, custom } from 'viem'\n * import { mainnet } from 'viem/chains'\n *\n * const client = createWalletClient({\n * chain: mainnet,\n * transport: custom(window.ethereum!)\n * });\n *\n * const signer = new WalletClientSigner(client, 'wallet');\n * console.log(await signer.getAddress());\n * ```\n *\n * @returns {Promise<string>} A promise that resolves to the first address after being processed by the `getAddress` function.\n */\n getAddress: () => Promise<`0x${string}`> = async () => {\n let addresses = await this.inner.getAddresses();\n return getAddress(addresses[0]);\n };\n\n /**\n * Signs a message using the account's signing method.\n *\n * @example\n * ```ts\n * import { WalletClientSigner } from \"@aa-sdk/core\";\n * import { createWalletClient, custom } from 'viem'\n * import { mainnet } from 'viem/chains'\n *\n * const client = createWalletClient({\n * chain: mainnet,\n * transport: custom(window.ethereum!)\n * });\n *\n * const signer = new WalletClientSigner(client, 'wallet');\n * console.log(await signer.signMessage(\"hello\"));\n * ```\n *\n * @param {string} message the message string that needs to be signed\n * @returns {Promise<string>} a promise that resolves to the signed message\n */\n readonly signMessage: (message: SignableMessage) => Promise<`0x${string}`> =\n async (message) => {\n const account = this.inner.account ?? (await this.getAddress());\n\n return this.inner.signMessage({ message, account });\n };\n\n /**\n * Signs the provided typed data using the account's private key.\n *\n * @example\n * ```ts\n * import { WalletClientSigner } from \"@aa-sdk/core\";\n * import { createWalletClient, custom } from 'viem'\n * import { mainnet } from 'viem/chains'\n *\n * const client = createWalletClient({\n * chain: mainnet,\n * transport: custom(window.ethereum!)\n * });\n *\n * const signer = new WalletClientSigner(client, 'wallet');\n * console.log(await signer.signTypedData({\n * types: {\n * \"Message\": [{ name: \"content\", type: \"string\" }]\n * },\n * primaryType: \"Message\",\n * message: { content: \"Hello\" },\n * }));\n * ```\n *\n * @param {TypedDataDefinition<TTypedData, TPrimaryType>} typedData The typed data to be signed\n * @returns {Promise<Hex>} A promise that resolves to a hex string representing the signed data\n */\n signTypedData = async <\n const TTypedData extends TypedData | { [key: string]: unknown },\n TPrimaryType extends string = string\n >(\n typedData: TypedDataDefinition<TTypedData, TPrimaryType>\n ): Promise<Hex> => {\n const account = this.inner.account ?? (await this.getAddress());\n\n return this.inner.signTypedData({\n account,\n ...typedData,\n });\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"split.js","sourceRoot":"","sources":["../../../src/transport/split.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAwC,MAAM,MAAM,CAAC;AA0CpE,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,MAA4B,EAAmB,EAAE;IACrE,MAAM,WAAW,GAAG,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QAC1D,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;YAC9B,IAAI,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,SAAS,EAAE,CAAC;gBAC9D,MAAM,IAAI,KAAK,CACb,uDAAuD,CACxD,CAAC;YACJ,CAAC;YAED,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QACpC,CAAC,CAAC,CAAC;QAEH,OAAO,KAAK,CAAC;IACf,CAAC,EAAE,IAAI,GAAG,EAAqB,CAAC,CAAC;IAEjC,OAAO,CAAC,IAAI,EAAE,EAAE,CACd,MAAM,CAAC;QACL,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;YACtB,MAAM,iBAAiB,GAAG,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACvD,IAAI,iBAAiB,IAAI,IAAI,EAAE,CAAC;gBAC9B,OAAO,iBAAiB,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAC/C,CAAC;YAED,OAAO,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC7C,CAAC;KACF,CAAC,CAAC,IAAI,CAAC,CAAC;AACb,CAAC,CAAC","sourcesContent":["import { custom, type CustomTransport, type Transport } from \"viem\";\n\nexport interface SplitTransportParams {\n overrides: {\n methods: string[];\n transport: Transport;\n }[];\n fallback: Transport;\n}\n\n/**\n * The Split Transport allows you to split RPC traffic for specific methods across\n * different RPC providers. This is done by specifying the methods you want handled\n * specially as overrides and providing a fallback transport for all other methods.\n *\n * @example\n * ```ts\n * import { createPublicClient, http } from \"viem\";\n * import { split } from \"@aa-sdk/core\";\n *\n * const bundlerMethods = [\n * \"eth_sendUserOperation\",\n * \"eth_estimateUserOperationGas\",\n * \"eth_getUserOperationReceipt\",\n * \"eth_getUserOperationByHash\",\n * \"eth_supportedEntryPoints\"\n * ];\n *\n * const clientWithSplit = createPublicClient({\n * transport: split({\n * overrides: [{\n * methods: bundlerMethods,\n * transport: http(BUNDLER_RPC_URL)\n * }]\n * fallback: http(OTHER_RPC_URL)\n * }),\n * });\n * ```\n *\n * @param params {@link SplitTransportParams} split transport configuration containing the methods overrides and fallback transport\n * @returns a {@link CustomTransport} that splits traffic\n */\nexport const split = (params: SplitTransportParams): CustomTransport => {\n const overrideMap = params.overrides.reduce((accum, curr) => {\n curr.methods.forEach((method) => {\n if (accum.has(method) && accum.get(method) !== curr.transport) {\n throw new Error(\n \"A method cannot be handled by more than one transport\"\n );\n }\n\n accum.set(method, curr.transport);\n });\n\n return accum;\n }, new Map<string, Transport>());\n\n return (opts) =>\n custom({\n request: async (args) => {\n const transportOverride = overrideMap.get(args.method);\n if (transportOverride != null) {\n return transportOverride(opts).request(args);\n }\n\n return params.fallback(opts).request(args);\n },\n })(opts);\n};\n"]}
1
+ {"version":3,"file":"split.js","sourceRoot":"","sources":["../../../src/transport/split.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAwC,MAAM,MAAM,CAAC;AA0CpE,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,MAA4B,EAAmB,EAAE;IACrE,MAAM,WAAW,GAAG,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QAC1D,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;YAC9B,IAAI,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,SAAS,EAAE,CAAC;gBAC9D,MAAM,IAAI,KAAK,CACb,uDAAuD,CACxD,CAAC;YACJ,CAAC;YAED,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QACpC,CAAC,CAAC,CAAC;QAEH,OAAO,KAAK,CAAC;IACf,CAAC,EAAE,IAAI,GAAG,EAAqB,CAAC,CAAC;IAEjC,OAAO,CAAC,IAAI,EAAE,EAAE,CACd,MAAM,CAAC;QACL,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;YACtB,MAAM,iBAAiB,GAAG,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACvD,IAAI,iBAAiB,IAAI,IAAI,EAAE,CAAC;gBAC9B,OAAO,iBAAiB,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAC/C,CAAC;YAED,OAAO,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC7C,CAAC;KACF,CAAC,CAAC,IAAI,CAAC,CAAC;AACb,CAAC,CAAC","sourcesContent":["import { custom, type CustomTransport, type Transport } from \"viem\";\n\nexport interface SplitTransportParams {\n overrides: {\n methods: string[];\n transport: Transport;\n }[];\n fallback: Transport;\n}\n\n/**\n * The Split Transport allows you to split RPC traffic for specific methods across\n * different RPC providers. This is done by specifying the methods you want handled\n * specially as overrides and providing a fallback transport for all other methods.\n *\n * @example\n * ```ts\n * import { createPublicClient, http } from \"viem\";\n * import { split } from \"@aa-sdk/core\";\n *\n * const bundlerMethods = [\n * \"eth_sendUserOperation\",\n * \"eth_estimateUserOperationGas\",\n * \"eth_getUserOperationReceipt\",\n * \"eth_getUserOperationByHash\",\n * \"eth_supportedEntryPoints\"\n * ];\n *\n * const clientWithSplit = createPublicClient({\n * transport: split({\n * overrides: [{\n * methods: bundlerMethods,\n * transport: http(BUNDLER_RPC_URL)\n * }]\n * fallback: http(OTHER_RPC_URL)\n * }),\n * });\n * ```\n *\n * @param {SplitTransportParams} params split transport configuration containing the methods overrides and fallback transport\n * @returns {CustomTransport} a viem Transport that splits traffic\n */\nexport const split = (params: SplitTransportParams): CustomTransport => {\n const overrideMap = params.overrides.reduce((accum, curr) => {\n curr.methods.forEach((method) => {\n if (accum.has(method) && accum.get(method) !== curr.transport) {\n throw new Error(\n \"A method cannot be handled by more than one transport\"\n );\n }\n\n accum.set(method, curr.transport);\n });\n\n return accum;\n }, new Map<string, Transport>());\n\n return (opts) =>\n custom({\n request: async (args) => {\n const transportOverride = overrideMap.get(args.method);\n if (transportOverride != null) {\n return transportOverride(opts).request(args);\n }\n\n return params.fallback(opts).request(args);\n },\n })(opts);\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"bigint.js","sourceRoot":"","sources":["../../../src/utils/bigint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAExC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAQ3C,MAAM,CAAC,MAAM,SAAS,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AAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC","sourcesContent":["import { keccak256, toHex } from \"viem\";\nimport type { BigNumberish, Multiplier } from \"../types\";\nimport { isMultiplier } from \"./schema.js\";\n\n/**\n * Returns the max bigint in a list of bigints\n *\n * @param args a list of bigints to get the max of\n * @returns the max bigint in the list\n */\nexport const bigIntMax = (...args: bigint[]): bigint => {\n if (!args.length) {\n throw new Error(\"bigIntMax requires at least one argument\");\n }\n\n return args.reduce((m, c) => (m > c ? m : c));\n};\n\n/**\n * Returns the min bigint in a list of bigints\n *\n * @param args a list of bigints to get the max of\n * @returns the min bigint in the list\n */\nexport const bigIntMin = (...args: bigint[]): bigint => {\n if (!args.length) {\n throw new Error(\"bigIntMin requires at least one argument\");\n }\n\n return args.reduce((m, c) => (m < c ? m : c));\n};\n\n/**\n * Given a bigint and a min-max range, returns the min-max clamped bigint value\n *\n * @param value a bigint value to clamp\n * @param lower lower bound min max tuple value\n * @param upper upper bound min max tuple value\n * @returns the clamped bigint value per given range\n */\nexport const bigIntClamp = (\n value: BigNumberish,\n lower: BigNumberish | null | undefined,\n upper: BigNumberish | null | undefined\n) => {\n lower = lower != null ? BigInt(lower) : null;\n upper = upper != null ? BigInt(upper) : null;\n\n if (upper != null && lower != null && upper < lower) {\n throw new Error(\n `invalid range: upper bound ${upper} is less than lower bound ${lower}`\n );\n }\n\n let ret = BigInt(value);\n if (lower != null && lower > ret) {\n ret = lower;\n }\n if (upper != null && upper < ret) {\n ret = upper;\n }\n return ret;\n};\n\nexport enum RoundingMode {\n ROUND_DOWN = 0,\n ROUND_UP = 1,\n}\n\n/**\n * Given a bigint and a number (which can be a float), returns the bigint value.\n * Note: this function has loss and will round down to the nearest integer.\n *\n * @param base - the number to be multiplied\n * @param multiplier - the amount to multiply by\n * @param roundingMode - the rounding mode to use when calculating the percent. defaults to ROUND_UP\n * @returns the bigint value of the multiplication with the number rounded by the rounding mode\n */\nexport const bigIntMultiply = (\n base: BigNumberish,\n multiplier: Multiplier[\"multiplier\"],\n roundingMode: RoundingMode = RoundingMode.ROUND_UP\n) => {\n if (!isMultiplier({ multiplier })) {\n throw new Error(\n \"bigIntMultiply requires a multiplier validated number as the second argument\"\n );\n }\n\n // Get decimal places of b. Max decimal places is defined by the MultiplerSchema.\n const decimalPlaces = multiplier.toString().split(\".\")[1]?.length ?? 0;\n const val =\n roundingMode === RoundingMode.ROUND_UP\n ? BigInt(base) * BigInt(multiplier * 10 ** decimalPlaces) +\n BigInt(10 ** decimalPlaces - 1)\n : BigInt(base) * BigInt(multiplier * 10 ** decimalPlaces);\n\n return val / BigInt(10 ** decimalPlaces);\n};\n\n/**\n * Useful if you want to use a string, such as a user's email address, as salt to generate a unique SmartAccount per user.\n *\n * example:\n * ```\n * const salt = stringToIndex(\"alice@example.com\");\n *\n * export const account = new SimpleSmartContractAccount({\n * index: salt,\n * // other args omitted...\n * });\n * ```\n *\n * @param phrase -- any string value.\n * @returns the bigint value of the hashed string\n */\nexport const stringToIndex = (phrase: string): bigint =>\n BigInt(keccak256(toHex(phrase)));\n"]}
1
+ {"version":3,"file":"bigint.js","sourceRoot":"","sources":["../../../src/utils/bigint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAExC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAQ3C,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,GAAG,IAAc,EAAU,EAAE;IACrD,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;IAC9D,CAAC;IAED,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAChD,CAAC,CAAC;AAQF,MAAM,CAAC,MAAM,SA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AY,KAAZ,YAAY,QAGvB;AAWD,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,IAAkB,EAClB,UAAoC,EACpC,eAA6B,YAAY,CAAC,QAAQ,EAClD,EAAE;IACF,IAAI,CAAC,YAAY,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC;QAClC,MAAM,IAAI,KAAK,CACb,8EAA8E,CAC/E,CAAC;IACJ,CAAC;IAGD,MAAM,aAAa,GAAG,UAAU,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,IAAI,CAAC,CAAC;IACvE,MAAM,GAAG,GACP,YAAY,KAAK,YAAY,CAAC,QAAQ;QACpC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,UAAU,GAAG,EAAE,IAAI,aAAa,CAAC;YACvD,MAAM,CAAC,EAAE,IAAI,aAAa,GAAG,CAAC,CAAC;QACjC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,UAAU,GAAG,EAAE,IAAI,aAAa,CAAC,CAAC;IAE9D,OAAO,GAAG,GAAG,MAAM,CAAC,EAAE,IAAI,aAAa,CAAC,CAAC;AAC3C,CAAC,CAAC;AAkBF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,MAAc,EAAU,EAAE,CACtD,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC","sourcesContent":["import { keccak256, toHex } from \"viem\";\nimport type { BigNumberish, Multiplier } from \"../types\";\nimport { isMultiplier } from \"./schema.js\";\n\n/**\n * Returns the max bigint in a list of bigints\n *\n * @param {bigint[]} args a list of bigints to get the max of\n * @returns {bigint} the max bigint in the list\n */\nexport const bigIntMax = (...args: bigint[]): bigint => {\n if (!args.length) {\n throw new Error(\"bigIntMax requires at least one argument\");\n }\n\n return args.reduce((m, c) => (m > c ? m : c));\n};\n\n/**\n * Returns the min bigint in a list of bigints\n *\n * @param {bigint[]} args a list of bigints to get the max of\n * @returns {bigint} the min bigint in the list\n */\nexport const bigIntMin = (...args: bigint[]): bigint => {\n if (!args.length) {\n throw new Error(\"bigIntMin requires at least one argument\");\n }\n\n return args.reduce((m, c) => (m < c ? m : c));\n};\n\n/**\n * Given a bigint and a min-max range, returns the min-max clamped bigint value\n *\n * @param {BigNumberish} value a bigint value to clamp\n * @param {BigNumberish | undefined} lower lower bound min max tuple value\n * @param {BigNumberish | undefined} upper upper bound min max tuple value\n * @returns {bigint} the clamped bigint value per given range\n */\nexport const bigIntClamp = (\n value: BigNumberish,\n lower: BigNumberish | null | undefined,\n upper: BigNumberish | null | undefined\n): bigint => {\n lower = lower != null ? BigInt(lower) : null;\n upper = upper != null ? BigInt(upper) : null;\n\n if (upper != null && lower != null && upper < lower) {\n throw new Error(\n `invalid range: upper bound ${upper} is less than lower bound ${lower}`\n );\n }\n\n let ret = BigInt(value);\n if (lower != null && lower > ret) {\n ret = lower;\n }\n if (upper != null && upper < ret) {\n ret = upper;\n }\n return ret;\n};\n\nexport enum RoundingMode {\n ROUND_DOWN = 0,\n ROUND_UP = 1,\n}\n\n/**\n * Given a bigint and a number (which can be a float), returns the bigint value.\n * Note: this function has loss and will round down to the nearest integer.\n *\n * @param {BigNumberish} base - the number to be multiplied\n * @param {number} multiplier - the amount to multiply by\n * @param {RoundingMode} roundingMode - the rounding mode to use when calculating the percent. defaults to ROUND_UP\n * @returns {bigint} the bigint value of the multiplication with the number rounded by the rounding mode\n */\nexport const bigIntMultiply = (\n base: BigNumberish,\n multiplier: Multiplier[\"multiplier\"],\n roundingMode: RoundingMode = RoundingMode.ROUND_UP\n) => {\n if (!isMultiplier({ multiplier })) {\n throw new Error(\n \"bigIntMultiply requires a multiplier validated number as the second argument\"\n );\n }\n\n // Get decimal places of b. Max decimal places is defined by the MultiplerSchema.\n const decimalPlaces = multiplier.toString().split(\".\")[1]?.length ?? 0;\n const val =\n roundingMode === RoundingMode.ROUND_UP\n ? BigInt(base) * BigInt(multiplier * 10 ** decimalPlaces) +\n BigInt(10 ** decimalPlaces - 1)\n : BigInt(base) * BigInt(multiplier * 10 ** decimalPlaces);\n\n return val / BigInt(10 ** decimalPlaces);\n};\n\n/**\n * Useful if you want to use a string, such as a user's email address, as salt to generate a unique SmartAccount per user.\n *\n * example:\n * ```\n * const salt = stringToIndex(\"alice@example.com\");\n *\n * export const account = new SimpleSmartContractAccount({\n * index: salt,\n * // other args omitted...\n * });\n * ```\n *\n * @param {string} phrase -- any string value.\n * @returns {bigint} the bigint value of the hashed string\n */\nexport const stringToIndex = (phrase: string): bigint =>\n BigInt(keccak256(toHex(phrase)));\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"bytes.js","sourceRoot":"","sources":["../../../src/utils/bytes.ts"],"names":[],"mappings":"AAgBA,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,KAAU,EAAE,OAAsB,EAAE,EAAO,EAAE;IACrE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;IAC/B,MAAM,KAAK,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAC5C,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAElD,OAAO,KAAK,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,CAAC;AACxC,CAAC,CAAC","sourcesContent":["import type { Hex } from \"viem\";\n\ntype TakeBytesOpts = {\n count?: number;\n offset?: number;\n};\n\n/**\n * Given a bytes string, returns a slice of the bytes\n *\n * @param bytes - the hex string representing bytes\n * @param opts - optional parameters for slicing the bytes\n * @param opts.offset - the offset in bytes to start slicing from\n * @param opts.count - the number of bytes to slice\n * @returns the sliced bytes\n */\nexport const takeBytes = (bytes: Hex, opts: TakeBytesOpts = {}): Hex => {\n const { offset, count } = opts;\n const start = (offset ? offset * 2 : 0) + 2; // add 2 to skip the 0x prefix\n const end = count ? start + count * 2 : undefined;\n\n return `0x${bytes.slice(start, end)}`;\n};\n"]}
1
+ {"version":3,"file":"bytes.js","sourceRoot":"","sources":["../../../src/utils/bytes.ts"],"names":[],"mappings":"AAgBA,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,KAAU,EAAE,OAAsB,EAAE,EAAO,EAAE;IACrE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;IAC/B,MAAM,KAAK,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAC5C,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAElD,OAAO,KAAK,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,CAAC;AACxC,CAAC,CAAC","sourcesContent":["import type { Hex } from \"viem\";\n\ntype TakeBytesOpts = {\n count?: number;\n offset?: number;\n};\n\n/**\n * Given a bytes string, returns a slice of the bytes\n *\n * @param {Hex} bytes - the hex string representing bytes\n * @param {TakeBytesOpts} opts - optional parameters for slicing the bytes\n * @param {number} opts.offset - the offset in bytes to start slicing from\n * @param {number} opts.count - the number of bytes to slice\n * @returns {Hex} the sliced bytes\n */\nexport const takeBytes = (bytes: Hex, opts: TakeBytesOpts = {}): Hex => {\n const { offset, count } = opts;\n const start = (offset ? offset * 2 : 0) + 2; // add 2 to skip the 0x prefix\n const end = count ? start + count * 2 : undefined;\n\n return `0x${bytes.slice(start, end)}`;\n};\n"]}
@@ -1,6 +1,4 @@
1
- import { type Address, type Chain } from "viem";
2
- import type { EntryPointVersion } from "../entrypoint/types.js";
3
- import type { UserOperationFeeOptions } from "../types";
4
- export declare const getDefaultSimpleAccountFactoryAddress: (chain: Chain, version?: EntryPointVersion) => Address;
1
+ import { type Chain } from "viem";
2
+ import type { UserOperationFeeOptions } from "../types.js";
5
3
  export declare const minPriorityFeePerBidDefaults: Map<number, bigint>;
6
4
  export declare const getDefaultUserOperationFeeOptions: (chain: Chain) => UserOperationFeeOptions;
@@ -1,44 +1,5 @@
1
1
  import {} from "viem";
2
- import { arbitrum, arbitrumGoerli, arbitrumSepolia, base, baseGoerli, baseSepolia, fraxtal, fraxtalSepolia, goerli, mainnet, optimism, optimismGoerli, optimismSepolia, polygon, polygonAmoy, polygonMumbai, sepolia, zora, zoraSepolia, } from "../chains/index.js";
3
- import { defaultEntryPointVersion } from "../entrypoint/index.js";
4
- import { DefaultFactoryNotDefinedError } from "../errors/account.js";
5
- export const getDefaultSimpleAccountFactoryAddress = (chain, version = defaultEntryPointVersion) => {
6
- switch (version) {
7
- case "0.6.0":
8
- switch (chain.id) {
9
- case mainnet.id:
10
- case polygon.id:
11
- case polygonAmoy.id:
12
- case optimism.id:
13
- case optimismSepolia.id:
14
- case arbitrum.id:
15
- case arbitrumSepolia.id:
16
- case base.id:
17
- case baseGoerli.id:
18
- case baseSepolia.id:
19
- case fraxtal.id:
20
- case fraxtalSepolia.id:
21
- case zora.id:
22
- case zoraSepolia.id:
23
- return "0x15Ba39375ee2Ab563E8873C8390be6f2E2F50232";
24
- case sepolia.id:
25
- case goerli.id:
26
- case polygonMumbai.id:
27
- case optimismGoerli.id:
28
- case arbitrumGoerli.id:
29
- return "0x9406Cc6185a346906296840746125a0E44976454";
30
- default:
31
- break;
32
- }
33
- break;
34
- case "0.7.0":
35
- switch (chain.id) {
36
- default:
37
- return "0x91E60e0613810449d098b0b5Ec8b51A0FE8c8985";
38
- }
39
- }
40
- throw new DefaultFactoryNotDefinedError("SimpleAccount", chain, version);
41
- };
2
+ import { arbitrum, arbitrumGoerli, arbitrumSepolia } from "viem/chains";
42
3
  export const minPriorityFeePerBidDefaults = new Map([
43
4
  [arbitrum.id, 10000000n],
44
5
  [arbitrumGoerli.id, 10000000n],
@@ -1 +1 @@
1
- {"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../../src/utils/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,MAAM,MAAM,CAAC;AAChD,OAAO,EACL,QAAQ,EACR,cAAc,EACd,eAAe,EACf,IAAI,EACJ,UAAU,EACV,WAAW,EACX,OAAO,EACP,cAAc,EACd,MAAM,EACN,OAAO,EACP,QAAQ,EACR,cAAc,EACd,eAAe,EACf,OAAO,EACP,WAAW,EACX,aAAa,EACb,OAAO,EACP,IAAI,EACJ,WAAW,GACZ,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAElE,OAAO,EAAE,6BAA6B,EAAE,MAAM,sBAAsB,CAAC;AAWrE,MAAM,CAAC,MAAM,qCAAqC,GAAG,CACnD,KAAY,EACZ,UAA6B,wBAAwB,EAC5C,EAAE;IACX,QAAQ,OAAO,EAAE,CAAC;QAChB,KAAK,OAAO;YACV,QAAQ,KAAK,CAAC,EAAE,EAAE,CAAC;gBACjB,KAAK,OAAO,CAAC,EAAE,CAAC;gBAChB,KAAK,OAAO,CAAC,EAAE,CAAC;gBAChB,KAAK,WAAW,CAAC,EAAE,CAAC;gBACpB,KAAK,QAAQ,CAAC,EAAE,CAAC;gBACjB,KAAK,eAAe,CAAC,EAAE,CAAC;gBACxB,KAAK,QAAQ,CAAC,EAAE,CAAC;gBACjB,KAAK,eAAe,CAAC,EAAE,CAAC;gBACxB,KAAK,IAAI,CAAC,EAAE,CAAC;gBACb,KAAK,UAAU,CAAC,EAAE,CAAC;gBACnB,KAAK,WAAW,CAAC,EAAE,CAAC;gBACpB,KAAK,OAAO,CAAC,EAAE,CAAC;gBAChB,KAAK,cAAc,CAAC,EAAE,CAAC;gBACvB,KAAK,IAAI,CAAC,EAAE,CAAC;gBACb,KAAK,WAAW,CAAC,EAAE;oBACjB,OAAO,4CAA4C,CAAC;gBACtD,KAAK,OAAO,CAAC,EAAE,CAAC;gBAChB,KAAK,MAAM,CAAC,EAAE,CAAC;gBACf,KAAK,aAAa,CAAC,EAAE,CAAC;gBACtB,KAAK,cAAc,CAAC,EAAE,CAAC;gBACvB,KAAK,cAAc,CAAC,EAAE;oBACpB,OAAO,4CAA4C,CAAC;gBACtD;oBACE,MAAM;YACV,CAAC;YACD,MAAM;QACR,KAAK,OAAO;YACV,QAAQ,KAAK,CAAC,EAAE,EAAE,CAAC;gBACjB;oBACE,OAAO,4CAA4C,CAAC;YACxD,CAAC;IACL,CAAC;IAED,MAAM,IAAI,6BAA6B,CAAC,eAAe,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;AAC3E,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,4BAA4B,GAAG,IAAI,GAAG,CAAiB;IAClE,CAAC,QAAQ,CAAC,EAAE,EAAE,SAAW,CAAC;IAC1B,CAAC,cAAc,CAAC,EAAE,EAAE,SAAW,CAAC;IAChC,CAAC,eAAe,CAAC,EAAE,EAAE,SAAW,CAAC;CAClC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAC/C,KAAY,EACa,EAAE;IAC3B,OAAO;QACL,oBAAoB,EAAE;YACpB,GAAG,EAAE,4BAA4B,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,UAAY;YAC/D,UAAU,EAAE,IAAI;SACjB;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { type Address, type Chain } from \"viem\";\nimport {\n arbitrum,\n arbitrumGoerli,\n arbitrumSepolia,\n base,\n baseGoerli,\n baseSepolia,\n fraxtal,\n fraxtalSepolia,\n goerli,\n mainnet,\n optimism,\n optimismGoerli,\n optimismSepolia,\n polygon,\n polygonAmoy,\n polygonMumbai,\n sepolia,\n zora,\n zoraSepolia,\n} from \"../chains/index.js\";\nimport { defaultEntryPointVersion } from \"../entrypoint/index.js\";\nimport type { EntryPointVersion } from \"../entrypoint/types.js\";\nimport { DefaultFactoryNotDefinedError } from \"../errors/account.js\";\nimport type { UserOperationFeeOptions } from \"../types\";\n\n/**\n * Utility method returning the default simple account factory address given a {@link Chain} object\n *\n * @param chain - a {@link Chain} object\n * @param version - {@link EntryPointVersion} value that defaults to `defaultEntryPointVersion`\n * @returns a {@link abi.Address} for the given chain\n * @throws if the chain doesn't have an address currently deployed\n */\nexport const getDefaultSimpleAccountFactoryAddress = (\n chain: Chain,\n version: EntryPointVersion = defaultEntryPointVersion\n): Address => {\n switch (version) {\n case \"0.6.0\":\n switch (chain.id) {\n case mainnet.id:\n case polygon.id:\n case polygonAmoy.id:\n case optimism.id:\n case optimismSepolia.id:\n case arbitrum.id:\n case arbitrumSepolia.id:\n case base.id:\n case baseGoerli.id:\n case baseSepolia.id:\n case fraxtal.id:\n case fraxtalSepolia.id:\n case zora.id:\n case zoraSepolia.id:\n return \"0x15Ba39375ee2Ab563E8873C8390be6f2E2F50232\";\n case sepolia.id:\n case goerli.id:\n case polygonMumbai.id:\n case optimismGoerli.id:\n case arbitrumGoerli.id:\n return \"0x9406Cc6185a346906296840746125a0E44976454\";\n default:\n break;\n }\n break;\n case \"0.7.0\":\n switch (chain.id) {\n default:\n return \"0x91E60e0613810449d098b0b5Ec8b51A0FE8c8985\";\n }\n }\n\n throw new DefaultFactoryNotDefinedError(\"SimpleAccount\", chain, version);\n};\n\nexport const minPriorityFeePerBidDefaults = new Map<number, bigint>([\n [arbitrum.id, 10_000_000n],\n [arbitrumGoerli.id, 10_000_000n],\n [arbitrumSepolia.id, 10_000_000n],\n]);\n\nexport const getDefaultUserOperationFeeOptions = (\n chain: Chain\n): UserOperationFeeOptions => {\n return {\n maxPriorityFeePerGas: {\n min: minPriorityFeePerBidDefaults.get(chain.id) ?? 100_000_000n,\n multiplier: 1.33,\n },\n };\n};\n"]}
1
+ {"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../../src/utils/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,MAAM,MAAM,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAGxE,MAAM,CAAC,MAAM,4BAA4B,GAAG,IAAI,GAAG,CAAiB;IAClE,CAAC,QAAQ,CAAC,EAAE,EAAE,SAAW,CAAC;IAC1B,CAAC,cAAc,CAAC,EAAE,EAAE,SAAW,CAAC;IAChC,CAAC,eAAe,CAAC,EAAE,EAAE,SAAW,CAAC;CAClC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAC/C,KAAY,EACa,EAAE;IAC3B,OAAO;QACL,oBAAoB,EAAE;YACpB,GAAG,EAAE,4BAA4B,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,UAAY;YAC/D,UAAU,EAAE,IAAI;SACjB;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { type Chain } from \"viem\";\nimport { arbitrum, arbitrumGoerli, arbitrumSepolia } from \"viem/chains\";\nimport type { UserOperationFeeOptions } from \"../types.js\";\n\nexport const minPriorityFeePerBidDefaults = new Map<number, bigint>([\n [arbitrum.id, 10_000_000n],\n [arbitrumGoerli.id, 10_000_000n],\n [arbitrumSepolia.id, 10_000_000n],\n]);\n\nexport const getDefaultUserOperationFeeOptions = (\n chain: Chain\n): UserOperationFeeOptions => {\n return {\n maxPriorityFeePerGas: {\n min: minPriorityFeePerBidDefaults.get(chain.id) ?? 100_000_000n,\n multiplier: 1.33,\n },\n };\n};\n"]}
@@ -1,8 +1,5 @@
1
- import type { Chain } from "viem";
2
1
  import type { PromiseOrValue } from "../types.js";
3
2
  import type { RecordableKeys } from "./types.js";
4
- export declare const AlchemyChainMap: Map<number, Chain>;
5
- export declare const getChain: (chainId: number) => Chain;
6
3
  export declare const asyncPipe: <S, O, F>(...fns: ((s: S, o?: O | undefined, f?: F | undefined) => Promise<S>)[]) => (s: S, o?: O | undefined, f?: F | undefined) => Promise<S>;
7
4
  export type Deferrable<T> = {
8
5
  [K in keyof T]: PromiseOrValue<T[K]>;
@@ -1,15 +1,4 @@
1
1
  import { toHex } from "viem";
2
- import * as chains from "viem/chains";
3
- import * as alchemyChains from "../chains/index.js";
4
- export const AlchemyChainMap = new Map(Object.values(alchemyChains).map((c) => [c.id, c]));
5
- export const getChain = (chainId) => {
6
- for (const chain of Object.values(chains)) {
7
- if (chain.id === chainId) {
8
- return AlchemyChainMap.get(chain.id) ?? chain;
9
- }
10
- }
11
- throw new Error("could not find chain");
12
- };
13
2
  export const asyncPipe = (...fns) => async (s, o, f) => {
14
3
  let result = s;
15
4
  for (const fn of fns) {