GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Centralize asset/token resolution behind a single resolver by fnando · Pull Request #2654 · stellar/stellar-cli

Conversation

@fnando

@fnando fnando commented Jul 22, 2026

Copy link
Copy Markdown
Member

What

Introduces a single token resolver in a new config::token module and migrates the scattered asset/token → contract-id derivations onto it, resolving #2652.

  • UnresolvedToken — a token reference parsed from a user string (native/CODE:ISSUER → asset; C… strkey or alias → contract).
  • ResolvedToken { contract_id, kind } where TokenKind is Sac(xdr::Asset) or Contract — the single answer to both "what contract id?" and "is this a SAC, and for which asset?". Helpers: is_sac() / asset().

Migrated call sites:

  • commands::token::args — dropped the old TokenTarget; not_deployed_error is now keyed off ResolvedToken::kind, keeping the sac_not_deployed vs contract_not_found split. args::Error now carries only the two token-aware variants it actually produces.
  • commands::token::{balance,transfer} — --id is now UnresolvedToken; both resolve once and thread the ResolvedToken through.
  • commands::contract::{id,deploy}::asset — derive the id (and, for deploy, the wrap-tx asset) via the resolver. Deploy resolves up front, before any RPC, so an invalid asset fails fast.
  • config::alias::resolve_reserved — the reserved native alias now resolves through the shared resolver.

utils::contract_id_hash_from_asset remains the low-level primitive the resolver builds on.

Why

Resolving a token/asset reference to a contract id — and knowing whether it's a Stellar Asset Contract and for which asset — was spread across several overlapping places, with no single type answering both questions. This surfaced in #2651, where native had to be special-cased as a SAC. The resolver makes SAC-awareness consistent everywhere (errors, deploy, id).

Known limitations

snapshot::create is intentionally left unmigrated: that site parses the asset to extract the issuer for account search, not to derive a contract id, so ResolvedToken's shape doesn't fit.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Copilot AI review requested due to automatic review settings July 22, 2026 14:25
@github-project-automation github-project-automation Bot added this to DevX Jul 22, 2026
@github-project-automation github-project-automation Bot moved this to Backlog (Not Ready) in DevX Jul 22, 2026
@fnando fnando self-assigned this Jul 22, 2026
@fnando fnando moved this from Backlog (Not Ready) to Needs Review in DevX Jul 22, 2026
Copilot started reviewing on behalf of fnando July 22, 2026 14:26
View session
@fnando
fnando requested review from aristidesstaffieri, leighmcculloch and mootz12 July 22, 2026 14:28
Copilot AI reviewed Jul 22, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Pull request overview

Centralizes token and Stellar Asset Contract resolution in config::token and migrates token and contract commands to use the shared resolver.

Changes:

  • Adds unresolved/resolved token types with SAC classification.
  • Migrates balance, transfer, asset ID, deployment, and native alias resolution.
  • Preserves token-aware missing-contract errors.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
config/token.rs Implements centralized token resolution.
config/mod.rs Exports the token module.
config/locator.rs Passes locator context to reserved aliases.
config/alias.rs Resolves native through the shared resolver.
commands/token/transfer.rs Uses resolved token metadata.
commands/token/balance.rs Shares resolved tokens across reads.
commands/token/args.rs Classifies missing contracts from resolved tokens.
commands/contract/id/asset.rs Derives SAC IDs through the resolver.
commands/contract/deploy/asset.rs Resolves SAC identity and asset before RPC.
commands/contract/alias/ls.rs Supplies locator context for native aliases.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread cmd/soroban-cli/src/commands/token/args.rs Resolved

Uh oh!

There was an error while loading. Please reload this page.

leighmcculloch
leighmcculloch approved these changes Jul 22, 2026
View reviewed changes
Comment thread cmd/soroban-cli/src/commands/contract/id/asset.rs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread cmd/soroban-cli/src/commands/contract/deploy/asset.rs Resolved

Uh oh!

There was an error while loading. Please reload this page.

@leighmcculloch leighmcculloch linked an issue Jul 23, 2026 that may be closed by this pull request
Centralize asset/token resolution behind a single resolver #2652
Closed
fnando added 3 commits July 23, 2026 14:54
@fnando
Centralize token resolution behind one resolver.
43c4461
@fnando
Test error when a token contract is missing.
1b5a0ba
@fnando
Drop unused asset error from wrap commands.
68d851b
@fnando
fnando force-pushed the centralize-token-resolution branch from c94d536 to 68d851b Compare July 23, 2026 17:55
@fnando
fnando merged commit 9c92633 into main Jul 23, 2026
229 of 230 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@fnando
fnando deleted the centralize-token-resolution branch July 23, 2026 21:28
@github-project-automation github-project-automation Bot moved this from Needs Review to Done in DevX Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments
@leighmcculloch leighmcculloch leighmcculloch approved these changes
@mootz12 mootz12 Awaiting requested review from mootz12
@aristidesstaffieri aristidesstaffieri Awaiting requested review from aristidesstaffieri

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@fnando fnando

Labels

None yet

Projects

DevX
Status: Done

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Centralize asset/token resolution behind a single resolver

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@fnando @leighmcculloch
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.