Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

explorer: add support for user operations #3312

Open
alvrs opened this issue Oct 21, 2024 · 0 comments
Open

explorer: add support for user operations #3312

alvrs opened this issue Oct 21, 2024 · 0 comments

Comments

@alvrs
Copy link
Member

alvrs commented Oct 21, 2024

const transaction = await getTransaction(userClient, { hash: txHash! });
if (transaction.to === entryPoint07Address) {
  console.log("entry point transaction", transaction);

  const decodedEntryPointCall = decodeFunctionData({
    abi: entryPoint07Abi,
    data: transaction.input,
  });

  const userOps = decodedEntryPointCall.args[0] as PackedUserOperation[];
  console.log("user operations", userOps);

  const decodedSmartAccountCall = decodeFunctionData({
    abi: parseAbi(["function execute(address target, uint256 value, bytes calldata data)"]),
    data: userOps[0].callData,
  });

  console.log("decoded smart account call", decodedSmartAccountCall);
}

Note this snippet only considers entry point 0.7 transactions and only those that use a smart account that has the execute signature. We can add support for more in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

2 participants
@alvrs and others