Skip to content

fix(data-formats): liquidity_pool_shares crashes AssetBadge, operationCount never shown in TxRow, truncateAddress JSDoc misses contract IDs #200

Description

@k-deejah

Problem

Three issues affect how the library handles Stellar-specific data formats and edge cases.

1. truncateAddress does not handle Stellar contract IDs (starting with C)

Stellar Soroban contract IDs start with C and are 56 characters long — the same length as account addresses. truncateAddress works correctly for them already, but the function's JSDoc only mentions "addresses" and "tx hashes". Contract IDs passed from ContractEventFeed should be documented as a supported input.

2. AssetBadge does not handle liquidity_pool_shares asset type

The Balance type includes "liquidity_pool_shares" as a valid assetType value, but AssetBadge only checks for "native". A liquidity_pool_shares balance renders with whatever balance.assetCode is, which is often undefined, causing the icon to show "un" (from "undefined".slice(0, 2)).

3. TransactionHistory does not handle operationCount > 1 visually

Transaction has operationCount but it is never displayed. Transactions with multiple operations (e.g. path payments, account merges) look identical to single-operation transactions. A small badge or indicator showing "2 ops" would provide useful context.

Solution

  1. Update truncateAddress JSDoc to document contract IDs as a valid input type.
  2. Add a liquidity_pool_shares case to AssetBadge that renders a "LP" label with a neutral colour.
  3. Add an operationCount badge to TxRow when tx.operationCount > 1.

Acceptance Criteria

  • truncateAddress JSDoc mentions contract IDs as valid input
  • AssetBadge renders "LP" badge for liquidity_pool_shares without undefined display
  • TxRow shows an operation count badge when operationCount > 1
  • npm run build passes

Note for Contributors: Write a clear PR description. Include a screenshot of the LP badge in AssetBadge and the multi-operation badge in TxRow.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions