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 — Add `stellar token transfer` for SEP-41 and Stellar Asset Contracts by fnando · Pull Request #2644 · stellar/stellar-cli

Add stellar token transfer for SEP-41 and Stellar Asset Contracts #2644

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Sign up for GitHub

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
fnando merged 7 commits into main from token-transfer
Jul 15, 2026

Uh oh!

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

Merged

Add stellar token transfer for SEP-41 and Stellar Asset Contracts #2644

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
7 commits
Select commit Hold shift + click to select a range
0e96d0f
Add token transfer command for SEP-41 and asset contracts.
fnando Jul 8, 2026
54360ee
Reject negative token transfer amounts.
fnando Jul 13, 2026
1b52fd1
Accept contract addresses as token transfer destinations.
fnando Jul 14, 2026
9451463
Always submit token transfers instead of simulating.
fnando Jul 14, 2026
33f8bfd
Fail loudly when SAC deploy errors in tests.
fnando Jul 14, 2026
80d0e8d
Reject muxed source accounts with a clear error.
fnando Jul 14, 2026
9ee7a6b
Resolve native token target through the built-in alias.
fnando Jul 15, 2026
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

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

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

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

Diff view
Diff view

There are no files selected for viewing

51 changes: 51 additions & 0 deletions 51 FULL_HELP_DOCS.md
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Anything after the `--` double dash (the "slop") is parsed as arguments to the c
- `container` — Start local networks in containers
- `config` — Manage CLI configuration
- `snapshot` — Download a snapshot of a ledger from an archive
- `token` — Interact with SEP-41 tokens and Stellar Asset Contracts
- `tx` — Sign, Simulate, and Send transactions
- `xdr` — Decode and encode XDR
- `strkey` — Decode and encode strkey
Expand Down Expand Up @@ -1839,6 +1840,56 @@ This allows combining snapshots from different contract deployments or manually

Default value: `snapshot.json`

## `stellar token`

Interact with SEP-41 tokens and Stellar Asset Contracts

**Usage:** `stellar token <COMMAND>`

###### **Subcommands:**

- `transfer` — Transfer tokens from one account to another

## `stellar token transfer`

Transfer tokens from one account to another

**Usage:** `stellar token transfer [OPTIONS] --id <ID> --from <FROM> --to <TO> --amount <AMOUNT>`

###### **Global Options:**

- `--config-dir <CONFIG_DIR>` — Location of config directory. By default, it uses `$XDG_CONFIG_HOME/stellar` if set, falling back to `~/.config/stellar` otherwise. Contains configuration files, aliases, and other persistent settings

###### **Options:**

- `--id <ID>` — The token to transfer from: a contract id or alias, `native`, or a classic asset as `CODE:ISSUER`
- `--from <FROM>` — Account to transfer tokens from. Signs and authorizes the transfer, so it must be an identity or secret key you control
- `--to <TO>` — Account or contract to transfer the tokens to. Accepts a `G…`/`M…` account, a `C…` contract address, or an alias
- `--amount <AMOUNT>` — Amount to transfer, in the token's smallest unit (stroops for a Stellar Asset Contract)
- `--output <OUTPUT>` — Format of the output

Default value: `text`

Possible values:
- `text`: Human-readable text
- `json`: Compact, single-line JSON receipt
- `json-formatted`: Formatted (multiline) JSON receipt

###### **RPC Options:**

- `--rpc-url <RPC_URL>` — RPC server endpoint
- `--rpc-header <RPC_HEADERS>` — RPC Header(s) to include in requests to the RPC provider, example: "X-API-Key: abc123". Multiple headers can be added by passing the option multiple times
- `--network-passphrase <NETWORK_PASSPHRASE>` — Network passphrase to sign the transaction sent to the rpc server
- `-n`, `--network <NETWORK>` — Name of network to use from config

###### **Signing Options:**

- `--sign-with-key <SIGN_WITH_KEY>` — Sign with a local key or key saved in OS secure storage. Can be an identity (--sign-with-key alice), a secret key (--sign-with-key SC36…), or a seed phrase (--sign-with-key "kite urban…"). If using seed phrase, `--hd-path` defaults to the `0` path
- `--hd-path <HD_PATH>` — If using a seed phrase to sign, sets which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0`
- `--sign-with-lab` — Sign with https://lab.stellar.org
- `--sign-with-ledger` — Sign with a ledger wallet
- `--auto-sign` — Sign without prompting for approval. Only applies to signatures that require user approval, like non-root Soroban auth entries

## `stellar tx`

Sign, Simulate, and Send transactions
Expand Down
1 change: 1 addition & 0 deletions 1 cmd/crates/soroban-test/tests/it/integration.rs
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ mod ledger;
mod network;
mod secure_store;
mod snapshot;
mod token;
mod tx;
mod util;
93 changes: 93 additions & 0 deletions 93 cmd/crates/soroban-test/tests/it/integration/token/mod.rs
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
pub mod transfer;

use soroban_test::{AssertExt, TestEnv};

/// Establish (and auto-authorize) a trustline from `source` to `asset`.
pub fn add_trustline(sandbox: &TestEnv, source: &str, asset: &str) {
sandbox
.new_assert_cmd("tx")
.args(["new", "change-trust", "--line", asset, "--source", source])
.assert()
.success();
}

/// Pay `amount` of `asset` from its issuer to `destination`.
pub fn issuer_pays(sandbox: &TestEnv, issuer: &str, destination: &str, asset: &str, amount: i128) {
sandbox
.new_assert_cmd("tx")
.args([
"new",
"payment",
"--destination",
destination,
"--asset",
asset,
"--amount",
&amount.to_string(),
"--source",
issuer,
])
.assert()
.success();
}

/// Deploy the Stellar Asset Contract for `asset`, tolerating the case where a
/// prior run already deployed it (the SAC is global to the network).
pub fn deploy_sac(sandbox: &TestEnv, asset: &str, source: &str) {
let output = sandbox
.new_assert_cmd("contract")
.args([
"asset",
"deploy",
"--asset",
asset,
"--source-account",
source,
])
.output()
Comment thread
fnando marked this conversation as resolved.
Resolved

Uh oh!

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

.expect("failed to run contract asset deploy");

// A clean deploy succeeds; the only failure we tolerate is the SAC already
// existing on this (persistent) network. Any other failure is a real bug —
// surface the captured stderr instead of swallowing it and misdirecting the
// failure two steps downstream.
if !output.status.success() {
let stderr = String::from_utf8_lossy(&output.stderr);
assert!(
stderr.contains("contract already exists"),
"contract asset deploy failed: {stderr}"
);
}
}

/// The contract id of the SAC for `asset`.
pub fn sac_id(sandbox: &TestEnv, asset: &str) -> String {
sandbox
.new_assert_cmd("contract")
.args(["id", "asset", "--asset", asset])
.assert()
.success()
.stdout_as_str()
}

/// Read a token's balance for `account` through its Stellar Asset Contract,
/// returning the raw stroop amount.
pub fn sac_balance(sandbox: &TestEnv, contract_id: &str, account: &str) -> i128 {
let stdout = sandbox
.new_assert_cmd("contract")
.args([
"invoke",
"--id",
contract_id,
"--source-account",
"test",
"--",
"balance",
"--id",
account,
])
.assert()
.success()
.stdout_as_str();
stdout.trim().trim_matches('"').parse().unwrap()
}
Loading
Oops, something went wrong.

Uh oh!

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

Loading
Oops, something went wrong.

Uh oh!

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

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.