Skip to content

Add stellar token approve subcommand - #2714

Merged
fnando merged 2 commits into
mainfrom
token-approve
Sep 8, 2026
Merged

fnando merged 2 commits into
mainfrom
token-approve

Conversation

@fnando

@fnando fnando commented Sep 4, 2026

Copy link
Copy Markdown
Member

What

Adds stellar token approve, a write subcommand that sets a SEP-41 allowance. --from grants and authorizes the allowance, --spender is the delegate, --amount is the allowance in smallest units, and --expiration-ledger is the ledger after which it expires. Returns a JSON receipt with the tx hash.

Why

Part of #2620 (typed SEP-41 + SAC client), first of the write commands after the read-metadata group. A thin wrapper over contract invoke reusing args::invoke_by_position and args::not_deployed_error, mirroring transfer. Landing approve before allowance lets the allowance command's tests do a clean approve→read round-trip.

Known limitations

Muxed (M…) source accounts are rejected with a clear error (same constraint as transfer, see #2645).

Copilot AI balanced review requested due to automatic review settings September 4, 2026 17:09
@github-project-automation github-project-automation Bot moved this to Backlog (Not Ready) in DevX Sep 4, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds stellar token approve for setting SEP-41 allowances and returning JSON transaction receipts.

Changes:

  • Implements approval invocation, validation, signing, and structured errors.
  • Registers command routing and updates help documentation.
  • Adds integration coverage for approval behavior and failures.

Reviewed changes

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

Show a summary per file
File Description
FULL_HELP_DOCS.md Documents the command and options.
cmd/soroban-cli/src/commands/token/mod.rs Registers and dispatches approve.
cmd/soroban-cli/src/commands/token/approve.rs Implements approvals; muxed-source coverage is missing and its guard explanation is inaccurate.
cmd/soroban-cli/src/cli.rs Enables JSON error formatting.
cmd/crates/soroban-test/tests/it/integration/token/mod.rs Registers approval integration tests.
cmd/crates/soroban-test/tests/it/integration/token/approve.rs Tests approval behavior and key failures.
Suppressed comments (1)

cmd/soroban-cli/src/commands/token/approve.rs:158

  • This explanation contradicts #2645: positional parsing and simulation accept the muxed address; the failure occurs later when the sequence-number lookup passes the M… strkey to a G-only account parser. Please keep the guard but describe the actual failure point so future work on #2645 does not remove or relocate it for the wrong reason.
        // The invoke pipeline can't source a transaction from a muxed account
        // yet (see #2645), and a muxed strkey in the `from` arg is rejected
        // mid-simulation with an opaque host error; reject it up front with a
        // clear message instead.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread cmd/soroban-cli/src/commands/token/approve.rs
@fnando fnando moved this from Backlog (Not Ready) to Needs Review in DevX Sep 4, 2026
@fnando fnando self-assigned this Sep 4, 2026
Copilot AI review requested due to automatic review settings September 4, 2026 18:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.

Comment thread cmd/soroban-cli/src/commands/token/approve.rs
Comment thread cmd/soroban-cli/src/commands/token/approve.rs
Base automatically changed from token-decimals to main September 8, 2026 17:14
@fnando
fnando merged commit 1d4bbea into main Sep 8, 2026
232 of 233 checks passed
@fnando
fnando deleted the token-approve branch September 8, 2026 18:01
@github-project-automation github-project-automation Bot moved this from Needs Review to Done in DevX Sep 8, 2026
@fnando fnando mentioned this pull request Oct 7, 2026
4 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants