Add stellar token transfer for SEP-41 and Stellar Asset Contracts#2644
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new stellar token command group (starting with transfer) that provides a typed SEP-41 / Stellar Asset Contract transfer wrapper over the existing contract invoke pipeline, including a receipt that surfaces the submitted transaction hash.
Changes:
- Introduces
stellar token transferwith token target resolution (native,CODE:ISSUER, orC…/alias) and JSON/text output selection. - Extends
contract invokewithexecute_with_receiptto return{ tx_hash, output }while keeping existingexecutebehavior stable. - Adds soroban-test integration coverage for native + issued-asset transfers and key failure modes.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| FULL_HELP_DOCS.md | Documents the new stellar token command and transfer subcommand usage/options. |
| cmd/soroban-cli/src/commands/token/transfer.rs | Implements token transfer command: target resolution, invoke orchestration, and receipt formatting. |
| cmd/soroban-cli/src/commands/token/mod.rs | Wires token command group and its error routing. |
| cmd/soroban-cli/src/commands/token/args.rs | Adds shared token target parsing/resolution and shared output format enum. |
| cmd/soroban-cli/src/commands/mod.rs | Registers the new token subcommand in the root command enum and error enum. |
| cmd/soroban-cli/src/commands/contract/invoke.rs | Adds execute_with_receipt and InvokeReceipt (tx hash + decoded output). |
| cmd/soroban-cli/src/cli.rs | Enables JSON error envelope rendering for token transfer based on its --output selection. |
| cmd/crates/soroban-test/tests/it/integration/token/transfer.rs | Adds integration tests for token transfer success and failure scenarios. |
| cmd/crates/soroban-test/tests/it/integration/token/mod.rs | Adds integration helpers for SAC deploy, trustlines, balances, and issuer payments. |
| cmd/crates/soroban-test/tests/it/integration.rs | Registers the new token integration test module. |
aristidesstaffieri
approved these changes
Jul 15, 2026
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
Adds
stellar token, starting with thetransfersubcommand — a typed SEP-41 / Stellar Asset Contract (SAC) transfer that wraps the existingcontract invokepipeline. It resolves a token target from--id(native→ native SAC,CODE:ISSUER→ that asset's SAC, or aC…contract id / alias), builds atransfer(from, to, amount)invocation, and runs it through the full pipeline (simulate → auth-sign → sign → fee-bump → submit → poll).--fromnames the sending account (required; it signs and authorizes),--tois the destination, and--amountis the raw stroop amount. There are no caller-supplied fee/sequence flags — sane defaults are used. With--output jsonthe command returns a machine-readable receipt{ "tx_hash", "result" }; in JSON mode the pipeline runs quietly so stdout stays clean. Missing SACs return a structured error pointing atcontract asset deploy.To surface the transaction hash,
contract invokegains a minimalexecute_with_receiptreturning{ tx_hash, output }; its existingexecute/invokeentry points are unchanged.Why
Part of #2620 (the "Improve Agent UX for Wallets" epic). Agents and wallets need an ergonomic, typed way to move tokens and get back a decoded receipt with a tx hash, instead of hand-crafting
contract invokeslop and scraping stderr. This lands thetransferslice plus the sharedtokenmodule foundation (target resolution + output format) that the remaining subcommands will reuse.Known limitations
i128); decimal-aware parsing is not included.transferis implemented;balance,allowance,approve,burn,mint, and the SAC-admin subcommands are follow-ups.contract invokeitself to theOutputsystem is a separate follow-up.Error(Contract, #13); the human-readable reason ("trustline entry is missing for account G…") comes through the transaction's diagnostic events, which the command already prints. We rely on that diagnostic rather than matching on#13, since that number is the SAC contract's internal error enum — not a stable API — and hard-coding it would break silently if it ever changed.