Skip to content

🟠 scValToString renders contract addresses as raw hex, not StrKey β€” event filtering and history display are brokenΒ #1015

Description

@Ejirowebfi

Area: Frontend Β· frontend/src/services/stellar-impl.ts (scValToString, getTokenInfoByAddress, getTokenEvents)

Description

For scvAddress values of contract type, scValToString returns the raw 32-byte contract ID as a
hex string
instead of the canonical C... StrKey encoding (stellar-impl.ts:254-256,
StrKey.encodeContract is never used). Every event field that holds a token contract address
(created.tokenAddress, mint.tokenAddress, burn.tokenAddress, meta.tokenAddress) is therefore
stored in an encoding no other part of the system uses. Downstream:

  • getTokenInfoByAddress(tokenAddress) compares e.data.tokenAddress === tokenAddress where the
    argument is a C... StrKey β€” the comparison never matches, so every token falls into the
    fallback branch (name = raw address, decimals = 7, no creator, no metadata).
  • getTokenEvents filters the same way β€” the per-token history view is always empty.
  • Transaction History and CSV export show meaningless hex blobs where addresses should be, and
    explorer links built from them are dead.

Tasks

  • Encode contract addresses with StrKey.encodeContract(addr.contractId()) in scValToString
    (and audit the account branch for muxed-account handling while there).
  • Prefer scValToNative + a thin formatting layer over the hand-rolled decoder where possible, to
    lean on the SDK's canonical conversions.
  • Add unit tests with real XDR fixtures asserting C.../G... outputs for contract and account
    addresses respectively.
  • Add regression tests for getTokenInfoByAddress and getTokenEvents proving a created token's
    events are found by its StrKey address.
  • Verify explorer links, AddressDisplay truncation, and CSV output render the canonical encodings.

Acceptance criteria

  • All addresses surfaced in events, history, CSV, and explorer links are canonical StrKey strings.
  • getTokenInfoByAddress returns real name/symbol/creator data for a token found in events, and the
    per-token history view is populated β€” both proven by tests.

Issue 11 of 20 from the codebase audit tracked in ISSUES.md.

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial Campaign | FWC26Campaign: Official Campaign | FWC26auditFrom the ISSUES.md codebase auditseverity: highBroken core feature or exploitable abuse vector

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions