Skip to content

Conversation

@GlobalStar117
Copy link

@GlobalStar117 GlobalStar117 commented Jan 15, 2026

Summary

This PR normalizes JSON output for wallet key commands (regen_coldkey, regen_coldkey_pub, regen_hotkey) to provide a consistent structure across all operations.

Fixes #635

Changes

  • Added a helper function _print_json_result(success, data, error) that standardizes JSON output format
  • Refactored all wallet key commands to use this helper instead of inline json.dumps() calls
  • Ensures consistent JSON structure: {"success": bool, "data": dict|null, "error": string|null}

Benefits

  • Consistency: All wallet JSON outputs now follow the same structure
  • Maintainability: Single source of truth for JSON formatting reduces code duplication
  • Reliability: Eliminates potential inconsistencies between different command outputs

Testing

Tested manually with:

  • btcli wallet regen-coldkey --json-output
  • btcli wallet regen-coldkey-pub --json-output
  • btcli wallet regen-hotkey --json-output

This is a Gittensor contribution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant