@aa-sdk/core 4.35.1 → 4.36.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.
@@ -5,6 +5,7 @@ import { IncompatibleClientError } from "../../errors/client.js";
5
5
  import { deepHexlify, resolveProperties } from "../../utils/index.js";
6
6
  import { _initUserOperation } from "./internal/initUserOperation.js";
7
7
  import { clientHeaderTrack } from "../../index.js";
8
+ import { getUserOperationError } from "./getUserOperationError.js";
8
9
  /**
9
10
  * Description SmartAccountClientAction for estimating the gas cost of a user operation
10
11
  *
@@ -29,7 +30,13 @@ export async function estimateUserOperationGas(client_, args) {
29
30
  }
30
31
  return _initUserOperation(client, args).then(async (struct) => {
31
32
  const request = deepHexlify(await resolveProperties(struct));
32
- return client.estimateUserOperationGas(request, account.getEntryPoint().address, overrides?.stateOverride);
33
+ try {
34
+ return await client.estimateUserOperationGas(request, account.getEntryPoint().address, overrides?.stateOverride);
35
+ }
36
+ catch (err) {
37
+ getUserOperationError(client, request, account.getEntryPoint());
38
+ throw err;
39
+ }
33
40
  });
34
41
  }
35
42
  //# sourceMappingURL=estimateUserOperationGas.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"estimateUserOperationGas.js","sourceRoot":"","sources":["../../../../src/actions/smartAccount/estimateUserOperationGas.ts"],"names":[],"mappings":"AACA,OAAO,EAGN,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAChF,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAEjE,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAKrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAY5C,OAA6C,EAC7C,IAAqD;IAErD,MAAM,MAAM,GAAG,iBAAiB,CAAC,OAAO,EAAE,0BAA0B,CAAC,CAAC;IACtE,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;IACrD,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,oBAAoB,EAAE,CAAC;IACnC,CAAC;IAED,IAAI,CAAC,wBAAwB,CAAC,MAAM,CAAC,EAAE,CAAC;QACtC,MAAM,IAAI,uBAAuB,CAC/B,wBAAwB,EACxB,0BAA0B,EAC1B,MAAM,CACP,CAAC;IACJ,CAAC;IAED,OAAO,kBAAkB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;QAC5D,MAAM,OAAO,GAAG,WAAW,CAAC,MAAM,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC;QAC7D,OAAO,MAAM,CAAC,wBAAwB,CACpC,OAAO,EACP,OAAO,CAAC,aAAa,EAAE,CAAC,OAAO,EAC/B,SAAS,EAAE,aAAa,CACzB,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { Chain, Client, Transport } from \"viem\";\nimport {\n type GetEntryPointFromAccount,\n type SmartContractAccount,\n} from \"../../account/smartContractAccount.js\";\nimport { isBaseSmartAccountClient } from \"../../client/isSmartAccountClient.js\";\nimport { AccountNotFoundError } from \"../../errors/account.js\";\nimport { IncompatibleClientError } from \"../../errors/client.js\";\nimport type { UserOperationEstimateGasResponse } from \"../../types.js\";\nimport { deepHexlify, resolveProperties } from \"../../utils/index.js\";\nimport { _initUserOperation } from \"./internal/initUserOperation.js\";\nimport type {\n SendUserOperationParameters,\n UserOperationContext,\n} from \"./types.js\";\nimport { clientHeaderTrack } from \"../../index.js\";\n\n/**\n * Description SmartAccountClientAction for estimating the gas cost of a user operation\n *\n * @async\n * @template {Transport} TTransport\n * @template {Chain | undefined} TChain\n * @template {SmartContractAccount | undefined} TAccount\n * @template {UserOperationContext | undefined} TContext\n * @template {GetEntryPointFromAccount<TAccount>} TEntryPointVersion\n * @param {Client<TTransport, TChain, TAccount>} client_ smart account client\n * @param {SendUserOperationParameters<TAccount, TContext>} args send user operation parameters\n * @returns {Promise<UserOperationEstimateGasResponse<TEntryPointVersion>>}user operation gas estimate response\n */\nexport async function estimateUserOperationGas<\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 TEntryPointVersion extends\n GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>,\n>(\n client_: Client<TTransport, TChain, TAccount>,\n args: SendUserOperationParameters<TAccount, TContext>,\n): Promise<UserOperationEstimateGasResponse<TEntryPointVersion>> {\n const client = clientHeaderTrack(client_, \"estimateUserOperationGas\");\n const { account = client.account, overrides } = args;\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n if (!isBaseSmartAccountClient(client)) {\n throw new IncompatibleClientError(\n \"BaseSmartAccountClient\",\n \"estimateUserOperationGas\",\n client,\n );\n }\n\n return _initUserOperation(client, args).then(async (struct) => {\n const request = deepHexlify(await resolveProperties(struct));\n return client.estimateUserOperationGas(\n request,\n account.getEntryPoint().address,\n overrides?.stateOverride,\n );\n });\n}\n"]}
1
+ {"version":3,"file":"estimateUserOperationGas.js","sourceRoot":"","sources":["../../../../src/actions/smartAccount/estimateUserOperationGas.ts"],"names":[],"mappings":"AACA,OAAO,EAGN,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAChF,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAEjE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{ Chain, Client, Transport } from \"viem\";\nimport {\n type GetEntryPointFromAccount,\n type SmartContractAccount,\n} from \"../../account/smartContractAccount.js\";\nimport { isBaseSmartAccountClient } from \"../../client/isSmartAccountClient.js\";\nimport { AccountNotFoundError } from \"../../errors/account.js\";\nimport { IncompatibleClientError } from \"../../errors/client.js\";\nimport type { UserOperationEstimateGasResponse } from \"../../types.js\";\nimport { deepHexlify, resolveProperties } from \"../../utils/index.js\";\nimport { _initUserOperation } from \"./internal/initUserOperation.js\";\nimport type {\n SendUserOperationParameters,\n UserOperationContext,\n} from \"./types.js\";\nimport { clientHeaderTrack } from \"../../index.js\";\nimport { getUserOperationError } from \"./getUserOperationError.js\";\n\n/**\n * Description SmartAccountClientAction for estimating the gas cost of a user operation\n *\n * @async\n * @template {Transport} TTransport\n * @template {Chain | undefined} TChain\n * @template {SmartContractAccount | undefined} TAccount\n * @template {UserOperationContext | undefined} TContext\n * @template {GetEntryPointFromAccount<TAccount>} TEntryPointVersion\n * @param {Client<TTransport, TChain, TAccount>} client_ smart account client\n * @param {SendUserOperationParameters<TAccount, TContext>} args send user operation parameters\n * @returns {Promise<UserOperationEstimateGasResponse<TEntryPointVersion>>}user operation gas estimate response\n */\nexport async function estimateUserOperationGas<\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 TEntryPointVersion extends\n GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>,\n>(\n client_: Client<TTransport, TChain, TAccount>,\n args: SendUserOperationParameters<TAccount, TContext>,\n): Promise<UserOperationEstimateGasResponse<TEntryPointVersion>> {\n const client = clientHeaderTrack(client_, \"estimateUserOperationGas\");\n const { account = client.account, overrides } = args;\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n if (!isBaseSmartAccountClient(client)) {\n throw new IncompatibleClientError(\n \"BaseSmartAccountClient\",\n \"estimateUserOperationGas\",\n client,\n );\n }\n\n return _initUserOperation(client, args).then(async (struct) => {\n const request = deepHexlify(await resolveProperties(struct));\n try {\n return await client.estimateUserOperationGas(\n request,\n account.getEntryPoint().address,\n overrides?.stateOverride,\n );\n } catch (err) {\n getUserOperationError(client, request, account.getEntryPoint());\n throw err;\n }\n });\n}\n"]}
@@ -0,0 +1,14 @@
1
+ import { type Chain, type Transport } from "viem";
2
+ import type { BaseSmartAccountClient } from "../../client/smartAccountClient";
3
+ import type { SmartContractAccount } from "../../account/smartContractAccount.js";
4
+ import type { UserOperationRequest } from "../../types.js";
5
+ import type { EntryPointDef } from "../../index.js";
6
+ /**
7
+ * Retrieves the error message from an entrypoint for a User Operation.
8
+ *
9
+ * @param {Client<TTransport, TChain, TAccount>} client the smart account client to use for RPC requests
10
+ * @param {UserOperationRequest} request the uo request to get the error for
11
+ * @param {EntryPointDef} entryPoint the entrypoint instance to send the uo to
12
+ * @returns {string} the error message from the entrypoint
13
+ */
14
+ export declare function getUserOperationError<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TAccount extends SmartContractAccount | undefined = SmartContractAccount | undefined>(client: BaseSmartAccountClient<TTransport, TChain, TAccount>, request: UserOperationRequest, entryPoint: EntryPointDef): Promise<void>;
@@ -0,0 +1,90 @@
1
+ import { fromHex, concat, isAddress, decodeErrorResult, } from "viem";
2
+ import { AccountNotFoundError } from "../../errors/account.js";
3
+ import { deepHexlify } from "../../utils/index.js";
4
+ import { packAccountGasLimits, packPaymasterData, } from "../../entrypoint/0.7.js";
5
+ /**
6
+ * Retrieves the error message from an entrypoint for a User Operation.
7
+ *
8
+ * @param {Client<TTransport, TChain, TAccount>} client the smart account client to use for RPC requests
9
+ * @param {UserOperationRequest} request the uo request to get the error for
10
+ * @param {EntryPointDef} entryPoint the entrypoint instance to send the uo to
11
+ * @returns {string} the error message from the entrypoint
12
+ */
13
+ export async function getUserOperationError(client, request, entryPoint) {
14
+ if (!client.account) {
15
+ throw new AccountNotFoundError();
16
+ }
17
+ const uo = deepHexlify(request);
18
+ try {
19
+ switch (entryPoint.version) {
20
+ case "0.6.0":
21
+ // TODO
22
+ break;
23
+ case "0.7.0":
24
+ await client.simulateContract({
25
+ address: entryPoint.address,
26
+ abi: entryPoint.abi,
27
+ functionName: "handleOps",
28
+ args: [
29
+ [
30
+ {
31
+ sender: client.account.address,
32
+ nonce: fromHex(uo.nonce, "bigint"),
33
+ initCode: uo.factory && uo.factoryData
34
+ ? concat([uo.factory, uo.factoryData])
35
+ : "0x",
36
+ callData: uo.callData,
37
+ accountGasLimits: packAccountGasLimits({
38
+ verificationGasLimit: uo.verificationGasLimit,
39
+ callGasLimit: uo.callGasLimit,
40
+ }),
41
+ preVerificationGas: fromHex(uo.preVerificationGas, "bigint"),
42
+ gasFees: packAccountGasLimits({
43
+ maxPriorityFeePerGas: uo.maxPriorityFeePerGas,
44
+ maxFeePerGas: uo.maxFeePerGas,
45
+ }),
46
+ paymasterAndData: uo.paymaster && isAddress(uo.paymaster)
47
+ ? packPaymasterData({
48
+ paymaster: uo.paymaster,
49
+ paymasterVerificationGasLimit: uo.paymasterVerificationGasLimit,
50
+ paymasterPostOpGasLimit: uo.paymasterPostOpGasLimit,
51
+ paymasterData: uo.paymasterData,
52
+ })
53
+ : "0x",
54
+ signature: uo.signature,
55
+ },
56
+ ],
57
+ client.account.address,
58
+ ],
59
+ });
60
+ }
61
+ }
62
+ catch (err) {
63
+ if (err?.cause && err?.cause?.raw) {
64
+ try {
65
+ const { errorName, args } = decodeErrorResult({
66
+ abi: entryPoint.abi,
67
+ data: err.cause.raw,
68
+ });
69
+ console.error(`Failed with '${errorName}':`);
70
+ switch (errorName) {
71
+ case "FailedOpWithRevert":
72
+ case "FailedOp":
73
+ // TODO: if we pass in abi we could decode and print this too
74
+ const argsIdx = errorName === "FailedOp" ? 1 : 2;
75
+ console.error(args && args[argsIdx]
76
+ ? `Smart contract account reverted with error: ${args[argsIdx]}`
77
+ : "No revert data from smart contract account");
78
+ break;
79
+ default:
80
+ args && args.forEach((arg) => console.error(`\n${arg}`));
81
+ }
82
+ return;
83
+ }
84
+ catch (err) { }
85
+ }
86
+ console.error("Entrypoint reverted with error: ");
87
+ console.error(err);
88
+ }
89
+ }
90
+ //# sourceMappingURL=getUserOperationError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getUserOperationError.js","sourceRoot":"","sources":["../../../../src/actions/smartAccount/getUserOperationError.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,MAAM,EACN,SAAS,EACT,iBAAiB,GAGlB,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAK/D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EACL,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAOzC,MAA4D,EAC5D,OAA6B,EAC7B,UAAyB;IAEzB,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,IAAI,oBAAoB,EAAE,CAAC;IACnC,CAAC;IAED,MAAM,EAAE,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;IAEhC,IAAI,CAAC;QACH,QAAQ,UAAU,CAAC,OAAO,EAAE,CAAC;YAC3B,KAAK,OAAO;gBACV,OAAO;gBACP,MAAM;YACR,KAAK,OAAO;gBACV,MAAM,MAAM,CAAC,gBAAgB,CAAC;oBAC5B,OAAO,EAAE,UAAU,CAAC,OAAO;oBAC3B,GAAG,EAAE,UAAU,CAAC,GAAG;oBACnB,YAAY,EAAE,WAAW;oBACzB,IAAI,EAAE;wBACJ;4BACE;gCACE,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,OAAO;gCAC9B,KAAK,EAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC;gCAClC,QAAQ,EAC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,CAAC,KAAK,CAAC,GAAG;iBACpB,CAAC,CAAC;gBACH,OAAO,CAAC,KAAK,CAAC,gBAAgB,SAAS,IAAI,CAAC,CAAC;gBAC7C,QAAQ,SAAS,EAAE,CAAC;oBAClB,KAAK,oBAAoB,CAAC;oBAC1B,KAAK,UAAU;wBACb,6DAA6D;wBAC7D,MAAM,OAAO,GAAG,SAAS,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;wBACjD,OAAO,CAAC,KAAK,CACX,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC;4BACnB,CAAC,CAAC,+CAA+C,IAAI,CAAC,OAAO,CAAC,EAAE;4BAChE,CAAC,CAAC,4CAA4C,CACjD,CAAC;wBACF,MAAM;oBACR;wBACE,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,GAAG,EAAE,CAAC,CAAC,CAAC;gBAC7D,CAAC;gBACD,OAAO;YACT,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC,CAAA,CAAC;QAClB,CAAC;QACD,OAAO,CAAC,KAAK,CAAC,kCAAkC,CAAC,CAAC;QAClD,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACrB,CAAC;AACH,CAAC","sourcesContent":["import {\n fromHex,\n concat,\n isAddress,\n decodeErrorResult,\n type Chain,\n type Transport,\n} from \"viem\";\nimport { AccountNotFoundError } from \"../../errors/account.js\";\nimport type { BaseSmartAccountClient } from \"../../client/smartAccountClient\";\nimport type { SmartContractAccount } from \"../../account/smartContractAccount.js\";\nimport type { UserOperationRequest } from \"../../types.js\";\nimport type { EntryPointDef } from \"../../index.js\";\nimport { deepHexlify } from \"../../utils/index.js\";\nimport {\n packAccountGasLimits,\n packPaymasterData,\n} from \"../../entrypoint/0.7.js\";\n\n/**\n * Retrieves the error message from an entrypoint for a User Operation.\n *\n * @param {Client<TTransport, TChain, TAccount>} client the smart account client to use for RPC requests\n * @param {UserOperationRequest} request the uo request to get the error for\n * @param {EntryPointDef} entryPoint the entrypoint instance to send the uo to\n * @returns {string} the error message from the entrypoint\n */\nexport async function getUserOperationError<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n>(\n client: BaseSmartAccountClient<TTransport, TChain, TAccount>,\n request: UserOperationRequest,\n entryPoint: EntryPointDef,\n) {\n if (!client.account) {\n throw new AccountNotFoundError();\n }\n\n const uo = deepHexlify(request);\n\n try {\n switch (entryPoint.version) {\n case \"0.6.0\":\n // TODO\n break;\n case \"0.7.0\":\n await client.simulateContract({\n address: entryPoint.address,\n abi: entryPoint.abi,\n functionName: \"handleOps\",\n args: [\n [\n {\n sender: client.account.address,\n nonce: fromHex(uo.nonce, \"bigint\"),\n initCode:\n uo.factory && uo.factoryData\n ? concat([uo.factory, uo.factoryData])\n : \"0x\",\n callData: uo.callData,\n accountGasLimits: packAccountGasLimits({\n verificationGasLimit: uo.verificationGasLimit,\n callGasLimit: uo.callGasLimit,\n }),\n preVerificationGas: fromHex(uo.preVerificationGas, \"bigint\"),\n gasFees: packAccountGasLimits({\n maxPriorityFeePerGas: uo.maxPriorityFeePerGas,\n maxFeePerGas: uo.maxFeePerGas,\n }),\n paymasterAndData:\n uo.paymaster && isAddress(uo.paymaster)\n ? packPaymasterData({\n paymaster: uo.paymaster,\n paymasterVerificationGasLimit:\n uo.paymasterVerificationGasLimit,\n paymasterPostOpGasLimit: uo.paymasterPostOpGasLimit,\n paymasterData: uo.paymasterData,\n })\n : \"0x\",\n signature: uo.signature,\n },\n ],\n client.account.address,\n ],\n });\n }\n } catch (err: any) {\n if (err?.cause && err?.cause?.raw) {\n try {\n const { errorName, args } = decodeErrorResult({\n abi: entryPoint.abi,\n data: err.cause.raw,\n });\n console.error(`Failed with '${errorName}':`);\n switch (errorName) {\n case \"FailedOpWithRevert\":\n case \"FailedOp\":\n // TODO: if we pass in abi we could decode and print this too\n const argsIdx = errorName === \"FailedOp\" ? 1 : 2;\n console.error(\n args && args[argsIdx]\n ? `Smart contract account reverted with error: ${args[argsIdx]}`\n : \"No revert data from smart contract account\",\n );\n break;\n default:\n args && args.forEach((arg) => console.error(`\\n${arg}`));\n }\n return;\n } catch (err) {}\n }\n console.error(\"Entrypoint reverted with error: \");\n console.error(err);\n }\n}\n"]}
@@ -1,6 +1,7 @@
1
1
  import { AccountNotFoundError } from "../../../errors/account.js";
2
2
  import { ChainNotFoundError } from "../../../errors/client.js";
3
3
  import { signUserOperation } from "../signUserOperation.js";
4
+ import { getUserOperationError } from "../getUserOperationError.js";
4
5
  export async function _sendUserOperation(client, args) {
5
6
  const { account = client.account, uoStruct, context, overrides } = args;
6
7
  if (!account) {
@@ -16,9 +17,15 @@ export async function _sendUserOperation(client, args) {
16
17
  context,
17
18
  overrides,
18
19
  });
19
- return {
20
- hash: await client.sendRawUserOperation(request, entryPoint.address),
21
- request,
22
- };
20
+ try {
21
+ return {
22
+ hash: await client.sendRawUserOperation(request, entryPoint.address),
23
+ request,
24
+ };
25
+ }
26
+ catch (err) {
27
+ getUserOperationError(client, request, entryPoint);
28
+ throw err;
29
+ }
23
30
  }
24
31
  //# sourceMappingURL=sendUserOperation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sendUserOperation.js","sourceRoot":"","sources":["../../../../../src/actions/smartAccount/internal/sendUserOperation.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAK/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAG5D,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAYtC,MAA4D,EAC5D,IAI+B;IAE/B,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;IACxE,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,oBAAoB,EAAE,CAAC;IACnC,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QAClB,MAAM,IAAI,kBAAkB,EAAE,CAAC;IACjC,CAAC;IAED,MAAM,UAAU,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAC3C,MAAM,OAAO,GAAG,MAAM,iBAAiB,CAAC,MAAM,EAAE;QAC9C,QAAQ;QACR,OAAO;QACP,OAAO;QACP,SAAS;KACV,CAAC,CAAC;IAEH,OAAO;QACL,IAAI,EAAE,MAAM,MAAM,CAAC,oBAAoB,CAAC,OAAO,EAAE,UAAU,CAAC,OAAO,CAAC;QACpE,OAAO;KACR,CAAC;AACJ,CAAC","sourcesContent":["import type { Chain, Transport } from \"viem\";\nimport type {\n GetAccountParameter,\n GetEntryPointFromAccount,\n SmartContractAccount,\n} from \"../../../account/smartContractAccount\";\nimport type { BaseSmartAccountClient } from \"../../../client/smartAccountClient\";\nimport type { SendUserOperationResult } from \"../../../client/types\";\nimport { AccountNotFoundError } from \"../../../errors/account.js\";\nimport { ChainNotFoundError } from \"../../../errors/client.js\";\nimport type {\n UserOperationOverrides,\n UserOperationStruct,\n} from \"../../../types\";\nimport { signUserOperation } from \"../signUserOperation.js\";\nimport type { GetContextParameter, UserOperationContext } from \"../types\";\n\nexport async function _sendUserOperation<\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 TEntryPointVersion extends\n GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>,\n>(\n client: BaseSmartAccountClient<TTransport, TChain, TAccount>,\n args: {\n uoStruct: UserOperationStruct<TEntryPointVersion>;\n overrides?: UserOperationOverrides<TEntryPointVersion>;\n } & GetAccountParameter<TAccount> &\n GetContextParameter<TContext>,\n): Promise<SendUserOperationResult<TEntryPointVersion>> {\n const { account = client.account, uoStruct, context, overrides } = args;\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n\n const entryPoint = account.getEntryPoint();\n const request = await signUserOperation(client, {\n uoStruct,\n account,\n context,\n overrides,\n });\n\n return {\n hash: await client.sendRawUserOperation(request, entryPoint.address),\n request,\n };\n}\n"]}
1
+ {"version":3,"file":"sendUserOperation.js","sourceRoot":"","sources":["../../../../../src/actions/smartAccount/internal/sendUserOperation.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAK/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAEpE,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAYtC,MAA4D,EAC5D,IAI+B;IAE/B,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;IACxE,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,oBAAoB,EAAE,CAAC;IACnC,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QAClB,MAAM,IAAI,kBAAkB,EAAE,CAAC;IACjC,CAAC;IAED,MAAM,UAAU,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAC3C,MAAM,OAAO,GAAG,MAAM,iBAAiB,CAAC,MAAM,EAAE;QAC9C,QAAQ;QACR,OAAO;QACP,OAAO;QACP,SAAS;KACV,CAAC,CAAC;IAEH,IAAI,CAAC;QACH,OAAO;YACL,IAAI,EAAE,MAAM,MAAM,CAAC,oBAAoB,CAAC,OAAO,EAAE,UAAU,CAAC,OAAO,CAAC;YACpE,OAAO;SACR,CAAC;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,qBAAqB,CAAC,MAAM,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;QACnD,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC","sourcesContent":["import type { Chain, Transport } from \"viem\";\nimport type {\n GetAccountParameter,\n GetEntryPointFromAccount,\n SmartContractAccount,\n} from \"../../../account/smartContractAccount\";\nimport type { BaseSmartAccountClient } from \"../../../client/smartAccountClient\";\nimport type { SendUserOperationResult } from \"../../../client/types\";\nimport { AccountNotFoundError } from \"../../../errors/account.js\";\nimport { ChainNotFoundError } from \"../../../errors/client.js\";\nimport type {\n UserOperationOverrides,\n UserOperationStruct,\n} from \"../../../types\";\nimport { signUserOperation } from \"../signUserOperation.js\";\nimport type { GetContextParameter, UserOperationContext } from \"../types\";\nimport { getUserOperationError } from \"../getUserOperationError.js\";\n\nexport async function _sendUserOperation<\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 TEntryPointVersion extends\n GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>,\n>(\n client: BaseSmartAccountClient<TTransport, TChain, TAccount>,\n args: {\n uoStruct: UserOperationStruct<TEntryPointVersion>;\n overrides?: UserOperationOverrides<TEntryPointVersion>;\n } & GetAccountParameter<TAccount> &\n GetContextParameter<TContext>,\n): Promise<SendUserOperationResult<TEntryPointVersion>> {\n const { account = client.account, uoStruct, context, overrides } = args;\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n\n const entryPoint = account.getEntryPoint();\n const request = await signUserOperation(client, {\n uoStruct,\n account,\n context,\n overrides,\n });\n\n try {\n return {\n hash: await client.sendRawUserOperation(request, entryPoint.address),\n request,\n };\n } catch (err) {\n getUserOperationError(client, request, entryPoint);\n throw err;\n }\n}\n"]}
@@ -61,3 +61,4 @@ export type * from "./types.js";
61
61
  export type * from "./utils/index.js";
62
62
  export { TraceHeader, TRACE_HEADER_NAME, TRACE_HEADER_STATE, } from "./utils/traceHeader.js";
63
63
  export { BigNumberishRangeSchema, BigNumberishSchema, ChainSchema, HexSchema, MultiplierSchema, allEqual, applyUserOpFeeOption, applyUserOpOverride, applyUserOpOverrideOrFeeOption, asyncPipe, bigIntMax, bigIntMultiply, bypassPaymasterAndData, bypassPaymasterAndDataEmptyHex, concatPaymasterAndData, deepHexlify, filterUndefined, getDefaultUserOperationFeeOptions, isBigNumberish, isMultiplier, isValidRequest, parsePaymasterAndData, pick, resolveProperties, takeBytes, toRecord, } from "./utils/index.js";
64
+ export { getUserOperationError } from "./actions/smartAccount/getUserOperationError.js";
package/dist/esm/index.js CHANGED
@@ -46,4 +46,5 @@ export { WalletClientSigner } from "./signer/wallet-client.js";
46
46
  export { split } from "./transport/split.js";
47
47
  export { TraceHeader, TRACE_HEADER_NAME, TRACE_HEADER_STATE, } from "./utils/traceHeader.js";
48
48
  export { BigNumberishRangeSchema, BigNumberishSchema, ChainSchema, HexSchema, MultiplierSchema, allEqual, applyUserOpFeeOption, applyUserOpOverride, applyUserOpOverrideOrFeeOption, asyncPipe, bigIntMax, bigIntMultiply, bypassPaymasterAndData, bypassPaymasterAndDataEmptyHex, concatPaymasterAndData, deepHexlify, filterUndefined, getDefaultUserOperationFeeOptions, isBigNumberish, isMultiplier, isValidRequest, parsePaymasterAndData, pick, resolveProperties, takeBytes, toRecord, } from "./utils/index.js";
49
+ export { getUserOperationError } from "./actions/smartAccount/getUserOperationError.js";
49
50
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,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,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAEhE,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAM5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,KAAK,EAA6B,MAAM,sBAAsB,CAAC;AAGxE,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,wBAAwB,CAAC;AAChC,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","sourcesContent":["export type { Abi } from \"abitype\";\nexport type { Address, HttpTransport } from \"viem\";\n\nexport { EntryPointAbi_v6 } from \"./abis/EntryPointAbi_v6.js\";\nexport { EntryPointAbi_v7 } from \"./abis/EntryPointAbi_v7.js\";\nexport { SimpleAccountAbi_v6 } from \"./abis/SimpleAccountAbi_v6.js\";\nexport { SimpleAccountAbi_v7 } from \"./abis/SimpleAccountAbi_v7.js\";\nexport { SimpleAccountFactoryAbi } from \"./abis/SimpleAccountFactoryAbi.js\";\nexport type * from \"./account/smartContractAccount.js\";\nexport {\n getAccountAddress,\n isSmartAccountWithSigner,\n parseFactoryAddressFromAccountInitCode,\n toSmartContractAccount,\n} from \"./account/smartContractAccount.js\";\nexport { buildUserOperation } from \"./actions/smartAccount/buildUserOperation.js\";\nexport { buildUserOperationFromTx } from \"./actions/smartAccount/buildUserOperationFromTx.js\";\nexport { buildUserOperationFromTxs } from \"./actions/smartAccount/buildUserOperationFromTxs.js\";\nexport { checkGasSponsorshipEligibility } from \"./actions/smartAccount/checkGasSponsorshipEligibility.js\";\nexport { dropAndReplaceUserOperation } from \"./actions/smartAccount/dropAndReplaceUserOperation.js\";\nexport { sendTransaction } from \"./actions/smartAccount/sendTransaction.js\";\nexport { sendTransactions } from \"./actions/smartAccount/sendTransactions.js\";\nexport { sendUserOperation } from \"./actions/smartAccount/sendUserOperation.js\";\nexport type * from \"./actions/smartAccount/types.js\";\nexport { waitForUserOperationTransaction } from \"./actions/smartAccount/waitForUserOperationTransacation.js\";\nexport type * from \"./client/bundlerClient.js\";\nexport {\n createBundlerClient,\n createBundlerClientFromExisting,\n} from \"./client/bundlerClient.js\";\nexport type * from \"./client/decorators/bundlerClient.js\";\nexport { bundlerActions } from \"./client/decorators/bundlerClient.js\";\nexport type * from \"./client/decorators/smartAccountClient.js\";\nexport { smartAccountClientActions } from \"./client/decorators/smartAccountClient.js\";\nexport { isSmartAccountClient } from \"./client/isSmartAccountClient.js\";\nexport {\n ConnectionConfigSchema,\n SmartAccountClientOptsSchema,\n} from \"./client/schema.js\";\nexport type * from \"./client/smartAccountClient.js\";\nexport {\n createSmartAccountClient,\n createSmartAccountClientFromExisting,\n} from \"./client/smartAccountClient.js\";\nexport type * from \"./client/types.js\";\nexport {\n convertChainIdToCoinType,\n convertCoinTypeToChain,\n convertCoinTypeToChainId,\n} from \"./ens/utils.js\";\nexport {\n defaultEntryPointVersion,\n entryPointRegistry,\n getEntryPoint,\n isEntryPointVersion,\n} from \"./entrypoint/index.js\";\nexport type * from \"./entrypoint/types.js\";\nexport {\n AccountNotFoundError,\n AccountRequiresOwnerError,\n BatchExecutionNotSupportedError,\n DefaultFactoryNotDefinedError,\n FailedToGetStorageSlotError,\n GetCounterFactualAddressError,\n IncorrectAccountType,\n SignTransactionNotSupportedError,\n SmartAccountWithSignerRequiredError,\n UpgradeToAndCallNotSupportedError,\n UpgradesNotSupportedError,\n} from \"./errors/account.js\";\nexport { BaseError } from \"./errors/base.js\";\nexport {\n ChainNotFoundError,\n IncompatibleClientError,\n InvalidRpcUrlError,\n InvalidEntityIdError,\n InvalidNonceKeyError,\n EntityIdOverrideError,\n InvalidModularAccountV2Mode,\n InvalidDeferredActionNonce,\n} from \"./errors/client.js\";\nexport {\n EntryPointNotFoundError,\n InvalidEntryPointError,\n} from \"./errors/entrypoint.js\";\nexport { InvalidSignerTypeError } from \"./errors/signer.js\";\nexport {\n FailedToFindTransactionError,\n TransactionMissingToParamError,\n} from \"./errors/transaction.js\";\nexport {\n InvalidUserOperationError,\n WaitForUserOperationError,\n} from \"./errors/useroperation.js\";\nexport * from \"./client/addBreadcrumb.js\";\nexport { LogLevel, Logger } from \"./logger.js\";\nexport { middlewareActions } from \"./middleware/actions.js\";\nexport { default7702UserOpSigner } from \"./middleware/defaults/7702signer.js\";\nexport { default7702GasEstimator } from \"./middleware/defaults/7702gasEstimator.js\";\nexport { defaultFeeEstimator } from \"./middleware/defaults/feeEstimator.js\";\nexport { defaultGasEstimator } from \"./middleware/defaults/gasEstimator.js\";\nexport { defaultPaymasterAndData } from \"./middleware/defaults/paymasterAndData.js\";\nexport { defaultUserOpSigner } from \"./middleware/defaults/userOpSigner.js\";\nexport type * from \"./middleware/erc7677middleware.js\";\nexport { erc7677Middleware } from \"./middleware/erc7677middleware.js\";\nexport { noopMiddleware } from \"./middleware/noopMiddleware.js\";\nexport type * from \"./middleware/types.js\";\nexport { LocalAccountSigner } from \"./signer/local-account.js\";\nexport { SignerSchema, isSigner } from \"./signer/schema.js\";\nexport type {\n SmartAccountAuthenticator,\n SmartAccountSigner,\n AuthorizationRequest,\n} from \"./signer/types.js\";\nexport { wrapSignatureWith6492 } from \"./signer/utils.js\";\nexport { WalletClientSigner } from \"./signer/wallet-client.js\";\nexport { split, type SplitTransportParams } from \"./transport/split.js\";\nexport type * from \"./types.js\";\nexport type * from \"./utils/index.js\";\nexport {\n TraceHeader,\n TRACE_HEADER_NAME,\n TRACE_HEADER_STATE,\n} from \"./utils/traceHeader.js\";\nexport {\n BigNumberishRangeSchema,\n BigNumberishSchema,\n ChainSchema,\n HexSchema,\n MultiplierSchema,\n allEqual,\n applyUserOpFeeOption,\n applyUserOpOverride,\n applyUserOpOverrideOrFeeOption,\n asyncPipe,\n bigIntMax,\n bigIntMultiply,\n bypassPaymasterAndData,\n bypassPaymasterAndDataEmptyHex,\n concatPaymasterAndData,\n deepHexlify,\n filterUndefined,\n getDefaultUserOperationFeeOptions,\n isBigNumberish,\n isMultiplier,\n isValidRequest,\n parsePaymasterAndData,\n pick,\n resolveProperties,\n takeBytes,\n toRecord,\n} from \"./utils/index.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,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;AAE5E,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,CAAC;AAChG,OAAO,EAAE,8BAA8B,EAAE,MAAM,0DAA0D,CAAC;AAC1G,OAAO,EAAE,2BAA2B,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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;AAC1B,OAAO,EAAE,qBAAqB,EAAE,MAAM,iDAAiD,CAAC","sourcesContent":["export type { Abi } from \"abitype\";\nexport type { Address, HttpTransport } from \"viem\";\n\nexport { EntryPointAbi_v6 } from \"./abis/EntryPointAbi_v6.js\";\nexport { EntryPointAbi_v7 } from \"./abis/EntryPointAbi_v7.js\";\nexport { SimpleAccountAbi_v6 } from \"./abis/SimpleAccountAbi_v6.js\";\nexport { SimpleAccountAbi_v7 } from \"./abis/SimpleAccountAbi_v7.js\";\nexport { SimpleAccountFactoryAbi } from \"./abis/SimpleAccountFactoryAbi.js\";\nexport type * from \"./account/smartContractAccount.js\";\nexport {\n getAccountAddress,\n isSmartAccountWithSigner,\n parseFactoryAddressFromAccountInitCode,\n toSmartContractAccount,\n} from \"./account/smartContractAccount.js\";\nexport { buildUserOperation } from \"./actions/smartAccount/buildUserOperation.js\";\nexport { buildUserOperationFromTx } from \"./actions/smartAccount/buildUserOperationFromTx.js\";\nexport { buildUserOperationFromTxs } from \"./actions/smartAccount/buildUserOperationFromTxs.js\";\nexport { checkGasSponsorshipEligibility } from \"./actions/smartAccount/checkGasSponsorshipEligibility.js\";\nexport { dropAndReplaceUserOperation } from \"./actions/smartAccount/dropAndReplaceUserOperation.js\";\nexport { sendTransaction } from \"./actions/smartAccount/sendTransaction.js\";\nexport { sendTransactions } from \"./actions/smartAccount/sendTransactions.js\";\nexport { sendUserOperation } from \"./actions/smartAccount/sendUserOperation.js\";\nexport type * from \"./actions/smartAccount/types.js\";\nexport { waitForUserOperationTransaction } from \"./actions/smartAccount/waitForUserOperationTransacation.js\";\nexport type * from \"./client/bundlerClient.js\";\nexport {\n createBundlerClient,\n createBundlerClientFromExisting,\n} from \"./client/bundlerClient.js\";\nexport type * from \"./client/decorators/bundlerClient.js\";\nexport { bundlerActions } from \"./client/decorators/bundlerClient.js\";\nexport type * from \"./client/decorators/smartAccountClient.js\";\nexport { smartAccountClientActions } from \"./client/decorators/smartAccountClient.js\";\nexport { isSmartAccountClient } from \"./client/isSmartAccountClient.js\";\nexport {\n ConnectionConfigSchema,\n SmartAccountClientOptsSchema,\n} from \"./client/schema.js\";\nexport type * from \"./client/smartAccountClient.js\";\nexport {\n createSmartAccountClient,\n createSmartAccountClientFromExisting,\n} from \"./client/smartAccountClient.js\";\nexport type * from \"./client/types.js\";\nexport {\n convertChainIdToCoinType,\n convertCoinTypeToChain,\n convertCoinTypeToChainId,\n} from \"./ens/utils.js\";\nexport {\n defaultEntryPointVersion,\n entryPointRegistry,\n getEntryPoint,\n isEntryPointVersion,\n} from \"./entrypoint/index.js\";\nexport type * from \"./entrypoint/types.js\";\nexport {\n AccountNotFoundError,\n AccountRequiresOwnerError,\n BatchExecutionNotSupportedError,\n DefaultFactoryNotDefinedError,\n FailedToGetStorageSlotError,\n GetCounterFactualAddressError,\n IncorrectAccountType,\n SignTransactionNotSupportedError,\n SmartAccountWithSignerRequiredError,\n UpgradeToAndCallNotSupportedError,\n UpgradesNotSupportedError,\n} from \"./errors/account.js\";\nexport { BaseError } from \"./errors/base.js\";\nexport {\n ChainNotFoundError,\n IncompatibleClientError,\n InvalidRpcUrlError,\n InvalidEntityIdError,\n InvalidNonceKeyError,\n EntityIdOverrideError,\n InvalidModularAccountV2Mode,\n InvalidDeferredActionNonce,\n} from \"./errors/client.js\";\nexport {\n EntryPointNotFoundError,\n InvalidEntryPointError,\n} from \"./errors/entrypoint.js\";\nexport { InvalidSignerTypeError } from \"./errors/signer.js\";\nexport {\n FailedToFindTransactionError,\n TransactionMissingToParamError,\n} from \"./errors/transaction.js\";\nexport {\n InvalidUserOperationError,\n WaitForUserOperationError,\n} from \"./errors/useroperation.js\";\nexport * from \"./client/addBreadcrumb.js\";\nexport { LogLevel, Logger } from \"./logger.js\";\nexport { middlewareActions } from \"./middleware/actions.js\";\nexport { default7702UserOpSigner } from \"./middleware/defaults/7702signer.js\";\nexport { default7702GasEstimator } from \"./middleware/defaults/7702gasEstimator.js\";\nexport { defaultFeeEstimator } from \"./middleware/defaults/feeEstimator.js\";\nexport { defaultGasEstimator } from \"./middleware/defaults/gasEstimator.js\";\nexport { defaultPaymasterAndData } from \"./middleware/defaults/paymasterAndData.js\";\nexport { defaultUserOpSigner } from \"./middleware/defaults/userOpSigner.js\";\nexport type * from \"./middleware/erc7677middleware.js\";\nexport { erc7677Middleware } from \"./middleware/erc7677middleware.js\";\nexport { noopMiddleware } from \"./middleware/noopMiddleware.js\";\nexport type * from \"./middleware/types.js\";\nexport { LocalAccountSigner } from \"./signer/local-account.js\";\nexport { SignerSchema, isSigner } from \"./signer/schema.js\";\nexport type {\n SmartAccountAuthenticator,\n SmartAccountSigner,\n AuthorizationRequest,\n} from \"./signer/types.js\";\nexport { wrapSignatureWith6492 } from \"./signer/utils.js\";\nexport { WalletClientSigner } from \"./signer/wallet-client.js\";\nexport { split, type SplitTransportParams } from \"./transport/split.js\";\nexport type * from \"./types.js\";\nexport type * from \"./utils/index.js\";\nexport {\n TraceHeader,\n TRACE_HEADER_NAME,\n TRACE_HEADER_STATE,\n} from \"./utils/traceHeader.js\";\nexport {\n BigNumberishRangeSchema,\n BigNumberishSchema,\n ChainSchema,\n HexSchema,\n MultiplierSchema,\n allEqual,\n applyUserOpFeeOption,\n applyUserOpOverride,\n applyUserOpOverrideOrFeeOption,\n asyncPipe,\n bigIntMax,\n bigIntMultiply,\n bypassPaymasterAndData,\n bypassPaymasterAndDataEmptyHex,\n concatPaymasterAndData,\n deepHexlify,\n filterUndefined,\n getDefaultUserOperationFeeOptions,\n isBigNumberish,\n isMultiplier,\n isValidRequest,\n parsePaymasterAndData,\n pick,\n resolveProperties,\n takeBytes,\n toRecord,\n} from \"./utils/index.js\";\nexport { getUserOperationError } from \"./actions/smartAccount/getUserOperationError.js\";\n"]}
@@ -1 +1 @@
1
- export declare const VERSION = "4.35.1";
1
+ export declare const VERSION = "4.36.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.35.1";
3
+ export const VERSION = "4.36.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.35.1\";\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.36.1\";\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"estimateUserOperationGas.d.ts","sourceRoot":"","sources":["../../../../src/actions/smartAccount/estimateUserOperationGas.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACrD,OAAO,EACL,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EAC1B,MAAM,uCAAuC,CAAC;AAI/C,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,gBAAgB,CAAC;AAGvE,OAAO,KAAK,EACV,2BAA2B,EAC3B,oBAAoB,EACrB,MAAM,YAAY,CAAC;AAGpB;;;;;;;;;;;;GAYG;AACH,wBAA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C,GAAG,wBAAwB,CAAC,QAAQ,CAAC,EAEzE,OAAO,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,EAC7C,IAAI,EAAE,2BAA2B,CAAC,QAAQ,EAAE,QAAQ,CAAC,GACpD,OAAO,CAAC,gCAAgC,CAAC,kBAAkB,CAAC,CAAC,CA4B/D"}
@@ -0,0 +1,15 @@
1
+ import { type Chain, type Transport } from "viem";
2
+ import type { BaseSmartAccountClient } from "../../client/smartAccountClient";
3
+ import type { SmartContractAccount } from "../../account/smartContractAccount.js";
4
+ import type { UserOperationRequest } from "../../types.js";
5
+ import type { EntryPointDef } from "../../index.js";
6
+ /**
7
+ * Retrieves the error message from an entrypoint for a User Operation.
8
+ *
9
+ * @param {Client<TTransport, TChain, TAccount>} client the smart account client to use for RPC requests
10
+ * @param {UserOperationRequest} request the uo request to get the error for
11
+ * @param {EntryPointDef} entryPoint the entrypoint instance to send the uo to
12
+ * @returns {string} the error message from the entrypoint
13
+ */
14
+ export declare function getUserOperationError<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TAccount extends SmartContractAccount | undefined = SmartContractAccount | undefined>(client: BaseSmartAccountClient<TTransport, TChain, TAccount>, request: UserOperationRequest, entryPoint: EntryPointDef): Promise<void>;
15
+ //# sourceMappingURL=getUserOperationError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getUserOperationError.d.ts","sourceRoot":"","sources":["../../../../src/actions/smartAccount/getUserOperationError.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,KAAK,EACV,KAAK,SAAS,EACf,MAAM,MAAM,CAAC;AAEd,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAClF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAOpD;;;;;;;GAOG;AACH,wBAAsB,qBAAqB,CACzC,UAAU,SAAS,SAAS,GAAG,SAAS,EACxC,MAAM,SAAS,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,EACpD,QAAQ,SAAS,oBAAoB,GAAG,SAAS,GAC7C,oBAAoB,GACpB,SAAS,EAEb,MAAM,EAAE,sBAAsB,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,EAC5D,OAAO,EAAE,oBAAoB,EAC7B,UAAU,EAAE,aAAa,iBAkF1B"}
@@ -1 +1 @@
1
- {"version":3,"file":"sendUserOperation.d.ts","sourceRoot":"","sources":["../../../../../src/actions/smartAccount/internal/sendUserOperation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAC7C,OAAO,KAAK,EACV,mBAAmB,EACnB,wBAAwB,EACxB,oBAAoB,EACrB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AACjF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAGrE,OAAO,KAAK,EACV,sBAAsB,EACtB,mBAAmB,EACpB,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAE1E,wBAAsB,kBAAkB,CACtC,UAAU,SAAS,SAAS,GAAG,SAAS,EACxC,MAAM,SAAS,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,EACpD,QAAQ,SAAS,oBAAoB,GAAG,SAAS,GAC7C,oBAAoB,GACpB,SAAS,EACb,QAAQ,SAAS,oBAAoB,GAAG,SAAS,GAC7C,oBAAoB,GACpB,SAAS,EACb,kBAAkB,SAChB,wBAAwB,CAAC,QAAQ,CAAC,GAAG,wBAAwB,CAAC,QAAQ,CAAC,EAEzE,M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AAM,EAAE,QAAQ,CAAC,EAC5D,IAAI,EAAE;IACJ,QAAQ,EAAE,mBAAmB,CAAC,kBAAkB,CAAC,CAAC;IAClD,SAAS,CAAC,EAAE,sBAAsB,CAAC,kBAAkB,CAAC,CAAC;CACxD,GAAG,mBAAmB,CAAC,QAAQ,CAAC,GAC/B,mBAAmB,CAAC,QAAQ,CAAC,GAC9B,OAAO,CAAC,uBAAuB,CAAC,kBAAkB,CAAC,CAAC,CA2BtD"}
@@ -61,4 +61,5 @@ export type * from "./types.js";
61
61
  export type * from "./utils/index.js";
62
62
  export { TraceHeader, TRACE_HEADER_NAME, TRACE_HEADER_STATE, } from "./utils/traceHeader.js";
63
63
  export { BigNumberishRangeSchema, BigNumberishSchema, ChainSchema, HexSchema, MultiplierSchema, allEqual, applyUserOpFeeOption, applyUserOpOverride, applyUserOpOverrideOrFeeOption, asyncPipe, bigIntMax, bigIntMultiply, bypassPaymasterAndData, bypassPaymasterAndDataEmptyHex, concatPaymasterAndData, deepHexlify, filterUndefined, getDefaultUserOperationFeeOptions, isBigNumberish, isMultiplier, isValidRequest, parsePaymasterAndData, pick, resolveProperties, takeBytes, toRecord, } from "./utils/index.js";
64
+ export { getUserOperationError } from "./actions/smartAccount/getUserOperationError.js";
64
65
  //# sourceMappingURL=index.d.ts.map
@@ -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,uBA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AAiC,EACjC,cAAc,EACd,YAAY,EACZ,cAAc,EACd,qBAAqB,EACrB,IAAI,EACJ,iBAAiB,EACjB,SAAS,EACT,QAAQ,GACT,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,qBAAqB,EAAE,MAAM,iDAAiD,CAAC"}
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "4.35.1";
1
+ export declare const VERSION = "4.36.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.35.1",
4
+ "version": "4.36.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",
@@ -62,5 +62,5 @@
62
62
  "url": "https://github.com/alchemyplatform/aa-sdk/issues"
63
63
  },
64
64
  "homepage": "https://github.com/alchemyplatform/aa-sdk#readme",
65
- "gitHead": "31e2138c2dd08c5b32cc2d67b3f0d7b2a7d21f4f"
65
+ "gitHead": "005595d01c06d778deed48d554e41dd4ad99eab2"
66
66
  }
@@ -14,6 +14,7 @@ import type {
14
14
  UserOperationContext,
15
15
  } from "./types.js";
16
16
  import { clientHeaderTrack } from "../../index.js";
17
+ import { getUserOperationError } from "./getUserOperationError.js";
17
18
 
18
19
  /**
19
20
  * Description SmartAccountClientAction for estimating the gas cost of a user operation
@@ -59,10 +60,15 @@ export async function estimateUserOperationGas<
59
60
 
60
61
  return _initUserOperation(client, args).then(async (struct) => {
61
62
  const request = deepHexlify(await resolveProperties(struct));
62
- return client.estimateUserOperationGas(
63
- request,
64
- account.getEntryPoint().address,
65
- overrides?.stateOverride,
66
- );
63
+ try {
64
+ return await client.estimateUserOperationGas(
65
+ request,
66
+ account.getEntryPoint().address,
67
+ overrides?.stateOverride,
68
+ );
69
+ } catch (err) {
70
+ getUserOperationError(client, request, account.getEntryPoint());
71
+ throw err;
72
+ }
67
73
  });
68
74
  }
@@ -0,0 +1,119 @@
1
+ import {
2
+ fromHex,
3
+ concat,
4
+ isAddress,
5
+ decodeErrorResult,
6
+ type Chain,
7
+ type Transport,
8
+ } from "viem";
9
+ import { AccountNotFoundError } from "../../errors/account.js";
10
+ import type { BaseSmartAccountClient } from "../../client/smartAccountClient";
11
+ import type { SmartContractAccount } from "../../account/smartContractAccount.js";
12
+ import type { UserOperationRequest } from "../../types.js";
13
+ import type { EntryPointDef } from "../../index.js";
14
+ import { deepHexlify } from "../../utils/index.js";
15
+ import {
16
+ packAccountGasLimits,
17
+ packPaymasterData,
18
+ } from "../../entrypoint/0.7.js";
19
+
20
+ /**
21
+ * Retrieves the error message from an entrypoint for a User Operation.
22
+ *
23
+ * @param {Client<TTransport, TChain, TAccount>} client the smart account client to use for RPC requests
24
+ * @param {UserOperationRequest} request the uo request to get the error for
25
+ * @param {EntryPointDef} entryPoint the entrypoint instance to send the uo to
26
+ * @returns {string} the error message from the entrypoint
27
+ */
28
+ export async function getUserOperationError<
29
+ TTransport extends Transport = Transport,
30
+ TChain extends Chain | undefined = Chain | undefined,
31
+ TAccount extends SmartContractAccount | undefined =
32
+ | SmartContractAccount
33
+ | undefined,
34
+ >(
35
+ client: BaseSmartAccountClient<TTransport, TChain, TAccount>,
36
+ request: UserOperationRequest,
37
+ entryPoint: EntryPointDef,
38
+ ) {
39
+ if (!client.account) {
40
+ throw new AccountNotFoundError();
41
+ }
42
+
43
+ const uo = deepHexlify(request);
44
+
45
+ try {
46
+ switch (entryPoint.version) {
47
+ case "0.6.0":
48
+ // TODO
49
+ break;
50
+ case "0.7.0":
51
+ await client.simulateContract({
52
+ address: entryPoint.address,
53
+ abi: entryPoint.abi,
54
+ functionName: "handleOps",
55
+ args: [
56
+ [
57
+ {
58
+ sender: client.account.address,
59
+ nonce: fromHex(uo.nonce, "bigint"),
60
+ initCode:
61
+ uo.factory && uo.factoryData
62
+ ? concat([uo.factory, uo.factoryData])
63
+ : "0x",
64
+ callData: uo.callData,
65
+ accountGasLimits: packAccountGasLimits({
66
+ verificationGasLimit: uo.verificationGasLimit,
67
+ callGasLimit: uo.callGasLimit,
68
+ }),
69
+ preVerificationGas: fromHex(uo.preVerificationGas, "bigint"),
70
+ gasFees: packAccountGasLimits({
71
+ maxPriorityFeePerGas: uo.maxPriorityFeePerGas,
72
+ maxFeePerGas: uo.maxFeePerGas,
73
+ }),
74
+ paymasterAndData:
75
+ uo.paymaster && isAddress(uo.paymaster)
76
+ ? packPaymasterData({
77
+ paymaster: uo.paymaster,
78
+ paymasterVerificationGasLimit:
79
+ uo.paymasterVerificationGasLimit,
80
+ paymasterPostOpGasLimit: uo.paymasterPostOpGasLimit,
81
+ paymasterData: uo.paymasterData,
82
+ })
83
+ : "0x",
84
+ signature: uo.signature,
85
+ },
86
+ ],
87
+ client.account.address,
88
+ ],
89
+ });
90
+ }
91
+ } catch (err: any) {
92
+ if (err?.cause && err?.cause?.raw) {
93
+ try {
94
+ const { errorName, args } = decodeErrorResult({
95
+ abi: entryPoint.abi,
96
+ data: err.cause.raw,
97
+ });
98
+ console.error(`Failed with '${errorName}':`);
99
+ switch (errorName) {
100
+ case "FailedOpWithRevert":
101
+ case "FailedOp":
102
+ // TODO: if we pass in abi we could decode and print this too
103
+ const argsIdx = errorName === "FailedOp" ? 1 : 2;
104
+ console.error(
105
+ args && args[argsIdx]
106
+ ? `Smart contract account reverted with error: ${args[argsIdx]}`
107
+ : "No revert data from smart contract account",
108
+ );
109
+ break;
110
+ default:
111
+ args && args.forEach((arg) => console.error(`\n${arg}`));
112
+ }
113
+ return;
114
+ } catch (err) {}
115
+ }
116
+ console.error("Entrypoint reverted with error: ");
117
+ console.error(err);
118
+ }
119
+ }
@@ -14,6 +14,7 @@ import type {
14
14
  } from "../../../types";
15
15
  import { signUserOperation } from "../signUserOperation.js";
16
16
  import type { GetContextParameter, UserOperationContext } from "../types";
17
+ import { getUserOperationError } from "../getUserOperationError.js";
17
18
 
18
19
  export async function _sendUserOperation<
19
20
  TTransport extends Transport = Transport,
@@ -51,8 +52,13 @@ export async function _sendUserOperation<
51
52
  overrides,
52
53
  });
53
54
 
54
- return {
55
- hash: await client.sendRawUserOperation(request, entryPoint.address),
56
- request,
57
- };
55
+ try {
56
+ return {
57
+ hash: await client.sendRawUserOperation(request, entryPoint.address),
58
+ request,
59
+ };
60
+ } catch (err) {
61
+ getUserOperationError(client, request, entryPoint);
62
+ throw err;
63
+ }
58
64
  }
package/src/index.ts CHANGED
@@ -150,3 +150,4 @@ export {
150
150
  takeBytes,
151
151
  toRecord,
152
152
  } from "./utils/index.js";
153
+ export { getUserOperationError } from "./actions/smartAccount/getUserOperationError.js";
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.35.1";
3
+ export const VERSION = "4.36.1";