Skip to content

Commit 397c0b5

Browse files
authored
Merge pull request #954 from tronprotocol/release_v4.9.8
Release v4.9.8
2 parents 14c1d4c + e1fa2e4 commit 397c0b5

456 files changed

Lines changed: 12605 additions & 5608 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build-artifact.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ jobs:
2626
cache: gradle
2727

2828
- name: Build
29+
working-directory: java
2930
run: ./gradlew clean build shadowJar shadowDistZip
3031

3132
- name: Package artifacts
@@ -43,8 +44,8 @@ jobs:
4344
artifact_name="wallet-cli-artifact-${GITHUB_REF_NAME}"
4445
4546
mkdir -p "$artifact_dir"
46-
cp build/libs/wallet-cli.jar "$artifact_dir/${artifact_base}.jar"
47-
cp build/distributions/*shadow*.zip "$artifact_dir/${artifact_base}.zip"
47+
cp java/build/libs/wallet-cli.jar "$artifact_dir/${artifact_base}.jar"
48+
cp java/build/distributions/*shadow*.zip "$artifact_dir/${artifact_base}.zip"
4849
git rev-parse HEAD > "$artifact_dir/git-sha.txt"
4950
echo "ARTIFACT_NAME=${artifact_name}" >> "$GITHUB_ENV"
5051

.gitignore

Lines changed: 12 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,20 @@
1-
.claude/settings.local.json
1+
# Per-implementation ignores live in java/.gitignore and ts/.gitignore.
2+
# Only repo-wide patterns belong here.
3+
4+
# OS / editor / IDE
25
.DS_Store
3-
build
4-
out
56
.idea
6-
.gradle
7+
.vscode/
8+
# Eclipse JDT / VS Code Java language server output
9+
/bin/
10+
11+
# Tooling
712
node_modules
8-
src/main/genjs/api
9-
src/main/genjs/core
10-
src/genjs
11-
src/gen
1213
tools
13-
src/main/resources/static/js/tronjs/tron-protoc.js
14-
logs
15-
docs
16-
!docs/
17-
!docs/standard-cli-contract-spec.md
18-
FileTest
19-
bin
20-
21-
# Wallet keystore files created at runtime
22-
/Wallet/
23-
/Mnemonic/
24-
/wallet_data/
25-
26-
# QA runtime output
27-
qa/results/
28-
qa/runtime/
29-
qa/report.txt
30-
qa/.verify.lock/
14+
graphify-out/
3115

32-
# claude
16+
# Claude
3317
.claude/
18+
.claude/settings.local.json
3419

3520
.private/
36-
37-
# graphify
38-
graphify-out/
39-
.vscode/
40-
docs/superpowers
41-
42-
43-
/ts-deprecated/

.travis.yml

Lines changed: 0 additions & 8 deletions
This file was deleted.

CLAUDE.md

Lines changed: 66 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,68 @@
22

33
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
44

5+
## Repository Layout
6+
7+
The repository holds two independent implementations:
8+
9+
- `java/` — the original REPL-first implementation, described by the rest of this file.
10+
- `ts/` — the agent-first TypeScript rewrite (npm package `@tron-walletcli/wallet-cli`). See the
11+
**TypeScript Implementation** section below and `ts/README.md`.
12+
13+
Everything below (except the TypeScript Implementation section) refers to the Java implementation.
14+
**All Java paths are relative to `java/`, and all Java commands are run from that directory**
15+
(`cd java` first).
16+
17+
## TypeScript Implementation
18+
19+
The `ts/` package is a self-contained, agent-first CLI (Node.js 20+, ESM, TypeScript). Every command
20+
has a stable JSON envelope, deterministic exit codes, and discoverable schemas; interactive prompts
21+
are used only for secret input (create / import / backup / delete). **All `ts/` commands run from the
22+
`ts/` directory.**
23+
24+
```bash
25+
cd ts
26+
npm ci # install
27+
npm run build # bundle to dist/ via tsup (bin: wallet-cli -> dist/index.js)
28+
npm run dev -- <args> # run from source via tsx (e.g. npm run dev -- create --label main)
29+
npm test # vitest (tests are co-located as *.test.ts)
30+
npm run typecheck # tsc --noEmit
31+
npm run depcruise # dependency-cruiser — enforces the architecture rules below
32+
```
33+
34+
### Architecture (hexagonal / ports & adapters)
35+
36+
Dependencies point inward. The source of truth is
37+
`ts/docs/typescript-wallet-cli-architecture-source-of-truth.md` — read it before changing
38+
boundaries, ports, command routing, or the JSON contract. `depcruise` enforces these rules in CI.
39+
40+
| Area (`ts/src/…`) | Role | May depend on | Must NOT depend on |
41+
|---|---|---|---|
42+
| `domain` | Pure rules & values, zero I/O (address, amounts, derivation, wallet, family, errors) | Node / pure libs only | application, adapters, bootstrap |
43+
| `application` | Use cases, services, contracts, and **ports** (interfaces it owns) | `domain` | adapters, bootstrap |
44+
| `adapters/inbound` | CLI driving side — parse argv, route to use cases, render output | application, domain | adapters/outbound, bootstrap |
45+
| `adapters/outbound` | Implements application ports — keystore, TronWeb/Tron gateway, Ledger, price, config, persistence | application ports, domain | adapters/inbound, bootstrap |
46+
| `bootstrap` | Composition root + process lifecycle (`runner.ts`, `composition.ts`, `argv.ts`, `families/`) | all areas | — (assembly only) |
47+
48+
Key points:
49+
- **Ports live in `application/ports/`** (e.g. `wallet-repository`, `tron-gateway`, `ledger-device`,
50+
`price-provider`); outbound adapters implement them (dependency inversion).
51+
- **Chain-family differences** are isolated in the `tron` family — `application/use-cases/tron/`,
52+
`adapters/outbound/chain/tron/`, and the family plugin under `bootstrap/families/`. EVM is planned,
53+
not yet public.
54+
- **A single Zod schema per command** drives validation, yargs arity, help text, and JSON Schema.
55+
- **Secrets** (private keys, mnemonics, BIP39 passphrases) are encrypted at rest and never accepted
56+
from argv or env — only a dedicated stdin channel or hidden TTY prompt.
57+
58+
### Adding a TypeScript command
59+
60+
1. Add the command module under `adapters/inbound/cli/commands/` with its Zod schema.
61+
2. Route it to an application use case (`application/use-cases/…`, e.g. `tron/transaction-service.ts`);
62+
do not put I/O or chain logic in the inbound layer.
63+
3. If it needs new I/O, define a **port** in `application/ports/` and implement it in
64+
`adapters/outbound/`. Wire it in `bootstrap/composition.ts`.
65+
4. Add co-located `*.test.ts` and run `npm run depcruise && npm run typecheck && npm test`.
66+
567
## Build & Run
668

769
```bash
@@ -49,7 +111,7 @@ This is a **TRON blockchain CLI wallet** built on the [Trident SDK](https://gith
49111

50112
### Two CLI Modes
51113

52-
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 (~4700 lines). Best for manual exploration and day-to-day wallet management by humans.
114+
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.
53115
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.
54116

55117
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/`.
@@ -59,7 +121,7 @@ The standard CLI suppresses all stray stdout/stderr in JSON mode to ensure machi
59121
Before changing parser behavior, auth flow, JSON output, command success/failure semantics, or `qa/` expectations for
60122
the standard CLI, read:
61123

62-
- `docs/standard-cli-contract-spec.md`
124+
- `java/docs/standard-cli-contract-spec.md`
63125

64126
Treat that file as the source of truth for the standard CLI contract unless the repository owner explicitly decides to
65127
revise it.
@@ -116,9 +178,9 @@ User Input → Client (JCommander) → WalletApiWrapper → WalletApi → Triden
116178

117179
### Key Frameworks & Libraries
118180

119-
- **Trident SDK 0.10.0** — All gRPC API calls to TRON nodes
181+
- **Trident SDK 0.11.0** — All gRPC API calls to TRON nodes
120182
- **JCommander 1.82** — CLI argument parsing (REPL 交互模式)
121183
- **JLine 3.25.0** — Interactive terminal/readline
122184
- **BouncyCastle** — Cryptographic operations
123-
- **Protobuf 3.25.5 / gRPC 1.60.0** — Protocol definitions and transport
185+
- **Protobuf 3.25.8 / gRPC 1.75.0** — Protocol definitions and transport
124186
- **Lombok**`@Getter`, `@Setter`, `@Slf4j` etc. (annotation processing)

FETCH_HEAD

Whitespace-only changes.

0 commit comments

Comments
 (0)