Skip to content

feat(SorobanScreen): validate contract IDs and manage saved contracts (#347) - #433

Open
BernardOnuh wants to merge 1 commit into
Sorokit:mainfrom
BernardOnuh:feat/issue-347-soroban-saved-contracts-ux
Open

feat(SorobanScreen): validate contract IDs and manage saved contracts (#347)#433
BernardOnuh wants to merge 1 commit into
Sorokit:mainfrom
BernardOnuh:feat/issue-347-soroban-saved-contracts-ux

Conversation

@BernardOnuh

@BernardOnuh BernardOnuh commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Description

Enhances the existing Soroban screen saved-contracts / Stellar Expert implementation for #347 with stricter, more convenient contract-ID handling.

1. Contract ID validation

  • Only a well-formed Soroban contract ID (/^C[A-Z0-9]{55}$/, the C-prefixed strkey format) is treated as valid.
  • The last-used contract is pre-filled on mount only when valid; malformed history entries are skipped instead of producing a broken active input or fake links.
  • The Stellar Expert link no longer appears for empty or invalid non-empty IDs — it only shows for a genuine contract.

2. Saved Contracts management

  • The panel now shows as soon as one saved contract exists (previously required >1).
  • Each saved contract gets a × remove button (removes it from the dropdown and localStorage), plus a "Clear all" action.
  • Full contract ID is exposed on hover via title for quick identification.
  • Replaces the useEffect-in-setState sync (fixes a react-hooks/set-state-in-effect lint error) with a clean per-render read + removed set.

Acceptance Criteria

  • Last-used (valid) contract ID pre-filled on mount
  • Saved Contracts dropdown lists and applies saved IDs; now also removable / clearable
  • Stellar Expert link appears for valid non-empty contract IDs
  • npm run build passes

Tests

src/screens/SorobanScreen.test.tsx now 18 tests, all passing. Added coverage for:

  • pre-fill skipping invalid first entries
  • listed/applied + remove + clear-all behavior
  • full-ID hover title
  • no Stellar Expert link for invalid-but-non-empty IDs

Screenshot: The Saved Contracts dropdown (with remove buttons & Clear all) and the Stellar Expert link appear in the Soroban screen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant