Repository navigation
chore(stellar): tighten chain id type + centralize parseCaipAssetType method call - #504
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused refactor has no identified blocking issues and includes helper validation tests, though tests were not executed.
No open issues 🎉
What changed in this PR
This PR centralizes Stellar chain-ID validation and asset-reference extraction across the wallet Snap, replacing direct parsing and an unchecked type assertion with shared helpers.
Changes:
- Add
getStellarAssetChainIdto validate and return supported Stellar chain IDs. - Use shared helpers in request handling, services, and confirmation views.
- Add tests covering supported networks, asset formats, and rejection of an unsupported chain.
| File | Description |
|---|---|
packages/stellar-wallet-snap/src/utils/caip.ts |
Add the validated Stellar chain-ID helper. |
packages/stellar-wallet-snap/src/utils/caip.test.ts |
Test supported asset IDs and unsupported-chain rejection. |
packages/stellar-wallet-snap/src/ui/confirmation/views/ConfirmSignChangeTrustOptOut/ConfirmSignChangeTrustOptOut.tsx |
Use shared asset-reference extraction for explorer links. |
packages/stellar-wallet-snap/src/ui/confirmation/views/ConfirmSignChangeTrustOptIn/ConfirmSignChangeTrustOptIn.tsx |
Use shared asset-reference extraction for explorer links. |
packages/stellar-wallet-snap/src/services/transaction/utils.ts |
Use shared helpers for asset conversion and scope validation. |
packages/stellar-wallet-snap/src/services/transaction/TransactionBuilder.ts |
Extract token addresses through the shared helper. |
packages/stellar-wallet-snap/src/services/network/NetworkService.ts |
Centralize asset-reference extraction in network operations. |
packages/stellar-wallet-snap/src/services/asset-metadata/utils.ts |
Validate chain IDs for metadata and asset grouping. |
packages/stellar-wallet-snap/src/handlers/clientRequest/signAndSendTransaction.ts |
Use shared asset-reference extraction in metadata fallbacks. |
packages/stellar-wallet-snap/src/handlers/clientRequest/api.ts |
Use validated chain IDs in request refinement and coercion. |
Review effort: Balanced
stanleyyconsensys
enabled auto-merge
October 23, 2026 04:08
|
parseCaipAssetType method call
arafetbenmakhlouf
approved these changes
Oct 23, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Explanation
This PR centralizes Stellar chain-ID validation and asset-reference extraction across the wallet Snap, replacing direct parsing and an unchecked type assertion with shared helpers.
Changes:
References
Checklist