@aa-sdk/core 4.12.0 → 4.13.0

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 (61) hide show
  1. package/dist/esm/account/smartContractAccount.d.ts +3 -1
  2. package/dist/esm/account/smartContractAccount.js +26 -24
  3. package/dist/esm/account/smartContractAccount.js.map +1 -1
  4. package/dist/esm/entrypoint/0.6.d.ts +1 -1
  5. package/dist/esm/entrypoint/0.7.d.ts +1 -1
  6. package/dist/esm/errors/client.d.ts +10 -0
  7. package/dist/esm/errors/client.js +17 -0
  8. package/dist/esm/errors/client.js.map +1 -1
  9. package/dist/esm/index.d.ts +3 -1
  10. package/dist/esm/index.js +3 -1
  11. package/dist/esm/index.js.map +1 -1
  12. package/dist/esm/middleware/defaults/7702gasEstimator.d.ts +36 -0
  13. package/dist/esm/middleware/defaults/7702gasEstimator.js +62 -0
  14. package/dist/esm/middleware/defaults/7702gasEstimator.js.map +1 -0
  15. package/dist/esm/middleware/defaults/7702signer.d.ts +37 -0
  16. package/dist/esm/middleware/defaults/7702signer.js +86 -0
  17. package/dist/esm/middleware/defaults/7702signer.js.map +1 -0
  18. package/dist/esm/signer/local-account.d.ts +21 -0
  19. package/dist/esm/signer/local-account.js +22 -0
  20. package/dist/esm/signer/local-account.js.map +1 -1
  21. package/dist/esm/signer/types.d.ts +2 -0
  22. package/dist/esm/signer/types.js.map +1 -1
  23. package/dist/esm/types.d.ts +12 -2
  24. package/dist/esm/types.js.map +1 -1
  25. package/dist/esm/utils/types.d.ts +1 -0
  26. package/dist/esm/utils/types.js.map +1 -1
  27. package/dist/esm/version.d.ts +1 -1
  28. package/dist/esm/version.js +1 -1
  29. package/dist/esm/version.js.map +1 -1
  30. package/dist/types/account/smartContractAccount.d.ts +3 -1
  31. package/dist/types/account/smartContractAccount.d.ts.map +1 -1
  32. package/dist/types/entrypoint/0.6.d.ts +1 -1
  33. package/dist/types/entrypoint/0.7.d.ts +1 -1
  34. package/dist/types/errors/client.d.ts +10 -0
  35. package/dist/types/errors/client.d.ts.map +1 -1
  36. package/dist/types/index.d.ts +3 -1
  37. package/dist/types/index.d.ts.map +1 -1
  38. package/dist/types/middleware/defaults/7702gasEstimator.d.ts +37 -0
  39. package/dist/types/middleware/defaults/7702gasEstimator.d.ts.map +1 -0
  40. package/dist/types/middleware/defaults/7702signer.d.ts +38 -0
  41. package/dist/types/middleware/defaults/7702signer.d.ts.map +1 -0
  42. package/dist/types/signer/local-account.d.ts +21 -0
  43. package/dist/types/signer/local-account.d.ts.map +1 -1
  44. package/dist/types/signer/types.d.ts +2 -0
  45. package/dist/types/signer/types.d.ts.map +1 -1
  46. package/dist/types/types.d.ts +12 -2
  47. package/dist/types/types.d.ts.map +1 -1
  48. package/dist/types/utils/types.d.ts +1 -0
  49. package/dist/types/utils/types.d.ts.map +1 -1
  50. package/dist/types/version.d.ts +1 -1
  51. package/package.json +3 -3
  52. package/src/account/smartContractAccount.ts +39 -30
  53. package/src/errors/client.ts +14 -0
  54. package/src/index.ts +3 -0
  55. package/src/middleware/defaults/7702gasEstimator.ts +77 -0
  56. package/src/middleware/defaults/7702signer.ts +105 -0
  57. package/src/signer/local-account.ts +28 -0
  58. package/src/signer/types.ts +5 -0
  59. package/src/types.ts +17 -4
  60. package/src/utils/types.ts +4 -0
  61. package/src/version.ts +1 -1
@@ -0,0 +1,86 @@
1
+ import { toHex } from "viem";
2
+ import { isSmartAccountWithSigner } from "../../account/smartContractAccount.js";
3
+ import { AccountNotFoundError } from "../../errors/account.js";
4
+ import { ChainNotFoundError } from "../../errors/client.js";
5
+ import { defaultUserOpSigner } from "./userOpSigner.js";
6
+ /**
7
+ * Provides a default middleware function for signing user operations with a client account when using EIP-7702 delegated accounts.
8
+ * If the signer doesn't support `signAuthorization`, then this just runs the provided `signUserOperation` middleware.
9
+ * This function is only compatible with accounts using EntryPoint v0.7.0, and the account must have an implementation address defined in `getImplementationAddress()`.
10
+ *
11
+ * @example
12
+ * ```ts twoslash
13
+ * import {
14
+ * default7702GasEstimator,
15
+ * default7702UserOpSigner,
16
+ * createSmartAccountClient,
17
+ * type SmartAccountClient,
18
+ * } from "@aa-sdk/core";
19
+ * import {
20
+ * createModularAccountV2,
21
+ * type CreateModularAccountV2ClientParams,
22
+ * } from "@account-kit/smart-contracts";
23
+ *
24
+ * async function createSMA7702AccountClient(
25
+ * config: CreateModularAccountV2ClientParams
26
+ * ): Promise<SmartAccountClient> {
27
+ * const sma7702Account = await createModularAccountV2({ ...config, mode: "7702" });
28
+ *
29
+ * return createSmartAccountClient({
30
+ * account: sma7702Account,
31
+ * gasEstimator: default7702GasEstimator(config.gasEstimator),
32
+ * signUserOperation: default7702UserOpSigner(config.signUserOperation),
33
+ * ...config,
34
+ * });
35
+ * }
36
+ * ```
37
+ *
38
+ * @param {ClientMiddlewareFn} [userOpSigner] Optional user operation signer function
39
+ * @returns {Function} A middleware function that signs EIP-7702 authorization tuples if necessary, and also uses the provided or default user operation signer to generate the user op signature.
40
+ */
41
+ export const default7702UserOpSigner = (userOpSigner) => async (struct, params) => {
42
+ const userOpSigner_ = userOpSigner ?? defaultUserOpSigner;
43
+ const uo = await userOpSigner_(struct, params);
44
+ const account = params.account ?? params.client.account;
45
+ const { client } = params;
46
+ if (!account || !isSmartAccountWithSigner(account)) {
47
+ throw new AccountNotFoundError();
48
+ }
49
+ const signer = account.getSigner();
50
+ if (!signer.signAuthorization) {
51
+ return uo;
52
+ }
53
+ if (!client.chain) {
54
+ throw new ChainNotFoundError();
55
+ }
56
+ const code = (await client.getCode({ address: account.address })) ?? "0x";
57
+ const implAddress = await account.getImplementationAddress();
58
+ const expectedCode = "0xef0100" + implAddress.slice(2);
59
+ if (code.toLowerCase() === expectedCode.toLowerCase()) {
60
+ // If the delegation already matches the expected, then we don't need to sign and include an authorization tuple.
61
+ return uo;
62
+ }
63
+ const accountNonce = await params.client.getTransactionCount({
64
+ address: account.address,
65
+ });
66
+ const authSignature = await signer.signAuthorization({
67
+ chainId: client.chain.id,
68
+ contractAddress: implAddress,
69
+ nonce: accountNonce,
70
+ });
71
+ const { r, s } = authSignature;
72
+ const yParity = authSignature.yParity ?? authSignature.v - 27n;
73
+ return {
74
+ ...uo,
75
+ eip7702Auth: {
76
+ // deepHexlify doesn't encode number(0) correctly, it returns "0x"
77
+ chainId: toHex(client.chain.id),
78
+ nonce: toHex(accountNonce),
79
+ address: implAddress,
80
+ r,
81
+ s,
82
+ yParity: toHex(yParity),
83
+ },
84
+ };
85
+ };
86
+ //# sourceMappingURL=7702signer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"7702signer.js","sourceRoot":"","sources":["../../../../src/middleware/defaults/7702signer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AACjF,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAGlC,CAAC,YAAiC,EAAE,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;IAC9D,MAAM,aAAa,GAAG,YAAY,IAAI,mBAAmB,CAAC;IAE1D,MAAM,EAAE,GAAG,MAAM,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE/C,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC;IACxD,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IAE1B,IAAI,CAAC,OAAO,IAAI,CAAC,wBAAwB,CAAC,OAAO,CAAC,EAAE,CAAC;QACnD,MAAM,IAAI,oBAAoB,EAAE,CAA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KAAK,EAAE,KAAK,CAAC,YAAY,CAAC;YAC1B,OAAO,EAAE,WAAW;YACpB,CAAC;YACD,CAAC;YACD,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC;SACxB;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { toHex } from \"viem\";\nimport { isSmartAccountWithSigner } from \"../../account/smartContractAccount.js\";\nimport { AccountNotFoundError } from \"../../errors/account.js\";\nimport { ChainNotFoundError } from \"../../errors/client.js\";\nimport type { ClientMiddlewareFn } from \"../types\";\nimport { defaultUserOpSigner } from \"./userOpSigner.js\";\n\n/**\n * Provides a default middleware function for signing user operations with a client account when using EIP-7702 delegated accounts.\n * If the signer doesn't support `signAuthorization`, then this just runs the provided `signUserOperation` middleware.\n * This function is only compatible with accounts using EntryPoint v0.7.0, and the account must have an implementation address defined in `getImplementationAddress()`.\n *\n * @example\n * ```ts twoslash\n * import {\n * default7702GasEstimator,\n * default7702UserOpSigner,\n * createSmartAccountClient,\n * type SmartAccountClient,\n * } from \"@aa-sdk/core\";\n * import {\n * createModularAccountV2,\n * type CreateModularAccountV2ClientParams,\n * } from \"@account-kit/smart-contracts\";\n *\n * async function createSMA7702AccountClient(\n * config: CreateModularAccountV2ClientParams\n * ): Promise<SmartAccountClient> {\n * const sma7702Account = await createModularAccountV2({ ...config, mode: \"7702\" });\n *\n * return createSmartAccountClient({\n * account: sma7702Account,\n * gasEstimator: default7702GasEstimator(config.gasEstimator),\n * signUserOperation: default7702UserOpSigner(config.signUserOperation),\n * ...config,\n * });\n * }\n * ```\n *\n * @param {ClientMiddlewareFn} [userOpSigner] Optional user operation signer function\n * @returns {Function} A middleware function that signs EIP-7702 authorization tuples if necessary, and also uses the provided or default user operation signer to generate the user op signature.\n */\nexport const default7702UserOpSigner: (\n userOpSigner?: ClientMiddlewareFn\n) => ClientMiddlewareFn =\n (userOpSigner?: ClientMiddlewareFn) => async (struct, params) => {\n const userOpSigner_ = userOpSigner ?? defaultUserOpSigner;\n\n const uo = await userOpSigner_(struct, params);\n\n const account = params.account ?? params.client.account;\n const { client } = params;\n\n if (!account || !isSmartAccountWithSigner(account)) {\n throw new AccountNotFoundError();\n }\n\n const signer = account.getSigner();\n\n if (!signer.signAuthorization) {\n return uo;\n }\n\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n\n const code = (await client.getCode({ address: account.address })) ?? \"0x\";\n\n const implAddress = await account.getImplementationAddress();\n\n const expectedCode = \"0xef0100\" + implAddress.slice(2);\n\n if (code.toLowerCase() === expectedCode.toLowerCase()) {\n // If the delegation already matches the expected, then we don't need to sign and include an authorization tuple.\n return uo;\n }\n\n const accountNonce = await params.client.getTransactionCount({\n address: account.address,\n });\n\n const authSignature = await signer.signAuthorization({\n chainId: client.chain.id,\n contractAddress: implAddress,\n nonce: accountNonce,\n });\n\n const { r, s } = authSignature;\n\n const yParity = authSignature.yParity ?? authSignature.v - 27n;\n\n return {\n ...uo,\n eip7702Auth: {\n // deepHexlify doesn't encode number(0) correctly, it returns \"0x\"\n chainId: toHex(client.chain.id),\n nonce: toHex(accountNonce),\n address: implAddress,\n r,\n s,\n yParity: toHex(yParity),\n },\n };\n };\n"]}
@@ -1,5 +1,6 @@
1
1
  import { type HDAccount, type HDOptions, type Hex, type LocalAccount, type PrivateKeyAccount, type SignableMessage, type TypedDataDefinition } from "viem";
2
2
  import type { SmartAccountSigner } from "./types.js";
3
+ import type { Authorization } from "viem/experimental";
3
4
  /**
4
5
  * 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.
5
6
  */
@@ -264,6 +265,26 @@ export declare class LocalAccountSigner<T extends HDAccount | PrivateKeyAccount
264
265
  uint240?: undefined;
265
266
  uint248?: undefined;
266
267
  }, TPrimaryType extends "EIP712Domain" | keyof TTypedData = keyof TTypedData>(params: TypedDataDefinition<TTypedData, TPrimaryType>) => Promise<Hex>;
268
+ /**
269
+ * Signs an unsigned authorization using the provided private key account.
270
+ *
271
+ * @example
272
+ * ```ts twoslash
273
+ * import { LocalAccountSigner } from "@aa-sdk/core";
274
+ * import { generatePrivateKey } from "viem/accounts";
275
+ *
276
+ * const signer = LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey());
277
+ * const signedAuthorization = await signer.signAuthorization({
278
+ * contractAddress: "0x1234123412341234123412341234123412341234",
279
+ * chainId: 1,
280
+ * nonce: 3,
281
+ * });
282
+ * ```
283
+ *
284
+ * @param {Authorization<number, false>} unsignedAuthorization - The unsigned authorization to be signed.
285
+ * @returns {Promise<Authorization<number, true>>} A promise that resolves to the signed authorization.
286
+ */
287
+ signAuthorization(this: LocalAccountSigner<PrivateKeyAccount>, unsignedAuthorization: Authorization<number, false>): Promise<Authorization<number, true>>;
267
288
  /**
268
289
  * Returns the address of the inner object in a specific hexadecimal format.
269
290
  *
@@ -108,6 +108,28 @@ export class LocalAccountSigner {
108
108
  this.inner = inner;
109
109
  this.signerType = inner.type; // type: "local"
110
110
  }
111
+ /**
112
+ * Signs an unsigned authorization using the provided private key account.
113
+ *
114
+ * @example
115
+ * ```ts twoslash
116
+ * import { LocalAccountSigner } from "@aa-sdk/core";
117
+ * import { generatePrivateKey } from "viem/accounts";
118
+ *
119
+ * const signer = LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey());
120
+ * const signedAuthorization = await signer.signAuthorization({
121
+ * contractAddress: "0x1234123412341234123412341234123412341234",
122
+ * chainId: 1,
123
+ * nonce: 3,
124
+ * });
125
+ * ```
126
+ *
127
+ * @param {Authorization<number, false>} unsignedAuthorization - The unsigned authorization to be signed.
128
+ * @returns {Promise<Authorization<number, true>>} A promise that resolves to the signed authorization.
129
+ */
130
+ signAuthorization(unsignedAuthorization) {
131
+ return this.inner.experimental_signAuthorization(unsignedAuthorization);
132
+ }
111
133
  /**
112
134
  * Creates a LocalAccountSigner using the provided mnemonic key and optional HD options.
113
135
  *
@@ -1 +1 @@
1
- {"version":3,"file":"local-account.js","sourceRoot":"","sources":["../../../src/signer/local-account.ts"],"names":[],"mappings":"AAAA,OA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AWG;IACH,MAAM,CAAC,wBAAwB;QAC7B,MAAM,MAAM,GAAG,mBAAmB,CAAC,kBAAkB,EAAE,CAAC,CAAC;QACzD,OAAO,IAAI,kBAAkB,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;CACF","sourcesContent":["import {\n type HDAccount,\n type HDOptions,\n type Hex,\n type LocalAccount,\n type PrivateKeyAccount,\n type SignableMessage,\n type TypedData,\n type TypedDataDefinition,\n} from \"viem\";\nimport {\n generatePrivateKey,\n mnemonicToAccount,\n privateKeyToAccount,\n} 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 | Record<string, unknown>,\n TPrimaryType extends keyof TTypedData | \"EIP712Domain\" = keyof TTypedData\n >(\n params: TypedDataDefinition<TTypedData, TPrimaryType>\n ): Promise<Hex> => {\n return this.inner.signTypedData(params);\n };\n\n /**\n * 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 */\n static privateKeyToAccountSigner(\n key: Hex\n ): LocalAccountSigner<PrivateKeyAccount> {\n const signer = privateKeyToAccount(key);\n return new LocalAccountSigner(signer);\n }\n\n /**\n * Generates a new private key and creates a `LocalAccountSigner` for a `PrivateKeyAccount`.\n *\n * @example\n * ```ts\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n *\n * const signer = LocalAccountSigner.generatePrivateKeySigner();\n * ```\n *\n * @returns {LocalAccountSigner<PrivateKeyAccount>} A `LocalAccountSigner` instance initialized with the generated private key account\n */\n static generatePrivateKeySigner(): LocalAccountSigner<PrivateKeyAccount> {\n const signer = privateKeyToAccount(generatePrivateKey());\n return new LocalAccountSigner(signer);\n }\n}\n"]}
1
+ {"version":3,"file":"local-account.js","sourceRoot":"","sources":["../../../src/signer/local-account.ts"],"names":[],"mappings":"AAAA,OAAO,EASN,MAAM,MAAM,CAAC;AACd,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,eAAe,CAAC;AAIvB;;GAEG;AACH,MAAM,OAAO,kBAAkB;IAO7B;;;;;;;;;;;;;;OAcG;IACH,YAAY,KAAQ;QAlBpB;;;;;WAAS;QACT;;;;;WAAmB;QAsBnB;;;;;;;;;;;;;;WAcG;QACM;;;;mBAAoE,CAC3E,OAAO,EACP,EAAE;gBACF,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;YAC7C,CAAC;WAAC;QAEF;;;;;;;;;;;;;;;;;;;WAmBG;QACM;;;;mBAAgB,KAAK,EAI5B,MAAqD,EACvC,EAAE;gBAChB,OAAO,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;YAC1C,CAAC;WAAC;QA6BF;;;;;;;;;;;;;WAaG;QACM;;;;mBAAa,KAAK,IAA4B,EAAE;gBACvD,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;YAC5B,CAAC;WAAC;QAjGA,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,iBAAiB;IACjD,CAAC;IAoDD;;;;;;;;;;;;;;;;;;OAkBG;IAEH,iBAAiB,CAEf,qBAAmD;QAEnD,OAAO,IAAI,CAAC,KAAK,CAAC,8BAA8B,CAAC,qBAAqB,CAAC,CAAC;IAC1E,CAAC;IAoBD;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,uBAAuB,CAC5B,GAAW,EACX,IAAgB;QAEhB,MAAM,MAAM,GAAG,iBAAiB,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QAC5C,OAAO,IAAI,kBAAkB,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,yBAAyB,CAC9B,GAAQ;QAER,MAAM,MAAM,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC;QACxC,OAAO,IAAI,kBAAkB,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;IAED;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,wBAAwB;QAC7B,MAAM,MAAM,GAAG,mBAAmB,CAAC,kBAAkB,EAAE,CAAC,CAAC;QACzD,OAAO,IAAI,kBAAkB,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;CACF","sourcesContent":["import {\n type HDAccount,\n type HDOptions,\n type Hex,\n type LocalAccount,\n type PrivateKeyAccount,\n type SignableMessage,\n type TypedData,\n type TypedDataDefinition,\n} from \"viem\";\nimport {\n generatePrivateKey,\n mnemonicToAccount,\n privateKeyToAccount,\n} from \"viem/accounts\";\nimport type { SmartAccountSigner } from \"./types.js\";\nimport type { Authorization } from \"viem/experimental\";\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 | Record<string, unknown>,\n TPrimaryType extends keyof TTypedData | \"EIP712Domain\" = keyof TTypedData\n >(\n params: TypedDataDefinition<TTypedData, TPrimaryType>\n ): Promise<Hex> => {\n return this.inner.signTypedData(params);\n };\n\n /**\n * Signs an unsigned authorization using the provided private key account.\n *\n * @example\n * ```ts twoslash\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { generatePrivateKey } from \"viem/accounts\";\n *\n * const signer = LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey());\n * const signedAuthorization = await signer.signAuthorization({\n * contractAddress: \"0x1234123412341234123412341234123412341234\",\n * chainId: 1,\n * nonce: 3,\n * });\n * ```\n *\n * @param {Authorization<number, false>} unsignedAuthorization - The unsigned authorization to be signed.\n * @returns {Promise<Authorization<number, true>>} A promise that resolves to the signed authorization.\n */\n\n signAuthorization(\n this: LocalAccountSigner<PrivateKeyAccount>,\n unsignedAuthorization: Authorization<number, false>\n ): Promise<Authorization<number, true>> {\n return this.inner.experimental_signAuthorization(unsignedAuthorization);\n }\n\n /**\n * Returns the address of the inner object in a specific hexadecimal format.\n *\n * @example\n * ```ts\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { generatePrivateKey } from \"viem\";\n *\n * const signer = LocalAccountSigner.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 */\n static privateKeyToAccountSigner(\n key: Hex\n ): LocalAccountSigner<PrivateKeyAccount> {\n const signer = privateKeyToAccount(key);\n return new LocalAccountSigner(signer);\n }\n\n /**\n * Generates a new private key and creates a `LocalAccountSigner` for a `PrivateKeyAccount`.\n *\n * @example\n * ```ts\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n *\n * const signer = LocalAccountSigner.generatePrivateKeySigner();\n * ```\n *\n * @returns {LocalAccountSigner<PrivateKeyAccount>} A `LocalAccountSigner` instance initialized with the generated private key account\n */\n static generatePrivateKeySigner(): LocalAccountSigner<PrivateKeyAccount> {\n const signer = privateKeyToAccount(generatePrivateKey());\n return new LocalAccountSigner(signer);\n }\n}\n"]}
@@ -1,5 +1,6 @@
1
1
  import type { Address } from "abitype";
2
2
  import type { Hex, SignableMessage, TypedData, TypedDataDefinition } from "viem";
3
+ import type { Authorization } from "viem/experimental";
3
4
  /**
4
5
  * Extends the @interface SmartAccountSigner interface with authentication.
5
6
  *
@@ -22,4 +23,5 @@ export interface SmartAccountSigner<Inner = any> {
22
23
  getAddress: () => Promise<Address>;
23
24
  signMessage: (message: SignableMessage) => Promise<Hex>;
24
25
  signTypedData: <const TTypedData extends TypedData | Record<string, unknown>, TPrimaryType extends keyof TTypedData | "EIP712Domain" = keyof TTypedData>(params: TypedDataDefinition<TTypedData, TPrimaryType>) => Promise<Hex>;
26
+ signAuthorization?: (unsignedAuthorization: Authorization<number, false>) => Promise<Authorization<number, true>>;
25
27
  }
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/signer/types.ts"],"names":[],"mappings":";AA6CA,kCAAkC","sourcesContent":["import type { Address } from \"abitype\";\nimport type {\n Hex,\n SignableMessage,\n TypedData,\n TypedDataDefinition,\n} from \"viem\";\n\n// [!region SmartAccountAuthenticator]\n/**\n * Extends the @interface SmartAccountSigner interface with authentication.\n *\n * @template AuthParams - the generic type of the authentication parameters\n * @template AuthDetails - the generic type of the authentication details\n * @template Inner - the generic type of the inner client that the signer wraps to provide functionality such as signing, etc.\n */\nexport interface SmartAccountAuthenticator<AuthParams, AuthDetails, Inner = any>\n extends SmartAccountSigner<Inner> {\n authenticate: (params: AuthParams) => Promise<AuthDetails>;\n\n getAuthDetails: () => Promise<AuthDetails>;\n}\n// [!endregion SmartAccountAuthenticator]\n\n// [!region SmartAccountSigner]\n/**\n * A signer that can sign messages and typed data.\n *\n * @template Inner - the generic type of the inner client that the signer wraps to provide functionality such as signing, etc.\n */\nexport interface SmartAccountSigner<Inner = any> {\n signerType: string;\n inner: Inner;\n\n getAddress: () => Promise<Address>;\n\n signMessage: (message: SignableMessage) => Promise<Hex>;\n\n signTypedData: <\n const TTypedData extends TypedData | Record<string, unknown>,\n TPrimaryType extends keyof TTypedData | \"EIP712Domain\" = keyof TTypedData\n >(\n params: TypedDataDefinition<TTypedData, TPrimaryType>\n ) => Promise<Hex>;\n}\n// [!endregion SmartAccountSigner]\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/signer/types.ts"],"names":[],"mappings":";AAkDA,kCAAkC","sourcesContent":["import type { Address } from \"abitype\";\nimport type {\n Hex,\n SignableMessage,\n TypedData,\n TypedDataDefinition,\n} from \"viem\";\nimport type { Authorization } from \"viem/experimental\";\n\n// [!region SmartAccountAuthenticator]\n/**\n * Extends the @interface SmartAccountSigner interface with authentication.\n *\n * @template AuthParams - the generic type of the authentication parameters\n * @template AuthDetails - the generic type of the authentication details\n * @template Inner - the generic type of the inner client that the signer wraps to provide functionality such as signing, etc.\n */\nexport interface SmartAccountAuthenticator<AuthParams, AuthDetails, Inner = any>\n extends SmartAccountSigner<Inner> {\n authenticate: (params: AuthParams) => Promise<AuthDetails>;\n\n getAuthDetails: () => Promise<AuthDetails>;\n}\n// [!endregion SmartAccountAuthenticator]\n\n// [!region SmartAccountSigner]\n/**\n * A signer that can sign messages and typed data.\n *\n * @template Inner - the generic type of the inner client that the signer wraps to provide functionality such as signing, etc.\n */\nexport interface SmartAccountSigner<Inner = any> {\n signerType: string;\n inner: Inner;\n\n getAddress: () => Promise<Address>;\n\n signMessage: (message: SignableMessage) => Promise<Hex>;\n\n signTypedData: <\n const TTypedData extends TypedData | Record<string, unknown>,\n TPrimaryType extends keyof TTypedData | \"EIP712Domain\" = keyof TTypedData\n >(\n params: TypedDataDefinition<TTypedData, TPrimaryType>\n ) => Promise<Hex>;\n\n signAuthorization?: (\n unsignedAuthorization: Authorization<number, false>\n ) => Promise<Authorization<number, true>>;\n}\n// [!endregion SmartAccountSigner]\n"]}
@@ -85,7 +85,17 @@ export interface UserOperationRequest_v7 {
85
85
  paymasterData?: Hex;
86
86
  signature: Hex;
87
87
  }
88
- export type UserOperationRequest<TEntryPointVersion extends EntryPointVersion = EntryPointVersion> = TEntryPointVersion extends "0.6.0" ? UserOperationRequest_v6 : TEntryPointVersion extends "0.7.0" ? UserOperationRequest_v7 : never;
88
+ export type Eip7702ExtendedFields = {
89
+ eip7702Auth?: {
90
+ chainId: Hex;
91
+ nonce: Hex;
92
+ address: Address;
93
+ r: Hex;
94
+ s: Hex;
95
+ yParity: Hex;
96
+ };
97
+ };
98
+ export type UserOperationRequest<TEntryPointVersion extends EntryPointVersion = EntryPointVersion> = (TEntryPointVersion extends "0.6.0" ? UserOperationRequest_v6 : TEntryPointVersion extends "0.7.0" ? UserOperationRequest_v7 : never) & Eip7702ExtendedFields;
89
99
  export interface UserOperationEstimateGasResponse<TEntryPointVersion extends EntryPointVersion = EntryPointVersion> {
90
100
  preVerificationGas: BigNumberish;
91
101
  verificationGasLimit: BigNumberish;
@@ -142,4 +152,4 @@ export interface UserOperationStruct_v7 {
142
152
  paymasterData?: BytesLike;
143
153
  signature: BytesLike;
144
154
  }
145
- export type UserOperationStruct<TEntryPointVersion extends EntryPointVersion = EntryPointVersion> = TEntryPointVersion extends "0.6.0" ? UserOperationStruct_v6 : TEntryPointVersion extends "0.7.0" ? UserOperationStruct_v7 : never;
155
+ export type UserOperationStruct<TEntryPointVersion extends EntryPointVersion = EntryPointVersion> = (TEntryPointVersion extends "0.6.0" ? UserOperationStruct_v6 : TEntryPointVersion extends "0.7.0" ? UserOperationStruct_v7 : never) & Eip7702ExtendedFields;
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAMN,MAAM,MAAM,CAAC;AA4Vd,mCAAmC","sourcesContent":["import {\n type Address,\n type Hash,\n type Hex,\n type StateOverride,\n type TransactionReceipt,\n} from \"viem\";\nimport type { z } from \"zod\";\nimport type {\n UserOperationFeeOptionsFieldSchema,\n UserOperationFeeOptionsSchema,\n UserOperationFeeOptionsSchema_v6,\n UserOperationFeeOptionsSchema_v7,\n} from \"./client/schema\";\nimport type { EntryPointVersion } from \"./entrypoint/types\";\nimport type {\n BigNumberishRangeSchema,\n BigNumberishSchema,\n MultiplierSchema,\n NoUndefined,\n} from \"./utils\";\n\nexport type EmptyHex = `0x`;\nexport type NullAddress = `0x0`;\n\n// based on @account-abstraction/common\nexport type PromiseOrValue<T> = T | Promise<T>;\nexport type BytesLike = Uint8Array | Hex;\nexport type Multiplier = z.input<typeof MultiplierSchema>;\n\nexport type BigNumberish = z.input<typeof BigNumberishSchema>;\nexport type BigNumberishRange = z.input<typeof BigNumberishRangeSchema>;\n\n// [!region UserOperationCallData]\nexport type UserOperationCallData =\n | {\n /* the target of the call */\n target: Address;\n /* the data passed to the target */\n data: Hex;\n /* the amount of native token to send to the target (default: 0) */\n value?: bigint;\n }\n | Hex;\n// [!endregion UserOperationCallData]\n\n// [!region BatchUserOperationCallData]\nexport type BatchUserOperationCallData = Exclude<UserOperationCallData, Hex>[];\n// [!endregion BatchUserOperationCallData]\n\nexport type UserOperationFeeOptionsField = z.input<\n typeof UserOperationFeeOptionsFieldSchema\n>;\n\nexport type UserOperationFeeOptions<\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion\n> = TEntryPointVersion extends \"0.6.0\"\n ? z.input<typeof UserOperationFeeOptionsSchema_v6>\n : TEntryPointVersion extends \"0.7.0\"\n ? z.input<typeof UserOperationFeeOptionsSchema_v7>\n : z.input<typeof UserOperationFeeOptionsSchema>;\n\nexport type UserOperationOverridesParameter<\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion,\n Required extends boolean = false\n> = Required extends true\n ? { overrides: UserOperationOverrides<TEntryPointVersion> }\n : { overrides?: UserOperationOverrides<TEntryPointVersion> };\n\n// [!region UserOperationPaymasterOverrides]\nexport type UserOperationPaymasterOverrides<\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion\n> = TEntryPointVersion extends \"0.6.0\"\n ? {\n // paymasterData overrides to bypass paymaster middleware\n paymasterAndData: Hex;\n }\n : TEntryPointVersion extends \"0.7.0\"\n ? {\n // paymasterData overrides to bypass paymaster middleware\n // if set to '0x', all paymaster related fields are omitted from the user op request\n paymasterData: Hex;\n paymaster: Address;\n paymasterVerificationGasLimit:\n | NoUndefined<\n UserOperationStruct<\"0.7.0\">[\"paymasterVerificationGasLimit\"]\n >\n | Multiplier;\n paymasterPostOpGasLimit:\n | NoUndefined<UserOperationStruct<\"0.7.0\">[\"paymasterPostOpGasLimit\"]>\n | Multiplier;\n }\n : {};\n// [!endregion UserOperationOverridesParameter]\n\n// [!region UserOperationOverrides]\nexport type UserOperationOverrides<\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion\n> = Partial<\n {\n callGasLimit:\n | UserOperationStruct<TEntryPointVersion>[\"callGasLimit\"]\n | Multiplier;\n maxFeePerGas:\n | UserOperationStruct<TEntryPointVersion>[\"maxFeePerGas\"]\n | Multiplier;\n maxPriorityFeePerGas:\n | UserOperationStruct<TEntryPointVersion>[\"maxPriorityFeePerGas\"]\n | Multiplier;\n preVerificationGas:\n | UserOperationStruct<TEntryPointVersion>[\"preVerificationGas\"]\n | Multiplier;\n verificationGasLimit:\n | UserOperationStruct<TEntryPointVersion>[\"verificationGasLimit\"]\n | Multiplier;\n /**\n * This can be used to override the key used when calling `entryPoint.getNonce`\n * It is useful when you want to use parallel nonces for user operations\n *\n * NOTE: not all bundlers fully support this feature and it could be that your bundler will still only include\n * one user operation for your account in a bundle\n */\n nonceKey: bigint;\n\n /**\n * The same state overrides for\n * [`eth_call`](https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-eth#eth-call) method.\n * An address-to-state mapping, where each entry specifies some state to be ephemerally overridden\n * prior to executing the call. State overrides allow you to customize the network state for\n * the purpose of the simulation, so this feature is useful when you need to estimate gas\n * for user operation scenarios under conditions that aren’t currently present on the live network.\n */\n stateOverride: StateOverride;\n } & UserOperationPaymasterOverrides<TEntryPointVersion>\n>;\n// [!endregion UserOperationOverrides]\n\n// [!region UserOperationRequest_v6]\n// represents the request as it needs to be formatted for v0.6 RPC requests\n// Reference: https://github.com/ethereum/ERCs/blob/8dd085d159cb123f545c272c0d871a5339550e79/ERCS/erc-4337.md#definitions\nexport interface UserOperationRequest_v6 {\n /* the origin of the request */\n sender: Address;\n /* nonce (as hex) of the transaction, returned from the entry point for this Address */\n nonce: Hex;\n /* the initCode for creating the sender if it does not exist yet, otherwise \"0x\" */\n initCode: Hex | EmptyHex;\n /* the callData passed to the target */\n callData: Hex;\n /* Gas value (as hex) used by inner account execution */\n callGasLimit: Hex;\n /* Actual gas (as hex) used by the validation of this UserOperation */\n verificationGasLimit: Hex;\n /* Gas overhead (as hex) of this UserOperation */\n preVerificationGas: Hex;\n /* Maximum fee per gas (similar to EIP-1559 max_fee_per_gas) (as hex)*/\n maxFeePerGas: Hex;\n /* Maximum priority fee per gas (similar to EIP-1559 max_priority_fee_per_gas) (as hex)*/\n maxPriorityFeePerGas: Hex;\n /* Address of paymaster sponsoring the transaction, followed by extra data to send to the paymaster (\"0x\" for self-sponsored transaction) */\n paymasterAndData: Hex | EmptyHex;\n /* Data passed into the account along with the nonce during the verification step */\n signature: Hex;\n}\n// [!endregion UserOperationRequest_v6]\n\n// [!region UserOperationRequest_v7]\n// represents the request as it needs to be formatted for v0.7 RPC requests\n// Reference: https://eips.ethereum.org/EIPS/eip-4337#definitions\nexport interface UserOperationRequest_v7 {\n /* the account making the operation */\n sender: Address;\n /* anti-replay parameter. nonce of the transaction, returned from the entry point for this address */\n nonce: Hex;\n /* account factory, only for new accounts */\n factory?: Address;\n /* data for account factory (only if account factory exists) */\n factoryData?: Hex;\n /* the data to pass to the sender during the main execution call */\n callData: Hex;\n /* the amount of gas to allocate the main execution call */\n callGasLimit: Hex;\n /* the amount of gas to allocate for the verification step */\n verificationGasLimit: Hex;\n /* extra gas to pay the bunder */\n preVerificationGas: Hex;\n /* maximum fee per gas (similar to EIP-1559 max_fee_per_gas) */\n maxFeePerGas: Hex;\n /* maximum priority fee per gas (similar to EIP-1559 max_priority_fee_per_gas) */\n maxPriorityFeePerGas: Hex;\n /* address of paymaster contract, (or empty, if account pays for itself) */\n paymaster?: Address;\n /* the amount of gas to allocate for the paymaster validation code */\n paymasterVerificationGasLimit?: Hex;\n /* the amount of gas to allocate for the paymaster post-operation code */\n paymasterPostOpGasLimit?: Hex;\n /* data for paymaster (only if paymaster exists) */\n paymasterData?: Hex;\n /* data passed into the account to verify authorization */\n signature: Hex;\n}\n// [!endregion UserOperationRequest_v7]\n\n// [!region UserOperationRequest]\n// Reference: https://eips.ethereum.org/EIPS/eip-4337#definitions\nexport type UserOperationRequest<\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion\n> = TEntryPointVersion extends \"0.6.0\"\n ? UserOperationRequest_v6\n : TEntryPointVersion extends \"0.7.0\"\n ? UserOperationRequest_v7\n : never;\n\n// [!endregion UserOperationRequest]\n\n// [!region UserOperationEstimateGasResponse]\nexport interface UserOperationEstimateGasResponse<\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion\n> {\n /* Gas overhead of this UserOperation */\n preVerificationGas: BigNumberish;\n /* Actual gas used by the validation of this UserOperation */\n verificationGasLimit: BigNumberish;\n /* Value used by inner account execution */\n callGasLimit: BigNumberish;\n /*\n * EntryPoint v0.7.0 operations only.\n * The amount of gas to allocate for the paymaster validation code.\n * Note: `eth_estimateUserOperationGas` does not return paymasterPostOpGasLimit.\n */\n paymasterVerificationGasLimit: TEntryPointVersion extends \"0.7.0\"\n ? BigNumberish | undefined\n : never;\n}\n// [!endregion UserOperationEstimateGasResponse]\n\n// [!region UserOperationResponse]\nexport interface UserOperationResponse<\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion\n> {\n /* the User Operation */\n userOperation: UserOperationRequest<TEntryPointVersion>;\n /* the address of the entry point contract that executed the user operation */\n entryPoint: Address;\n /* the block number the user operation was included in */\n blockNumber: BigNumberish;\n /* the hash of the block the user operation was included in */\n blockHash: Hash;\n /* the hash of the transaction that included the user operation */\n transactionHash: Hash;\n}\n// [!endregion UserOperationResponse]\n\n// [!region UserOperationReceipt]\nexport interface UserOperationReceipt {\n /* The request hash of the UserOperation. */\n userOpHash: Hash;\n /* The entry point address used for the UserOperation. */\n entryPoint: Address;\n /* The account initiating the UserOperation. */\n sender: Address;\n /* The nonce used in the UserOperation. */\n nonce: BigNumberish;\n /* The paymaster used for this UserOperation (or empty). */\n paymaster?: Address;\n /* The actual amount paid (by account or paymaster) for this UserOperation. */\n actualGasCost: BigNumberish;\n /* The total gas used by this UserOperation (including preVerification, creation, validation, and execution). */\n actualGasUsed: BigNumberish;\n /* Indicates whether the execution completed without reverting. */\n success: boolean;\n /* In case of revert, this is the revert reason. */\n reason?: string;\n /* The logs generated by this UserOperation (not including logs of other UserOperations in the same bundle). */\n logs: string[];\n /* The TransactionReceipt object for the entire bundle, not only for this UserOperation. */\n receipt: TransactionReceipt;\n}\n// [!endregion UserOperationReceipt]\n\n// [!region UserOperationStruct_v6]\n// https://github.com/eth-infinitism/account-abstraction/blob/releases/v0.6/test/UserOperation.ts\n// this is used for building requests for v0.6 entry point contract\nexport interface UserOperationStruct_v6 {\n /* the origin of the request */\n sender: string;\n /* nonce of the transaction, returned from the entry point for this address */\n nonce: BigNumberish;\n /* the initCode for creating the sender if it does not exist yet, otherwise \"0x\" */\n initCode: BytesLike | \"0x\";\n /* the callData passed to the target */\n callData: BytesLike;\n /* Value used by inner account execution */\n callGasLimit?: BigNumberish;\n /* Actual gas used by the validation of this UserOperation */\n verificationGasLimit?: BigNumberish;\n /* Gas overhead of this UserOperation */\n preVerificationGas?: BigNumberish;\n /* Maximum fee per gas (similar to EIP-1559 max_fee_per_gas) */\n maxFeePerGas?: BigNumberish;\n /* Maximum priority fee per gas (similar to EIP-1559 max_priority_fee_per_gas) */\n maxPriorityFeePerGas?: BigNumberish;\n /* Address of paymaster sponsoring the transaction, followed by extra data to send to the paymaster (\"0x\" for self-sponsored transaction) */\n paymasterAndData: BytesLike | \"0x\";\n /* Data passed into the account along with the nonce during the verification step */\n signature: BytesLike;\n}\n// [!endregion UserOperationStruct_v6]\n\n// [!region UserOperationStruct_v7]\n// based on https://github.com/eth-infinitism/account-abstraction/blob/releases/v0.7/test/UserOperation.ts\n// this is used for building requests for v0.7 entry point contract\nexport interface UserOperationStruct_v7 {\n /* the account making the operation */\n sender: string;\n /* anti-replay parameter. nonce of the transaction, returned from the entry point for this address */\n nonce: BigNumberish;\n /* account factory, only for new accounts */\n factory?: string;\n /* data for account factory (only if account factory exists) */\n factoryData?: BytesLike;\n /* the data to pass to the sender during the main execution call */\n callData: BytesLike;\n /* the amount of gas to allocate the main execution call */\n callGasLimit?: BigNumberish;\n /* the amount of gas to allocate for the verification step */\n verificationGasLimit?: BigNumberish;\n /* extra gas to pay the bunder */\n preVerificationGas?: BigNumberish;\n /* maximum fee per gas (similar to EIP-1559 max_fee_per_gas) */\n maxFeePerGas?: BigNumberish;\n /* maximum priority fee per gas (similar to EIP-1559 max_priority_fee_per_gas) */\n maxPriorityFeePerGas?: BigNumberish;\n /* address of paymaster contract, (or empty, if account pays for itself) */\n paymaster?: string;\n /* the amount of gas to allocate for the paymaster validation code */\n paymasterVerificationGasLimit?: BigNumberish;\n /* the amount of gas to allocate for the paymaster post-operation code */\n paymasterPostOpGasLimit?: BigNumberish;\n /* data for paymaster (only if paymaster exists) */\n paymasterData?: BytesLike;\n /* data passed into the account to verify authorization */\n signature: BytesLike;\n}\n// [!endregion UserOperationStruct_v7]\n\n// [!region UserOperationStruct]\nexport type UserOperationStruct<\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion\n> = TEntryPointVersion extends \"0.6.0\"\n ? UserOperationStruct_v6\n : TEntryPointVersion extends \"0.7.0\"\n ? UserOperationStruct_v7\n : never;\n// [!endregion UserOperationStruct]\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAMN,MAAM,MAAM,CAAC;AAyWd,mCAAmC","sourcesContent":["import {\n type Address,\n type Hash,\n type Hex,\n type StateOverride,\n type TransactionReceipt,\n} from \"viem\";\nimport type { z } from \"zod\";\nimport type {\n UserOperationFeeOptionsFieldSchema,\n UserOperationFeeOptionsSchema,\n UserOperationFeeOptionsSchema_v6,\n UserOperationFeeOptionsSchema_v7,\n} from \"./client/schema\";\nimport type { EntryPointVersion } from \"./entrypoint/types\";\nimport type {\n BigNumberishRangeSchema,\n BigNumberishSchema,\n MultiplierSchema,\n NoUndefined,\n} from \"./utils\";\n\nexport type EmptyHex = `0x`;\nexport type NullAddress = `0x0`;\n\n// based on @account-abstraction/common\nexport type PromiseOrValue<T> = T | Promise<T>;\nexport type BytesLike = Uint8Array | Hex;\nexport type Multiplier = z.input<typeof MultiplierSchema>;\n\nexport type BigNumberish = z.input<typeof BigNumberishSchema>;\nexport type BigNumberishRange = z.input<typeof BigNumberishRangeSchema>;\n\n// [!region UserOperationCallData]\nexport type UserOperationCallData =\n | {\n /* the target of the call */\n target: Address;\n /* the data passed to the target */\n data: Hex;\n /* the amount of native token to send to the target (default: 0) */\n value?: bigint;\n }\n | Hex;\n// [!endregion UserOperationCallData]\n\n// [!region BatchUserOperationCallData]\nexport type BatchUserOperationCallData = Exclude<UserOperationCallData, Hex>[];\n// [!endregion BatchUserOperationCallData]\n\nexport type UserOperationFeeOptionsField = z.input<\n typeof UserOperationFeeOptionsFieldSchema\n>;\n\nexport type UserOperationFeeOptions<\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion\n> = TEntryPointVersion extends \"0.6.0\"\n ? z.input<typeof UserOperationFeeOptionsSchema_v6>\n : TEntryPointVersion extends \"0.7.0\"\n ? z.input<typeof UserOperationFeeOptionsSchema_v7>\n : z.input<typeof UserOperationFeeOptionsSchema>;\n\nexport type UserOperationOverridesParameter<\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion,\n Required extends boolean = false\n> = Required extends true\n ? { overrides: UserOperationOverrides<TEntryPointVersion> }\n : { overrides?: UserOperationOverrides<TEntryPointVersion> };\n\n// [!region UserOperationPaymasterOverrides]\nexport type UserOperationPaymasterOverrides<\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion\n> = TEntryPointVersion extends \"0.6.0\"\n ? {\n // paymasterData overrides to bypass paymaster middleware\n paymasterAndData: Hex;\n }\n : TEntryPointVersion extends \"0.7.0\"\n ? {\n // paymasterData overrides to bypass paymaster middleware\n // if set to '0x', all paymaster related fields are omitted from the user op request\n paymasterData: Hex;\n paymaster: Address;\n paymasterVerificationGasLimit:\n | NoUndefined<\n UserOperationStruct<\"0.7.0\">[\"paymasterVerificationGasLimit\"]\n >\n | Multiplier;\n paymasterPostOpGasLimit:\n | NoUndefined<UserOperationStruct<\"0.7.0\">[\"paymasterPostOpGasLimit\"]>\n | Multiplier;\n }\n : {};\n// [!endregion UserOperationOverridesParameter]\n\n// [!region UserOperationOverrides]\nexport type UserOperationOverrides<\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion\n> = Partial<\n {\n callGasLimit:\n | UserOperationStruct<TEntryPointVersion>[\"callGasLimit\"]\n | Multiplier;\n maxFeePerGas:\n | UserOperationStruct<TEntryPointVersion>[\"maxFeePerGas\"]\n | Multiplier;\n maxPriorityFeePerGas:\n | UserOperationStruct<TEntryPointVersion>[\"maxPriorityFeePerGas\"]\n | Multiplier;\n preVerificationGas:\n | UserOperationStruct<TEntryPointVersion>[\"preVerificationGas\"]\n | Multiplier;\n verificationGasLimit:\n | UserOperationStruct<TEntryPointVersion>[\"verificationGasLimit\"]\n | Multiplier;\n /**\n * This can be used to override the key used when calling `entryPoint.getNonce`\n * It is useful when you want to use parallel nonces for user operations\n *\n * NOTE: not all bundlers fully support this feature and it could be that your bundler will still only include\n * one user operation for your account in a bundle\n */\n nonceKey: bigint;\n\n /**\n * The same state overrides for\n * [`eth_call`](https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-eth#eth-call) method.\n * An address-to-state mapping, where each entry specifies some state to be ephemerally overridden\n * prior to executing the call. State overrides allow you to customize the network state for\n * the purpose of the simulation, so this feature is useful when you need to estimate gas\n * for user operation scenarios under conditions that aren’t currently present on the live network.\n */\n stateOverride: StateOverride;\n } & UserOperationPaymasterOverrides<TEntryPointVersion>\n>;\n// [!endregion UserOperationOverrides]\n\n// [!region UserOperationRequest_v6]\n// represents the request as it needs to be formatted for v0.6 RPC requests\n// Reference: https://github.com/ethereum/ERCs/blob/8dd085d159cb123f545c272c0d871a5339550e79/ERCS/erc-4337.md#definitions\nexport interface UserOperationRequest_v6 {\n /* the origin of the request */\n sender: Address;\n /* nonce (as hex) of the transaction, returned from the entry point for this Address */\n nonce: Hex;\n /* the initCode for creating the sender if it does not exist yet, otherwise \"0x\" */\n initCode: Hex | EmptyHex;\n /* the callData passed to the target */\n callData: Hex;\n /* Gas value (as hex) used by inner account execution */\n callGasLimit: Hex;\n /* Actual gas (as hex) used by the validation of this UserOperation */\n verificationGasLimit: Hex;\n /* Gas overhead (as hex) of this UserOperation */\n preVerificationGas: Hex;\n /* Maximum fee per gas (similar to EIP-1559 max_fee_per_gas) (as hex)*/\n maxFeePerGas: Hex;\n /* Maximum priority fee per gas (similar to EIP-1559 max_priority_fee_per_gas) (as hex)*/\n maxPriorityFeePerGas: Hex;\n /* Address of paymaster sponsoring the transaction, followed by extra data to send to the paymaster (\"0x\" for self-sponsored transaction) */\n paymasterAndData: Hex | EmptyHex;\n /* Data passed into the account along with the nonce during the verification step */\n signature: Hex;\n}\n// [!endregion UserOperationRequest_v6]\n\n// [!region UserOperationRequest_v7]\n// represents the request as it needs to be formatted for v0.7 RPC requests\n// Reference: https://eips.ethereum.org/EIPS/eip-4337#definitions\nexport interface UserOperationRequest_v7 {\n /* the account making the operation */\n sender: Address;\n /* anti-replay parameter. nonce of the transaction, returned from the entry point for this address */\n nonce: Hex;\n /* account factory, only for new accounts */\n factory?: Address;\n /* data for account factory (only if account factory exists) */\n factoryData?: Hex;\n /* the data to pass to the sender during the main execution call */\n callData: Hex;\n /* the amount of gas to allocate the main execution call */\n callGasLimit: Hex;\n /* the amount of gas to allocate for the verification step */\n verificationGasLimit: Hex;\n /* extra gas to pay the bunder */\n preVerificationGas: Hex;\n /* maximum fee per gas (similar to EIP-1559 max_fee_per_gas) */\n maxFeePerGas: Hex;\n /* maximum priority fee per gas (similar to EIP-1559 max_priority_fee_per_gas) */\n maxPriorityFeePerGas: Hex;\n /* address of paymaster contract, (or empty, if account pays for itself) */\n paymaster?: Address;\n /* the amount of gas to allocate for the paymaster validation code */\n paymasterVerificationGasLimit?: Hex;\n /* the amount of gas to allocate for the paymaster post-operation code */\n paymasterPostOpGasLimit?: Hex;\n /* data for paymaster (only if paymaster exists) */\n paymasterData?: Hex;\n /* data passed into the account to verify authorization */\n signature: Hex;\n}\n// [!endregion UserOperationRequest_v7]\n\nexport type Eip7702ExtendedFields = {\n eip7702Auth?: {\n chainId: Hex;\n nonce: Hex;\n address: Address;\n r: Hex;\n s: Hex;\n yParity: Hex;\n };\n};\n\n// [!region UserOperationRequest]\n// Reference: https://eips.ethereum.org/EIPS/eip-4337#definitions\nexport type UserOperationRequest<\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion\n> = (TEntryPointVersion extends \"0.6.0\"\n ? UserOperationRequest_v6\n : TEntryPointVersion extends \"0.7.0\"\n ? UserOperationRequest_v7\n : never) &\n Eip7702ExtendedFields;\n\n// [!endregion UserOperationRequest]\n\n// [!region UserOperationEstimateGasResponse]\nexport interface UserOperationEstimateGasResponse<\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion\n> {\n /* Gas overhead of this UserOperation */\n preVerificationGas: BigNumberish;\n /* Actual gas used by the validation of this UserOperation */\n verificationGasLimit: BigNumberish;\n /* Value used by inner account execution */\n callGasLimit: BigNumberish;\n /*\n * EntryPoint v0.7.0 operations only.\n * The amount of gas to allocate for the paymaster validation code.\n * Note: `eth_estimateUserOperationGas` does not return paymasterPostOpGasLimit.\n */\n paymasterVerificationGasLimit: TEntryPointVersion extends \"0.7.0\"\n ? BigNumberish | undefined\n : never;\n}\n// [!endregion UserOperationEstimateGasResponse]\n\n// [!region UserOperationResponse]\nexport interface UserOperationResponse<\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion\n> {\n /* the User Operation */\n userOperation: UserOperationRequest<TEntryPointVersion>;\n /* the address of the entry point contract that executed the user operation */\n entryPoint: Address;\n /* the block number the user operation was included in */\n blockNumber: BigNumberish;\n /* the hash of the block the user operation was included in */\n blockHash: Hash;\n /* the hash of the transaction that included the user operation */\n transactionHash: Hash;\n}\n// [!endregion UserOperationResponse]\n\n// [!region UserOperationReceipt]\nexport interface UserOperationReceipt {\n /* The request hash of the UserOperation. */\n userOpHash: Hash;\n /* The entry point address used for the UserOperation. */\n entryPoint: Address;\n /* The account initiating the UserOperation. */\n sender: Address;\n /* The nonce used in the UserOperation. */\n nonce: BigNumberish;\n /* The paymaster used for this UserOperation (or empty). */\n paymaster?: Address;\n /* The actual amount paid (by account or paymaster) for this UserOperation. */\n actualGasCost: BigNumberish;\n /* The total gas used by this UserOperation (including preVerification, creation, validation, and execution). */\n actualGasUsed: BigNumberish;\n /* Indicates whether the execution completed without reverting. */\n success: boolean;\n /* In case of revert, this is the revert reason. */\n reason?: string;\n /* The logs generated by this UserOperation (not including logs of other UserOperations in the same bundle). */\n logs: string[];\n /* The TransactionReceipt object for the entire bundle, not only for this UserOperation. */\n receipt: TransactionReceipt;\n}\n// [!endregion UserOperationReceipt]\n\n// [!region UserOperationStruct_v6]\n// https://github.com/eth-infinitism/account-abstraction/blob/releases/v0.6/test/UserOperation.ts\n// this is used for building requests for v0.6 entry point contract\nexport interface UserOperationStruct_v6 {\n /* the origin of the request */\n sender: string;\n /* nonce of the transaction, returned from the entry point for this address */\n nonce: BigNumberish;\n /* the initCode for creating the sender if it does not exist yet, otherwise \"0x\" */\n initCode: BytesLike | \"0x\";\n /* the callData passed to the target */\n callData: BytesLike;\n /* Value used by inner account execution */\n callGasLimit?: BigNumberish;\n /* Actual gas used by the validation of this UserOperation */\n verificationGasLimit?: BigNumberish;\n /* Gas overhead of this UserOperation */\n preVerificationGas?: BigNumberish;\n /* Maximum fee per gas (similar to EIP-1559 max_fee_per_gas) */\n maxFeePerGas?: BigNumberish;\n /* Maximum priority fee per gas (similar to EIP-1559 max_priority_fee_per_gas) */\n maxPriorityFeePerGas?: BigNumberish;\n /* Address of paymaster sponsoring the transaction, followed by extra data to send to the paymaster (\"0x\" for self-sponsored transaction) */\n paymasterAndData: BytesLike | \"0x\";\n /* Data passed into the account along with the nonce during the verification step */\n signature: BytesLike;\n}\n// [!endregion UserOperationStruct_v6]\n\n// [!region UserOperationStruct_v7]\n// based on https://github.com/eth-infinitism/account-abstraction/blob/releases/v0.7/test/UserOperation.ts\n// this is used for building requests for v0.7 entry point contract\nexport interface UserOperationStruct_v7 {\n /* the account making the operation */\n sender: string;\n /* anti-replay parameter. nonce of the transaction, returned from the entry point for this address */\n nonce: BigNumberish;\n /* account factory, only for new accounts */\n factory?: string;\n /* data for account factory (only if account factory exists) */\n factoryData?: BytesLike;\n /* the data to pass to the sender during the main execution call */\n callData: BytesLike;\n /* the amount of gas to allocate the main execution call */\n callGasLimit?: BigNumberish;\n /* the amount of gas to allocate for the verification step */\n verificationGasLimit?: BigNumberish;\n /* extra gas to pay the bunder */\n preVerificationGas?: BigNumberish;\n /* maximum fee per gas (similar to EIP-1559 max_fee_per_gas) */\n maxFeePerGas?: BigNumberish;\n /* maximum priority fee per gas (similar to EIP-1559 max_priority_fee_per_gas) */\n maxPriorityFeePerGas?: BigNumberish;\n /* address of paymaster contract, (or empty, if account pays for itself) */\n paymaster?: string;\n /* the amount of gas to allocate for the paymaster validation code */\n paymasterVerificationGasLimit?: BigNumberish;\n /* the amount of gas to allocate for the paymaster post-operation code */\n paymasterPostOpGasLimit?: BigNumberish;\n /* data for paymaster (only if paymaster exists) */\n paymasterData?: BytesLike;\n /* data passed into the account to verify authorization */\n signature: BytesLike;\n}\n// [!endregion UserOperationStruct_v7]\n\n// [!region UserOperationStruct]\nexport type UserOperationStruct<\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion\n> = (TEntryPointVersion extends \"0.6.0\"\n ? UserOperationStruct_v6\n : TEntryPointVersion extends \"0.7.0\"\n ? UserOperationStruct_v7\n : never) &\n Eip7702ExtendedFields;\n// [!endregion UserOperationStruct]\n"]}
@@ -36,3 +36,4 @@ export type OneOf<T1, T2> = IsOneOf<T1, T2> extends true ? T1 : never;
36
36
  export type RecordableKeys<T> = {
37
37
  [K in keyof T]: T[K] extends string | number | symbol ? K : never;
38
38
  }[keyof T];
39
+ export type OptionalFields<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/utils/types.ts"],"names":[],"mappings":"AAAA,qBAAqB","sourcesContent":["// borrowed from viem\n\n/**\n * @description Constructs a type by excluding `undefined` from `T`.\n *\n * @example\n * NoUndefined<string | undefined>\n * => string\n */\nexport type NoUndefined<T> = T extends undefined ? never : T;\n// borrowed from viem\n/**\n * @description Checks if T is `undefined`\n * @param T - Type to check\n * @example\n * type Result = IsUndefined<undefined>\n * // ^? type Result = true\n */\n\nexport type IsUndefined<T> = [undefined] extends [T] ? true : false;\n\nexport type RequiredBy<TType, TKeys extends keyof TType> = Required<\n Pick<TType, TKeys>\n> &\n Omit<TType, TKeys>;\n\n/**\n * @description Combines members of an intersection into a readable type.\n *\n * @see https://twitter.com/mattpocockuk/status/1622730173446557697?s=20&t=NdpAcmEFXY01xkqU3KO0Mg\n * @example\n * Prettify<{ a: string } & { b: string } & { c: number, d: bigint }>\n * => { a: string, b: string, c: number, d: bigint }\n */\nexport type Prettify<T> = {\n [K in keyof T]: T[K];\n} & {};\n\nexport type WithRequired<T, K extends keyof T> = Required<Pick<T, K>>;\nexport type WithOptional<T, K extends keyof T> = Pick<Partial<T>, K>;\n\n// Checks for type equivalence, evaluates always to either `true` or `false`.\n// Semantics: (EQ<A, B> = true) <==> (A <==> B)\nexport type EQ<A, B> = [A] extends [B]\n ? [B] extends [A]\n ? true\n : false\n : false;\n\n// Auxiliary type for `IsMemberOrSubtypeOfAComponent`\n// Evaluates to `true` or `boolean` if one of the explicit components (according to the TypeScript distribution\n// mechanism for union types) of the union type equals the other given type.\n// Examples:\n// EqualsOneOfTheComponents<string, string | boolean> ⟶ boolean\n// EqualsOneOfTheComponents<string, string> ⟶ true\n// EqualsOneOfTheComponents<number, string | boolean> ⟶ false\nexport type EqualsOneOfTheComponents<T, Union> = Union extends infer Component // enforce distribution\n ? EQ<T, Component>\n : never;\n\n// Auxiliary type for `IsOneOf`\nexport type IsMemberOrSubtypeOfAComponent<\n T,\n Union,\n ConjunctionOfExplicitComponentChecks extends boolean\n> = [T] extends [Union]\n ? true extends ConjunctionOfExplicitComponentChecks\n ? true\n : false\n : false;\n\n// Checks whether the given type equals one of the explicit components of the union type. Note that in this respect we\n// consider the members of the infinite types number and string as implicit since the inbuilt distribution mechanism of\n// TypeScript does not (cannot) distribute over the infinite number of strings or numbers. However, `boolean` is treated\n// by TypeScript (and accordingly here) as the explicit union `true | false`.\n//\n// In particular, the evaluation result is `false` if the type is a proper union of components of the union type. It also\n// evaluates to false if the given type is a proper subtype of one of its explicit components.\n// It always evaluates to either `true` or `false`.\n// Examples:\n// IsOneOf<number, string | number | boolean> ⟶ true\n// IsOneOf<2 | 4, 0 | 1 | 2 | 3 | 4 | 5 | 6> ⟶ false\n// IsOneOf<'text', string> ⟶ false // only implicit but not explicit component\nexport type IsOneOf<T, Union> = IsMemberOrSubtypeOfAComponent<\n T,\n Union,\n EqualsOneOfTheComponents<T, Union>\n>;\n\nexport type OneOf<T1, T2> = IsOneOf<T1, T2> extends true ? T1 : never;\n\nexport type RecordableKeys<T> = {\n [K in keyof T]: T[K] extends string | number | symbol ? K : never;\n}[keyof T];\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/utils/types.ts"],"names":[],"mappings":"AAAA,qBAAqB","sourcesContent":["// borrowed from viem\n\n/**\n * @description Constructs a type by excluding `undefined` from `T`.\n *\n * @example\n * NoUndefined<string | undefined>\n * => string\n */\nexport type NoUndefined<T> = T extends undefined ? never : T;\n// borrowed from viem\n/**\n * @description Checks if T is `undefined`\n * @param T - Type to check\n * @example\n * type Result = IsUndefined<undefined>\n * // ^? type Result = true\n */\n\nexport type IsUndefined<T> = [undefined] extends [T] ? true : false;\n\nexport type RequiredBy<TType, TKeys extends keyof TType> = Required<\n Pick<TType, TKeys>\n> &\n Omit<TType, TKeys>;\n\n/**\n * @description Combines members of an intersection into a readable type.\n *\n * @see https://twitter.com/mattpocockuk/status/1622730173446557697?s=20&t=NdpAcmEFXY01xkqU3KO0Mg\n * @example\n * Prettify<{ a: string } & { b: string } & { c: number, d: bigint }>\n * => { a: string, b: string, c: number, d: bigint }\n */\nexport type Prettify<T> = {\n [K in keyof T]: T[K];\n} & {};\n\nexport type WithRequired<T, K extends keyof T> = Required<Pick<T, K>>;\nexport type WithOptional<T, K extends keyof T> = Pick<Partial<T>, K>;\n\n// Checks for type equivalence, evaluates always to either `true` or `false`.\n// Semantics: (EQ<A, B> = true) <==> (A <==> B)\nexport type EQ<A, B> = [A] extends [B]\n ? [B] extends [A]\n ? true\n : false\n : false;\n\n// Auxiliary type for `IsMemberOrSubtypeOfAComponent`\n// Evaluates to `true` or `boolean` if one of the explicit components (according to the TypeScript distribution\n// mechanism for union types) of the union type equals the other given type.\n// Examples:\n// EqualsOneOfTheComponents<string, string | boolean> ⟶ boolean\n// EqualsOneOfTheComponents<string, string> ⟶ true\n// EqualsOneOfTheComponents<number, string | boolean> ⟶ false\nexport type EqualsOneOfTheComponents<T, Union> = Union extends infer Component // enforce distribution\n ? EQ<T, Component>\n : never;\n\n// Auxiliary type for `IsOneOf`\nexport type IsMemberOrSubtypeOfAComponent<\n T,\n Union,\n ConjunctionOfExplicitComponentChecks extends boolean\n> = [T] extends [Union]\n ? true extends ConjunctionOfExplicitComponentChecks\n ? true\n : false\n : false;\n\n// Checks whether the given type equals one of the explicit components of the union type. Note that in this respect we\n// consider the members of the infinite types number and string as implicit since the inbuilt distribution mechanism of\n// TypeScript does not (cannot) distribute over the infinite number of strings or numbers. However, `boolean` is treated\n// by TypeScript (and accordingly here) as the explicit union `true | false`.\n//\n// In particular, the evaluation result is `false` if the type is a proper union of components of the union type. It also\n// evaluates to false if the given type is a proper subtype of one of its explicit components.\n// It always evaluates to either `true` or `false`.\n// Examples:\n// IsOneOf<number, string | number | boolean> ⟶ true\n// IsOneOf<2 | 4, 0 | 1 | 2 | 3 | 4 | 5 | 6> ⟶ false\n// IsOneOf<'text', string> ⟶ false // only implicit but not explicit component\nexport type IsOneOf<T, Union> = IsMemberOrSubtypeOfAComponent<\n T,\n Union,\n EqualsOneOfTheComponents<T, Union>\n>;\n\nexport type OneOf<T1, T2> = IsOneOf<T1, T2> extends true ? T1 : never;\n\nexport type RecordableKeys<T> = {\n [K in keyof T]: T[K] extends string | number | symbol ? K : never;\n}[keyof T];\n\n// Marks a subset of the fields of T as optional.\nexport type OptionalFields<T, K extends keyof T> = Pick<Partial<T>, K> &\n Omit<T, K>;\n"]}
@@ -1 +1 @@
1
- export declare const VERSION = "4.12.0";
1
+ export declare const VERSION = "4.13.0";
@@ -1,4 +1,4 @@
1
1
  // This file is autogenerated by inject-version.ts. Any changes will be
2
2
  // overwritten on commit!
3
- export const VERSION = "4.12.0";
3
+ export const VERSION = "4.13.0";
4
4
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,yBAAyB;AACzB,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["// This file is autogenerated by inject-version.ts. Any changes will be\n// overwritten on commit!\nexport const VERSION = \"4.12.0\";\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,yBAAyB;AACzB,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["// This file is autogenerated by inject-version.ts. Any changes will be\n// overwritten on commit!\nexport const VERSION = \"4.13.0\";\n"]}
@@ -75,8 +75,10 @@ export type ToSmartContractAccountParams<Name extends string = string, TTranspor
75
75
  getDummySignature: () => Hex | Promise<Hex>;
76
76
  encodeExecute: (tx: AccountOp) => Promise<Hex>;
77
77
  encodeBatchExecute?: (txs: AccountOp[]) => Promise<Hex>;
78
+ getNonce?: (nonceKey?: bigint) => Promise<bigint>;
78
79
  signUserOperationHash?: (uoHash: Hex) => Promise<Hex>;
79
80
  encodeUpgradeToAndCall?: (params: UpgradeToAndCallParams) => Promise<Hex>;
81
+ getImplementationAddress?: () => Promise<NullAddress | Address>;
80
82
  } & Omit<CustomSource, "signTransaction" | "address">;
81
83
  /**
82
84
  * Parses the factory address and factory calldata from the provided account initialization code (initCode).
@@ -120,5 +122,5 @@ export type GetAccountAddressParams = {
120
122
  * @returns {Promise<Address>} A promise that resolves to the account address
121
123
  */
122
124
  export declare const getAccountAddress: ({ client, entryPoint, accountAddress, getAccountInitCode, }: GetAccountAddressParams) => Promise<`0x${string}`>;
123
- export declare function toSmartContractAccount<Name extends string = string, TTransport extends Transport = Transport, TChain extends Chain = Chain, TEntryPointVersion extends EntryPointVersion = EntryPointVersion>({ transport, chain, entryPoint, source, accountAddress, getAccountInitCode, signMessage, signTypedData, encodeBatchExecute, encodeExecute, getDummySignature, signUserOperationHash, encodeUpgradeToAndCall, }: ToSmartContractAccountParams<Name, TTransport, TChain, TEntryPointVersion>): Promise<SmartContractAccount<Name, TEntryPointVersion>>;
125
+ export declare function toSmartContractAccount<Name extends string = string, TTransport extends Transport = Transport, TChain extends Chain = Chain, TEntryPointVersion extends EntryPointVersion = EntryPointVersion>({ transport, chain, entryPoint, source, accountAddress, getAccountInitCode, getNonce, signMessage, signTypedData, encodeBatchExecute, encodeExecute, getDummySignature, signUserOperationHash, encodeUpgradeToAndCall, }: ToSmartContractAccountParams<Name, TTransport, TChain, TEntryPointVersion>): Promise<SmartContractAccount<Name, TEntryPointVersion>>;
124
126
  //# sourceMappingURL=smartContractAccount.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"smartContractAccount.d.ts","sourceRoot":"","sources":["../../../src/account/smartContractAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,OAAO,EACZ,KAAK,KAAK,EACV,KAAK,YAAY,EACjB,KAAK,GAAG,EACR,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,SAAS,EACd,KAAK,SAAS,EACd,KAAK,mBAAmB,EACzB,MAAM,MAAM,CAAC;AAGd,OAAO,KAAK,EACV,aAAa,EACb,sBAAsB,EACtB,iBAAiB,EAClB,MAAM,wBAAwB,CAAC;AAWhC,OAAO,KAAK,E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AAqB,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;IACtD,sBAAsB,CAAC,EAAE,CAAC,MAAM,EAAE,sBAAsB,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;CAC3E,GAAG,IAAI,CAAC,YAAY,EAAE,iBAAiB,GAAG,SAAS,CAAC,CAAC;AAGtD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,sCAAsC,aACvC,GAAG,KACZ,CAAC,OAAO,EAAE,GAAG,CAIf,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,MAAM,EAAE,YAAY,CAAC;IACrB,UAAU,EAAE,aAAa,CAAC;IAC1B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,kBAAkB,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC;CACxC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,iBAAiB,gEAK3B,uBAAuB,2BAkCzB,CAAC;AAGF,wBAAsB,sBAAsB,CAC1C,IAAI,SAAS,MAAM,GAAG,MAAM,EAC5B,UAAU,SAAS,SAAS,GAAG,SAAS,EACxC,MAAM,SAAS,KAAK,GAAG,KAAK,EAC5B,kBAAkB,SAAS,iBAAiB,GAAG,iBAAiB,EAChE,EACA,SAAS,EACT,KAAK,EACL,UAAU,EACV,MAAM,EACN,cAAc,EACd,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,kBAAkB,EAClB,aAAa,EACb,iBAAiB,EACjB,qBAAqB,EACrB,sBAAsB,GACvB,EAAE,4BAA4B,CAC7B,IAAI,EACJ,UAAU,EACV,MAAM,EACN,kBAAkB,CACnB,GAAG,OAAO,CAAC,oBAAoB,CAAC,IAAI,EAAE,kBAAkB,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"smartContractAccount.d.ts","sourceRoot":"","sources":["../../../src/account/smartContractAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAA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EAC5B,kBAAkB,SAAS,iBAAiB,GAAG,iBAAiB,EAChE,EACA,SAAS,EACT,KAAK,EACL,UAAU,EACV,MAAM,EACN,cAAc,EACd,kBAAkB,EAClB,QAAQ,EACR,WAAW,EACX,aAAa,EACb,kBAAkB,EAClB,aAAa,EACb,iBAAiB,EACjB,qBAAqB,EACrB,sBAAsB,GACvB,EAAE,4BAA4B,CAC7B,IAAI,EACJ,UAAU,EACV,MAAM,EACN,kBAAkB,CACnB,GAAG,OAAO,CAAC,oBAAoB,CAAC,IAAI,EAAE,kBAAkB,CAAC,CAAC,CAAC"}
@@ -1024,7 +1024,7 @@ declare const _default: {
1024
1024
  readonly type: "receive";
1025
1025
  }];
1026
1026
  getUserOperationHash: (request: UserOperationRequest<"0.6.0">, entryPointAddress: Address, chainId: number) => Hash;
1027
- packUserOperation: (request: import("../types.js").UserOperationRequest_v6) => `0x${string}`;
1027
+ packUserOperation: (request: UserOperationRequest<"0.6.0">) => `0x${string}`;
1028
1028
  };
1029
1029
  export default _default;
1030
1030
  //# sourceMappingURL=0.6.d.ts.map
@@ -781,7 +781,7 @@ declare const _default: {
781
781
  readonly type: "receive";
782
782
  }];
783
783
  getUserOperationHash: (request: UserOperationRequest<"0.7.0">, entryPointAddress: Address, chainId: number) => Hash;
784
- packUserOperation: (request: UserOperationRequest_v7) => `0x${string}`;
784
+ packUserOperation: (request: UserOperationRequest<"0.7.0">) => `0x${string}`;
785
785
  };
786
786
  export default _default;
787
787
  export declare function packAccountGasLimits(data: Pick<UserOperationRequest_v7, "verificationGasLimit" | "callGasLimit"> | Pick<UserOperationRequest_v7, "maxPriorityFeePerGas" | "maxFeePerGas">): Hex;
@@ -70,4 +70,14 @@ export declare class EntityIdOverrideError extends BaseError {
70
70
  */
71
71
  constructor();
72
72
  }
73
+ /**
74
+ * Error class denoting that the provided ma v2 account mode is invalid.
75
+ */
76
+ export declare class InvalidModularAccountV2Mode extends BaseError {
77
+ name: string;
78
+ /**
79
+ * Initializes a new instance of the error message with a default message indicating that the provided ma v2 account mode is invalid.
80
+ */
81
+ constructor();
82
+ }
73
83
  //# sourceMappingURL=client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/errors/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC;;GAEG;AACH,qBAAa,uBAAwB,SAAQ,SAAS;IAC3C,IAAI,SAA6B;IAE1C;;;;;;OAMG;gBACS,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CAQnE;AAED;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,SAAS;IACtC,IAAI,SAAwB;IAErC;;;;OAIG;gBACS,MAAM,CAAC,EAAE,MAAM;CAG5B;AAED;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,SAAS;IACtC,IAAI,SAAwB;IAErC;;OAEG;;CAIJ;AAED;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,SAAS;IACxC,IAAI,SAA0B;IAEvC;;;;OAIG;gBACS,QAAQ,EAAE,MAAM;CAK7B;AAED;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,SAAS;IACxC,IAAI,SAA0B;IAEvC;;;;OAIG;gBACS,QAAQ,EAAE,MAAM;CAK7B;AAED;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,SAAS;IACzC,IAAI,SAA2B;IAExC;;OAEG;;CAIJ"}
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/errors/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC;;GAEG;AACH,qBAAa,uBAAwB,SAAQ,SAAS;IAC3C,IAAI,SAA6B;IAE1C;;;;;;OAMG;gBACS,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CAQnE;AAED;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,SAAS;IACtC,IAAI,SAAwB;IAErC;;;;OAIG;gBACS,MAAM,CAAC,EAAE,MAAM;CAG5B;AAED;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,SAAS;IACtC,IAAI,SAAwB;IAErC;;OAEG;;CAIJ;AAED;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,SAAS;IACxC,IAAI,SAA0B;IAEvC;;;;OAIG;gBACS,QAAQ,EAAE,MAAM;CAK7B;AAED;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,SAAS;IACxC,IAAI,SAA0B;IAEvC;;;;OAIG;gBACS,QAAQ,EAAE,MAAM;CAK7B;AAED;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,SAAS;IACzC,IAAI,SAA2B;IAExC;;OAEG;;CAIJ;AAED;;GAEG;AACH,qBAAa,2BAA4B,SAAQ,SAAS;IAC/C,IAAI,SAAiC;IAE9C;;OAEG;;CAIJ"}
@@ -33,13 +33,15 @@ export { defaultEntryPointVersion, entryPointRegistry, getEntryPoint, isEntryPoi
33
33
  export type * from "./entrypoint/types.js";
34
34
  export { AccountNotFoundError, AccountRequiresOwnerError, BatchExecutionNotSupportedError, DefaultFactoryNotDefinedError, FailedToGetStorageSlotError, GetCounterFactualAddressError, IncorrectAccountType, SignTransactionNotSupportedError, SmartAccountWithSignerRequiredError, UpgradeToAndCallNotSupportedError, UpgradesNotSupportedError, } from "./errors/account.js";
35
35
  export { BaseError } from "./errors/base.js";
36
- export { ChainNotFoundError, IncompatibleClientError, InvalidRpcUrlError, InvalidEntityIdError, InvalidNonceKeyError, EntityIdOverrideError, } from "./errors/client.js";
36
+ export { ChainNotFoundError, IncompatibleClientError, InvalidRpcUrlError, InvalidEntityIdError, InvalidNonceKeyError, EntityIdOverrideError, InvalidModularAccountV2Mode, } from "./errors/client.js";
37
37
  export { EntryPointNotFoundError, InvalidEntryPointError, } from "./errors/entrypoint.js";
38
38
  export { InvalidSignerTypeError } from "./errors/signer.js";
39
39
  export { FailedToFindTransactionError, TransactionMissingToParamError, } from "./errors/transaction.js";
40
40
  export { InvalidUserOperationError, WaitForUserOperationError, } from "./errors/useroperation.js";
41
41
  export { LogLevel, Logger } from "./logger.js";
42
42
  export { middlewareActions } from "./middleware/actions.js";
43
+ export { default7702UserOpSigner } from "./middleware/defaults/7702signer.js";
44
+ export { default7702GasEstimator } from "./middleware/defaults/7702gasEstimator.js";
43
45
  export { defaultFeeEstimator } from "./middleware/defaults/feeEstimator.js";
44
46
  export { defaultGasEstimator } from "./middleware/defaults/gasEstimator.js";
45
47
  export { defaultPaymasterAndData } from "./middleware/defaults/paymasterAndData.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,GAAG,EAAE,MAAM,SAAS,CAAC;AACnC,YAAY,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AAEnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAC5E,mBAAmB,mCAAmC,CAAC;AACvD,OAAO,EACL,iBAAiB,EACjB,wBAAwB,EACxB,sCAAsC,EACtC,sBAAsB,GACvB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,8CAA8C,CAAC;AAClF,OAAO,EAAE,wBAAwB,EAAE,MAAM,oDAAoD,CAAC;AAC9F,OAAO,EAAE,yBAAyB,EAAE,MAAM,qDAAqD,CAA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yBAAyB,EACzB,kBAAkB,GACnB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,KAAK,EAAE,KAAK,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACxE,mBAAmB,YAAY,CAAC;AAChC,mBAAmB,kBAAkB,CAAC;AACtC,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,WAAW,EACX,SAAS,EACT,gBAAgB,EAChB,QAAQ,EACR,oBAAoB,EACpB,mBAAmB,EACnB,8BAA8B,EAC9B,SAAS,EACT,SAAS,EACT,cAAc,EACd,sBAAsB,EACtB,8BAA8B,EAC9B,sBAAsB,EACtB,WAAW,EACX,eAAe,EACf,iCAAiC,EACjC,cAAc,EACd,YAAY,EACZ,cAAc,EACd,qBAAqB,EACrB,IAAI,EACJ,iBAAiB,EACjB,SAAS,EACT,QAAQ,GACT,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,37 @@
1
+ import type { ClientMiddlewareFn } from "../types";
2
+ /**
3
+ * A middleware function to estimate the gas usage of a user operation when using an EIP-7702 delegated account. Has an optional custom gas estimator.
4
+ * This function is only compatible with accounts using EntryPoint v0.7.0, and the account must have an implementation address defined in `getImplementationAddress()`.
5
+ *
6
+ * @example
7
+ * ```ts twoslash
8
+ * import {
9
+ * default7702GasEstimator,
10
+ * default7702UserOpSigner,
11
+ * createSmartAccountClient,
12
+ * type SmartAccountClient,
13
+ * } from "@aa-sdk/core";
14
+ * import {
15
+ * createModularAccountV2,
16
+ * type CreateModularAccountV2ClientParams,
17
+ * } from "@account-kit/smart-contracts";
18
+ *
19
+ * async function createSMA7702AccountClient(
20
+ * config: CreateModularAccountV2ClientParams
21
+ * ): Promise<SmartAccountClient> {
22
+ * const sma7702Account = await createModularAccountV2({ ...config, mode: "7702" });
23
+ *
24
+ * return createSmartAccountClient({
25
+ * account: sma7702Account,
26
+ * gasEstimator: default7702GasEstimator(config.gasEstimator),
27
+ * signUserOperation: default7702UserOpSigner(config.signUserOperation),
28
+ * ...config,
29
+ * });
30
+ * }
31
+ * ```
32
+ *
33
+ * @param {ClientMiddlewareFn} [gasEstimator] Optional custom gas estimator function
34
+ * @returns {Function} A function that takes user operation struct and parameters, estimates gas usage, and returns the user operation with gas limits.
35
+ */
36
+ export declare const default7702GasEstimator: (gasEstimator?: ClientMiddlewareFn) => ClientMiddlewareFn;
37
+ //# sourceMappingURL=7702gasEstimator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"7702gasEstimator.d.ts","sourceRoot":"","sources":["../../../../src/middleware/defaults/7702gasEstimator.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAGnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,eAAO,MAAM,uBAAuB,EAAE,CACpC,YAAY,CAAC,EAAE,kBAAkB,KAC9B,kBAkCF,CAAC"}
@@ -0,0 +1,38 @@
1
+ import type { ClientMiddlewareFn } from "../types";
2
+ /**
3
+ * Provides a default middleware function for signing user operations with a client account when using EIP-7702 delegated accounts.
4
+ * If the signer doesn't support `signAuthorization`, then this just runs the provided `signUserOperation` middleware.
5
+ * This function is only compatible with accounts using EntryPoint v0.7.0, and the account must have an implementation address defined in `getImplementationAddress()`.
6
+ *
7
+ * @example
8
+ * ```ts twoslash
9
+ * import {
10
+ * default7702GasEstimator,
11
+ * default7702UserOpSigner,
12
+ * createSmartAccountClient,
13
+ * type SmartAccountClient,
14
+ * } from "@aa-sdk/core";
15
+ * import {
16
+ * createModularAccountV2,
17
+ * type CreateModularAccountV2ClientParams,
18
+ * } from "@account-kit/smart-contracts";
19
+ *
20
+ * async function createSMA7702AccountClient(
21
+ * config: CreateModularAccountV2ClientParams
22
+ * ): Promise<SmartAccountClient> {
23
+ * const sma7702Account = await createModularAccountV2({ ...config, mode: "7702" });
24
+ *
25
+ * return createSmartAccountClient({
26
+ * account: sma7702Account,
27
+ * gasEstimator: default7702GasEstimator(config.gasEstimator),
28
+ * signUserOperation: default7702UserOpSigner(config.signUserOperation),
29
+ * ...config,
30
+ * });
31
+ * }
32
+ * ```
33
+ *
34
+ * @param {ClientMiddlewareFn} [userOpSigner] Optional user operation signer function
35
+ * @returns {Function} A middleware function that signs EIP-7702 authorization tuples if necessary, and also uses the provided or default user operation signer to generate the user op signature.
36
+ */
37
+ export declare const default7702UserOpSigner: (userOpSigner?: ClientMiddlewareFn) => ClientMiddlewareFn;
38
+ //# sourceMappingURL=7702signer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"7702signer.d.ts","sourceRoot":"","sources":["../../../../src/middleware/defaults/7702signer.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAGnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,eAAO,MAAM,uBAAuB,EAAE,CACpC,YAAY,CAAC,EAAE,kBAAkB,KAC9B,kBA4DF,CAAC"}