Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
114 commits
Select commit Hold shift + click to select a range
54b858d
chore(ts): trim comments to describe current behaviour
gummy789j Oct 27, 2026
6af679a
docs(ts): add architecture and comment rules as the refactor target
gummy789j Oct 27, 2026
a235921
docs(ts): clarify architecture rules found ambiguous by the violation…
gummy789j Oct 27, 2026
657e04b
docs(ts): classify single-family protocol modules in every layer and …
gummy789j Oct 27, 2026
2a15ff2
docs(ts): allow plaintext secret export files under rule 6.5
gummy789j Oct 28, 2026
b99489c
docs(ts): add rule 6.6 for external service credentials
gummy789j Oct 28, 2026
e578aad
docs(ts): narrow rule 6.3 txId reporting to outcome-unknown chain sub…
gummy789j Oct 28, 2026
7cb5764
docs(ts): bind TRON transactions to a network by their reference bloc…
gummy789j Oct 28, 2026
55b1e16
docs(ts): redefine family code placement, clarify the 7.2 fallback, a…
gummy789j Oct 28, 2026
ce66484
docs(ts): drop the family import rule and renumber section 1
gummy789j Oct 29, 2026
db18adf
docs(ts): drop the placement rule and keep protocols out of family di…
gummy789j Oct 29, 2026
d963087
chore(ts): keep the generated architecture diagram out of Prettier
gummy789j Oct 29, 2026
e2f6326
test(ts): verify layer and cycle dependency rules fire
gummy789j Oct 29, 2026
a9cfb92
build(ts): enforce dependency baseline freshness
gummy789j Oct 29, 2026
2658be4
build(ts): forbid outbound adapters from importing services or use cases
gummy789j Oct 29, 2026
382b3f1
build(ts): keep application ports and contracts innermost
gummy789j Oct 29, 2026
8cd0cb6
build(ts): forbid application modules from importing use cases
gummy789j Oct 29, 2026
422adc3
build(ts): confine outside packages to the allowlist and SDKs to outb…
gummy789j Oct 29, 2026
c6a2214
build(ts): keep outbound integrations from importing each other
gummy789j Oct 29, 2026
0bd54fb
build(ts): drop the SunSwap/SunPump rules the integration rule covers
gummy789j Oct 29, 2026
533001d
build(ts): confine device-signing and payment SDK modules to their wr…
gummy789j Oct 29, 2026
159633c
docs(ts): enforce servers and SDK signing by lint, and stored-state a…
gummy789j Oct 29, 2026
37525e4
build(ts): baseline ESLint violations with bulk suppressions
gummy789j Oct 29, 2026
0f9b7cb
build(ts): restrict environment reads to approved modules
gummy789j Oct 29, 2026
70a04ca
build(ts): restrict server imports to inbound adapters
gummy789j Oct 29, 2026
b5e287b
fix(ts): enforce dry-run and signing boundaries on every funds path
gummy789j Oct 29, 2026
dc61a78
fix(ts): validate and atomically update user data stores
gummy789j Oct 29, 2026
99a2a69
fix(ts): route all signing through one entry that checks chain identity
gummy789j Oct 29, 2026
2c0a184
fix(ts): normalize reported facts once in adapters and closed types
gummy789j Oct 29, 2026
234fa10
fix(ts): derive discovery and gates from one declaration
gummy789j Oct 29, 2026
0b3432c
fix(ts): give each rule one owner and keep CLI wording at the edge
gummy789j Oct 30, 2026
10270c5
refactor(ts): move single-family and protocol modules into their dire…
gummy789j Oct 30, 2026
78e9bf4
docs(ts): record the legacy records that rule 2.2 tolerates on load
gummy789j Oct 30, 2026
96c944a
docs(ts): limit rule 3.1 to values that cross a port inward
gummy789j Oct 30, 2026
0a16aad
build(ts): enforce closed port types with a lint rule
gummy789j Oct 30, 2026
f089878
fix(ts): report malformed TronLink hashes as provider errors and fee …
gummy789j Oct 30, 2026
3cd65ba
fix(ts): report ambiguous broadcast errors as unknown, keep confirmed…
gummy789j Nov 1, 2026
922f353
feat(ts): limit each command by one deadline
gummy789j Nov 1, 2026
4d42f9a
feat(ts): wait for confirmation by default
gummy789j Nov 1, 2026
5086e27
docs(ts): align help and docs with the branch's behavior
gummy789j Nov 1, 2026
af18914
docs(ts): make the architecture and comment rules easier to read
gummy789j Nov 1, 2026
00082d9
fix(ts): resolve token symbols through one matcher on every family
gummy789j Nov 2, 2026
676bb71
fix(ts): name the flags that pick one token when a symbol is ambiguous
gummy789j Nov 2, 2026
bbece75
feat(ts): mark unknown outcomes with one field and report TRON duplic…
gummy789j Nov 2, 2026
e6c0839
fix(ts): recover stale locks safely and release only our own
gummy789j Nov 2, 2026
44b6515
fix(ts): mark every unknown outcome and none that was not sent
gummy789j Nov 2, 2026
52b01d7
fix(ts): report bai recharge failures before payment as not sent
gummy789j Nov 2, 2026
3304f76
Revert "fix(ts): recover stale locks safely and release only our own"
gummy789j Nov 2, 2026
4b11300
fix(ts): tell the user which lock blocks a write and how to clear it
gummy789j Nov 2, 2026
1e37b57
fix(ts): keep settled payments and deadline refusals out of unknown o…
gummy789j Nov 2, 2026
6248ea5
fix(ts): name the blocking lock when the command runs out of time wai…
gummy789j Nov 2, 2026
abc4b78
refactor(ts): stage every transaction submit through one function
gummy789j Nov 2, 2026
21d0b7c
fix(ts): stop waiting for confirmation on an error a retry cannot fix
gummy789j Nov 2, 2026
d777be9
fix(ts): report why a required confirmation stopped
gummy789j Nov 2, 2026
7844703
fix(ts): list an approval whose wait stopped on an error among the su…
gummy789j Nov 2, 2026
2256be6
refactor(ts): check the deploy ABI in the TRON adapter and the origin…
gummy789j Nov 2, 2026
ed3f3d2
refactor(ts): compare transaction ids through the family hash normalizer
gummy789j Nov 2, 2026
6945169
chore(ts): delete unused exports and merge the sunswap fixture direct…
gummy789j Nov 2, 2026
a63ca6f
test(ts): test the lint rules in process instead of through the npm gate
gummy789j Nov 2, 2026
29640fe
feat(ts): add one request helper for the JSON service clients
gummy789j Nov 2, 2026
06b5b61
refactor(ts): send SunSwap and SunPump API requests through the servi…
gummy789j Nov 2, 2026
7a78a85
refactor(ts): send GasFree and TronLink requests through requestJson
gummy789j Nov 2, 2026
ebb6be4
refactor(ts): send B.AI requests through requestJson
gummy789j Nov 2, 2026
a9ea518
fix(ts): read a Retry-After date only in the IMF-fixdate form
gummy789j Nov 2, 2026
70922ab
refactor(ts): build x402 rate-limit details with the shared helper
gummy789j Nov 2, 2026
eacae47
docs(ts): describe one provider_rate_limited shape for every service
gummy789j Nov 2, 2026
3c417b8
style(ts): format the B.AI report rate-limit test
gummy789j Nov 2, 2026
57a43ba
fix(ts): keep the B.AI context fields beside the rate-limit keys
gummy789j Nov 2, 2026
27aac02
fix(ts): keep a Retry-After hint on x402 upstream errors other than 429
gummy789j Nov 2, 2026
2e26f1f
fix(ts): name the x402 Permit2 approval in an error after it was sent
gummy789j Nov 2, 2026
f2d25a9
refactor(ts): compare the TRON integrity txID through the family hash…
gummy789j Nov 2, 2026
32afac8
docs(ts): scope the polling rule to chain transactions and describe G…
gummy789j Nov 2, 2026
8385b2f
refactor(ts): name CLI inputs through references in outbound messages
gummy789j Nov 2, 2026
db8a7fd
fix(ts): ignore a Retry-After date that is not a valid IMF-fixdate
gummy789j Nov 2, 2026
323b37a
fix(ts): keep the Retry-After hint on x402 facilitator verify and set…
gummy789j Nov 2, 2026
db662b2
fix(ts): route the x402 provider catalog through the shared JSON-serv…
gummy789j Nov 2, 2026
d59ce54
refactor(ts): move TronRpcClient's response normalizers into TRON map…
gummy789j Nov 2, 2026
3116c92
test(ts): table-driven tests for the TRON response mappers
gummy789j Nov 2, 2026
290c894
fix(ts): keep input references when x402 wrappers rebuild an error me…
gummy789j Nov 2, 2026
ce5d85f
refactor(ts): name the SunPump token search through a follow-up refer…
gummy789j Nov 2, 2026
c869470
fix(ts): require the exact IMF-fixdate syntax for a Retry-After date
gummy789j Nov 2, 2026
bff2d61
refactor(ts): one WallClock contract for the clocks application servi…
gummy789j Nov 2, 2026
3191e42
refactor(ts): inject the wall clock where services read Date.now() fo…
gummy789j Nov 2, 2026
5df8bb8
refactor(ts): wire the system wall clock into the TRON services in bo…
gummy789j Nov 2, 2026
d912cd8
refactor(ts): WalletService locates the Ledger account on its own dev…
gummy789j Nov 2, 2026
acadfea
refactor(ts): WalletService counts software wallets; inbound no longe…
gummy789j Nov 2, 2026
a509a70
fix(ts): thread the service clock into TRON transaction hooks
gummy789j Nov 2, 2026
b715c93
build(ts): check environment reads in production modules only
gummy789j Nov 2, 2026
79f2820
docs(ts): mark unautomated rule parts review and drop the review-only…
gummy789j Nov 2, 2026
338078f
fix(ts): write the sun unit in lowercase in chain prices; refresh cha…
gummy789j Nov 4, 2026
2e28d5f
fix(ts): classify TRON constant-call reverts as execution_reverted
gummy789j Nov 4, 2026
98a3649
fix(ts): report the network's maintenance interval and x402 refusal d…
gummy789j Nov 4, 2026
06c9813
fix(ts): correct TRC10 history, headerless blocks, keypair dirs and r…
gummy789j Nov 4, 2026
63a7a3f
fix(ts): end prompts with aborted and validate payment inputs early
gummy789j Nov 4, 2026
67f9d02
fix(ts): keep the approval txId and fail timeout on deadline-ended me…
gummy789j Nov 4, 2026
b16b0a0
fix(ts): verify device signatures and pre-check undelegate and token …
gummy789j Nov 5, 2026
99bba34
fix(ts): classify input conflicts, block positionals and derive relabels
gummy789j Nov 5, 2026
965f2ab
fix(ts): close the 2026-11-05 security audit batch
gummy789j Nov 5, 2026
b92ff3c
style(ts): format the constant-call revert test
gummy789j Nov 5, 2026
8bed293
fix(ts): floor SunSwap swaps against zero quotes and add --min-out
gummy789j Nov 5, 2026
de0c719
docs: add the shared Graphify workflow the ts and java instructions p…
gummy789j Nov 5, 2026
337a5ba
build(ts): bump vite to 8.3.6 and source-map-js to 1.2.2
gummy789j Nov 5, 2026
f1631a9
fix(ts): keep command-deadline failures as timeout on optional reads
gummy789j Nov 5, 2026
a381c43
docs(ts): align the command and contract docs with the current behavior
gummy789j Nov 5, 2026
e40ed9c
fix(ts): make help and usage diagnostics match the command behavior
gummy789j Nov 5, 2026
b98ef0c
fix(ts): fail TRON contract info on the deadline and spell the report…
gummy789j Nov 5, 2026
fbd6d01
fix(ts): fail SunSwap token names and vote dry runs on the deadline
gummy789j Nov 5, 2026
4adb2df
test(ts): assert contract info is omitted when the optional read fails
gummy789j Nov 5, 2026
1f8432b
fix(ts): refuse a GET body in x402 pay and name positionals as arguments
gummy789j Nov 5, 2026
7637338
test(ts): expect the positional keyword named as an argument
gummy789j Nov 5, 2026
02d9486
docs(ts): note the GET restriction on x402 pay --body-file
gummy789j Nov 5, 2026
d98e2eb
fix(ts): read stake facts from the latest node state
gummy789j Nov 6, 2026
3742491
style(ts): format the stake reads
gummy789j Nov 6, 2026
335ed06
Merge pull request #1046 from tronprotocol/feat/improve-engineering-q…
gummy789j Nov 6, 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
  •  
  •  
  •  
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,7 @@ ts/.npmrc
.codex/

# MCP
.mcp.json
.mcp.json

# Team working files (status, briefs, handoffs); local only
.team/
33 changes: 33 additions & 0 deletions .graphifyignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Generated code and build/dependency output obscure the handwritten code graph.
java/src/main/gen/
java/src/gen/
node_modules/
build/
dist/
bin/
.gradle/
coverage/
graphify-out/

# Generated fixtures, dependency locks, and architecture drawing data.
**/__snapshots__/
**/package-lock.json
**/yarn.lock
**/pnpm-lock.yaml
ts/.dependency-cruiser-known-violations.json
ts/eslint-suppressions.json
ts/docs/
java/docs/

# Local agent state and wallet data are outside the source graph.
.claude/
.codex/
.agents/
.superpowers/
.team/
.private/
.mcp.json
Wallet/
Mnemonic/
wallet_data/
.wallet-cli/
6 changes: 6 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# AGENTS.md

Read `CLAUDE.md` for the repository layout, build, and test commands.

Before changing anything under `ts/`, read every file in `ts/docs/dev/rules/`. Those rules are the single
source of truth for the TypeScript architecture and comment style.
143 changes: 83 additions & 60 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,37 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co

The repository holds two independent implementations:

- `java/` — the original REPL-first implementation, described by the rest of this file.
- `ts/` — the agent-first TypeScript rewrite (npm package `@tron-walletcli/wallet-cli`). See the
**TypeScript Implementation** section below and `ts/README.md`.

Everything below (except the TypeScript Implementation section) refers to the Java implementation.
**All Java paths are relative to `java/`, and all Java commands are run from that directory**
(`cd java` first).

## TypeScript Implementation

The `ts/` package is a self-contained, agent-first CLI (Node.js 22.23.4+ / 24.22.1+ / 26.12.1+, ESM, TypeScript). Every command
has a stable JSON envelope, deterministic exit codes, and discoverable schemas; interactive prompts
are used only for secret input (create / import / backup / delete). **All `ts/` commands run from the
`ts/` directory.**
- `ts/` — the agent-first TypeScript rewrite (npm package `@tron-walletcli/wallet-cli`). See
[TypeScript](#typescript-ts) and `ts/README.md`.
- `java/` — the original REPL-first implementation. See [Java](#java-java).

## Graphify

Use the local code graph when you need to explore: where a symbol is used, how a flow passes through modules,
or what a change affects. Query it with
`bash scripts/graphify.sh query "<symbol or question>" --budget 1200` from the repository root.
Use this wrapper to select the project's pinned Graphify version and disable LLM backends. When you already
know the file and lines, or need every occurrence of a string, use source search instead.

- Initial setup: `bash scripts/graphify.sh setup` (requires `uv` and Python 3.13).
- Refresh only before a query, when the graph may be stale (a new session, a branch change, or code edits since
the last refresh): `bash scripts/graphify.sh refresh`. Extraction reuses unchanged files. If refresh fails,
say the graph is stale and use source search.
- From `ts/` or `java/`, use `bash ../scripts/graphify.sh` with the same arguments. The wrapper changes
to the repository root and updates the shared graph for both implementations.
- View `graphify-out/graph.html` for communities or `graphify-out/GRAPH_TREE.html` for symbols by file;
query data is in `graphify-out/graph.json` and the summary is in
`graphify-out/GRAPH_REPORT.md`. These generated files and the local Python environment are git-ignored.
- The scan covers code and tests in both implementations; `.graphifyignore` excludes generated code,
snapshots, build output, and local state. Document semantics are outside this code-only graph.
- Confirm graph findings in source, especially port-to-adapter wiring in `ts/src/bootstrap/composition.ts`.
Architecture rules and automated checks remain authoritative. If Graphify is unavailable, use source search.

## TypeScript (`ts/`)

A self-contained, agent-first CLI (Node.js 22.23.4+ / 24.22.1+ / 26.12.1+, ESM, TypeScript). Every command has a
stable JSON envelope, deterministic exit codes, and discoverable schemas; interactive prompts are used only for
secret input (create / import / backup / delete). **All `ts/` commands run from the `ts/` directory.**

```bash
cd ts
Expand All @@ -28,50 +45,56 @@ npm run build # bundle to dist/ via tsup (bin: wallet-cli -> dist/index
npm run dev -- <args> # run from source via tsx (e.g. npm run dev -- create --label main)
npm test # vitest (tests are co-located as *.test.ts)
npm run typecheck # tsc --noEmit
npm run depcruise # dependency-cruiser — enforces the architecture rules below
npm run depcruise # dependency-cruiser — enforces the layer rules
npm run lint # ESLint, with known violations suppressed
```

### Architecture (hexagonal / ports & adapters)

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 |
|---|---|---|---|
| `domain` | Pure rules & values, zero I/O (address, amounts, derivation, wallet, family, errors) | Node / pure libs only | application, adapters, bootstrap |
| `application` | Use cases, services, contracts, and **ports** (interfaces it owns) | `domain` | adapters, bootstrap |
| `adapters/inbound` | CLI driving side — parse argv, route to use cases, render output | application, domain | adapters/outbound, bootstrap |
| `adapters/outbound` | Implements application ports — keystore, TronWeb/Tron gateway, Ledger, price, config, persistence | application ports, domain | adapters/inbound, bootstrap |
| `bootstrap` | Composition root + process lifecycle (`runner.ts`, `composition.ts`, `argv.ts`, `families/`) | all areas | — (assembly only) |

Key points:
- **Ports live in `application/ports/`** (e.g. `wallet-repository`, `tron-gateway`, `ledger-device`,
`price-provider`); outbound adapters implement them (dependency inversion). Shared transaction input types live in
`application/contracts/`; ports must not import use cases or services (`ports-are-innermost`).
- **Chain-family differences** are isolated per family — `application/use-cases/<family>/`,
`adapters/outbound/chain/<family>/`, and the family plugin under `bootstrap/families/`. Both
`tron` and `evm` are registered unconditionally (`bootstrap/composition.ts`) and reachable: the
builtin networks and aliases cover ETH, Sepolia, BSC, BSC testnet, Base and Base Sepolia alongside the TRON three.
There is no family-level feature gate. EVM simply binds a narrower command set (30 bindings:
account, block, chain, tx, token, contract, message/typed-data signing, `bai recharge` and eight ERC-8004 identity commands) against TRON's 96, which adds
stake, permission, proposal, asset, GasFree, TronLink multisig, and the SunSwap and SunPump groups (17 commands).
The counts are the `families` tags in `wallet-cli --json-schema`.
- **A single Zod schema per command** drives validation, yargs arity, help text, and JSON Schema.
- **Secrets** (private keys, mnemonics, BIP39 passphrases) are encrypted at rest and never accepted
from argv or env — only a dedicated stdin channel or hidden TTY prompt.

### Adding a TypeScript command
`npm run depcruise` uses `ts/.dependency-cruiser-known-violations.json` and fails on new violations or
stale/duplicate baseline entries. After fixing a known violation or enabling a rule with existing violations,
run `npm run depcruise:baseline` from `ts/`, review the exact entries added or removed, and rerun
`npm run depcruise`. Commit the baseline diff with the corresponding code or rule change. Regeneration records
all current violations; fix unintended new violations before regenerating. To see unsuppressed diagnostics,
run `npx --no-install depcruise src`.

`npm run lint` uses `ts/eslint-suppressions.json`, ESLint's bulk suppressions file, which records a violation
count per file and rule. It fails when a count rises, when it falls (the entry stays until regeneration), and
on an entry for a file that is deleted, git-ignored, or ignored by ESLint (including `--ignore-pattern`).
Keys must use ESLint's relative POSIX paths, such as `src/example.ts`; aliases such as `./src/example.ts` fail.
Counts are compared, not locations, so fixing one violation and adding another of the same rule in the same
file passes. After fixing a known
violation or enabling a rule with existing violations, run `npm run lint:baseline` from `ts/`, review the exact
entries added or removed, and rerun `npm run lint`; commit the diff as for depcruise. Pass the same
`--ignore-pattern` options to both commands, for example for local git-ignored directories. To see the suppressed
diagnostics, run `npx --no-install eslint . --format json` and read each file's `suppressedMessages`.
Boolean ignore options use the last setting: `--ignore` or `--no-ignore`, optionally followed by `=true`
or `=false`. The lint wrapper rejects other assignment values, including whitespace-padded booleans.

Local ESLint rules live in `ts/eslint-rules/`; their tests in `ts/test/lint/rules/` run with
`npm run test:unit`. The baseline can include test and tooling files. The npm-script integration suite
`ts/test/lint/suppressions.test.ts` remains separate from these rule tests.

### Development rules

The rules for `ts/` are in `ts/docs/dev/rules/`. They are the single source of truth; do not restate them here.

@ts/docs/dev/rules/architecture.md
@ts/docs/dev/rules/comments.md

Which commands each chain family supports: the `families` tags in `wallet-cli --json-schema`.

### Adding a command

1. Add the command module under `adapters/inbound/cli/commands/` with its Zod schema.
2. Route it to an application use case (`application/use-cases/…`, e.g. `tron/transaction-service.ts`);
do not put I/O or chain logic in the inbound layer.
3. If it needs new I/O, define a **port** in `application/ports/` and implement it in
`adapters/outbound/`. Wire it in `bootstrap/composition.ts`.
2. Route it to an application use case under `application/use-cases/`.
3. If it needs new I/O, define a port in `application/ports/`, implement it in `adapters/outbound/`, and wire
it in `bootstrap/composition.ts`.
4. Add co-located `*.test.ts` and run `npm run depcruise && npm run typecheck && npm test`.

## Build & Run
## Java (`java/`)

**All Java paths are relative to `java/`, and all Java commands are run from that directory** (`cd java` first).

### Build & Run

```bash
# Build the project (generates protobuf sources into src/main/gen/)
Expand All @@ -96,7 +119,7 @@ Key points:

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`.

## End-to-end coverage
### End-to-end coverage

`java/qa-repl/` drives the real interactive shell over a pty (`expect`) against a
funded Nile account — wallet lifecycle, account queries, a signed 1 TRX transfer, and
Expand All @@ -110,11 +133,11 @@ cd java
./qa-repl/cli-boundary.sh build/libs/wallet-cli.jar # entry point takes only --version/--help
```

## Architecture
### 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.

### One CLI Mode
#### One CLI Mode

**Interactive REPL** — `Client` class with JCommander `@Parameters` inner classes. Entry point:
`org.tron.walletcli.Client`. Features tab completion, interactive prompts, and conversational
Expand All @@ -125,20 +148,20 @@ The shell is started one way only: a bare `java -jar wallet-cli.jar`. The entry
TypeScript CLI on stderr and exits 2. Non-interactive, scriptable and CI use belongs to `ts/`
(npm `@tron-walletcli/wallet-cli`).

### Request Flow
#### Request Flow

```
User Input → Client (JCommander) → WalletApiWrapper → WalletApi → Trident SDK → gRPC → TRON Node
```

### Key Classes
#### Key Classes

- **`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).

### Package Organization
#### Package Organization

| Package | Purpose |
|---------|---------|
Expand All @@ -152,13 +175,13 @@ User Input → Client (JCommander) → WalletApiWrapper → WalletApi → Triden
| `multi` | Multi-signature transaction handling |
| `gasfree` | GasFree transaction API (transfer tokens without gas) |

### Configuration
#### Configuration

- **Network config:** `src/main/resources/config.conf` (HOCON format via Typesafe Config)
- **Logging:** `src/main/resources/logback.xml` (Logback, INFO level console + rolling file)
- **Lombok:** `lombok.config` — uses `logger` as the log field name (not the default `log`)

### Key Frameworks & Libraries
#### Key Frameworks & Libraries

- **Trident SDK 0.11.0** — All gRPC API calls to TRON nodes
- **JCommander 1.82** — CLI argument parsing (interactive REPL)
Expand Down
4 changes: 4 additions & 0 deletions java/AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Java agent instructions

Read [the repository instructions](../AGENTS.md) and [the local instructions](CLAUDE.md), including
the Graphify usage and refresh requirements, before working in this directory.
16 changes: 16 additions & 0 deletions java/CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Java agent instructions

Read [the repository instructions](../CLAUDE.md) for build commands and the shared Graphify workflow.

## Graphify

Follow the [Graphify refresh requirements](../CLAUDE.md#graphify) when modifying code or tests here.
From `java/`, use:

```bash
bash ../scripts/graphify.sh query "WalletApiWrapper" --budget 1200
bash ../scripts/graphify.sh explain WalletApi
bash ../scripts/graphify.sh refresh
```

The wrapper uses the shared repository graph at `../graphify-out/`.
37 changes: 37 additions & 0 deletions scripts/graphify.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env bash
set -euo pipefail

repo_root="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$repo_root"
graphify_python="$repo_root/graphify-out/.venv/bin/python"
graphify_cli="$repo_root/graphify-out/.venv/bin/graphify"
export GRAPHIFY_BACKEND=none

case "${1:-help}" in
setup)
if [[ ! -x "$graphify_python" ]]; then
uv venv --python 3.13 graphify-out/.venv
fi
uv pip install --python "$graphify_python" 'graphifyy==0.9.97'
;;
refresh)
if [[ ! -x "$graphify_cli" ]]; then
echo 'Run bash scripts/graphify.sh setup first.' >&2
exit 1
fi
"$graphify_cli" extract . --code-only --max-workers 4
"$graphify_cli" cluster-only .
"$graphify_cli" tree --root . --label wallet-cli
;;
help|--help|-h)
echo 'Usage: bash scripts/graphify.sh setup|refresh|<graphify command> [args...]'
echo 'Examples: query "MessageSigner" --budget 1200; explain "TronGridHistoryReader"'
;;
*)
if [[ ! -x "$graphify_cli" ]]; then
echo 'Run bash scripts/graphify.sh setup first.' >&2
exit 1
fi
exec "$graphify_cli" "$@"
;;
esac
35 changes: 35 additions & 0 deletions ts/.dependency-cruiser-known-violations.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[
{
"type": "dependency",
"from": "src/adapters/outbound/x402/gasfree-errors.test.ts",
"to": "@bankofai/x402-tron/gasfree/client",
"unresolvedTo": "@bankofai/x402-tron/gasfree/client",
"dependencyTypes": ["unknown"],
"rule": {
"severity": "error",
"name": "x402-payment-modules-only-in-payment-client"
}
},
{
"type": "dependency",
"from": "src/adapters/outbound/x402/gasfree-errors.test.ts",
"to": "node_modules/@bankofai/x402-fetch/dist/cjs/index.js",
"unresolvedTo": "@bankofai/x402-fetch",
"dependencyTypes": ["npm-dev", "import"],
"rule": {
"severity": "error",
"name": "x402-payment-modules-only-in-payment-client"
}
},
{
"type": "dependency",
"from": "src/adapters/outbound/x402/nile-settlement.test.ts",
"to": "@bankofai/x402-tron/exact/facilitator",
"unresolvedTo": "@bankofai/x402-tron/exact/facilitator",
"dependencyTypes": ["unknown"],
"rule": {
"severity": "error",
"name": "x402-payment-modules-only-in-payment-client"
}
}
]
Loading
Loading