feat(transaction-controller): add approval-time sponsorship/signing hooks - #10109
Open
pedronfigueiredo wants to merge 6 commits into
Open
feat(transaction-controller): add approval-time sponsorship/signing hooks#10109pedronfigueiredo wants to merge 6 commits into
pedronfigueiredo wants to merge 6 commits into
Conversation
pedronfigueiredo
temporarily deployed
to
default-branch
September 4, 2026 10:26 — with
GitHub Actions
Inactive
jpuri
previously approved these changes
Sep 4, 2026
matthewwalsh0
requested changes
Sep 7, 2026
pedronfigueiredo
force-pushed
the
pnf/canonical-transaction-approval-preparation-handoff-implementation
branch
2 times, most recently
from
September 10, 2026 09:58
c78867c to
bd526cb
Compare
pedronfigueiredo
force-pushed
the
pnf/canonical-transaction-approval-preparation-handoff-implementation
branch
from
September 10, 2026 10:53
57e5828 to
83c15c8
Compare
pedronfigueiredo
force-pushed
the
pnf/canonical-transaction-approval-preparation-handoff-implementation
branch
from
September 10, 2026 11:17
83c15c8 to
ec803b7
Compare
pedronfigueiredo
force-pushed
the
pnf/canonical-transaction-approval-preparation-handoff-implementation
branch
from
September 10, 2026 17:18
ec803b7 to
01d269f
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 53cdb36. Configure here.
pedronfigueiredo
force-pushed
the
pnf/canonical-transaction-approval-preparation-handoff-implementation
branch
from
September 10, 2026 17:40
53cdb36 to
688ed6e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Related pull requests
Summary
isSponsoredandshouldSignhooks toTransactionControllerOptions['hooks']so clients supply approval-time sponsorship and local-vs-external signing policy at the approval boundarybeforeSignexecution even when the approved transaction ends up on the external-sign pathPublic API
Behavior decisions
isSponsoredanswers whether the transaction should be treated as sponsored at approval time.shouldSignanswers whether the controller should reserve a nonce and sign locally.beforeSignstill runs before gas-fee-token publication checks, even when the final path does not locally sign.Validation
corepack yarn workspace @metamask/transaction-controller run jest --no-watchman --no-coverage packages/transaction-controller/src/TransactionController.test.tscorepack yarn buildNote
High Risk
Reorders the post-approval signing pipeline (nonce, sponsorship, external sign, gas-fee preflight), which affects every approved transaction and coordinated extension/mobile consumers.
Overview
Adds
isSponsoredandshouldSigncontroller hooks (exported asIsSponsoredHook/ShouldSignHook) so clients decide sponsorship and local vs external signing at approval time, with defaults tied toisGasFeeSponsoredand!isExternalSign.Approval flow is reordered: mark approved →
beforeSign→ gas-fee-token preflight (checkGasFeeTokenBeforePublish, moved out of#signTransactionfor this path) → run hooks and setisGasFeeSponsored/isExternalSign→ only reserve nonce and sign whenshouldSignis true; external-sign paths skip nonce lock and clear nonce.#signTransactiongains optional skips so the approval path does not duplicate those steps.Smaller fixes: transaction batch gas estimates update from the gas-fee poller; simulation requests initialize delegation overrides when missing;
getGasFeeTokensreturns empty tokens when EIP-7702 pubkey or upgrade address is missing; minorgetTransactionstyping andremoveLeadingZeroescleanup. Tests cover hook ordering, external-sign behavior, andtransactionApprovedincluding nonce after sign.Reviewed by Cursor Bugbot for commit 688ed6e. Bugbot is set up for automated code reviews on this repo. Configure here.