Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
11c98aa
feat: evm extension
gummy789j Aug 24, 2026
58c3916
feat: help review and update & known issues fix
gummy789j Aug 24, 2026
559017c
feat: requirement alignment
gummy789j Aug 24, 2026
4bb4471
feat: drop useless
gummy789j Aug 24, 2026
ee28612
feat(lint): clear
gummy789j Aug 24, 2026
016e651
fix(ci): test timeout
gummy789j Aug 25, 2026
f5ee5a8
feat: requirement alignment review
gummy789j Aug 25, 2026
44a40ee
feat: run format
gummy789j Aug 25, 2026
c0bddb6
fix: scope chain json schemas by family
Aug 24, 2026
9f14026
chore: fix lint gate
Aug 24, 2026
902a562
style: apply prettier formatting
Aug 24, 2026
0de53d8
fix: neutralize shared chain command metadata
Aug 24, 2026
f67e4bf
refactor: share EVM unsigned tx building
Aug 24, 2026
e6e9ffc
refactor: require EVM service dependencies
Aug 24, 2026
8ee6b39
refactor: centralize EVM RPC requests
Aug 24, 2026
e8b0d35
refactor: reuse EVM ABI call encoder
Aug 24, 2026
e4bf7e6
fix: guard EVM safe integer conversions
Aug 24, 2026
b1bc761
docs: refresh EVM command metadata
Aug 24, 2026
c41b43a
chore: fix post-rebase quality gates
Aug 24, 2026
701c58c
Merge pull request #984 from grayfoxd/feat/architecture-evm-extension
gummy789j Aug 26, 2026
3913909
chore(ts): drop dead eslint block, redundant #send wrapper, and the g…
gummy789j Aug 26, 2026
7a33dcd
feat(ts): route every chain HTTP call through one transport, add per-…
gummy789j Aug 27, 2026
5389b00
docs: repoint the ts architecture reference at what still exists
gummy789j Aug 27, 2026
f723d8f
docs: drop the ADR reference — ts/docs/adr is gitignored
gummy789j Aug 27, 2026
fbf5362
Merge pull request #982 from tronprotocol/feat/architecture-evm-exten…
gummy789j Aug 27, 2026
e35e054
fix(ts): restore --permission-id/--expiration on the TRON-only writes
gummy789j Aug 27, 2026
61ee130
docs(ts): align the reference with the EVM-capable CLI
gummy789j Aug 27, 2026
2f7ba11
Merge branch 'feat/architecture-evm-extension' into feat/v4.13.0
gummy789j Aug 27, 2026
de12f5f
docs(java): add the standard CLI removal plan
gummy789j Aug 26, 2026
946d8f5
refactor(java): move CommandErrorException out of the standard CLI pa…
gummy789j Aug 26, 2026
7a2b9cc
feat(java)!: reduce the entry point to the interactive shell
gummy789j Aug 26, 2026
c5add15
refactor(java): move LedgerSigner/LedgerSignOutcome to org.tron.ledge…
gummy789j Aug 26, 2026
b4515a3
feat(java)!: delete the standard CLI package, its tests, and its reso…
gummy789j Aug 26, 2026
e4dcf38
refactor(java): remove the standard CLI's private surface from the core
gummy789j Aug 26, 2026
ea5663f
chore(java): delete the QA harness
gummy789j Aug 26, 2026
a0008d8
feat(java)!: close out the standard CLI removal and cut v4.13.0
gummy789j Aug 26, 2026
bc41b69
chore(java): drop the lombok Setter import orphaned by the CLI removal
gummy789j Aug 26, 2026
e66ecff
refactor(java): remove the permission-id override left over from the CLI
gummy789j Aug 26, 2026
d6d7e67
chore(java): drop three Ledger helpers orphaned by the adapter removal
gummy789j Aug 26, 2026
6281f95
chore: drop useless spec
gummy789j Aug 27, 2026
adb0b8a
Merge pull request #991 from tronprotocol/feat/java-remove-standard-cli
gummy789j Aug 27, 2026
e206c00
feat: update tag to capital
gummy789j Aug 27, 2026
eb20b2d
chore(ts): strip version and spec-section citations from comments
gummy789j Aug 31, 2026
204978d
fix(config): fold an alias-keyed network entry into its canonical key…
gummy789j Aug 31, 2026
a34f983
fix(config): fold an alias target that is itself an alias
gummy789j Aug 31, 2026
084d8d5
feat!: adopt CAIP-2 canonical network ids
gummy789j Aug 31, 2026
c3b0fb2
feat(migration): rewrite tokens.json scope keys to CAIP-2 network ids
gummy789j Aug 31, 2026
de25430
docs: describe canonical network ids as CAIP-2
gummy789j Aug 31, 2026
765bc2e
feat: --help align
gummy789j Sep 1, 2026
896361e
feat: prepare wallet-cli v4.13.0
Sep 1, 2026
cd8f618
Merge 765bc2e2 into feat/v4.13.0
Sep 1, 2026
1b08115
Merge pull request #994 from grayfoxd/feat/v4.13.0
gummy789j Sep 1, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
71 changes: 20 additions & 51 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@ npm run depcruise # dependency-cruiser — enforces the architecture rules

### Architecture (hexagonal / ports & adapters)

Dependencies point inward. The source of truth is
`ts/docs/typescript-wallet-cli-architecture-source-of-truth.md` — read it before changing
boundaries, ports, command routing, or the JSON contract. `depcruise` enforces these rules in CI.
Dependencies point inward, and the table below is the rule — read it before changing boundaries,
ports, or command routing. `depcruise` enforces it in CI (`ts/.dependency-cruiser.cjs`).
`ts/docs/machine-interface.md` is the source of truth for the JSON contract (envelope, exit codes,
stdout/stderr discipline).

| Area (`ts/src/…`) | Role | May depend on | Must NOT depend on |
|---|---|---|---|
Expand Down Expand Up @@ -73,14 +74,10 @@ Key points:
# Build fat JAR (output: build/libs/wallet-cli.jar)
./gradlew shadowJar

# Run in REPL 交互模式 (human-friendly, interactive prompts)
# Run the interactive shell (the only way to run it)
./gradlew run
# Or after building: java -jar build/libs/wallet-cli.jar

# Run in standard CLI mode (non-interactive, scriptable)
java -jar build/libs/wallet-cli.jar --network nile get-account --address TXyz...
java -jar build/libs/wallet-cli.jar --output json --network nile get-account --address TXyz...

# Run tests
./gradlew test

Expand All @@ -93,74 +90,46 @@ java -jar build/libs/wallet-cli.jar --output json --network nile get-account --a

Java 8 source/target compatibility. Protobuf sources are in `src/main/protos/` and generate into `src/main/gen/` — this directory is git-tracked but rebuilt on `clean`.

## QA Verification

The `qa/` directory contains shell-based parity tests that compare interactive REPL output vs standard CLI (text and JSON modes). Requires a funded Nile testnet account.

```bash
# Run QA verification (needs TRON_TEST_PRIVATE_KEY env var for private key)
TRON_TEST_PRIVATE_KEY=<nile-private-key> bash qa/run.sh verify
## End-to-end coverage

# QA config is in qa/config.sh; test commands are in qa/commands/*.sh
# MASTER_PASSWORD env var is used for keystore auto-login (default: testpassword123A)
```
There is none, and there never was: the `qa/` harness that used to live here
only ever drove the standard CLI, which was removed in v4.13.0. `./gradlew build`
passing does **not** mean the interactive shell still works — changes that touch
shared helpers must be walked through by hand against a funded Nile account.

## Architecture

This is a **TRON blockchain CLI wallet** built on the [Trident SDK](https://github.com/tronprotocol/trident). It communicates with TRON nodes via gRPC.

### Two CLI Modes

1. **REPL 交互模式** (human-friendly) — `Client` class with JCommander `@Parameters` inner classes. Entry point: `org.tron.walletcli.Client`. Features tab completion, interactive prompts, and conversational output. This is the largest file (~4900 lines). Best for manual exploration and day-to-day wallet management by humans.
2. **Standard CLI 模式** (AI-agent-friendly) — `StandardCliRunner` with `CommandRegistry`/`CommandDefinition` pattern in `org.tron.walletcli.cli.*`. Supports `--output json`, `--network`, `--quiet` flags. Commands are registered in `cli/commands/` classes (e.g., `WalletCommands`, `TransactionCommands`, `QueryCommands`). Designed for automation: deterministic exit codes, structured JSON output, no interactive prompts, and env-var-based authentication — ideal for AI agents, scripts, and CI/CD pipelines.
### One CLI Mode

The standard CLI suppresses all stray stdout/stderr in JSON mode to ensure machine-parseable output. Authentication is automatic via `MASTER_PASSWORD` env var + keystore files in `Wallet/`.
**REPL 交互模式** — `Client` class with JCommander `@Parameters` inner classes. Entry point:
`org.tron.walletcli.Client`. Features tab completion, interactive prompts, and conversational
output. This is the largest file (~4800 lines).

### Standard CLI Contract

Before changing parser behavior, auth flow, JSON output, command success/failure semantics, or `qa/` expectations for
the standard CLI, read:

- `java/docs/standard-cli-contract-spec.md`

Treat that file as the source of truth for the standard CLI contract unless the repository owner explicitly decides to
revise it.
The shell is started one way only: a bare `java -jar wallet-cli.jar`. The entry point recognises
`--version` and `--help` and nothing else; any other argument prints a one-line pointer to the
TypeScript CLI on stderr and exits 2. Non-interactive, scriptable and CI use belongs to `ts/`
(npm `@tron-walletcli/wallet-cli`).

### Request Flow

```
# Standard CLI mode:
User Input → GlobalOptions → StandardCliRunner → CommandRegistry → CommandHandler → WalletApiWrapper → WalletApi → Trident SDK → gRPC → TRON Node

# Interactive REPL mode:
User Input → Client (JCommander) → WalletApiWrapper → WalletApi → Trident SDK → gRPC → TRON Node
```

### Key Classes

- **`org.tron.walletcli.Client`** — Legacy REPL entry point and CLI command dispatcher. Each command is a JCommander `@Parameters` inner class.
- **`org.tron.walletcli.cli.StandardCliRunner`** — New standard CLI executor. Handles network init, auto-authentication, JSON stream suppression, and command dispatch.
- **`org.tron.walletcli.cli.CommandRegistry`** — Maps command names/aliases to `CommandDefinition` instances. Supports fuzzy suggestion on typos.
- **`org.tron.walletcli.cli.CommandDefinition`** — Immutable command metadata (name, aliases, options, handler). Built via fluent `Builder` API.
- **`org.tron.walletcli.cli.OutputFormatter`** — Formats output as text or JSON. In JSON mode, wraps results in `{"success":true,"data":...}` envelope.
- **`org.tron.walletcli.Client`** — REPL entry point and command dispatcher. Each command is a JCommander `@Parameters` inner class.
- **`org.tron.walletcli.WalletApiWrapper`** — Orchestration layer between CLI and core wallet logic. Handles transaction construction, signing, and broadcasting.
- **`org.tron.walletserver.WalletApi`** — Core wallet operations: account management, transaction creation, proposals, asset operations. Delegates gRPC calls to Trident.
- **`org.tron.walletcli.ApiClientFactory`** — Creates gRPC client instances for different networks (mainnet, Nile testnet, Shasta testnet, custom).

### Adding a New Standard CLI Command

1. Create or extend a class in `cli/commands/` (e.g., `TransactionCommands.java`)
2. Build a `CommandDefinition` via `CommandDefinition.builder()` with name, aliases, options, and handler
3. Register it in the appropriate `register(CommandRegistry)` method
4. The handler receives `(ParsedOptions, WalletApiWrapper, OutputFormatter)` — use `formatter.success()/error()` for output

### Package Organization

| Package | Purpose |
|---------|---------|
| `walletcli` | CLI entry points, API wrapper |
| `walletcli.cli` | Standard CLI framework: registry, definitions, options, formatter |
| `walletcli.cli.commands` | Standard CLI command implementations by domain |
| `walletcli` | REPL entry point, API wrapper |
| `walletserver` | Core wallet API and gRPC communication |
| `common` | Crypto utilities, encoding, enums, shared helpers |
| `core` | Configuration, data converters, DAOs, exceptions, managers |
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<h1 align="center">wallet-cli</h1>

<h4 align="center">
A command-line wallet for the <a href="https://tron.network">TRON network</a> — interactive in Java, agent-first in TypeScript
A command-line wallet for <a href="https://tron.network">TRON</a> and selected EVM networks — interactive in Java, agent-first in TypeScript
</h4>

<p align="center">
Expand All @@ -17,20 +17,20 @@ This repository holds **two independent implementations** that share the same pu
- **[Java](java/README.md)** — the original, full-featured reference CLI. An interactive prompt (REPL) you drive by hand.
- **[TypeScript](ts/README.md)** — an agent-first rewrite for automation. Standard subcommands with a stable JSON envelope, built for scripts, CI, and AI agents.

Both manage the same kind of wallet on the same networks — your address is identical regardless of which you use. They cover the same TRON feature surface and differ in how you install and drive them. Pick one and read its own README for depth; this page gives you the basics of each so you can choose.
Both manage TRON wallets, but they are independent implementations rather than interchangeable account stores. Do not assume every derived account has the same address across implementations: check the recorded BIP44 path when migrating. The TypeScript implementation additionally supports selected EVM networks.

## At a glance

| | [**Java**](java/README.md) — the original | [**TypeScript**](ts/README.md) — agent-first rewrite |
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **What it is** | The mature, full-feature reference CLI. | A newer rewrite focused on programmatic integration. |
| **Runtime** | JVM — built with Gradle, run as a `.jar`. Uses the [Trident](https://github.com/tronprotocol/trident) SDK. | [Node.js](https://nodejs.org) **20+**. |
| **Install** | `git clone` + `./gradlew build` (see [Setup](java/README.md#setup)) | `npm install -g @tron-walletcli/wallet-cli` |
| **Install** | `git clone` + `cd wallet-cli/java && ./gradlew build` (see [Setup](java/README.md#setup)) | `npm install -g @tron-walletcli/wallet-cli` |
| **How you drive it** | An **interactive prompt only** — start it, then type commands at `>`. | **One-shot subcommands** — `wallet-cli <command>` from your shell. Interactive prompts only for secret input. |
| **Command style** | PascalCase verbs: `RegisterWallet`, `SendCoin`, `GetBalance`. Amounts in **SUN** (1 TRX = 1,000,000 SUN). | Noun-verb subcommands: `create`, `tx send`, `account balance`, with `--flags`. |
| **Output for scripts** | Human-readable text. | Stable JSON via `-o json` ([`wallet-cli.result.v1`](ts/docs/machine-interface.md)) + fixed exit codes (`0`/`1`/`2`). |
| **Config / networks** | `config.conf` (net type + full node), or `SwitchNetwork` at runtime. Mainnet · Nile · Shasta · custom. | `--network` flag / `config` command. `tron:mainnet` · `tron:nile` · `tron:shasta`. |
| **Signing** | Software keystore · Ledger. | Encrypted local keystore · Ledger. Secrets never via argv/env. |
| **Config / networks** | `config.conf` endpoints, or `SwitchNetwork` at runtime. Mainnet · Nile · Shasta · custom. | `--network` flag / `config` command. Three TRON networks plus Ethereum, Sepolia, BNB Smart Chain, and its testnet. |
| **Signing** | Software keystore · Ledger. | Encrypted local keystore · Ledger. Secrets enter via stdin/TTY, never argv or dedicated secret environment variables. |
| **Feature scope** | **The full surface** — wallets and transfers, staking, voting and rewards, governance, contracts, TRC10, and the on-chain exchange. | **The full surface** — HD wallets, TRX/TRC20/TRC10 transfers, staking & delegation, voting & rewards, governance proposals & super-representative operation, contract call/deploy/governance, TRC10 issuance, the on-chain Bancor exchange, multi-sig, GasFree transfers, message signing, and on-chain queries. |
| **Best for** | People at a terminal who want every TRON capability. | Scripting, CI pipelines, and AI agents. |
| **Full docs** | [java/README.md](java/README.md) | [ts/README.md](ts/README.md) |
Expand All @@ -41,9 +41,9 @@ Interactive only. Build it, start the prompt, then type commands:

```console
$ git clone https://github.com/tronprotocol/wallet-cli.git
$ cd wallet-cli && ./gradlew build && cd build/libs
$ cd wallet-cli/java && ./gradlew build && cd build/libs
$ java -jar wallet-cli.jar # opens the interactive prompt
> RegisterWallet 123456 # create a keystore (password 123456)
> RegisterWallet # prompts twice for the password, then for mnemonic length
> Login # unlock it
> GetAddress # your TRON address
> GetBalance # TRX balance
Expand All @@ -58,7 +58,7 @@ Install from npm, then run subcommands directly from your shell:
```console
$ npm install -g @tron-walletcli/wallet-cli
$ wallet-cli create --label main # prompts for a master password
$ wallet-cli account balance --network tron:nile
$ wallet-cli account balance --network tron:3448148188
$ wallet-cli account balance -o json # one wallet-cli.result.v1 JSON frame
```

Expand Down
6 changes: 0 additions & 6 deletions java/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,4 @@ Wallet/
Mnemonic/
wallet_data/

# QA runtime output
qa/results/
qa/runtime/
qa/report.txt
qa/.verify.lock/

docs/superpowers
10 changes: 5 additions & 5 deletions java/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ git clone https://github.com/tronprotocol/wallet-cli.git

### Configuration

A minimal `config.conf` only needs a network type and a full node to talk to:
A minimal `config.conf` needs a full-node endpoint. `net.type` does not select the network; it only controls whether `grpc.mainnet.apiKey` is applied. The startup network is inferred from the configured node endpoints.

```
net {
Expand All @@ -40,13 +40,13 @@ You can also switch networks at runtime with the [`SwitchNetwork`](docs/commands
- **Compile and run**:

```console
$ cd wallet-cli
$ cd wallet-cli/java
$ ./gradlew build
$ cd build/libs
$ java -jar wallet-cli.jar
```

wallet-cli connects to java-tron via the gRPC protocol, which can be deployed locally or remotely. Configure the java-tron node IP and port in `src/main/resources/config.conf`, or use `SwitchNetwork` to switch among mainnet, testnets (Nile and Shasta), and custom networks.
wallet-cli connects to java-tron via gRPC. At startup it first looks for `config.conf` in the current working directory, then falls back to the bundled classpath resource. Use `SwitchNetwork` to switch among mainnet, testnets (Nile and Shasta), and custom networks.

## Quickstart

Expand All @@ -55,13 +55,13 @@ Build, create an account, and send your first transfer — all from the interact
```console
# 1. Build
$ git clone https://github.com/tronprotocol/wallet-cli.git
$ cd wallet-cli && ./gradlew build && cd build/libs
$ cd wallet-cli/java && ./gradlew build && cd build/libs

# 2. Start the interactive wallet
$ java -jar wallet-cli.jar

# 3. In the wallet prompt: create an account (or ImportWallet), unlock, and inspect it
> RegisterWallet 123456 # create a keystore with password 123456
> RegisterWallet # prompts twice for the password, then for mnemonic length
> Login # unlock the account
> GetAddress # show your address
> GetBalance # TRX balance
Expand Down
16 changes: 0 additions & 16 deletions java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -150,19 +150,3 @@ shadowJar {
version = null
mergeServiceFiles() // https://github.com/grpc/grpc-java/issues/10853
}

task qaJar(type: Jar, dependsOn: [shadowJar, testClasses]) {
from zipTree(shadowJar.archiveFile)
from sourceSets.test.output
archiveBaseName.set('wallet-cli-qa')
archiveClassifier.set('')
archiveVersion.set('')
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}

task qaRun(type: JavaExec) {
classpath = sourceSets.test.runtimeClasspath
mainClass = 'org.tron.qa.QARunner'
args = project.hasProperty('qaArgs') ? project.property('qaArgs').split(' ') : ['list']
standardInput = System.in
}
Loading