@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
@@ -18,7 +18,6 @@ import { ChainNotFoundError } from "../errors/client.js";
18
18
  import { middlewareActions } from "../middleware/actions.js";
19
19
  import type { ClientMiddleware } from "../middleware/types.js";
20
20
  import type { Prettify } from "../utils/index.js";
21
- import { ADD_BREADCRUMB } from "./addBreadcrumb.js";
22
21
  import { createBundlerClient, type BundlerClient } from "./bundlerClient.js";
23
22
  import {
24
23
  type BundlerActions,
@@ -30,6 +29,7 @@ import {
30
29
  } from "./decorators/smartAccountClient.js";
31
30
  import { SmartAccountClientOptsSchema } from "./schema.js";
32
31
  import type { ClientMiddlewareConfig } from "./types.js";
32
+ import { ADD_BREADCRUMB } from "./addBreadcrumb.js";
33
33
 
34
34
  type SmartAccountClientOpts = z.output<typeof SmartAccountClientOptsSchema>;
35
35
 
@@ -41,7 +41,7 @@ export type SmartAccountClientConfig<
41
41
  | undefined,
42
42
  context extends UserOperationContext | undefined =
43
43
  | UserOperationContext
44
- | undefined
44
+ | undefined,
45
45
  > = Prettify<
46
46
  Pick<
47
47
  ClientConfig<transport, chain, account>,
@@ -69,7 +69,7 @@ export type SmartAccountClientConfig<
69
69
 
70
70
  export type SmartAccountClientRpcSchema = [
71
71
  ...BundlerRpcSchema,
72
- ...PublicRpcSchema
72
+ ...PublicRpcSchema,
73
73
  ];
74
74
 
75
75
  // [!region SmartAccountClientActions]
@@ -80,7 +80,7 @@ export type SmartAccountClientActions<
80
80
  | undefined,
81
81
  context extends UserOperationContext | undefined =
82
82
  | UserOperationContext
83
- | undefined
83
+ | undefined,
84
84
  > = BaseSmartAccountClientActions<chain, account, context> &
85
85
  BundlerActions &
86
86
  PublicActions;
@@ -97,7 +97,7 @@ export type SmartAccountClient<
97
97
  rpcSchema extends RpcSchema = SmartAccountClientRpcSchema,
98
98
  context extends UserOperationContext | undefined =
99
99
  | UserOperationContext
100
- | undefined
100
+ | undefined,
101
101
  > = Prettify<
102
102
  Client<
103
103
  transport,
@@ -117,7 +117,7 @@ export type BaseSmartAccountClient<
117
117
  | undefined,
118
118
  context extends UserOperationContext | undefined =
119
119
  | UserOperationContext
120
- | undefined
120
+ | undefined,
121
121
  > = Prettify<
122
122
  Client<
123
123
  transport,
@@ -140,9 +140,9 @@ export function createSmartAccountClient<
140
140
  | undefined,
141
141
  TContext extends UserOperationContext | undefined =
142
142
  | UserOperationContext
143
- | undefined
143
+ | undefined,
144
144
  >(
145
- config: SmartAccountClientConfig<TTransport, TChain, TAccount, TContext>
145
+ config: SmartAccountClientConfig<TTransport, TChain, TAccount, TContext>,
146
146
  ): SmartAccountClient<TTransport, TChain, TAccount>;
147
147
 
148
148
  /**
@@ -166,7 +166,7 @@ export function createSmartAccountClient<
166
166
  * @returns {SmartAccountClient} A smart account client capable of handling transactions, message signing, and other operations on a smart account
167
167
  */
168
168
  export function createSmartAccountClient(
169
- config: SmartAccountClientConfig
169
+ config: SmartAccountClientConfig,
170
170
  ): SmartAccountClient {
171
171
  const {
172
172
  key = "account",
@@ -189,106 +189,100 @@ export function createSmartAccountClient(
189
189
  transport: (opts) => {
190
190
  const rpcTransport = transport(opts);
191
191
 
192
- return custom(
193
- {
194
- name: "SmartAccountClientTransport",
195
- async request({ method, params }) {
196
- switch (method) {
197
- case "eth_accounts": {
198
- if (!client.account) {
199
- throw new AccountNotFoundError();
200
- }
192
+ return custom({
193
+ name: "SmartAccountClientTransport",
194
+ async request({ method, params }) {
195
+ switch (method) {
196
+ case "eth_accounts": {
197
+ if (!client.account) {
198
+ throw new AccountNotFoundError();
199
+ }
201
200
 
202
- return [client.account.address];
201
+ return [client.account.address];
202
+ }
203
+ case "eth_sendTransaction":
204
+ if (!client.account) {
205
+ throw new AccountNotFoundError();
203
206
  }
204
- case "eth_sendTransaction":
205
- if (!client.account) {
206
- throw new AccountNotFoundError();
207
- }
208
- if (!client.chain) {
209
- throw new ChainNotFoundError();
210
- }
211
- const [tx] = params as [FormattedTransactionRequest];
212
- return client.sendTransaction({
213
- ...tx,
214
- account: client.account,
215
- chain: client.chain,
216
- });
217
- case "eth_sign":
218
- if (!client.account) {
219
- throw new AccountNotFoundError();
220
- }
221
- const [address, data] = params!;
222
- if (
223
- address?.toLowerCase() !==
224
- client.account.address.toLowerCase()
225
- ) {
226
- throw new Error(
227
- "cannot sign for address that is not the current account"
228
- );
229
- }
230
- return client.signMessage({
231
- message: data,
232
- account: client.account,
233
- });
234
- case "personal_sign": {
235
- if (!client.account) {
236
- throw new AccountNotFoundError();
237
- }
238
- const [data, address] = params!;
239
- if (
240
- address?.toLowerCase() !==
241
- client.account.address.toLowerCase()
242
- ) {
243
- throw new Error(
244
- "cannot sign for address that is not the current account"
245
- );
246
- }
247
- return client.signMessage({
248
- message: data,
207
+ if (!client.chain) {
208
+ throw new ChainNotFoundError();
209
+ }
210
+ const [tx] = params as [FormattedTransactionRequest];
211
+ return client.sendTransaction({
212
+ ...tx,
213
+ account: client.account,
214
+ chain: client.chain,
215
+ });
216
+ case "eth_sign":
217
+ if (!client.account) {
218
+ throw new AccountNotFoundError();
219
+ }
220
+ const [address, data] = params!;
221
+ if (
222
+ address?.toLowerCase() !== client.account.address.toLowerCase()
223
+ ) {
224
+ throw new Error(
225
+ "cannot sign for address that is not the current account",
226
+ );
227
+ }
228
+ return client.signMessage({
229
+ message: data,
230
+ account: client.account,
231
+ });
232
+ case "personal_sign": {
233
+ if (!client.account) {
234
+ throw new AccountNotFoundError();
235
+ }
236
+ const [data, address] = params!;
237
+ if (
238
+ address?.toLowerCase() !== client.account.address.toLowerCase()
239
+ ) {
240
+ throw new Error(
241
+ "cannot sign for address that is not the current account",
242
+ );
243
+ }
244
+ return client.signMessage({
245
+ message: data,
246
+ account: client.account,
247
+ });
248
+ }
249
+ case "eth_signTypedData_v4": {
250
+ if (!client.account) {
251
+ throw new AccountNotFoundError();
252
+ }
253
+ const [address, dataParams] = params!;
254
+ if (
255
+ address?.toLowerCase() !== client.account.address.toLowerCase()
256
+ ) {
257
+ throw new Error(
258
+ "cannot sign for address that is not the current account",
259
+ );
260
+ }
261
+ try {
262
+ return client.signTypedData({
249
263
  account: client.account,
264
+ typedData:
265
+ typeof dataParams === "string"
266
+ ? JSON.parse(dataParams)
267
+ : dataParams,
250
268
  });
269
+ } catch {
270
+ throw new Error("invalid JSON data params");
251
271
  }
252
- case "eth_signTypedData_v4": {
253
- if (!client.account) {
254
- throw new AccountNotFoundError();
255
- }
256
- const [address, dataParams] = params!;
257
- if (
258
- address?.toLowerCase() !==
259
- client.account.address.toLowerCase()
260
- ) {
261
- throw new Error(
262
- "cannot sign for address that is not the current account"
263
- );
264
- }
265
- try {
266
- return client.signTypedData({
267
- account: client.account,
268
- typedData:
269
- typeof dataParams === "string"
270
- ? JSON.parse(dataParams)
271
- : dataParams,
272
- });
273
- } catch {
274
- throw new Error("invalid JSON data params");
275
- }
272
+ }
273
+ case "eth_chainId":
274
+ if (!opts.chain) {
275
+ throw new ChainNotFoundError();
276
276
  }
277
- case "eth_chainId":
278
- if (!opts.chain) {
279
- throw new ChainNotFoundError();
280
- }
281
277
 
282
- return opts.chain.id;
283
- default:
284
- // TODO: there's probably a number of methods we just don't support, will need to test most of them out
285
- // first let's get something working though
286
- return rpcTransport.request({ method, params });
287
- }
288
- },
278
+ return opts.chain.id;
279
+ default:
280
+ // TODO: there's probably a number of methods we just don't support, will need to test most of them out
281
+ // first let's get something working though
282
+ return rpcTransport.request({ method, params });
283
+ }
289
284
  },
290
- { retryCount: 0 }
291
- )(opts);
285
+ })(opts);
292
286
  },
293
287
  })
294
288
  .extend(() => {
@@ -323,12 +317,12 @@ export function createSmartAccountClientFromExisting<
323
317
  TRpcSchema extends SmartAccountClientRpcSchema = SmartAccountClientRpcSchema,
324
318
  TContext extends UserOperationContext | undefined =
325
319
  | UserOperationContext
326
- | undefined
320
+ | undefined,
327
321
  >(
328
322
  config: Omit<
329
323
  SmartAccountClientConfig<Transport, TChain, TAccount, TContext>,
330
324
  "transport" | "chain"
331
- > & { client: TClient }
325
+ > & { client: TClient },
332
326
  ): SmartAccountClient<
333
327
  CustomTransport,
334
328
  TChain,
@@ -362,7 +356,7 @@ export function createSmartAccountClientFromExisting<
362
356
  export function createSmartAccountClientFromExisting(
363
357
  config: Omit<SmartAccountClientConfig, "transport" | "chain"> & {
364
358
  client: BundlerClient;
365
- }
359
+ },
366
360
  ): SmartAccountClient {
367
361
  return createSmartAccountClient({
368
362
  ...config,
@@ -15,7 +15,7 @@ export type ConnectionConfig = z.input<typeof ConnectionConfigSchema>;
15
15
 
16
16
  // [!region SendUserOperationResult]
17
17
  export type SendUserOperationResult<
18
- TEntryPointVersion extends EntryPointVersion = EntryPointVersion
18
+ TEntryPointVersion extends EntryPointVersion = EntryPointVersion,
19
19
  > = {
20
20
  hash: Hash;
21
21
  request: UserOperationRequest<TEntryPointVersion>;
@@ -33,6 +33,6 @@ export type UpgradeToData = {
33
33
  export type ClientMiddlewareConfig<
34
34
  TContext extends UserOperationContext | undefined =
35
35
  | UserOperationContext
36
- | undefined
36
+ | undefined,
37
37
  > = Partial<ClientMiddleware<TContext>>;
38
38
  // [!endregion ClientMiddlewareConfig]
package/src/ens/utils.ts CHANGED
@@ -2,7 +2,7 @@ import * as chains from "viem/chains";
2
2
  import { mainnet, type Chain } from "viem/chains";
3
3
 
4
4
  export const ChainsById: Map<number, chains.Chain> = new Map(
5
- Object.values(chains).map((x) => [x.id, x])
5
+ Object.values(chains).map((x) => [x.id, x]),
6
6
  );
7
7
 
8
8
  /**
@@ -40,7 +40,7 @@ const packUserOperation = (request: UserOperationRequest<"0.6.0">): Hex => {
40
40
  hexToBigInt(request.maxFeePerGas),
41
41
  hexToBigInt(request.maxPriorityFeePerGas),
42
42
  hashedPaymasterAndData,
43
- ]
43
+ ],
44
44
  );
45
45
  };
46
46
 
@@ -56,7 +56,7 @@ export default {
56
56
  getUserOperationHash: (
57
57
  request: UserOperationRequest<"0.6.0">,
58
58
  entryPointAddress: Address,
59
- chainId: number
59
+ chainId: number,
60
60
  ): Hash => {
61
61
  const encoded = encodeAbiParameters(
62
62
  [{ type: "bytes32" }, { type: "address" }, { type: "uint256" }],
@@ -64,7 +64,7 @@ export default {
64
64
  keccak256(packUserOperation(request)),
65
65
  entryPointAddress,
66
66
  BigInt(chainId),
67
- ]
67
+ ],
68
68
  );
69
69
 
70
70
  return keccak256(encoded);
@@ -62,7 +62,7 @@ const packUserOperation = (request: UserOperationRequest<"0.7.0">): Hex => {
62
62
  hexToBigInt(request.preVerificationGas),
63
63
  gasFees,
64
64
  keccak256(paymasterAndData),
65
- ]
65
+ ],
66
66
  );
67
67
  };
68
68
 
@@ -78,7 +78,7 @@ export default {
78
78
  getUserOperationHash: (
79
79
  request: UserOperationRequest<"0.7.0">,
80
80
  entryPointAddress: Address,
81
- chainId: number
81
+ chainId: number,
82
82
  ): Hash => {
83
83
  const encoded = encodeAbiParameters(
84
84
  [{ type: "bytes32" }, { type: "address" }, { type: "uint256" }],
@@ -86,7 +86,7 @@ export default {
86
86
  keccak256(packUserOperation(request)),
87
87
  entryPointAddress,
88
88
  BigInt(chainId),
89
- ]
89
+ ],
90
90
  );
91
91
 
92
92
  return keccak256(encoded);
@@ -98,7 +98,7 @@ export default {
98
98
  export function packAccountGasLimits(
99
99
  data:
100
100
  | Pick<UserOperationRequest_v7, "verificationGasLimit" | "callGasLimit">
101
- | Pick<UserOperationRequest_v7, "maxPriorityFeePerGas" | "maxFeePerGas">
101
+ | Pick<UserOperationRequest_v7, "maxPriorityFeePerGas" | "maxFeePerGas">,
102
102
  ): Hex {
103
103
  return concat(Object.values(data).map((v) => pad(v, { size: 16 })));
104
104
  }
@@ -32,30 +32,31 @@ export const entryPointRegistry: EntryPointRegistry = {
32
32
  * @returns {boolean} true if the value is a valid key of EntryPointRegistry, false otherwise
33
33
  */
34
34
  export const isEntryPointVersion = (
35
- value: any
35
+ value: any,
36
36
  ): value is keyof EntryPointRegistry => {
37
37
  return Object.keys(entryPointRegistry).includes(value);
38
38
  };
39
39
 
40
40
  export function getEntryPoint<
41
41
  TEntryPointVersion extends EntryPointVersion = DefaultEntryPointVersion,
42
- TChain extends Chain = Chain
42
+ TChain extends Chain = Chain,
43
43
  >(
44
44
  chain: TChain,
45
- options: GetEntryPointOptions<TEntryPointVersion>
45
+ options: GetEntryPointOptions<TEntryPointVersion>,
46
46
  ): EntryPointDefRegistry<TChain>[TEntryPointVersion];
47
47
 
48
48
  export function getEntryPoint<
49
- TEntryPointVersion extends DefaultEntryPointVersion = DefaultEntryPointVersion,
50
- TChain extends Chain = Chain
49
+ TEntryPointVersion extends
50
+ DefaultEntryPointVersion = DefaultEntryPointVersion,
51
+ TChain extends Chain = Chain,
51
52
  >(
52
53
  chain: TChain,
53
- options?: GetEntryPointOptions<TEntryPointVersion>
54
+ options?: GetEntryPointOptions<TEntryPointVersion>,
54
55
  ): EntryPointDefRegistry<TChain>[TEntryPointVersion];
55
56
 
56
57
  export function getEntryPoint<TChain extends Chain = Chain>(
57
58
  chain: TChain,
58
- options?: GetEntryPointOptions<DefaultEntryPointVersion>
59
+ options?: GetEntryPointOptions<DefaultEntryPointVersion>,
59
60
  ): EntryPointDefRegistry<TChain>[DefaultEntryPointVersion];
60
61
 
61
62
  /**
@@ -76,10 +77,10 @@ export function getEntryPoint<TChain extends Chain = Chain>(
76
77
  */
77
78
  export function getEntryPoint<
78
79
  TEntryPointVersion extends EntryPointVersion,
79
- TChain extends Chain = Chain
80
+ TChain extends Chain = Chain,
80
81
  >(
81
82
  chain: TChain,
82
- options: GetEntryPointOptions<TEntryPointVersion>
83
+ options: GetEntryPointOptions<TEntryPointVersion>,
83
84
  ): EntryPointDefRegistry<TChain>[EntryPointVersion] {
84
85
  const { version = defaultEntryPointVersion, addressOverride } = options ?? {
85
86
  version: defaultEntryPointVersion,
@@ -23,7 +23,7 @@ export type DefaultEntryPointVersion = OneOf<"0.6.0", EntryPointVersion>;
23
23
  export type SupportedEntryPoint<
24
24
  TEntryPointVersion extends EntryPointVersion = EntryPointVersion,
25
25
  TChain extends Chain = Chain,
26
- TAbi extends Abi | readonly unknown[] = Abi
26
+ TAbi extends Abi | readonly unknown[] = Abi,
27
27
  > = {
28
28
  version: TEntryPointVersion;
29
29
  address: Record<TChain["id"] | "default", Address>;
@@ -40,7 +40,7 @@ export type SupportedEntryPoint<
40
40
  getUserOperationHash: (
41
41
  request: UserOperationRequest<TEntryPointVersion>,
42
42
  entryPointAddress: Address,
43
- chainId: number
43
+ chainId: number,
44
44
  ) => Hash;
45
45
 
46
46
  /**
@@ -53,7 +53,7 @@ export type SupportedEntryPoint<
53
53
  * @returns the hash of the UserOperation
54
54
  */
55
55
  packUserOperation: (
56
- userOperation: UserOperationRequest<TEntryPointVersion>
56
+ userOperation: UserOperationRequest<TEntryPointVersion>,
57
57
  ) => Hex;
58
58
  };
59
59
 
@@ -69,17 +69,17 @@ export interface EntryPointRegistry<TChain extends Chain = Chain>
69
69
  export type EntryPointDef<
70
70
  TEntryPointVersion extends EntryPointVersion = EntryPointVersion,
71
71
  TChain extends Chain = Chain,
72
- TAbi extends Abi | readonly unknown[] = Abi
72
+ TAbi extends Abi | readonly unknown[] = Abi,
73
73
  > = {
74
74
  version: TEntryPointVersion;
75
75
  address: Address;
76
76
  chain: TChain;
77
77
  abi: GetContractParameters<Transport, TChain, Account, TAbi>["abi"];
78
78
  getUserOperationHash: (
79
- request: UserOperationRequest<TEntryPointVersion>
79
+ request: UserOperationRequest<TEntryPointVersion>,
80
80
  ) => Hex;
81
81
  packUserOperation: (
82
- userOperation: UserOperationRequest<TEntryPointVersion>
82
+ userOperation: UserOperationRequest<TEntryPointVersion>,
83
83
  ) => Hex;
84
84
  };
85
85
  // [!endregion EntryPointDef]
@@ -93,28 +93,30 @@ export interface EntryPointDefRegistry<TChain extends Chain = Chain>
93
93
  }
94
94
 
95
95
  export type GetEntryPointOptions<
96
- TEntryPointVersion extends EntryPointVersion = DefaultEntryPointVersion
97
- > = EQ<TEntryPointVersion, DefaultEntryPointVersion> extends true
98
- ?
99
- | {
100
- addressOverride?: Address;
101
- version?: OneOf<TEntryPointVersion, EntryPointVersion>;
102
- }
103
- | undefined
104
- : {
105
- addressOverride?: Address;
106
- version: OneOf<TEntryPointVersion, EntryPointVersion>;
107
- };
96
+ TEntryPointVersion extends EntryPointVersion = DefaultEntryPointVersion,
97
+ > =
98
+ EQ<TEntryPointVersion, DefaultEntryPointVersion> extends true
99
+ ?
100
+ | {
101
+ addressOverride?: Address;
102
+ version?: OneOf<TEntryPointVersion, EntryPointVersion>;
103
+ }
104
+ | undefined
105
+ : {
106
+ addressOverride?: Address;
107
+ version: OneOf<TEntryPointVersion, EntryPointVersion>;
108
+ };
108
109
 
109
110
  export type EntryPointParameter<
110
111
  TEntryPointVersion extends EntryPointVersion,
111
- TChain extends Chain = Chain
112
- > = EQ<TEntryPointVersion, DefaultEntryPointVersion> extends true
113
- ? {
114
- entryPoint?: EntryPointDef<TEntryPointVersion, TChain>;
115
- }
116
- : {
117
- entryPoint: IsOneOf<TEntryPointVersion, EntryPointVersion> extends true
118
- ? EntryPointDef<TEntryPointVersion, TChain>
119
- : never;
120
- };
112
+ TChain extends Chain = Chain,
113
+ > =
114
+ EQ<TEntryPointVersion, DefaultEntryPointVersion> extends true
115
+ ? {
116
+ entryPoint?: EntryPointDef<TEntryPointVersion, TChain>;
117
+ }
118
+ : {
119
+ entryPoint: IsOneOf<TEntryPointVersion, EntryPointVersion> extends true
120
+ ? EntryPointDef<TEntryPointVersion, TChain>
121
+ : never;
122
+ };
@@ -36,7 +36,7 @@ export class DefaultFactoryNotDefinedError extends BaseError {
36
36
  [
37
37
  `No default factory for ${accountType} found on chain ${chain.name} for entrypoint version ${version}`,
38
38
  "Supply an override via the `factoryAddress` parameter when creating an account",
39
- ].join("\n")
39
+ ].join("\n"),
40
40
  );
41
41
  }
42
42
  }
@@ -19,7 +19,7 @@ export class IncompatibleClientError extends BaseError {
19
19
  [
20
20
  `Client of type (${client.type}) is not a ${expectedClient}.`,
21
21
  `Create one with \`createSmartAccountClient\` first before using \`${method}\``,
22
- ].join("\n")
22
+ ].join("\n"),
23
23
  );
24
24
  }
25
25
  }
@@ -67,7 +67,7 @@ export class InvalidEntityIdError extends BaseError {
67
67
  */
68
68
  constructor(entityId: number) {
69
69
  super(
70
- `Entity ID used is ${entityId}, but must be less than or equal to uint32.max`
70
+ `Entity ID used is ${entityId}, but must be less than or equal to uint32.max`,
71
71
  );
72
72
  }
73
73
  }
@@ -85,7 +85,7 @@ export class InvalidNonceKeyError extends BaseError {
85
85
  */
86
86
  constructor(nonceKey: bigint) {
87
87
  super(
88
- `Nonce key is ${nonceKey} but has to be less than or equal to 2**152`
88
+ `Nonce key is ${nonceKey} but has to be less than or equal to 2**152`,
89
89
  );
90
90
  }
91
91
  }
@@ -18,7 +18,7 @@ export class EntryPointNotFoundError extends BaseError {
18
18
  [
19
19
  `No default entry point v${entryPointVersion} exists for ${chain.name}.`,
20
20
  `Supply an override.`,
21
- ].join("\n")
21
+ ].join("\n"),
22
22
  );
23
23
  }
24
24
  }
@@ -37,7 +37,7 @@ export class InvalidEntryPointError extends BaseError {
37
37
  */
38
38
  constructor(chain: Chain, entryPointVersion: any) {
39
39
  super(
40
- `Invalid entry point: unexpected version ${entryPointVersion} for ${chain.name}.`
40
+ `Invalid entry point: unexpected version ${entryPointVersion} for ${chain.name}.`,
41
41
  );
42
42
  }
43
43
  }
@@ -16,7 +16,7 @@ export class InvalidSignerTypeError extends BaseError {
16
16
  [
17
17
  "Invalid signer type parameter passed to SmartAccountSigner.",
18
18
  signerType ?? "A signerType must be provided.",
19
- ].join("\n")
19
+ ].join("\n"),
20
20
  );
21
21
  }
22
22
  }
@@ -30,8 +30,8 @@ export class InvalidUserOperationError extends BaseError {
30
30
  value: value.toString(),
31
31
  }
32
32
  : value,
33
- 2
34
- )}`
33
+ 2,
34
+ )}`,
35
35
  );
36
36
  }
37
37
  }
@@ -47,7 +47,10 @@ export class WaitForUserOperationError extends BaseError {
47
47
  * @param {UserOperationRequest} request the user operation request that failed
48
48
  * @param {Error} error the underlying error that caused the failure
49
49
  */
50
- constructor(public request: UserOperationRequest, error: Error) {
50
+ constructor(
51
+ public request: UserOperationRequest,
52
+ error: Error,
53
+ ) {
51
54
  super(`Failed to find User Operation: ${error.message}`);
52
55
  }
53
56
  }
@@ -30,7 +30,7 @@ export type MiddlewareClient<
30
30
  TChain extends Chain | undefined = Chain | undefined,
31
31
  TAccount extends SmartContractAccount | undefined =
32
32
  | SmartContractAccount
33
- | undefined
33
+ | undefined,
34
34
  > = Client<
35
35
  TTransport,
36
36
  TChain,
@@ -53,9 +53,9 @@ export const middlewareActions =
53
53
  TChain extends Chain | undefined = Chain | undefined,
54
54
  TAccount extends SmartContractAccount | undefined =
55
55
  | SmartContractAccount
56
- | undefined
56
+ | undefined,
57
57
  >(
58
- client: MiddlewareClient<TTransport, TChain, TAccount>
58
+ client: MiddlewareClient<TTransport, TChain, TAccount>,
59
59
  ): { middleware: ClientMiddleware } => ({
60
60
  middleware: {
61
61
  customMiddleware: overrides.customMiddleware ?? noopMiddleware,