feat: add Stellar (XLM) support to keyring-api, keyring-internal-api, and eth-snap-keyring#483
feat: add Stellar (XLM) support to keyring-api, keyring-internal-api, and eth-snap-keyring#483
Conversation
| * 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); |
There was a problem hiding this comment.
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
| // @deprecated Use `SignMessage` instead. | ||
| SignMessageV2 = 'signMessageV2', | ||
| // @deprecated Not supported anymore. | ||
| VerifyMessageV2 = 'verifyMessageV2', |
There was a problem hiding this comment.
we dont that those method i think, as stellar is new
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.
| // @deprecated Use `SignMessage` instead. | ||
| SignMessageV2 = 'signMessageV2', | ||
| // @deprecated Not supported anymore. | ||
| VerifyMessageV2 = 'verifyMessageV2', |
There was a problem hiding this comment.
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.


Adds Stellar account support to the Accounts keyring stack, aligned with the existing TRX pattern and Stellar CAIP-2 (
stellar:pubnet,stellar:testnet).Changes
xlmmodule:XlmScope,XlmAccountType(xlm:eoa),XlmAddressStruct,XlmMethod,XlmEoaAccountStruct, tests, and exports.InternalXlmEoaAccountStructand internal account unions/maps.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, andXlmEoaAccountStruct(withG...address validation) to@metamask/keyring-api, and exporting the newxlmmodule.Extends
@metamask/keyring-internal-apiwithInternalXlmEoaAccountStructand updates internal account unions/maps to include Stellar.Updates
keyring-snap-bridgeto assertxlm:eoaaccounts viaassertKeyringAccountand 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.