Skip to content

stellar token: typed SEP-41 + SAC client #2620

Description

@aristidesstaffieri

Part of the Improve Agent UX for Wallets epic.

Summary

Add stellar token, a typed SEP-41 + SAC client. Each subcommand is a thin wrapper over the existing contract invoke pipeline with token-aware argument parsing, asset/contract resolution, and decimal-aware amount formatting. Because the underlying call is a contract invocation, every state-changing subcommand inherits the full pipeline (simulate → auth-entry signing → tx signing → fee-bump → submit → poll) and returns a decoded receipt. Sane default are included for settings like the transaction fee.

Subcommands

Group Subcommands
Transfer transfer, transfer-from
Read balance, allowance, name, symbol, decimals
Allowance approve
Supply burn, burn-from
SAC admin mint, set-admin, clawback, set-authorized

Target resolution

  • --id C… or an alias targets any SEP-41/SAC contract directly, reusing UnresolvedContract from config/alias.rs.
  • Special-case native--id native resolves the native SAC.
  • Reuse contract id asset resolution + utils::contract_id_hash_from_asset; asset parsing in tx/builder/asset.rs.
  • SEP-41 reference implementation: cmd/crates/soroban-test/tests/fixtures/test-wasms/token/src/contract.rs.

New files

cmd/soroban-cli/src/commands/token/{mod.rs, transfer.rs, balance.rs, approve.rs, allowance.rs, burn.rs, mint.rs, admin.rs, args.rs} — subcommands plus shared resolution/formatting in args.rs.

Error paths

  • SAC not deployed → structured error pointing at contract deploy asset.
  • Missing trustline / authorization → named error; provisioning left to a skill using tx new change_trust.

Acceptance criteria

  • stellar token transfer --id native --to <dst> --amount <amt> on testnet resolves the SAC, simulates, signs, submits, polls, and returns a JSON receipt with tx hash + decoded result — no caller-supplied seq/fee.
  • Issued-asset transfer succeeds with a deployed SAC + trustlines; returns the deploy-pointer error when the SAC is missing; returns the named trustline error when the trustline is missing.
  • mint / set-admin / clawback / set-authorized against an administered SAC each return a decoded receipt.
  • balance / allowance return decimal-aware values; name / symbol / decimals return metadata.

Dependencies

Builds on the structured-output/CLI-API task for receipt + error shapes.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status
Backlog (Not Ready)

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions