Skip to content

Conversation

@pedronfigueiredo
Copy link
Contributor

@pedronfigueiredo pedronfigueiredo commented Feb 9, 2026

Explanation

As per preemptive validation on #7806

  • Adds ordered strategy retrieval via TransactionPayController:getStrategies while preserving existing getStrategy behavior.
  • Adds compatibility filtering (supports(...)) during strategy selection.
  • Implements quote fallback orchestration:
    • try next strategy when quote retrieval fails
    • try next strategy when quote list is empty
    • skip unsupported strategies
  • Implements publish-hook fallback orchestration:
    • execute primary strategy from existing quote strategy
    • on execution failure, rebuild quote requests and try next compatible strategy
    • throw original primary error if all fallback attempts fail

References

Addresses https://github.com/MetaMask/MetaMask-planning/issues/6992

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 communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Medium Risk
Changes the core quote-selection and publish-time execution flow, so subtle ordering/compatibility or fallback edge cases could alter which strategy executes and affect transaction funding behavior.

Overview
Adds ordered strategy orchestration to transaction-pay-controller by introducing TransactionPayController:getStrategies (and a getStrategies constructor callback) while keeping getStrategy working as “first strategy or Relay”.

Quote retrieval now iterates the ordered strategies with optional supports(...) checks and falls back on errors or empty quotes; the publish hook similarly executes the quote’s encoded primary strategy first and, on failure, rebuilds quote requests and retries the next compatible strategies before rethrowing the original error. Documentation and tests are updated to cover the new fallback behavior and the new supports capability on PayStrategy.

Written by Cursor Bugbot for commit 782bc16. This will update automatically on new commits. Configure here.

@pedronfigueiredo pedronfigueiredo force-pushed the cor-6992-extract-fallback-mechanism branch 6 times, most recently from 23573ac to 55549a1 Compare February 9, 2026 11:34
@pedronfigueiredo pedronfigueiredo force-pushed the cor-6992-extract-fallback-mechanism branch from 55549a1 to e2818b3 Compare February 9, 2026 13:32
@pedronfigueiredo pedronfigueiredo force-pushed the cor-6992-extract-fallback-mechanism branch from e2818b3 to 5158351 Compare February 9, 2026 13:48
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

@pedronfigueiredo pedronfigueiredo force-pushed the cor-6992-extract-fallback-mechanism branch 2 times, most recently from 49eb1e8 to c450bc6 Compare February 9, 2026 14:22
@pedronfigueiredo pedronfigueiredo force-pushed the cor-6992-extract-fallback-mechanism branch from c450bc6 to 782bc16 Compare February 9, 2026 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant