Skip to content

Fix trustline --asset to accept valid asset codes of any length.#2405

Merged
fnando merged 3 commits into
mainfrom
2395
Feb 20, 2026
Merged

Fix trustline --asset to accept valid asset codes of any length.#2405
fnando merged 3 commits into
mainfrom
2395

Conversation

@fnando
Copy link
Copy Markdown
Member

@fnando fnando commented Feb 20, 2026

What

Fix trustline --asset to accept valid asset codes of any length.

Why

So it can accept any valid asset length. Close #2395.

Known limitations

N/A

Copilot AI review requested due to automatic review settings February 20, 2026 01:26
@github-project-automation github-project-automation Bot moved this to Backlog (Not Ready) in DevX Feb 20, 2026
@fnando fnando self-assigned this Feb 20, 2026
@fnando fnando moved this from Backlog (Not Ready) to Needs Review in DevX Feb 20, 2026
@fnando fnando added bug Something isn't working cli Related to Soroban CLI labels Feb 20, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a bug in the stellar ledger entry fetch trustline --asset command that rejected valid asset codes that weren't exactly 4 or 12 characters long. The fix delegates asset code parsing to the AssetCode type's parse() method from the stellar-xdr library, which properly handles asset codes of any valid length (1-12 characters) and automatically determines whether to use CreditAlphanum4 (1-4 chars) or CreditAlphanum12 (5-12 chars) with proper padding.

Changes:

  • Replaced manual length matching logic with AssetCode::parse() for more flexible asset code validation
  • Removed unnecessary imports (TryFromSliceError, AssetCode4, AssetCode12) since they're no longer needed
  • Simplified the code by delegating validation and type selection to the stellar-xdr library

Comment thread cmd/soroban-cli/src/commands/ledger/entry/fetch/trustline.rs
@fnando fnando enabled auto-merge (squash) February 20, 2026 16:59
@fnando fnando merged commit abec6f1 into main Feb 20, 2026
32 checks passed
@fnando fnando deleted the 2395 branch February 20, 2026 17:21
@github-project-automation github-project-automation Bot moved this from Needs Review to Done in DevX Feb 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working claude-code-assisted cli Related to Soroban CLI

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

stellar ledger entry fetch trustline --asset rejects valid asset codes that aren't exactly 4 or 12 characters

3 participants