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

Use account snap by default in user operations #3844

Merged
merged 79 commits into from
Jan 29, 2024

Conversation

matthewwalsh0
Copy link
Member

@matthewwalsh0 matthewwalsh0 commented Jan 25, 2024

Explanation

Currently the UserOperationController requires a SmartContractAccount implementation in order to create user operations with addUserOperation and addUserOperationFromTransaction.

This PR provides a default implementation via SnapSmartContractAccount which means if no override is provided, all user operations will be created using the current account snap via the KeyringController.

In addition, this includes various bug fixes:

  • Delete user operation from state if rejected during approval.
  • Set transaction userFeeLevel to custom if using a paymaster.
  • Validate arguments when calling addUserOperationFromTransaction.

References

Changelog

@metamask/user-operation-controller

  • BREAKING: Add required from property to PrepareUserOperationRequest.
  • BREAKING: Add required from property to AddUserOperationRequest.
  • BREAKING: Make smartContractAccount optional in AddUserOperationOptions.
    • Use current account snap by default if not provided.
  • CHANGED: Delete user operation if rejected during approval.
  • CHANGED: Set userFeeLevel to custom in transaction event if using a paymaster.
  • CHANGED: Validate arguments when calling addUserOperationFromTransaction.

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've highlighted breaking changes using the "BREAKING" category above as appropriate

Add unit tests for Bundler helper.
Estimate gas only if not provided by account.
Do not throw unless hash function called.
Create associated unit tests.
Emit transaction-updated events.
Add isUserOperation property to transactions.
Add associated unit tests.
@matthewwalsh0 matthewwalsh0 marked this pull request as ready for review January 25, 2024 13:55
@matthewwalsh0 matthewwalsh0 requested a review from a team as a code owner January 25, 2024 13:55
@matthewwalsh0 matthewwalsh0 added the team-confirmations-system DEPRECATED: please use "team-confirmations" label instead label Jan 25, 2024
@matthewwalsh0 matthewwalsh0 merged commit 4bc2d40 into main Jan 29, 2024
136 checks passed
@matthewwalsh0 matthewwalsh0 deleted the feat/snap-smart-contract-account branch January 29, 2024 10:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-confirmations-system DEPRECATED: please use "team-confirmations" label instead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants