Conversation
- Read public address from wallet keystore without decryption - Support custom wallet path via --wallet/-w flag - Support custom config path via --config/-c flag - Return proper exit codes (12 for wallet not found) - Add comprehensive README documentation Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR implements a new CLI tool get-address that retrieves the public Ethereum address from an x402 wallet keystore file without requiring password decryption.
Changes:
- Added new
get-addressCLI tool with support for custom wallet and config paths - Implemented proper exit code handling (exit code 12 for wallet not found, exit code 1 for other errors)
- Added comprehensive README documentation covering usage, security considerations, and exit codes
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| get-address/src/main.rs | Implements the CLI tool with argument parsing, config loading, and wallet address retrieval with proper exit code handling |
| get-address/Cargo.toml | Adds dependencies for clap (CLI parsing), x402_common (wallet/config functionality), and anyhow |
| get-address/README.md | Provides comprehensive documentation including usage examples, security notes, and exit codes |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| [dependencies] | ||
| x402_common = { path = "../x402-common" } | ||
| clap = { version = "4", features = ["derive"] } | ||
| anyhow = "1" |
There was a problem hiding this comment.
The anyhow dependency is declared but never used in the code. The main.rs file uses std::process::ExitCode for error handling instead of anyhow's Result type. Consider removing this unused dependency.
| anyhow = "1" |
| let wallet_path = if let Some(path) = args.wallet { | ||
| Some(path) | ||
| } else { | ||
| // Try to load config for default wallet path | ||
| match Config::load_from(args.config.as_deref()) { | ||
| Ok(config) => Some(config.wallet_path()), | ||
| Err(_) => None, // Use library default |
There was a problem hiding this comment.
When loading configuration fails, the error is silently ignored. If a user explicitly specifies a config path via --config that contains invalid TOML or has IO errors, they won't be notified of the problem. Consider checking if args.config.is_some() and if so, propagate the error to inform the user about the invalid config file they explicitly specified.
| let wallet_path = if let Some(path) = args.wallet { | |
| Some(path) | |
| } else { | |
| // Try to load config for default wallet path | |
| match Config::load_from(args.config.as_deref()) { | |
| Ok(config) => Some(config.wallet_path()), | |
| Err(_) => None, // Use library default | |
| let config_path = args.config.as_deref(); | |
| let wallet_path = if let Some(path) = args.wallet.clone() { | |
| Some(path) | |
| } else { | |
| // Try to load config for default wallet path | |
| match Config::load_from(config_path) { | |
| Ok(config) => Some(config.wallet_path()), | |
| Err(e) => { | |
| // If the user explicitly specified a config path, surface the error | |
| if let Some(path) = config_path { | |
| eprintln!( | |
| "Error loading config file '{}': {}", | |
| path.display(), | |
| e | |
| ); | |
| return ExitCode::FAILURE; | |
| } | |
| // No explicit config provided: fall back to library default | |
| None | |
| } |
Summary
get-addressCLI tool to read public Ethereum address from wallet keystore--wallet/-wflag--config/-cflagTest plan
cargo build --release -p get-addresscargo test --allcargo clippy --all -- -D warningscargo fmt --all -- --check--helpshows usage informationGenerated with Claude Code