feat: add named RPC endpoint profiles for dev/staging/prod workflows#165
feat: add named RPC endpoint profiles for dev/staging/prod workflows#165okwn wants to merge 2 commits intoopen-wallet-standard:mainfrom
Conversation
|
@okwn is attempting to deploy a commit to the MoonPay Team on Vercel. A member of the Team first needs to authorize it. |
634100a to
bc0b0bd
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| .map_err(|e| CliError::InvalidArgs(format!("failed to write config: {}", e)))?; | ||
|
|
||
| Ok(()) | ||
| } |
There was a problem hiding this comment.
Config save fails if .ows directory doesn't exist
Medium Severity
save_config calls std::fs::write on ~/.ows/config.json without first ensuring the ~/.ows directory exists via create_dir_all. If a user runs ows rpc add before ever creating a wallet (which normally creates the .ows directory), the write fails with a confusing OS-level "No such file or directory" error. Other parts of the codebase (e.g., audit.rs) consistently call create_dir_all before writing to the .ows tree.


Summary
Adds named RPC endpoint profiles to OWS so users can manage chain-specific endpoint sets for different environments such as dev, staging, and prod.
This introduces config support for named profiles, CLI commands for profile management, and endpoint resolution that uses the active profile when no explicit RPC override is provided.
What’s included
rpc_configsupport in~/.ows/config.jsonows rpc addows rpc listows rpc showows rpc useows rpc removeows rpc clearRPC resolution precedence
RPC endpoint resolution now follows this order:
rpcUrlargumentrpcconfigBackward compatibility
This change preserves the legacy flat
rpcconfig format.Existing configs continue to work as before. The new
rpc_configsection is optional, and profile-based resolution is only used when configured.Testing
Ran the following checks:
cargo fmt --checkcargo clippy -p ows-core -p ows-lib -p ows-clicargo test -p ows-corecargo test -p ows-clicargo test -p ows-lib -- resolve_rpc_urlAll RPC-profile-related checks pass.
Reviewer notes
#[cfg(not(windows))]tests inresolve_rpc_urlremain intentionally gated with explanatory comments. The tested behaviors are still covered elsewhere in the suite.policy_engine::executable_*failures inows-libare unrelated to this feature and predate this branch.Option<String>due to a lifetime-safe implementation choice; this is internal-only and not part of the public API.Note
Medium Risk
Changes how RPC endpoints are resolved for signing/broadcasting by introducing profile precedence and new config serialization behavior, which could impact transaction submission if misconfigured or if defaults/overrides are merged unexpectedly.
Overview
Adds named RPC endpoint profiles to
~/.ows/config.json(rpc_configwithactiveProfileand per-chain URLs) and updates RPC resolution to prefer explicit--rpc-url→ active profile → globalrpc→ built-in defaults.Introduces a new
ows rpcCLI command group (add,list,show,use,remove,clear), enhancesows config showto display active/available profiles, and updates docs/tests to cover the new config format, persistence behavior (avoid baking defaults into saved config), and precedence rules.Written by Cursor Bugbot for commit bc0b0bd. This will update automatically on new commits. Configure here.