@aa-sdk/core 4.14.0 → 4.15.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.
@@ -1 +1 @@
1
- {"version":3,"file":"smartAccountClient.js","sourceRoot":"","sources":["../../../src/client/smartAccountClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,GAUP,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAG7D,OAAO,EAAE,mBAAmB,EAAsB,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EAGN,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,yBAAyB,GAE1B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC;AA4G3D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,wBAAwB,CACtC,MAAgC;IAEhC,MAAM,EACJ,GAAG,GAAG,SAAS,EACf,IAAI,GAAG,kBAAkB,EACzB,SAAS,EACT,IAAI,GAAG,oBAAoB,EAC3B,GAAG,MAAM,EACV,GAAG,MAAM,CAAC;IAEX,MAAM,MAAM,GAAuB,mBAAmB,CAAC;QACrD,GAAG,MAAM;QACT,GAAG;QACH,IAAI;QACJ,2EAA2E;QAC3E,iFAAiF;QACjF,wEAAwE;QACxE,IAAI,EAAE,oBAAoB;QAC1B,gCAAgC;QAChC,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE;YAClB,MAAM,YAAY,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;YAErC,OAAO,MAAM,CAAC;gBACZ,KAAK,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE;oBAC9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AE,CAAC;AAC7B,CAAC;AAgCD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,oCAAoC,CAClD,MAEC;IAED,OAAO,wBAAwB,CAAC;QAC9B,GAAG,MAAM;QACT,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK;QAC1B,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;KACjC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {\n custom,\n type Chain,\n type Client,\n type ClientConfig,\n type CustomTransport,\n type FormattedTransactionRequest,\n type PublicActions,\n type PublicRpcSchema,\n type RpcSchema,\n type Transport,\n} from \"viem\";\nimport { z } from \"zod\";\nimport type { SmartContractAccount } from \"../account/smartContractAccount.js\";\nimport type { UserOperationContext } from \"../actions/smartAccount/types.js\";\nimport { AccountNotFoundError } from \"../errors/account.js\";\nimport { ChainNotFoundError } from \"../errors/client.js\";\nimport { middlewareActions } from \"../middleware/actions.js\";\nimport type { ClientMiddleware } from \"../middleware/types.js\";\nimport type { Prettify } from \"../utils/index.js\";\nimport { createBundlerClient, type BundlerClient } from \"./bundlerClient.js\";\nimport {\n type BundlerActions,\n type BundlerRpcSchema,\n} from \"./decorators/bundlerClient.js\";\nimport {\n smartAccountClientActions,\n type BaseSmartAccountClientActions,\n} from \"./decorators/smartAccountClient.js\";\nimport { SmartAccountClientOptsSchema } from \"./schema.js\";\nimport type { ClientMiddlewareConfig } from \"./types.js\";\n\ntype SmartAccountClientOpts = z.output<typeof SmartAccountClientOptsSchema>;\n\nexport type SmartAccountClientConfig<\n transport extends Transport = Transport,\n chain extends Chain | undefined = Chain | undefined,\n account extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n context extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n> = Prettify<\n Pick<\n ClientConfig<transport, chain, account>,\n | \"cacheTime\"\n | \"chain\"\n | \"key\"\n | \"name\"\n | \"pollingInterval\"\n | \"transport\"\n | \"type\"\n > & {\n account?: account;\n opts?: z.input<typeof SmartAccountClientOptsSchema>;\n } & ClientMiddlewareConfig<context>\n>;\n\nexport type SmartAccountClientRpcSchema = [\n ...BundlerRpcSchema,\n ...PublicRpcSchema\n];\n\n//#region SmartAccountClientActions\nexport type SmartAccountClientActions<\n chain extends Chain | undefined = Chain | undefined,\n account extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n context extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n> = BaseSmartAccountClientActions<chain, account, context> &\n BundlerActions &\n PublicActions;\n//#endregion SmartAccountClientActions\n\n//#region SmartAccountClient\nexport type SmartAccountClient<\n transport extends Transport = Transport,\n chain extends Chain | undefined = Chain | undefined,\n account extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n actions extends Record<string, unknown> = Record<string, unknown>,\n rpcSchema extends RpcSchema = SmartAccountClientRpcSchema,\n context extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n> = Prettify<\n Client<\n transport,\n chain,\n account,\n rpcSchema,\n actions & SmartAccountClientActions<chain, account, context>\n >\n>;\n//#endregion SmartAccountClient\n\nexport type BaseSmartAccountClient<\n transport extends Transport = Transport,\n chain extends Chain | undefined = Chain | undefined,\n account extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n context extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n> = Prettify<\n Client<\n transport,\n chain,\n account,\n [...BundlerRpcSchema, ...PublicRpcSchema],\n {\n middleware: ClientMiddleware<context>;\n } & SmartAccountClientOpts &\n BundlerActions &\n PublicActions\n >\n>;\n\nexport function createSmartAccountClient<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n>(\n config: SmartAccountClientConfig<TTransport, TChain, TAccount, TContext>\n): SmartAccountClient<TTransport, TChain, TAccount>;\n\n/**\n * Creates a smart account client using the provided configuration. This client handles various Ethereum transactions and message signing operations.\n *\n * @example\n * ```ts\n * import { createSmartAccountClient, toSmartContractAccount } from \"@aa-sdk/core\";\n * import { http } from \"viem\";\n * import { sepolia } from \"viem/chains\";\n *\n * const client = createSmartAccountClient({\n * chain: sepolia,\n * transport: http(\"RPC_URL\"),\n * // optionally hoist the account\n * account: toSmartContractAccount(...),\n * });\n * ```\n *\n * @param {SmartAccountClientConfig} config The configuration for creating the smart account client\n * @returns {SmartAccountClient} A smart account client capable of handling transactions, message signing, and other operations on a smart account\n */\nexport function createSmartAccountClient(\n config: SmartAccountClientConfig\n): SmartAccountClient {\n const {\n key = \"account\",\n name = \"account provider\",\n transport,\n type = \"SmartAccountClient\",\n ...params\n } = config;\n\n const client: SmartAccountClient = createBundlerClient({\n ...params,\n key,\n name,\n // we start out with this because the base methods for a SmartAccountClient\n // require a smart account client, but once we have completed building everything\n // we want to override this value with the one passed in by the extender\n type: \"SmartAccountClient\",\n // TODO: this needs to be tested\n transport: (opts) => {\n const rpcTransport = transport(opts);\n\n return custom({\n async request({ method, params }) {\n switch (method) {\n case \"eth_accounts\": {\n if (!client.account) {\n throw new AccountNotFoundError();\n }\n\n return [client.account.address];\n }\n case \"eth_sendTransaction\":\n if (!client.account) {\n throw new AccountNotFoundError();\n }\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n const [tx] = params as [FormattedTransactionRequest];\n return client.sendTransaction({\n ...tx,\n account: client.account,\n chain: client.chain,\n });\n case \"eth_sign\":\n if (!client.account) {\n throw new AccountNotFoundError();\n }\n const [address, data] = params!;\n if (address !== client.account.address) {\n throw new Error(\n \"cannot sign for address that is not the current account\"\n );\n }\n return client.signMessage(data);\n case \"personal_sign\": {\n if (!client.account) {\n throw new AccountNotFoundError();\n }\n const [data, address] = params!;\n if (address !== client.account.address) {\n throw new Error(\n \"cannot sign for address that is not the current account\"\n );\n }\n return client.signMessage(data);\n }\n case \"eth_signTypedData_v4\": {\n if (!client.account) {\n throw new AccountNotFoundError();\n }\n const [address, dataParams] = params!;\n if (address !== client.account.address) {\n throw new Error(\n \"cannot sign for address that is not the current account\"\n );\n }\n return client.signTypedData(dataParams);\n }\n case \"eth_chainId\":\n if (!opts.chain) {\n throw new ChainNotFoundError();\n }\n\n return opts.chain.id;\n default:\n // TODO: there's probably a number of methods we just don't support, will need to test most of them out\n // first let's get something working though\n return rpcTransport.request({ method, params });\n }\n },\n })(opts);\n },\n })\n .extend(() => ({\n ...SmartAccountClientOptsSchema.parse(config.opts ?? {}),\n }))\n .extend(middlewareActions(config))\n .extend(smartAccountClientActions);\n\n return { ...client, type };\n}\n\nexport function createSmartAccountClientFromExisting<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TClient extends BundlerClient<TTransport> = BundlerClient<TTransport>,\n TActions extends SmartAccountClientActions<\n TChain,\n TAccount,\n TContext\n > = SmartAccountClientActions<TChain, TAccount>,\n TRpcSchema extends SmartAccountClientRpcSchema = SmartAccountClientRpcSchema,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n>(\n config: Omit<\n SmartAccountClientConfig<Transport, TChain, TAccount, TContext>,\n \"transport\" | \"chain\"\n > & { client: TClient }\n): SmartAccountClient<\n CustomTransport,\n TChain,\n TAccount,\n TActions,\n TRpcSchema,\n TContext\n>;\n\n/**\n * Creates a smart account client using an existing client and specific configuration. This function can be used to reuse a pre-existing BundlerClient while customizing other aspects of the smart account.\n *\n * @example\n * ```ts\n * import {\n * createBundlerClient,\n * createSmartAccountClientFromExisting,\n * toSmartContractAccount\n * } from \"@aa-sdk/core\";\n *\n * const bundlerClient = createBundlerClient(...);\n * const client = createSmartAccountClientFromExisting({\n * client,\n * account: toSmartContractAccount(...),\n * })\n * ```\n *\n * @param {Omit<SmartAccountClientConfig, \"transport\" | \"chain\"> & {client: BundlerClient}} config the configuration object which includes the client\n * @returns {SmartAccountClient} A smart account client created from the existing BundlerClient\n */\nexport function createSmartAccountClientFromExisting(\n config: Omit<SmartAccountClientConfig, \"transport\" | \"chain\"> & {\n client: BundlerClient;\n }\n): SmartAccountClient {\n return createSmartAccountClient({\n ...config,\n chain: config.client.chain,\n transport: custom(config.client),\n });\n}\n"]}
1
+ {"version":3,"file":"smartAccountClient.js","sourceRoot":"","sources":["../../../src/client/smartAccountClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,GAUP,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAG7D,OAAO,EAAE,mBAAmB,EAAsB,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EAGN,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,yBAAyB,GAE1B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC;AA4G3D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,wBAAwB,CACtC,MAAgC;IAEhC,MAAM,EACJ,GAAG,GAAG,SAAS,EACf,IAAI,GAAG,kBAAkB,EACzB,SAAS,EACT,IAAI,GAAG,oBAAoB,EAC3B,GAAG,MAAM,EACV,GAAG,MAAM,CAAC;IAEX,MAAM,MAAM,GAAuB,mBAAmB,CAAC;QACrD,GAAG,MAAM;QACT,GAAG;QACH,IAAI;QACJ,2EAA2E;QAC3E,iFAAiF;QACjF,wEAAwE;QACxE,IAAI,EAAE,oBAAoB;QAC1B,gCAAgC;QAChC,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE;YAClB,MAAM,YAAY,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;YAErC,OAAO,MAAM,CAAC;gBACZ,KAAK,CAAC,OAAO,CAAC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AAO,EAAE,GAAG,MAAM,EAAE,IAAI,EAAE,CAAC;AAC7B,CAAC;AAgCD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,oCAAoC,CAClD,MAEC;IAED,OAAO,wBAAwB,CAAC;QAC9B,GAAG,MAAM;QACT,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK;QAC1B,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;KACjC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {\n custom,\n type Chain,\n type Client,\n type ClientConfig,\n type CustomTransport,\n type FormattedTransactionRequest,\n type PublicActions,\n type PublicRpcSchema,\n type RpcSchema,\n type Transport,\n} from \"viem\";\nimport { z } from \"zod\";\nimport type { SmartContractAccount } from \"../account/smartContractAccount.js\";\nimport type { UserOperationContext } from \"../actions/smartAccount/types.js\";\nimport { AccountNotFoundError } from \"../errors/account.js\";\nimport { ChainNotFoundError } from \"../errors/client.js\";\nimport { middlewareActions } from \"../middleware/actions.js\";\nimport type { ClientMiddleware } from \"../middleware/types.js\";\nimport type { Prettify } from \"../utils/index.js\";\nimport { createBundlerClient, type BundlerClient } from \"./bundlerClient.js\";\nimport {\n type BundlerActions,\n type BundlerRpcSchema,\n} from \"./decorators/bundlerClient.js\";\nimport {\n smartAccountClientActions,\n type BaseSmartAccountClientActions,\n} from \"./decorators/smartAccountClient.js\";\nimport { SmartAccountClientOptsSchema } from \"./schema.js\";\nimport type { ClientMiddlewareConfig } from \"./types.js\";\n\ntype SmartAccountClientOpts = z.output<typeof SmartAccountClientOptsSchema>;\n\nexport type SmartAccountClientConfig<\n transport extends Transport = Transport,\n chain extends Chain | undefined = Chain | undefined,\n account extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n context extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n> = Prettify<\n Pick<\n ClientConfig<transport, chain, account>,\n | \"cacheTime\"\n | \"chain\"\n | \"key\"\n | \"name\"\n | \"pollingInterval\"\n | \"transport\"\n | \"type\"\n > & {\n account?: account;\n opts?: z.input<typeof SmartAccountClientOptsSchema>;\n } & ClientMiddlewareConfig<context>\n>;\n\nexport type SmartAccountClientRpcSchema = [\n ...BundlerRpcSchema,\n ...PublicRpcSchema\n];\n\n// [!region SmartAccountClientActions]\nexport type SmartAccountClientActions<\n chain extends Chain | undefined = Chain | undefined,\n account extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n context extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n> = BaseSmartAccountClientActions<chain, account, context> &\n BundlerActions &\n PublicActions;\n// [!endregion SmartAccountClientActions]\n\n// [!region SmartAccountClient]\nexport type SmartAccountClient<\n transport extends Transport = Transport,\n chain extends Chain | undefined = Chain | undefined,\n account extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n actions extends Record<string, unknown> = Record<string, unknown>,\n rpcSchema extends RpcSchema = SmartAccountClientRpcSchema,\n context extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n> = Prettify<\n Client<\n transport,\n chain,\n account,\n rpcSchema,\n actions & SmartAccountClientActions<chain, account, context>\n >\n>;\n// [!endregion SmartAccountClient]\n\nexport type BaseSmartAccountClient<\n transport extends Transport = Transport,\n chain extends Chain | undefined = Chain | undefined,\n account extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n context extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n> = Prettify<\n Client<\n transport,\n chain,\n account,\n [...BundlerRpcSchema, ...PublicRpcSchema],\n {\n middleware: ClientMiddleware<context>;\n } & SmartAccountClientOpts &\n BundlerActions &\n PublicActions\n >\n>;\n\nexport function createSmartAccountClient<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n>(\n config: SmartAccountClientConfig<TTransport, TChain, TAccount, TContext>\n): SmartAccountClient<TTransport, TChain, TAccount>;\n\n/**\n * Creates a smart account client using the provided configuration. This client handles various Ethereum transactions and message signing operations.\n *\n * @example\n * ```ts\n * import { createSmartAccountClient, toSmartContractAccount } from \"@aa-sdk/core\";\n * import { http } from \"viem\";\n * import { sepolia } from \"viem/chains\";\n *\n * const client = createSmartAccountClient({\n * chain: sepolia,\n * transport: http(\"RPC_URL\"),\n * // optionally hoist the account\n * account: toSmartContractAccount(...),\n * });\n * ```\n *\n * @param {SmartAccountClientConfig} config The configuration for creating the smart account client\n * @returns {SmartAccountClient} A smart account client capable of handling transactions, message signing, and other operations on a smart account\n */\nexport function createSmartAccountClient(\n config: SmartAccountClientConfig\n): SmartAccountClient {\n const {\n key = \"account\",\n name = \"account provider\",\n transport,\n type = \"SmartAccountClient\",\n ...params\n } = config;\n\n const client: SmartAccountClient = createBundlerClient({\n ...params,\n key,\n name,\n // we start out with this because the base methods for a SmartAccountClient\n // require a smart account client, but once we have completed building everything\n // we want to override this value with the one passed in by the extender\n type: \"SmartAccountClient\",\n // TODO: this needs to be tested\n transport: (opts) => {\n const rpcTransport = transport(opts);\n\n return custom({\n async request({ method, params }) {\n switch (method) {\n case \"eth_accounts\": {\n if (!client.account) {\n throw new AccountNotFoundError();\n }\n\n return [client.account.address];\n }\n case \"eth_sendTransaction\":\n if (!client.account) {\n throw new AccountNotFoundError();\n }\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n const [tx] = params as [FormattedTransactionRequest];\n return client.sendTransaction({\n ...tx,\n account: client.account,\n chain: client.chain,\n });\n case \"eth_sign\":\n if (!client.account) {\n throw new AccountNotFoundError();\n }\n const [address, data] = params!;\n if (address !== client.account.address) {\n throw new Error(\n \"cannot sign for address that is not the current account\"\n );\n }\n return client.signMessage(data);\n case \"personal_sign\": {\n if (!client.account) {\n throw new AccountNotFoundError();\n }\n const [data, address] = params!;\n if (address !== client.account.address) {\n throw new Error(\n \"cannot sign for address that is not the current account\"\n );\n }\n return client.signMessage(data);\n }\n case \"eth_signTypedData_v4\": {\n if (!client.account) {\n throw new AccountNotFoundError();\n }\n const [address, dataParams] = params!;\n if (address !== client.account.address) {\n throw new Error(\n \"cannot sign for address that is not the current account\"\n );\n }\n return client.signTypedData(dataParams);\n }\n case \"eth_chainId\":\n if (!opts.chain) {\n throw new ChainNotFoundError();\n }\n\n return opts.chain.id;\n default:\n // TODO: there's probably a number of methods we just don't support, will need to test most of them out\n // first let's get something working though\n return rpcTransport.request({ method, params });\n }\n },\n })(opts);\n },\n })\n .extend(() => ({\n ...SmartAccountClientOptsSchema.parse(config.opts ?? {}),\n }))\n .extend(middlewareActions(config))\n .extend(smartAccountClientActions);\n\n return { ...client, type };\n}\n\nexport function createSmartAccountClientFromExisting<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TClient extends BundlerClient<TTransport> = BundlerClient<TTransport>,\n TActions extends SmartAccountClientActions<\n TChain,\n TAccount,\n TContext\n > = SmartAccountClientActions<TChain, TAccount>,\n TRpcSchema extends SmartAccountClientRpcSchema = SmartAccountClientRpcSchema,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n>(\n config: Omit<\n SmartAccountClientConfig<Transport, TChain, TAccount, TContext>,\n \"transport\" | \"chain\"\n > & { client: TClient }\n): SmartAccountClient<\n CustomTransport,\n TChain,\n TAccount,\n TActions,\n TRpcSchema,\n TContext\n>;\n\n/**\n * Creates a smart account client using an existing client and specific configuration. This function can be used to reuse a pre-existing BundlerClient while customizing other aspects of the smart account.\n *\n * @example\n * ```ts\n * import {\n * createBundlerClient,\n * createSmartAccountClientFromExisting,\n * toSmartContractAccount\n * } from \"@aa-sdk/core\";\n *\n * const bundlerClient = createBundlerClient(...);\n * const client = createSmartAccountClientFromExisting({\n * client,\n * account: toSmartContractAccount(...),\n * })\n * ```\n *\n * @param {Omit<SmartAccountClientConfig, \"transport\" | \"chain\"> & {client: BundlerClient}} config the configuration object which includes the client\n * @returns {SmartAccountClient} A smart account client created from the existing BundlerClient\n */\nexport function createSmartAccountClientFromExisting(\n config: Omit<SmartAccountClientConfig, \"transport\" | \"chain\"> & {\n client: BundlerClient;\n }\n): SmartAccountClient {\n return createSmartAccountClient({\n ...config,\n chain: config.client.chain,\n transport: custom(config.client),\n });\n}\n"]}
@@ -4,21 +4,21 @@ const packUserOperation = (request) => {
4
4
  const initCode = request.factory && request.factoryData
5
5
  ? concat([request.factory, request.factoryData])
6
6
  : "0x";
7
- const accountGasLimits = packAccountGasLimits((({ verificationGasLimit, callGasLimit }) => ({
8
- verificationGasLimit,
9
- callGasLimit,
10
- }))(request));
11
- const gasFees = packAccountGasLimits((({ maxPriorityFeePerGas, maxFeePerGas }) => ({
12
- maxPriorityFeePerGas,
13
- maxFeePerGas,
14
- }))(request));
7
+ const accountGasLimits = packAccountGasLimits({
8
+ verificationGasLimit: request.verificationGasLimit,
9
+ callGasLimit: request.callGasLimit,
10
+ });
11
+ const gasFees = packAccountGasLimits({
12
+ maxPriorityFeePerGas: request.maxPriorityFeePerGas,
13
+ maxFeePerGas: request.maxFeePerGas,
14
+ });
15
15
  const paymasterAndData = request.paymaster && isAddress(request.paymaster)
16
- ? packPaymasterData((({ paymaster, paymasterVerificationGasLimit, paymasterPostOpGasLimit, paymasterData, }) => ({
17
- paymaster,
18
- paymasterVerificationGasLimit,
19
- paymasterPostOpGasLimit,
20
- paymasterData,
21
- }))(request))
16
+ ? packPaymasterData({
17
+ paymaster: request.paymaster,
18
+ paymasterVerificationGasLimit: request.paymasterVerificationGasLimit,
19
+ paymasterPostOpGasLimit: request.paymasterPostOpGasLimit,
20
+ paymasterData: request.paymasterData,
21
+ })
22
22
  : "0x";
23
23
  return encodeAbiParameters([
24
24
  { type: "address" },
@@ -1 +1 @@
1
- {"version":3,"file":"0.7.js","sourceRoot":"","sources":["../../../src/entrypoint/0.7.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,mBAAmB,EACnB,WAA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,SAAS,EACT,6BAA6B,EAC7B,uBAAuB,EACvB,aAAa,GAOd;IACC,IACE,CAAC,SAAS;QACV,CAAC,6BAA6B;QAC9B,CAAC,uBAAuB;QACxB,CAAC,aAAa,EACd,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,MAAM,CAAC;QACZ,SAAS;QACT,GAAG,CAAC,6BAA6B,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;QAChD,GAAG,CAAC,uBAAuB,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;QAC1C,aAAa;KACd,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,gBAAwB;IAI7D,OAAO;QACL,oBAAoB,EAAE,QAAQ,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;QACjE,YAAY,EAAE,QAAQ,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;KACvD,CAAC;AACJ,CAAC","sourcesContent":["import {\n concat,\n encodeAbiParameters,\n hexToBigInt,\n isAddress,\n keccak256,\n pad,\n type Address,\n type Chain,\n type Hash,\n type Hex,\n} from \"viem\";\nimport { EntryPointAbi_v7 } from \"../abis/EntryPointAbi_v7.js\";\nimport type {\n UserOperationRequest,\n UserOperationRequest_v7,\n} from \"../types.js\";\nimport type { SupportedEntryPoint } from \"./types.js\";\n\nconst packUserOperation = (request: UserOperationRequest<\"0.7.0\">): Hex => {\n const initCode =\n request.factory && request.factoryData\n ? concat([request.factory, request.factoryData])\n : \"0x\";\n const accountGasLimits = packAccountGasLimits(\n (({ verificationGasLimit, callGasLimit }) => ({\n verificationGasLimit,\n callGasLimit,\n }))(request)\n );\n\n const gasFees = packAccountGasLimits(\n (({ maxPriorityFeePerGas, maxFeePerGas }) => ({\n maxPriorityFeePerGas,\n maxFeePerGas,\n }))(request)\n );\n\n const paymasterAndData =\n request.paymaster && isAddress(request.paymaster)\n ? packPaymasterData(\n (({\n paymaster,\n paymasterVerificationGasLimit,\n paymasterPostOpGasLimit,\n paymasterData,\n }) => ({\n paymaster,\n paymasterVerificationGasLimit,\n paymasterPostOpGasLimit,\n paymasterData,\n }))(request)\n )\n : \"0x\";\n\n return encodeAbiParameters(\n [\n { type: \"address\" },\n { type: \"uint256\" },\n { type: \"bytes32\" },\n { type: \"bytes32\" },\n { type: \"bytes32\" },\n { type: \"uint256\" },\n { type: \"bytes32\" },\n { type: \"bytes32\" },\n ],\n [\n request.sender as Address,\n hexToBigInt(request.nonce),\n keccak256(initCode),\n keccak256(request.callData),\n accountGasLimits,\n hexToBigInt(request.preVerificationGas),\n gasFees,\n keccak256(paymasterAndData),\n ]\n );\n};\n\nexport default {\n version: \"0.7.0\",\n\n address: {\n default: \"0x0000000071727De22E5E9d8BAf0edAc6f37da032\",\n },\n\n abi: EntryPointAbi_v7,\n\n getUserOperationHash: (\n request: UserOperationRequest<\"0.7.0\">,\n entryPointAddress: Address,\n chainId: number\n ): Hash => {\n const encoded = encodeAbiParameters(\n [{ type: \"bytes32\" }, { type: \"address\" }, { type: \"uint256\" }],\n [\n keccak256(packUserOperation(request)),\n entryPointAddress,\n BigInt(chainId),\n ]\n );\n\n return keccak256(encoded);\n },\n\n packUserOperation,\n} satisfies SupportedEntryPoint<\"0.7.0\", Chain, typeof EntryPointAbi_v7>;\n\nexport function packAccountGasLimits(\n data:\n | Pick<UserOperationRequest_v7, \"verificationGasLimit\" | \"callGasLimit\">\n | Pick<UserOperationRequest_v7, \"maxPriorityFeePerGas\" | \"maxFeePerGas\">\n): Hex {\n return concat(Object.values(data).map((v) => pad(v, { size: 16 })));\n}\n\nexport function packPaymasterData({\n paymaster,\n paymasterVerificationGasLimit,\n paymasterPostOpGasLimit,\n paymasterData,\n}: Pick<\n UserOperationRequest_v7,\n | \"paymaster\"\n | \"paymasterVerificationGasLimit\"\n | \"paymasterPostOpGasLimit\"\n | \"paymasterData\"\n>): Hex {\n if (\n !paymaster ||\n !paymasterVerificationGasLimit ||\n !paymasterPostOpGasLimit ||\n !paymasterData\n ) {\n return \"0x\";\n }\n return concat([\n paymaster,\n pad(paymasterVerificationGasLimit, { size: 16 }),\n pad(paymasterPostOpGasLimit, { size: 16 }),\n paymasterData,\n ]);\n}\n\nexport function unpackAccountGasLimits(accountGasLimits: string): {\n verificationGasLimit: number;\n callGasLimit: number;\n} {\n return {\n verificationGasLimit: parseInt(accountGasLimits.slice(2, 34), 16),\n callGasLimit: parseInt(accountGasLimits.slice(34), 16),\n };\n}\n"]}
1
+ {"version":3,"file":"0.7.js","sourceRoot":"","sources":["../../../src/entrypoint/0.7.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,mBAAmB,EACnB,WAAW,EACX,SAAS,EACT,SAAS,EACT,GAAG,GAKJ,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAO/D,MAAM,iBAAiB,GAAG,CAAC,OAAsC,EAAO,EAAE;IACxE,MAAM,QAAQ,GACZ,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,WAAW;QACpC,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;QAChD,CAAC,CAAC,IAAI,CAAC;IACX,MAAM,gBAAgB,GAAG,oBAAoB,CAAC;QAC5C,oBAAoB,EAAE,OAAO,CAAC,oBAAoB;QAClD,YAAY,EAAE,OAAO,CAAC,YAAY;KACnC,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,oBAAoB,CAAC;QACnC,oBAAoB,EAAE,OAAO,CAAC,oBAAoB;QAClD,YAAY,EAAE,OAAO,CAAC,YAAY;KACnC,CAAC,CAAC;IAEH,MAAM,gBAAgB,GACpB,OAAO,CAAC,SAAS,IAAI,SAAS,CAAC,OAAO,CAAC,SAAS,CAAC;QAC/C,CAAC,CAAC,iBAAiB,CAAC;YAChB,SAAS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B,CACF,CAAC;QAEF,OAAO,SAAS,CAAC,OAAO,CAAC,CAAC;IAC5B,CAAC;IAED,iBAAiB;CACqD,CAAC;AAEzE,MAAM,UAAU,oBAAoB,CAClC,IAE0E;IAE1E,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;AACtE,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,EAChC,SAAS,EACT,6BAA6B,EAC7B,uBAAuB,EACvB,aAAa,GAOd;IACC,IACE,CAAC,SAAS;QACV,CAAC,6BAA6B;QAC9B,CAAC,uBAAuB;QACxB,CAAC,aAAa,EACd,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,MAAM,CAAC;QACZ,SAAS;QACT,GAAG,CAAC,6BAA6B,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;QAChD,GAAG,CAAC,uBAAuB,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;QAC1C,aAAa;KACd,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,gBAAwB;IAI7D,OAAO;QACL,oBAAoB,EAAE,QAAQ,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;QACjE,YAAY,EAAE,QAAQ,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;KACvD,CAAC;AACJ,CAAC","sourcesContent":["import {\n concat,\n encodeAbiParameters,\n hexToBigInt,\n isAddress,\n keccak256,\n pad,\n type Address,\n type Chain,\n type Hash,\n type Hex,\n} from \"viem\";\nimport { EntryPointAbi_v7 } from \"../abis/EntryPointAbi_v7.js\";\nimport type {\n UserOperationRequest,\n UserOperationRequest_v7,\n} from \"../types.js\";\nimport type { SupportedEntryPoint } from \"./types.js\";\n\nconst packUserOperation = (request: UserOperationRequest<\"0.7.0\">): Hex => {\n const initCode =\n request.factory && request.factoryData\n ? concat([request.factory, request.factoryData])\n : \"0x\";\n const accountGasLimits = packAccountGasLimits({\n verificationGasLimit: request.verificationGasLimit,\n callGasLimit: request.callGasLimit,\n });\n\n const gasFees = packAccountGasLimits({\n maxPriorityFeePerGas: request.maxPriorityFeePerGas,\n maxFeePerGas: request.maxFeePerGas,\n });\n\n const paymasterAndData =\n request.paymaster && isAddress(request.paymaster)\n ? packPaymasterData({\n paymaster: request.paymaster,\n paymasterVerificationGasLimit: request.paymasterVerificationGasLimit,\n paymasterPostOpGasLimit: request.paymasterPostOpGasLimit,\n paymasterData: request.paymasterData,\n })\n : \"0x\";\n\n return encodeAbiParameters(\n [\n { type: \"address\" },\n { type: \"uint256\" },\n { type: \"bytes32\" },\n { type: \"bytes32\" },\n { type: \"bytes32\" },\n { type: \"uint256\" },\n { type: \"bytes32\" },\n { type: \"bytes32\" },\n ],\n [\n request.sender as Address,\n hexToBigInt(request.nonce),\n keccak256(initCode),\n keccak256(request.callData),\n accountGasLimits,\n hexToBigInt(request.preVerificationGas),\n gasFees,\n keccak256(paymasterAndData),\n ]\n );\n};\n\nexport default {\n version: \"0.7.0\",\n\n address: {\n default: \"0x0000000071727De22E5E9d8BAf0edAc6f37da032\",\n },\n\n abi: EntryPointAbi_v7,\n\n getUserOperationHash: (\n request: UserOperationRequest<\"0.7.0\">,\n entryPointAddress: Address,\n chainId: number\n ): Hash => {\n const encoded = encodeAbiParameters(\n [{ type: \"bytes32\" }, { type: \"address\" }, { type: \"uint256\" }],\n [\n keccak256(packUserOperation(request)),\n entryPointAddress,\n BigInt(chainId),\n ]\n );\n\n return keccak256(encoded);\n },\n\n packUserOperation,\n} satisfies SupportedEntryPoint<\"0.7.0\", Chain, typeof EntryPointAbi_v7>;\n\nexport function packAccountGasLimits(\n data:\n | Pick<UserOperationRequest_v7, \"verificationGasLimit\" | \"callGasLimit\">\n | Pick<UserOperationRequest_v7, \"maxPriorityFeePerGas\" | \"maxFeePerGas\">\n): Hex {\n return concat(Object.values(data).map((v) => pad(v, { size: 16 })));\n}\n\nexport function packPaymasterData({\n paymaster,\n paymasterVerificationGasLimit,\n paymasterPostOpGasLimit,\n paymasterData,\n}: Pick<\n UserOperationRequest_v7,\n | \"paymaster\"\n | \"paymasterVerificationGasLimit\"\n | \"paymasterPostOpGasLimit\"\n | \"paymasterData\"\n>): Hex {\n if (\n !paymaster ||\n !paymasterVerificationGasLimit ||\n !paymasterPostOpGasLimit ||\n !paymasterData\n ) {\n return \"0x\";\n }\n return concat([\n paymaster,\n pad(paymasterVerificationGasLimit, { size: 16 }),\n pad(paymasterPostOpGasLimit, { size: 16 }),\n paymasterData,\n ]);\n}\n\nexport function unpackAccountGasLimits(accountGasLimits: string): {\n verificationGasLimit: number;\n callGasLimit: number;\n} {\n return {\n verificationGasLimit: parseInt(accountGasLimits.slice(2, 34), 16),\n callGasLimit: parseInt(accountGasLimits.slice(34), 16),\n };\n}\n"]}
@@ -55,8 +55,6 @@ export const default7702GasEstimator = (gasEstimator) => async (struct, params)
55
55
  s: zeroHash,
56
56
  yParity: "0x0",
57
57
  };
58
- const estimatedUO = await gasEstimator_(struct, params);
59
- estimatedUO.eip7702Auth = undefined; // Strip out the auth after estimation.
60
- return estimatedUO;
58
+ return gasEstimator_(struct, params);
61
59
  };
62
60
  //# sourceMappingURL=7702gasEstimator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"7702gasEstimator.js","sourceRoot":"","sources":["../../../../src/middleware/defaults/7702gasEstimator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAG/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAGlC,CAAC,YAAiC,EAAE,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;IAC9D,MAAM,aAAa,GAAG,YAAY,IAAI,mBAAmB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAEzE,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC;IACxD,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,oBAAoB,EAAE,CAAC;IACnC,CAAC;IAED,MAAM,UAAU,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAC3C,IAAI,UAAU,CAAC,OAAO,KAAK,OAAO,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CACb,2DAA2D,CAC5D,CAAC;IACJ,CAAC;IAED,MAAM,qBAAqB,GAAG,MAAM,OAAO,CAAC,wBAAwB,EAAE,CAAC;IAEvE,+FAA+F;IAE9F,MAAuC,CAAC,WAAW,GAAG;QACrD,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,KAAK;QACZ,OAAO,EAAE,qBAAqB;QAC9B,CAAC,EAAE,QAAQ,EAAE,mBAAmB;QAChC,CAAC,EAAE,QAAQ;QACX,OAAO,EAAE,KAAK;KACf,CAAC;IAEF,MAAM,WAAW,GAAG,MAAM,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAExD,WAAW,CAAC,WAAW,GAAG,SAAS,CAAC,CAAC,uCAAuC;IAE5E,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC","sourcesContent":["import { zeroHash } from \"viem\";\nimport { AccountNotFoundError } from \"../../errors/account.js\";\nimport type { UserOperationStruct } from \"../../types.js\";\nimport type { ClientMiddlewareFn } from \"../types\";\nimport { defaultGasEstimator } from \"./gasEstimator.js\";\n\n/**\n * A middleware function to estimate the gas usage of a user operation when using an EIP-7702 delegated account. Has an optional custom gas estimator.\n * This function is only compatible with accounts using EntryPoint v0.7.0, and the account must have an implementation address defined in `getImplementationAddress()`.\n *\n * @example\n * ```ts twoslash\n * import {\n * default7702GasEstimator,\n * default7702UserOpSigner,\n * createSmartAccountClient,\n * type SmartAccountClient,\n * } from \"@aa-sdk/core\";\n * import {\n * createModularAccountV2,\n * type CreateModularAccountV2ClientParams,\n * } from \"@account-kit/smart-contracts\";\n *\n * async function createSMA7702AccountClient(\n * config: CreateModularAccountV2ClientParams\n * ): Promise<SmartAccountClient> {\n * const sma7702Account = await createModularAccountV2({ ...config, mode: \"7702\" });\n *\n * return createSmartAccountClient({\n * account: sma7702Account,\n * gasEstimator: default7702GasEstimator(config.gasEstimator),\n * signUserOperation: default7702UserOpSigner(config.signUserOperation),\n * ...config,\n * });\n * }\n * ```\n *\n * @param {ClientMiddlewareFn} [gasEstimator] Optional custom gas estimator function\n * @returns {Function} A function that takes user operation struct and parameters, estimates gas usage, and returns the user operation with gas limits.\n */\nexport const default7702GasEstimator: (\n gasEstimator?: ClientMiddlewareFn\n) => ClientMiddlewareFn =\n (gasEstimator?: ClientMiddlewareFn) => async (struct, params) => {\n const gasEstimator_ = gasEstimator ?? defaultGasEstimator(params.client);\n\n const account = params.account ?? params.client.account;\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n const entryPoint = account.getEntryPoint();\n if (entryPoint.version !== \"0.7.0\") {\n throw new Error(\n \"This middleware is only compatible with EntryPoint v0.7.0\"\n );\n }\n\n const implementationAddress = await account.getImplementationAddress();\n\n // Note: does not omit the delegation from estimation if the account is already 7702 delegated.\n\n (struct as UserOperationStruct<\"0.7.0\">).eip7702Auth = {\n chainId: \"0x0\",\n nonce: \"0x0\",\n address: implementationAddress,\n r: zeroHash, // aka `bytes32(0)`\n s: zeroHash,\n yParity: \"0x0\",\n };\n\n const estimatedUO = await gasEstimator_(struct, params);\n\n estimatedUO.eip7702Auth = undefined; // Strip out the auth after estimation.\n\n return estimatedUO;\n };\n"]}
1
+ {"version":3,"file":"7702gasEstimator.js","sourceRoot":"","sources":["../../../../src/middleware/defaults/7702gasEstimator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAG/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAGlC,CAAC,YAAiC,EAAE,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;IAC9D,MAAM,aAAa,GAAG,YAAY,IAAI,mBAAmB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAEzE,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC;IACxD,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,oBAAoB,EAAE,CAAC;IACnC,CAAC;IAED,MAAM,UAAU,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAC3C,IAAI,UAAU,CAAC,OAAO,KAAK,OAAO,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CACb,2DAA2D,CAC5D,CAAC;IACJ,CAAC;IAED,MAAM,qBAAqB,GAAG,MAAM,OAAO,CAAC,wBAAwB,EAAE,CAAC;IAEvE,+FAA+F;IAE9F,MAAuC,CAAC,WAAW,GAAG;QACrD,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,KAAK;QACZ,OAAO,EAAE,qBAAqB;QAC9B,CAAC,EAAE,QAAQ,EAAE,mBAAmB;QAChC,CAAC,EAAE,QAAQ;QACX,OAAO,EAAE,KAAK;KACf,CAAC;IAEF,OAAO,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AACvC,CAAC,CAAC","sourcesContent":["import { zeroHash } from \"viem\";\nimport { AccountNotFoundError } from \"../../errors/account.js\";\nimport type { UserOperationStruct } from \"../../types.js\";\nimport type { ClientMiddlewareFn } from \"../types\";\nimport { defaultGasEstimator } from \"./gasEstimator.js\";\n\n/**\n * A middleware function to estimate the gas usage of a user operation when using an EIP-7702 delegated account. Has an optional custom gas estimator.\n * This function is only compatible with accounts using EntryPoint v0.7.0, and the account must have an implementation address defined in `getImplementationAddress()`.\n *\n * @example\n * ```ts twoslash\n * import {\n * default7702GasEstimator,\n * default7702UserOpSigner,\n * createSmartAccountClient,\n * type SmartAccountClient,\n * } from \"@aa-sdk/core\";\n * import {\n * createModularAccountV2,\n * type CreateModularAccountV2ClientParams,\n * } from \"@account-kit/smart-contracts\";\n *\n * async function createSMA7702AccountClient(\n * config: CreateModularAccountV2ClientParams\n * ): Promise<SmartAccountClient> {\n * const sma7702Account = await createModularAccountV2({ ...config, mode: \"7702\" });\n *\n * return createSmartAccountClient({\n * account: sma7702Account,\n * gasEstimator: default7702GasEstimator(config.gasEstimator),\n * signUserOperation: default7702UserOpSigner(config.signUserOperation),\n * ...config,\n * });\n * }\n * ```\n *\n * @param {ClientMiddlewareFn} [gasEstimator] Optional custom gas estimator function\n * @returns {Function} A function that takes user operation struct and parameters, estimates gas usage, and returns the user operation with gas limits.\n */\nexport const default7702GasEstimator: (\n gasEstimator?: ClientMiddlewareFn\n) => ClientMiddlewareFn =\n (gasEstimator?: ClientMiddlewareFn) => async (struct, params) => {\n const gasEstimator_ = gasEstimator ?? defaultGasEstimator(params.client);\n\n const account = params.account ?? params.client.account;\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n const entryPoint = account.getEntryPoint();\n if (entryPoint.version !== \"0.7.0\") {\n throw new Error(\n \"This middleware is only compatible with EntryPoint v0.7.0\"\n );\n }\n\n const implementationAddress = await account.getImplementationAddress();\n\n // Note: does not omit the delegation from estimation if the account is already 7702 delegated.\n\n (struct as UserOperationStruct<\"0.7.0\">).eip7702Auth = {\n chainId: \"0x0\",\n nonce: \"0x0\",\n address: implementationAddress,\n r: zeroHash, // aka `bytes32(0)`\n s: zeroHash,\n yParity: \"0x0\",\n };\n\n return gasEstimator_(struct, params);\n };\n"]}
@@ -40,7 +40,11 @@ import { defaultUserOpSigner } from "./userOpSigner.js";
40
40
  */
41
41
  export const default7702UserOpSigner = (userOpSigner) => async (struct, params) => {
42
42
  const userOpSigner_ = userOpSigner ?? defaultUserOpSigner;
43
- const uo = await userOpSigner_(struct, params);
43
+ const uo = await userOpSigner_({
44
+ ...struct,
45
+ // Strip out the dummy eip7702 fields.
46
+ eip7702Auth: undefined,
47
+ }, params);
44
48
  const account = params.account ?? params.client.account;
45
49
  const { client } = params;
46
50
  if (!account || !isSmartAccountWithSigner(account)) {
@@ -1 +1 @@
1
- {"version":3,"file":"7702signer.js","sourceRoot":"","sources":["../../../../src/middleware/defaults/7702signer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AACjF,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAGlC,CAAC,YAAiC,EAAE,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;IAC9D,MAAM,aAAa,GAAG,YAAY,IAAI,mBAAmB,CAAC;IAE1D,MAAM,EAAE,GAAG,MAAM,aAAa,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,IAA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,kEAAkE;YAClE,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;YAC/B,KAAK,EAAE,KAAK,CAAC,YAAY,CAAC;YAC1B,OAAO,EAAE,WAAW;YACpB,CAAC;YACD,CAAC;YACD,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC;SACxB;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { toHex } from \"viem\";\nimport { isSmartAccountWithSigner } from \"../../account/smartContractAccount.js\";\nimport { AccountNotFoundError } from \"../../errors/account.js\";\nimport { ChainNotFoundError } from \"../../errors/client.js\";\nimport type { ClientMiddlewareFn } from \"../types\";\nimport { defaultUserOpSigner } from \"./userOpSigner.js\";\n\n/**\n * Provides a default middleware function for signing user operations with a client account when using EIP-7702 delegated accounts.\n * If the signer doesn't support `signAuthorization`, then this just runs the provided `signUserOperation` middleware.\n * This function is only compatible with accounts using EntryPoint v0.7.0, and the account must have an implementation address defined in `getImplementationAddress()`.\n *\n * @example\n * ```ts twoslash\n * import {\n * default7702GasEstimator,\n * default7702UserOpSigner,\n * createSmartAccountClient,\n * type SmartAccountClient,\n * } from \"@aa-sdk/core\";\n * import {\n * createModularAccountV2,\n * type CreateModularAccountV2ClientParams,\n * } from \"@account-kit/smart-contracts\";\n *\n * async function createSMA7702AccountClient(\n * config: CreateModularAccountV2ClientParams\n * ): Promise<SmartAccountClient> {\n * const sma7702Account = await createModularAccountV2({ ...config, mode: \"7702\" });\n *\n * return createSmartAccountClient({\n * account: sma7702Account,\n * gasEstimator: default7702GasEstimator(config.gasEstimator),\n * signUserOperation: default7702UserOpSigner(config.signUserOperation),\n * ...config,\n * });\n * }\n * ```\n *\n * @param {ClientMiddlewareFn} [userOpSigner] Optional user operation signer function\n * @returns {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
+ {"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,GAG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OAAO,EAAE,OAAO,CAAC,OAAO;KACzB,CAAC,CAAC;IAEH,MAAM,aAAa,GAAG,MAAM,MAAM,CAAC,iBAAiB,CAAC;QACnD,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE;QACxB,eAAe,EAAE,WAAW;QAC5B,KAAK,EAAE,YAAY;KACpB,CAAC,CAAC;IAEH,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,aAAa,CAAC;IAE/B,MAAM,OAAO,GAAG,aAAa,CAAC,OAAO,IAAI,aAAa,CAAC,CAAC,GAAG,GAAG,CAAC;IAE/D,OAAO;QACL,GAAG,EAAE;QACL,WAAW,EAAE;YACX,kEAAkE;YAClE,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;YAC/B,KAAK,EAAE,KAAK,CAAC,YAAY,CAAC;YAC1B,OAAO,EAAE,WAAW;YACpB,CAAC;YACD,CAAC;YACD,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC;SACxB;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { toHex } from \"viem\";\nimport { isSmartAccountWithSigner } from \"../../account/smartContractAccount.js\";\nimport { AccountNotFoundError } from \"../../errors/account.js\";\nimport { ChainNotFoundError } from \"../../errors/client.js\";\nimport type { ClientMiddlewareFn } from \"../types\";\nimport { defaultUserOpSigner } from \"./userOpSigner.js\";\n\n/**\n * Provides a default middleware function for signing user operations with a client account when using EIP-7702 delegated accounts.\n * If the signer doesn't support `signAuthorization`, then this just runs the provided `signUserOperation` middleware.\n * This function is only compatible with accounts using EntryPoint v0.7.0, and the account must have an implementation address defined in `getImplementationAddress()`.\n *\n * @example\n * ```ts twoslash\n * import {\n * default7702GasEstimator,\n * default7702UserOpSigner,\n * createSmartAccountClient,\n * type SmartAccountClient,\n * } from \"@aa-sdk/core\";\n * import {\n * createModularAccountV2,\n * type CreateModularAccountV2ClientParams,\n * } from \"@account-kit/smart-contracts\";\n *\n * async function createSMA7702AccountClient(\n * config: CreateModularAccountV2ClientParams\n * ): Promise<SmartAccountClient> {\n * const sma7702Account = await createModularAccountV2({ ...config, mode: \"7702\" });\n *\n * return createSmartAccountClient({\n * account: sma7702Account,\n * gasEstimator: default7702GasEstimator(config.gasEstimator),\n * signUserOperation: default7702UserOpSigner(config.signUserOperation),\n * ...config,\n * });\n * }\n * ```\n *\n * @param {ClientMiddlewareFn} [userOpSigner] Optional user operation signer function\n * @returns {Function} A middleware function that signs EIP-7702 authorization tuples if necessary, and also uses the provided or default user operation signer to generate the user op signature.\n */\nexport const default7702UserOpSigner: (\n userOpSigner?: ClientMiddlewareFn\n) => ClientMiddlewareFn =\n (userOpSigner?: ClientMiddlewareFn) => async (struct, params) => {\n const userOpSigner_ = userOpSigner ?? defaultUserOpSigner;\n\n const uo = await userOpSigner_(\n {\n ...struct,\n // Strip out the dummy eip7702 fields.\n eip7702Auth: undefined,\n },\n params\n );\n\n const account = params.account ?? params.client.account;\n const { client } = params;\n\n if (!account || !isSmartAccountWithSigner(account)) {\n throw new AccountNotFoundError();\n }\n\n const signer = account.getSigner();\n\n if (!signer.signAuthorization) {\n return uo;\n }\n\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n\n const code = (await client.getCode({ address: account.address })) ?? \"0x\";\n\n const implAddress = await account.getImplementationAddress();\n\n const expectedCode = \"0xef0100\" + implAddress.slice(2);\n\n if (code.toLowerCase() === expectedCode.toLowerCase()) {\n // If the delegation already matches the expected, then we don't need to sign and include an authorization tuple.\n return uo;\n }\n\n const accountNonce = await params.client.getTransactionCount({\n address: account.address,\n });\n\n const authSignature = await signer.signAuthorization({\n chainId: client.chain.id,\n contractAddress: implAddress,\n nonce: accountNonce,\n });\n\n const { r, s } = authSignature;\n\n const yParity = authSignature.yParity ?? authSignature.v - 27n;\n\n return {\n ...uo,\n eip7702Auth: {\n // deepHexlify doesn't encode number(0) correctly, it returns \"0x\"\n chainId: toHex(client.chain.id),\n nonce: toHex(accountNonce),\n address: implAddress,\n r,\n s,\n yParity: toHex(yParity),\n },\n };\n };\n"]}
@@ -1 +1 @@
1
- export declare const VERSION = "4.14.0";
1
+ export declare const VERSION = "4.15.1";
@@ -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.14.0";
3
+ export const VERSION = "4.15.1";
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.14.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.15.1\";\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"0.7.d.ts","sourceRoot":"","sources":["../../../src/entrypoint/0.7.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,OAAO,EAEZ,KAAK,IAAI,EACT,KAAK,GAAG,EACT,MAAM,MAAM,CAAC;AAEd,OAAO,KAAK,EACV,oBAAoB,EACpB,uBAAuB,EACxB,MAAM,aAAa,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AM,KACd,IAAI;;;AAbT,wBA2ByE;AAEzE,wBAAgB,oBAAoB,CAClC,IAAI,EACA,IAAI,CAAC,uBAAuB,EAAE,sBAAsB,GAAG,cAAc,CAAC,GACtE,IAAI,CAAC,uBAAuB,EAAE,sBAAsB,GAAG,cAAc,CAAC,GACzE,GAAG,CAEL;AAED,wBAAgB,iBAAiB,CAAC,EAChC,SAAS,EACT,6BAA6B,EAC7B,uBAAuB,EACvB,aAAa,GACd,EAAE,IAAI,CACL,uBAAuB,EACrB,WAAW,GACX,+BAA+B,GAC/B,yBAAyB,GACzB,eAAe,CAClB,GAAG,GAAG,CAeN;AAED,wBAAgB,sBAAsB,CAAC,gBAAgB,EAAE,MAAM,GAAG;IAChE,oBAAoB,EAAE,MAAM,CAAC;IAC7B,YAAY,EAAE,MAAM,CAAC;CACtB,CAKA"}
@@ -1 +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"}
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,kBA8BF,CAAC"}
@@ -1 +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"}
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,kBAmEF,CAAC"}
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "4.14.0";
1
+ export declare const VERSION = "4.15.1";
2
2
  //# sourceMappingURL=version.d.ts.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aa-sdk/core",
3
3
  "license": "MIT",
4
- "version": "4.14.0",
4
+ "version": "4.15.1",
5
5
  "description": "viem based SDK that enables interactions with ERC-4337 Smart Accounts. ABIs are based off the definitions generated in @account-abstraction/contracts",
6
6
  "author": "Alchemy",
7
7
  "type": "module",
@@ -65,5 +65,5 @@
65
65
  "url": "https://github.com/alchemyplatform/aa-sdk/issues"
66
66
  },
67
67
  "homepage": "https://github.com/alchemyplatform/aa-sdk#readme",
68
- "gitHead": "9230c8f9c9af7a9a7d90538ef6ec42dcca1c39db"
68
+ "gitHead": "c360ac3bfe07172ef44a53ad6ef20ed54f0fd885"
69
69
  }
@@ -62,7 +62,7 @@ export type SmartAccountClientRpcSchema = [
62
62
  ...PublicRpcSchema
63
63
  ];
64
64
 
65
- //#region SmartAccountClientActions
65
+ // [!region SmartAccountClientActions]
66
66
  export type SmartAccountClientActions<
67
67
  chain extends Chain | undefined = Chain | undefined,
68
68
  account extends SmartContractAccount | undefined =
@@ -74,9 +74,9 @@ export type SmartAccountClientActions<
74
74
  > = BaseSmartAccountClientActions<chain, account, context> &
75
75
  BundlerActions &
76
76
  PublicActions;
77
- //#endregion SmartAccountClientActions
77
+ // [!endregion SmartAccountClientActions]
78
78
 
79
- //#region SmartAccountClient
79
+ // [!region SmartAccountClient]
80
80
  export type SmartAccountClient<
81
81
  transport extends Transport = Transport,
82
82
  chain extends Chain | undefined = Chain | undefined,
@@ -97,7 +97,7 @@ export type SmartAccountClient<
97
97
  actions & SmartAccountClientActions<chain, account, context>
98
98
  >
99
99
  >;
100
- //#endregion SmartAccountClient
100
+ // [!endregion SmartAccountClient]
101
101
 
102
102
  export type BaseSmartAccountClient<
103
103
  transport extends Transport = Transport,
@@ -22,35 +22,24 @@ const packUserOperation = (request: UserOperationRequest<"0.7.0">): Hex => {
22
22
  request.factory && request.factoryData
23
23
  ? concat([request.factory, request.factoryData])
24
24
  : "0x";
25
- const accountGasLimits = packAccountGasLimits(
26
- (({ verificationGasLimit, callGasLimit }) => ({
27
- verificationGasLimit,
28
- callGasLimit,
29
- }))(request)
30
- );
25
+ const accountGasLimits = packAccountGasLimits({
26
+ verificationGasLimit: request.verificationGasLimit,
27
+ callGasLimit: request.callGasLimit,
28
+ });
31
29
 
32
- const gasFees = packAccountGasLimits(
33
- (({ maxPriorityFeePerGas, maxFeePerGas }) => ({
34
- maxPriorityFeePerGas,
35
- maxFeePerGas,
36
- }))(request)
37
- );
30
+ const gasFees = packAccountGasLimits({
31
+ maxPriorityFeePerGas: request.maxPriorityFeePerGas,
32
+ maxFeePerGas: request.maxFeePerGas,
33
+ });
38
34
 
39
35
  const paymasterAndData =
40
36
  request.paymaster && isAddress(request.paymaster)
41
- ? packPaymasterData(
42
- (({
43
- paymaster,
44
- paymasterVerificationGasLimit,
45
- paymasterPostOpGasLimit,
46
- paymasterData,
47
- }) => ({
48
- paymaster,
49
- paymasterVerificationGasLimit,
50
- paymasterPostOpGasLimit,
51
- paymasterData,
52
- }))(request)
53
- )
37
+ ? packPaymasterData({
38
+ paymaster: request.paymaster,
39
+ paymasterVerificationGasLimit: request.paymasterVerificationGasLimit,
40
+ paymasterPostOpGasLimit: request.paymasterPostOpGasLimit,
41
+ paymasterData: request.paymasterData,
42
+ })
54
43
  : "0x";
55
44
 
56
45
  return encodeAbiParameters(
@@ -69,9 +69,5 @@ export const default7702GasEstimator: (
69
69
  yParity: "0x0",
70
70
  };
71
71
 
72
- const estimatedUO = await gasEstimator_(struct, params);
73
-
74
- estimatedUO.eip7702Auth = undefined; // Strip out the auth after estimation.
75
-
76
- return estimatedUO;
72
+ return gasEstimator_(struct, params);
77
73
  };
@@ -46,7 +46,14 @@ export const default7702UserOpSigner: (
46
46
  (userOpSigner?: ClientMiddlewareFn) => async (struct, params) => {
47
47
  const userOpSigner_ = userOpSigner ?? defaultUserOpSigner;
48
48
 
49
- const uo = await userOpSigner_(struct, params);
49
+ const uo = await userOpSigner_(
50
+ {
51
+ ...struct,
52
+ // Strip out the dummy eip7702 fields.
53
+ eip7702Auth: undefined,
54
+ },
55
+ params
56
+ );
50
57
 
51
58
  const account = params.account ?? params.client.account;
52
59
  const { client } = params;
package/src/version.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  // This file is autogenerated by inject-version.ts. Any changes will be
2
2
  // overwritten on commit!
3
- export const VERSION = "4.14.0";
3
+ export const VERSION = "4.15.1";