Description
The backend currently only explains payment operations. All other operation types fall into Operation::Other and return no explanation. Stellar has ~20 operation types — this issue implements explainers for the most important remaining ones, following the exact same pattern as the existing payment.rs explainer.
Operation Types to Implement
Each operation needs:
- A struct in
src/models/operation.rs
- A
From<HorizonOperation> mapping
- An explainer in
src/explain/operation/
- Unit tests
Required operations (in priority order):
| Operation |
Why it matters |
create_account |
Most common after payment — activates new wallets |
change_trust |
How accounts opt in to hold assets (USDC etc.) |
set_options |
Configures signers, flags, home domain, thresholds |
path_payment_strict_send |
Cross-asset payment — sends one asset, receiver gets another |
path_payment_strict_receive |
Cross-asset payment — receiver specifies exact amount |
manage_sell_offer |
DEX order placement / update / cancel |
manage_buy_offer |
DEX buy order |
create_passive_sell_offer |
DEX passive order (doesn't consume existing offers) |
clawback |
Regulated asset recovery by issuer |
clawback_claimable_balance |
Clawback on claimable balances |
account_merge |
Merges account into another, transfers all XLM |
Requirements
- Follow the exact pattern established in
src/explain/operation/payment.rs
- Each explainer must be pure, deterministic, and side-effect free
- Each new variant must be added to the
Operation enum in src/models/operation.rs
- Each must have a
From<HorizonOperation> mapping
- Register each new module in
src/explain/operation/mod.rs
- Plain-English explanations — no jargon
- Example output for
create_account: "GABC… funded and activated a new Stellar account GDEST… with a starting balance of 1.5 XLM"
- Example output for
change_trust (add): "GABC… opted in to hold up to 10,000 USDC issued by GBBB…"
- Example output for
change_trust (remove): "GABC… removed their trust line for USDC"
- Example output for
account_merge: "GABC… merged their account into GDEST…, transferring all remaining XLM"
- DEX offers:
offer_id = 0 = new offer, offer_id > 0 = update, amount = 0 = cancel
Key Files
packages/core/src/models/operation.rs
packages/core/src/explain/operation/ (create new files here)
packages/core/src/explain/operation/mod.rs
packages/core/src/services/horizon.rs (add any missing HorizonOperation fields)
Acceptance Criteria
Stage: S3 — Operation Coverage
Description
The backend currently only explains
paymentoperations. All other operation types fall intoOperation::Otherand return no explanation. Stellar has ~20 operation types — this issue implements explainers for the most important remaining ones, following the exact same pattern as the existingpayment.rsexplainer.Operation Types to Implement
Each operation needs:
src/models/operation.rsFrom<HorizonOperation>mappingsrc/explain/operation/Required operations (in priority order):
create_accountchange_trustset_optionspath_payment_strict_sendpath_payment_strict_receivemanage_sell_offermanage_buy_offercreate_passive_sell_offerclawbackclawback_claimable_balanceaccount_mergeRequirements
src/explain/operation/payment.rsOperationenum insrc/models/operation.rsFrom<HorizonOperation>mappingsrc/explain/operation/mod.rscreate_account:"GABC… funded and activated a new Stellar account GDEST… with a starting balance of 1.5 XLM"change_trust(add):"GABC… opted in to hold up to 10,000 USDC issued by GBBB…"change_trust(remove):"GABC… removed their trust line for USDC"account_merge:"GABC… merged their account into GDEST…, transferring all remaining XLM"offer_id = 0= new offer,offer_id > 0= update,amount = 0= cancelKey Files
packages/core/src/models/operation.rspackages/core/src/explain/operation/(create new files here)packages/core/src/explain/operation/mod.rspackages/core/src/services/horizon.rs(add any missing HorizonOperation fields)Acceptance Criteria
create_accounttransaction returns a human-readable explanationchange_trusttransaction correctly identifies add vs removecargo testpasses with no regressionsStage: S3 — Operation Coverage