Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses issue #2394 by returning an error when users attempt to fetch a trustline ledger entry using the native asset (XLM). Previously, the CLI would silently accept "XLM" or "native" as the asset parameter and return an empty result, which was confusing since trustlines cannot hold the native asset - native balances are stored in the account entry itself.
Changes:
- Added a new
NativeAsseterror variant that provides a helpful error message directing users to usestellar ledger entry fetch accountinstead - Modified the asset parsing logic to check for "XLM" or "native" (case-insensitive) and return the new error instead of creating a
TrustLineAsset::Native - Added comprehensive test coverage for both "xlm" and "native" keywords with various capitalizations
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| cmd/soroban-cli/src/commands/ledger/entry/fetch/trustline.rs | Added NativeAsset error variant and modified asset parsing to reject native assets with a helpful error message |
| cmd/crates/soroban-test/tests/it/integration/ledger/entry.rs | Added two test functions covering all case variations of "xlm" and "native" to ensure proper error handling |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Return error when fetching ledger entry for trustline using native asset.
Why
So it behaves like it should with native asset. Close #2394.
Known limitations
N/A