Skip to content

feat: add Stellar (XLM) support to keyring-api, keyring-internal-api, and eth-snap-keyring#483

Open
khanti42 wants to merge 4 commits intomainfrom
feat/add-stellar-pubnet-testnet
Open

feat: add Stellar (XLM) support to keyring-api, keyring-internal-api, and eth-snap-keyring#483
khanti42 wants to merge 4 commits intomainfrom
feat/add-stellar-pubnet-testnet

Conversation

@khanti42
Copy link
Copy Markdown

@khanti42 khanti42 commented Mar 25, 2026

Adds Stellar account support to the Accounts keyring stack, aligned with the existing TRX pattern and Stellar CAIP-2 (stellar:pubnet, stellar:testnet).

Changes

  • @metamask/keyring-api: New xlm module: XlmScope, XlmAccountType (xlm:eoa), XlmAddressStruct, XlmMethod, XlmEoaAccountStruct, tests, and exports.
  • @metamask/keyring-internal-api: InternalXlmEoaAccountStruct and internal account unions/maps.
  • @metamask/eth-snap-keyring: Account assertion for xlm:eoa, v1 migration default scopes for mainnet + testnet, and Snap keyring test updates.

Examples


Note

Medium Risk
Medium risk because it extends core account-type unions and validation/migration logic in keyring-snap-bridge, which could affect account deserialization and assertions for existing users if mis-specified.

Overview
Adds Stellar support end-to-end by introducing XlmScope, XlmAccountType (xlm:eoa), XlmMethod, and XlmEoaAccountStruct (with G... address validation) to @metamask/keyring-api, and exporting the new xlm module.

Extends @metamask/keyring-internal-api with InternalXlmEoaAccountStruct and updates internal account unions/maps to include Stellar.

Updates keyring-snap-bridge to assert xlm:eoa accounts via assertKeyringAccount and to provide default v1 migration scopes for Stellar (pubnet/testnet), with tests expanded to cover the new account type.

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

* Stellar account addresses use strkey encoding: non-muxed accounts start with `G`
* and are 56 characters long.
*/
export const XlmAddressStruct = definePattern('XlmAddress', /^G[A-Z2-7]{55}$/u);
Copy link
Copy Markdown
Contributor

@stanleyyconsensys stanleyyconsensys Mar 27, 2026

Choose a reason for hiding this comment

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

i think it is the min way to check the address,
we can also do checksum, but may require to install https://github.com/stellar/js-stellar-base/blob/master/src/strkey.js#L361

Comment on lines +25 to +28
// @deprecated Use `SignMessage` instead.
SignMessageV2 = 'signMessageV2',
// @deprecated Not supported anymore.
VerifyMessageV2 = 'verifyMessageV2',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

we dont that those method i think, as stellar is new

@stanleyyconsensys stanleyyconsensys marked this pull request as ready for review March 27, 2026 11:24
@stanleyyconsensys stanleyyconsensys requested a review from a team as a code owner March 27, 2026 11:24
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.

// @deprecated Use `SignMessage` instead.
SignMessageV2 = 'signMessageV2',
// @deprecated Not supported anymore.
VerifyMessageV2 = 'verifyMessageV2',
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Deprecated methods needlessly added to new Stellar chain

Low Severity

XlmMethod includes SignMessageV2 and VerifyMessageV2 copied from TrxMethod, but Stellar is a brand-new chain with no existing consumers needing backward compatibility. These deprecated methods add unnecessary API surface and flow into the XlmEoaAccountStruct via enums(Object.values(XlmMethod)), meaning Stellar accounts will advertise support for methods that were never actually supported on this chain. The PR reviewer also flagged this concern.

Fix in Cursor Fix in Web

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