feat(client-utils): map Stellar trustline keyring transactions#9440
Open
jeremytsng wants to merge 3 commits into
Open
feat(client-utils): map Stellar trustline keyring transactions#9440jeremytsng wants to merge 3 commits into
jeremytsng wants to merge 3 commits into
Conversation
…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).
stanleyyconsensys
requested changes
Jul 9, 2026
Co-authored-by: Stanley Yuen <102275989+stanleyyconsensys@users.noreply.github.com>
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 to activity-type mapping in client-utils; behavior change is limited to trustline-labeled keyring transactions, with non-trustline paths unchanged.
Overview
Adds
assetActivationandassetDeactivationto shared activity types and teachesmapKeyringTransactionto recognize Stellar trustline operations viadetails.typeLabel(trustline-approve/trustline-disapprove).TokenApprovewith a trustline label now maps toassetActivationinstead ofapproveSpendingCap. A dedicatedTokenDisapprovebranch maps trustline revokes toassetDeactivation; other disapproves still becomecontractInteraction. Trustline items strip tokenamountso the activity UI does not imply a transfer.Includes fixtures, unit tests, and an unreleased changelog entry so extension can drop its local adapter.
Reviewed by Cursor Bugbot for commit 1819d25. Bugbot is set up for automated code reviews on this repo. Configure here.