Skip to content

feat: submit batch sell quotes#8775

Open
micaelae wants to merge 9 commits into
swaps4229-submitTx-strategy-refactorfrom
swaps4458-submit-batch-sell
Open

feat: submit batch sell quotes#8775
micaelae wants to merge 9 commits into
swaps4229-submitTx-strategy-refactorfrom
swaps4458-submit-batch-sell

Conversation

@micaelae
Copy link
Copy Markdown
Member

@micaelae micaelae commented May 12, 2026

Explanation

Client TODOs

  • add BridgeController:getState as an allowed messenger action for the bridge-status-controller
  • wire up submitBatchSell in metamask-controller (extension only)
  • add submitBatchSellTrade action similar to submitTx (extension only)
  • check isBatchSellTradeAvailable=true to enable submit button
  • submitBatchSell params are the same as submitTx, except clients need to pass a list of the recommendedQuotes instead of a single quote

References

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

High Risk
Breaking API and messenger changes plus multi-tx submission, EIP-7702 batching, and history-keying logic that affects swap/bridge activity and analytics accuracy.

Overview
Adds end-to-end BatchSell submission: BridgeStatusController:submitBatchSell loads batchSellTrades from BridgeController:getState and routes multi-quote flows through a new submitBatchSellHandler (non-atomic batches, STX vs EIP-7702 via shared shouldDisable7702).

bridge-status-controller extends submitTx and all submit strategies to accept arrays of quotes plus optional batchSellTrades; history now stores batchSellData, quoteIds (7702 delegation), and per-trade keys for STX. New exports: getBatchSellHistoryItemsForTxHash, isBatchSellHistoryItem. BatchSell batches no longer match history by batchId alone (avoids marking sibling trades complete/failed early). Swap completion/failure records completionTime for actual_time_minutes metrics; nested swap txs are treated like swaps.

bridge-controller extends BatchSellTradesResponse validation with gasIncluded / gasIncluded7702 (GaslessPropertiesSchema), removes deprecated BridgeUserAction / BridgeBackgroundAction exports, and tightens quote metadata types for metrics.

Breaking for integrators: allow BridgeController:getState on the status controller messenger; wire submitBatchSell with recommended quote list (same params as submitTx otherwise).

Reviewed by Cursor Bugbot for commit 403926e. Bugbot is set up for automated code reviews on this repo. Configure here.

@micaelae micaelae changed the base branch from main to swaps4229-submitTx-strategy-refactor May 12, 2026 15:45
@micaelae micaelae force-pushed the swaps4458-submit-batch-sell branch from 7db77cd to 24c2026 Compare May 12, 2026 17:41
Comment thread packages/bridge-status-controller/src/utils/transaction.ts Fixed
@micaelae micaelae force-pushed the swaps4458-submit-batch-sell branch 4 times, most recently from 580ef84 to 6686375 Compare May 21, 2026 01:02
@micaelae
Copy link
Copy Markdown
Member Author

@metamaskbot publish-preview

@github-actions
Copy link
Copy Markdown
Contributor

Preview builds have been published. Learn how to use preview builds in other projects.

Expand for full list of packages and versions.
@metamask-previews/account-tree-controller@7.4.0-preview-8751708e2
@metamask-previews/accounts-controller@38.1.1-preview-8751708e2
@metamask-previews/address-book-controller@7.1.2-preview-8751708e2
@metamask-previews/ai-controllers@0.6.3-preview-8751708e2
@metamask-previews/analytics-controller@1.1.0-preview-8751708e2
@metamask-previews/analytics-data-regulation-controller@0.0.0-preview-8751708e2
@metamask-previews/announcement-controller@8.1.0-preview-8751708e2
@metamask-previews/app-metadata-controller@2.0.1-preview-8751708e2
@metamask-previews/approval-controller@9.0.1-preview-8751708e2
@metamask-previews/assets-controller@8.0.1-preview-8751708e2
@metamask-previews/assets-controllers@108.1.0-preview-8751708e2
@metamask-previews/authenticated-user-storage@2.0.0-preview-8751708e2
@metamask-previews/base-controller@9.1.0-preview-8751708e2
@metamask-previews/base-data-service@0.1.3-preview-8751708e2
@metamask-previews/bridge-controller@73.0.1-preview-8751708e2
@metamask-previews/bridge-status-controller@71.2.0-preview-8751708e2
@metamask-previews/build-utils@3.0.4-preview-8751708e2
@metamask-previews/chain-agnostic-permission@1.6.1-preview-8751708e2
@metamask-previews/chomp-api-service@3.1.0-preview-8751708e2
@metamask-previews/claims-controller@0.5.1-preview-8751708e2
@metamask-previews/client-controller@1.0.1-preview-8751708e2
@metamask-previews/compliance-controller@2.0.1-preview-8751708e2
@metamask-previews/composable-controller@12.0.1-preview-8751708e2
@metamask-previews/config-registry-controller@0.3.1-preview-8751708e2
@metamask-previews/connectivity-controller@0.2.0-preview-8751708e2
@metamask-previews/controller-utils@12.1.0-preview-8751708e2
@metamask-previews/core-backend@6.3.0-preview-8751708e2
@metamask-previews/delegation-controller@3.0.0-preview-8751708e2
@metamask-previews/earn-controller@12.2.0-preview-8751708e2
@metamask-previews/eip-5792-middleware@3.0.4-preview-8751708e2
@metamask-previews/eip-7702-internal-rpc-middleware@0.1.1-preview-8751708e2
@metamask-previews/eip1193-permission-middleware@2.0.1-preview-8751708e2
@metamask-previews/ens-controller@19.1.3-preview-8751708e2
@metamask-previews/eth-block-tracker@15.0.1-preview-8751708e2
@metamask-previews/eth-json-rpc-middleware@23.1.3-preview-8751708e2
@metamask-previews/eth-json-rpc-provider@6.0.1-preview-8751708e2
@metamask-previews/foundryup@1.0.1-preview-8751708e2
@metamask-previews/gas-fee-controller@26.2.2-preview-8751708e2
@metamask-previews/gator-permissions-controller@4.2.0-preview-8751708e2
@metamask-previews/geolocation-controller@0.1.3-preview-8751708e2
@metamask-previews/json-rpc-engine@10.5.0-preview-8751708e2
@metamask-previews/json-rpc-middleware-stream@8.0.8-preview-8751708e2
@metamask-previews/keyring-controller@25.5.0-preview-8751708e2
@metamask-previews/logging-controller@8.0.2-preview-8751708e2
@metamask-previews/message-manager@14.1.2-preview-8751708e2
@metamask-previews/messenger@1.2.0-preview-8751708e2
@metamask-previews/messenger-cli@0.2.0-preview-8751708e2
@metamask-previews/money-account-balance-service@1.0.2-preview-8751708e2
@metamask-previews/money-account-controller@0.3.0-preview-8751708e2
@metamask-previews/money-account-upgrade-controller@2.0.2-preview-8751708e2
@metamask-previews/multichain-account-service@10.0.0-preview-8751708e2
@metamask-previews/multichain-api-middleware@3.1.2-preview-8751708e2
@metamask-previews/multichain-network-controller@3.1.2-preview-8751708e2
@metamask-previews/multichain-transactions-controller@7.1.0-preview-8751708e2
@metamask-previews/name-controller@9.1.2-preview-8751708e2
@metamask-previews/network-controller@32.0.0-preview-8751708e2
@metamask-previews/network-enablement-controller@5.2.0-preview-8751708e2
@metamask-previews/notification-services-controller@24.1.1-preview-8751708e2
@metamask-previews/passkey-controller@2.0.1-preview-8751708e2
@metamask-previews/permission-controller@13.1.1-preview-8751708e2
@metamask-previews/permission-log-controller@5.1.0-preview-8751708e2
@metamask-previews/perps-controller@6.2.0-preview-8751708e2
@metamask-previews/phishing-controller@17.2.0-preview-8751708e2
@metamask-previews/polling-controller@16.0.6-preview-8751708e2
@metamask-previews/preferences-controller@23.1.0-preview-8751708e2
@metamask-previews/profile-metrics-controller@3.1.4-preview-8751708e2
@metamask-previews/profile-sync-controller@28.1.0-preview-8751708e2
@metamask-previews/ramps-controller@14.0.0-preview-8751708e2
@metamask-previews/rate-limit-controller@7.0.1-preview-8751708e2
@metamask-previews/react-data-query@0.2.1-preview-8751708e2
@metamask-previews/remote-feature-flag-controller@4.2.1-preview-8751708e2
@metamask-previews/sample-controllers@5.0.1-preview-8751708e2
@metamask-previews/seedless-onboarding-controller@9.1.0-preview-8751708e2
@metamask-previews/selected-network-controller@26.1.3-preview-8751708e2
@metamask-previews/shield-controller@5.1.2-preview-8751708e2
@metamask-previews/signature-controller@39.2.2-preview-8751708e2
@metamask-previews/snap-account-service@0.2.0-preview-8751708e2
@metamask-previews/social-controllers@2.2.1-preview-8751708e2
@metamask-previews/storage-service@1.0.1-preview-8751708e2
@metamask-previews/subscription-controller@6.1.3-preview-8751708e2
@metamask-previews/transaction-controller@66.0.0-preview-8751708e2
@metamask-previews/transaction-pay-controller@22.7.0-preview-8751708e2
@metamask-previews/user-operation-controller@41.2.2-preview-8751708e2
@metamask-previews/wallet@0.0.0-preview-8751708e2

@micaelae micaelae force-pushed the swaps4229-submitTx-strategy-refactor branch 2 times, most recently from 1fe7da4 to 2a6703f Compare May 27, 2026 21:29
@micaelae micaelae force-pushed the swaps4458-submit-batch-sell branch from 8751708 to 403926e Compare May 28, 2026 00:57
@micaelae micaelae marked this pull request as ready for review May 28, 2026 01:02
@micaelae micaelae requested review from a team as code owners May 28, 2026 01:02
Copy link
Copy Markdown

@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 1 potential issue.

Fix All in Cursor

❌ 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 403926e. Configure here.

}
// Default value
return true;
};
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Refactored shouldDisable7702 changes behavior for delegated gasless accounts

High Severity

The extracted shouldDisable7702 function has different behavior from the inline logic it replaced. When isDelegatedAccount=true and gasIncluded=true (but gasIncluded7702=false), the old code evaluated !isDelegatedAccount || gasIncludedfalse || truetrue (disable 7702). The new code returns false early at the isDelegatedAccount check, never reaching the gasIncluded guard. This means delegated accounts with gasless STX/sendBundle quotes now incorrectly get 7702 batching enabled instead of being kept on the STX path.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 403926e. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants