feat(client-utils): map Stellar trustline keyring transactions#9440
Merged
Conversation
stanleyyconsensys
requested changes
Jul 9, 2026
…etActivation/assetDeactivation Ports the trustline mapping added in metamask-extension#44200 into the canonical keyring-transaction-mapper: TokenApprove/TokenDisapprove transactions carrying a trustline details.typeLabel now map to new assetActivation/assetDeactivation activity kinds instead of approveSpendingCap/contractInteraction, with the token amount cleared to avoid showing a zero total. Non-trustline TokenDisapprove now maps to contractInteraction (previously unhandled, falling through to the same default).
1819d25 to
9c57290
Compare
9c57290 to
dc50e53
Compare
n3ps
approved these changes
Jul 10, 2026
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
@metamask/client-utils'smapKeyringTransaction(#9376) doesn't yet handle Stellar trustlineTokenApprove/TokenDisapprovetransactions — they fall through toapproveSpendingCap/contractInteractionlike any other token approval, which shows a spending-cap UI for what's actually a trustline activation/deactivation (not a token transfer).metamask-extension#44200 added this mapping locally in its own adapter ahead of Core support, keyed off a
details.typeLabeloftrustline-approve/trustline-disapprove. This PR ports that mapping into the canonicalkeyring-transaction-mapperso Extension can switch over to it, per review discussion on that PR.Changes:
assetActivation/assetDeactivationtoActivityKindand a matchingActivityItemdata shape ({ from?, token?, fees? }).CustomTransactionTypeLabelandhasTrustlineTypeLabelfrom the extension adapter.TokenApprovenow branches toassetActivationfor trustline ops before falling into the existingapproveSpendingCaplogic.TokenDisapprovecase (previously unhandled — fell through tocontractInteractionviadefault): branches toassetDeactivationfor trustlineops, otherwise keeps the existing
contractInteractionfallback.amount(matching the spending-cap "unlimited" pattern) since a trustline change isn't a token transfer and shouldn't show a total.References
mapKeyringTransaction.Checklist
Note
Low Risk
Scoped mapper and type additions with tests; non-trustline approve/disapprove behavior is unchanged aside from an explicit
TokenDisapprovepath that still falls back tocontractInteraction.Overview
mapKeyringTransactionnow recognizes Stellar trustline operations viadetails.typeLabel(trustline-approve/trustline-disapprove) instead of treating them like generic token approvals.TokenApprovewith a trustline label maps toassetActivation(token amount cleared so the UI does not show a transfer total).TokenDisapprovegets an explicit branch: trustline →assetDeactivation, otherwisecontractInteractionas before.Shared types add
assetActivationandassetDeactivationtoActivityKindandActivityItem.CustomTransactionTypeLabelandhasTrustlineTypeLabelare exported from the keyring mapper (ported from extension). Tests and changelog updated.Reviewed by Cursor Bugbot for commit dc50e53. Bugbot is set up for automated code reviews on this repo. Configure here.