Skip to content

feat(bridge-controller): add bridge support [STELLAR]#8829

Merged
jeremytsng merged 15 commits into
mainfrom
feat/stellar-bridge-controller
Jun 25, 2026
Merged

feat(bridge-controller): add bridge support [STELLAR]#8829
jeremytsng merged 15 commits into
mainfrom
feat/stellar-bridge-controller

Conversation

@khanti42

@khanti42 khanti42 commented May 15, 2026

Copy link
Copy Markdown
Contributor

Explanation

This PR adds Stellar as a supported non-EVM network for the bridge/swap flow, spanning two packages: @metamask/bridge-controller (quote handling and trade construction) and @metamask/bridge-status-controller (transaction submission and status tracking).

Until now the bridge/swap stack recognized EVM chains plus Bitcoin, Solana, and Tron as non-EVM chains. Stellar was not a recognized chain, so quotes, trade-data extraction, and snap-based submission had no path for it. This change introduces the chain, its native asset, and the Stellar-specific trade-data shape so that Stellar quotes can be fetched, parsed, and submitted end to end.

@metamask/bridge-controller

  • Register Stellar mainnet (stellar:pubnet, XlmScope.Pubnet) as a supported chain and include Stellar pubnet/testnet in isNonEvmChainId; add isStellarChainId and ChainId.STELLAR.
  • Add native XLM metadata: CURRENCY_SYMBOLS.XLM, the XLM_SWAPS_TOKEN_OBJECT ("Stellar Lumens"), and the slip44:148 native asset id.
  • Add the StellarTradeDataSchema / StellarTradeData type and isStellarTrade; extend extractTradeData to read a Stellar transaction envelope (XDR) from either a { xdrBase64 } or { xdr } object, mirroring how the other non-EVM trade types are handled.
  • Align CAIP / decimal formatting with the Bridge API for Stellar in the CAIP formatters.
  • Export StellarTradeData, isStellarChainId, and isStellarTrade from the package root.

@metamask/bridge-status-controller

  • Thread StellarTradeData through the non-EVM submit strategies so Stellar trades can be submitted alongside Bitcoin/Tron.
  • Include the source and destination asset IDs (CAIP-19) in the snap client transaction request. These are used to populate Stellar trade metadata for transaction history. Because the request shape is shared across non-EVM submissions, the asset IDs now also appear for the existing Solana paths (reflected in the updated submit snapshots) — no behavioral change beyond the added metadata fields.

Notes for reviewers

  • The QuoteResponse/QuoteResponseV1 union now includes StellarTradeData so Stellar quotes type-check through the existing quote-response path.
  • No public API is removed or renamed by this PR; the new exports are additive.

References

Part of the Stellar network enablement across @metamask/core:

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 non-EVM transaction submission path and snap request shape for bridge trades; scope is additive but touches fund-movement plumbing.

Overview
Adds Stellar as a supported non-EVM network for unified bridge/swap flows in @metamask/bridge-controller and @metamask/bridge-status-controller.

In bridge-controller, Stellar pubnet is registered as an allowed bridge chain with native XLM metadata (slip44:148), ChainId.STELLAR, and isStellarChainId / isNonEvmChainId updates. Quote validation and types gain StellarTradeData (xdrBase64 or xdr); extractTradeData and CAIP/decimal formatters map Stellar IDs for Bridge API requests. New helpers are exported from the package entry.

In bridge-status-controller, non-EVM submit validation accepts Stellar trades, and signAndSendTransaction snap requests can include sourceAssetId / destAssetId from the quote (for Stellar history metadata; Solana submit snapshots pick up the same optional fields). Trade type guards in trade-utils switch to hasOwnProp instead of in checks.

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

@khanti42 khanti42 mentioned this pull request May 15, 2026
4 tasks
@khanti42 khanti42 marked this pull request as ready for review June 10, 2026 07:40
@khanti42 khanti42 requested review from a team as code owners June 10, 2026 07:40
@khanti42 khanti42 temporarily deployed to default-branch June 10, 2026 07:40 — with GitHub Actions Inactive
Comment thread packages/bridge-controller/src/utils/trade-utils.ts
khanti42 and others added 9 commits June 10, 2026 14:38
# Conflicts:
#	packages/bridge-controller/CHANGELOG.md
#	packages/bridge-controller/src/types.ts
…us controller (#9170)

## Explanation

<!--
Thanks for your contribution! Take a moment to answer these questions so
that reviewers have the information they need to properly understand
your changes:

* What is the current state of things and why does it need to change?
* What is the solution your changes offer and how does it work?
* Are there any changes whose purpose might not obvious to those
unfamiliar with the domain?
* If your primary goal was to update one package but you found you had
to update another one along the way, why did you do so?
* If you had to upgrade a dependency, why did you do so?
-->

## References

<!--
Are there any issues that this pull request is tied to?
Are there other links that reviewers should consult to understand these
changes better?
Are there client or consumer pull requests to adopt any breaking
changes?

For example:

* Fixes #12345
* Related to #67890
-->

## 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](https://github.com/MetaMask/core/tree/main/docs/processes/updating-changelogs.md)
- [ ] I've introduced [breaking
changes](https://github.com/MetaMask/core/tree/main/docs/processes/breaking-changes.md)
in this PR and have prepared draft pull requests for clients and
consumer packages to resolve them

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Changes the non-EVM snap request payload for all trades that pass
asset IDs from quotes; Tron overwrites options so behavior there stays
isolated, but Stellar and other non-Tron paths now depend on correct
quote asset metadata.
> 
> **Overview**
> **Stellar bridge trades** are wired through submit validation and the
non-EVM handler by treating `ChainId.STELLAR` like other snap chains
(string XDR or `StellarTradeData`).
> 
> **Snap `signAndSendTransaction` requests** now optionally include
`sourceAssetId` and `destAssetId` from the quote in `params.options`,
passed from `handleNonEvmTx` via an extended `getClientRequest`. That
gives the Stellar snap enough context for **transaction history**
without changing the core request shape for chains that omit those args.
**Tron** still sets `visible` and contract `type` in `options`, which
replaces any asset-id options for Tron trades (unchanged Tron-specific
behavior).
> 
> Tests cover Stellar asset ID options (full pair and source-only).
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
bd8bc27. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
@jeremytsng jeremytsng enabled auto-merge June 22, 2026 13:33
# Conflicts:
#	packages/bridge-controller/CHANGELOG.md
# Conflicts:
#	packages/bridge-controller/CHANGELOG.md
#	packages/bridge-status-controller/CHANGELOG.md
@khanti42

Copy link
Copy Markdown
Contributor 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.5.2-preview-b2742a2fc
@metamask-previews/accounts-controller@39.0.2-preview-b2742a2fc
@metamask-previews/address-book-controller@7.1.2-preview-b2742a2fc
@metamask-previews/ai-controllers@0.7.0-preview-b2742a2fc
@metamask-previews/analytics-controller@1.1.1-preview-b2742a2fc
@metamask-previews/analytics-data-regulation-controller@0.0.0-preview-b2742a2fc
@metamask-previews/announcement-controller@8.1.0-preview-b2742a2fc
@metamask-previews/app-metadata-controller@2.0.1-preview-b2742a2fc
@metamask-previews/approval-controller@9.0.2-preview-b2742a2fc
@metamask-previews/assets-controller@9.0.2-preview-b2742a2fc
@metamask-previews/assets-controllers@109.2.1-preview-b2742a2fc
@metamask-previews/authenticated-user-storage@2.0.0-preview-b2742a2fc
@metamask-previews/base-controller@9.1.0-preview-b2742a2fc
@metamask-previews/base-data-service@0.1.3-preview-b2742a2fc
@metamask-previews/bitcoin-regtest-up@0.0.0-preview-b2742a2fc
@metamask-previews/bridge-controller@75.2.1-preview-b2742a2fc
@metamask-previews/bridge-status-controller@72.1.1-preview-b2742a2fc
@metamask-previews/build-utils@3.0.4-preview-b2742a2fc
@metamask-previews/chain-agnostic-permission@1.6.2-preview-b2742a2fc
@metamask-previews/chomp-api-service@3.1.0-preview-b2742a2fc
@metamask-previews/claims-controller@0.5.3-preview-b2742a2fc
@metamask-previews/client-controller@1.0.1-preview-b2742a2fc
@metamask-previews/compliance-controller@2.1.0-preview-b2742a2fc
@metamask-previews/composable-controller@12.0.1-preview-b2742a2fc
@metamask-previews/config-registry-controller@0.4.1-preview-b2742a2fc
@metamask-previews/connectivity-controller@0.2.0-preview-b2742a2fc
@metamask-previews/controller-utils@12.3.0-preview-b2742a2fc
@metamask-previews/core-backend@6.3.3-preview-b2742a2fc
@metamask-previews/delegation-controller@3.0.2-preview-b2742a2fc
@metamask-previews/earn-controller@12.2.1-preview-b2742a2fc
@metamask-previews/eip-5792-middleware@3.0.4-preview-b2742a2fc
@metamask-previews/eip-7702-internal-rpc-middleware@0.1.1-preview-b2742a2fc
@metamask-previews/eip1193-permission-middleware@2.0.1-preview-b2742a2fc
@metamask-previews/ens-controller@19.1.4-preview-b2742a2fc
@metamask-previews/eth-block-tracker@15.0.1-preview-b2742a2fc
@metamask-previews/eth-json-rpc-middleware@23.1.3-preview-b2742a2fc
@metamask-previews/eth-json-rpc-provider@6.0.1-preview-b2742a2fc
@metamask-previews/foundryup@1.0.1-preview-b2742a2fc
@metamask-previews/gas-fee-controller@26.2.3-preview-b2742a2fc
@metamask-previews/gator-permissions-controller@4.2.1-preview-b2742a2fc
@metamask-previews/geolocation-controller@0.1.3-preview-b2742a2fc
@metamask-previews/java-tron-up@0.0.0-preview-b2742a2fc
@metamask-previews/json-rpc-engine@10.5.0-preview-b2742a2fc
@metamask-previews/json-rpc-middleware-stream@8.0.8-preview-b2742a2fc
@metamask-previews/keyring-controller@27.1.0-preview-b2742a2fc
@metamask-previews/logging-controller@8.0.2-preview-b2742a2fc
@metamask-previews/message-manager@14.1.2-preview-b2742a2fc
@metamask-previews/messenger@1.2.0-preview-b2742a2fc
@metamask-previews/messenger-cli@0.2.0-preview-b2742a2fc
@metamask-previews/money-account-balance-service@2.1.1-preview-b2742a2fc
@metamask-previews/money-account-controller@0.3.3-preview-b2742a2fc
@metamask-previews/money-account-upgrade-controller@2.1.0-preview-b2742a2fc
@metamask-previews/multichain-account-service@10.0.3-preview-b2742a2fc
@metamask-previews/multichain-api-middleware@3.1.5-preview-b2742a2fc
@metamask-previews/multichain-network-controller@3.1.4-preview-b2742a2fc
@metamask-previews/multichain-transactions-controller@7.1.1-preview-b2742a2fc
@metamask-previews/name-controller@9.1.2-preview-b2742a2fc
@metamask-previews/network-controller@33.0.0-preview-b2742a2fc
@metamask-previews/network-enablement-controller@5.4.0-preview-b2742a2fc
@metamask-previews/notification-services-controller@24.1.3-preview-b2742a2fc
@metamask-previews/passkey-controller@2.0.1-preview-b2742a2fc
@metamask-previews/permission-controller@13.1.1-preview-b2742a2fc
@metamask-previews/permission-log-controller@5.1.0-preview-b2742a2fc
@metamask-previews/perps-controller@8.2.0-preview-b2742a2fc
@metamask-previews/phishing-controller@17.2.0-preview-b2742a2fc
@metamask-previews/polling-controller@16.0.7-preview-b2742a2fc
@metamask-previews/preferences-controller@23.1.0-preview-b2742a2fc
@metamask-previews/profile-metrics-controller@4.0.0-preview-b2742a2fc
@metamask-previews/profile-sync-controller@28.2.0-preview-b2742a2fc
@metamask-previews/ramps-controller@14.3.0-preview-b2742a2fc
@metamask-previews/rate-limit-controller@7.0.1-preview-b2742a2fc
@metamask-previews/react-data-query@0.2.1-preview-b2742a2fc
@metamask-previews/remote-feature-flag-controller@4.2.2-preview-b2742a2fc
@metamask-previews/sample-controllers@5.0.2-preview-b2742a2fc
@metamask-previews/seedless-onboarding-controller@10.0.2-preview-b2742a2fc
@metamask-previews/selected-network-controller@26.1.4-preview-b2742a2fc
@metamask-previews/shield-controller@5.1.2-preview-b2742a2fc
@metamask-previews/signature-controller@39.2.6-preview-b2742a2fc
@metamask-previews/smart-transactions-controller@24.2.3-preview-b2742a2fc
@metamask-previews/snap-account-service@0.3.1-preview-b2742a2fc
@metamask-previews/social-controllers@2.3.1-preview-b2742a2fc
@metamask-previews/solana-test-validator-up@0.0.0-preview-b2742a2fc
@metamask-previews/storage-service@1.0.2-preview-b2742a2fc
@metamask-previews/subscription-controller@6.2.0-preview-b2742a2fc
@metamask-previews/transaction-controller@68.1.1-preview-b2742a2fc
@metamask-previews/transaction-pay-controller@23.13.1-preview-b2742a2fc
@metamask-previews/user-operation-controller@41.2.5-preview-b2742a2fc
@metamask-previews/wallet@4.0.0-preview-b2742a2fc
@metamask-previews/wallet-cli@0.0.0-preview-b2742a2fc

Comment thread packages/bridge-controller/src/utils/trade-utils.ts
@jeremytsng jeremytsng added this pull request to the merge queue Jun 24, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 24, 2026
@jeremytsng jeremytsng added this pull request to the merge queue Jun 25, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 25, 2026
@jeremytsng jeremytsng added this pull request to the merge queue Jun 25, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 25, 2026
@jeremytsng jeremytsng added this pull request to the merge queue Jun 25, 2026
@jeremytsng jeremytsng removed this pull request from the merge queue due to a manual request Jun 25, 2026
@jeremytsng jeremytsng enabled auto-merge June 25, 2026 06:16
@jeremytsng jeremytsng added this pull request to the merge queue Jun 25, 2026
Merged via the queue into main with commit b98fa01 Jun 25, 2026
395 of 396 checks passed
@jeremytsng jeremytsng deleted the feat/stellar-bridge-controller branch June 25, 2026 06:22
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.

4 participants