htcli 1.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. htcli-1.1.0.dist-info/METADATA +509 -0
  2. htcli-1.1.0.dist-info/RECORD +140 -0
  3. htcli-1.1.0.dist-info/WHEEL +4 -0
  4. htcli-1.1.0.dist-info/entry_points.txt +2 -0
  5. htcli-1.1.0.dist-info/licenses/LICENSE +21 -0
  6. src/__init__.py +0 -0
  7. src/htcli/__init__.py +5 -0
  8. src/htcli/client/__init__.py +338 -0
  9. src/htcli/client/extrinsics/__init__.py +26 -0
  10. src/htcli/client/extrinsics/base.py +487 -0
  11. src/htcli/client/extrinsics/consensus.py +79 -0
  12. src/htcli/client/extrinsics/governance.py +714 -0
  13. src/htcli/client/extrinsics/identity.py +490 -0
  14. src/htcli/client/extrinsics/node.py +1054 -0
  15. src/htcli/client/extrinsics/overwatch.py +401 -0
  16. src/htcli/client/extrinsics/staking.py +1504 -0
  17. src/htcli/client/extrinsics/subnet.py +2218 -0
  18. src/htcli/client/extrinsics/validator.py +203 -0
  19. src/htcli/client/extrinsics/wallet.py +323 -0
  20. src/htcli/client/offchain/__init__.py +10 -0
  21. src/htcli/client/offchain/backup.py +385 -0
  22. src/htcli/client/offchain/config.py +541 -0
  23. src/htcli/client/offchain/wallet.py +839 -0
  24. src/htcli/client/rpc/__init__.py +20 -0
  25. src/htcli/client/rpc/chain.py +568 -0
  26. src/htcli/client/rpc/node.py +783 -0
  27. src/htcli/client/rpc/overwatch.py +680 -0
  28. src/htcli/client/rpc/staking.py +216 -0
  29. src/htcli/client/rpc/subnet.py +2104 -0
  30. src/htcli/client/rpc/wallet.py +912 -0
  31. src/htcli/commands/__init__.py +31 -0
  32. src/htcli/commands/chain/__init__.py +66 -0
  33. src/htcli/commands/chain/display.py +204 -0
  34. src/htcli/commands/chain/handlers.py +260 -0
  35. src/htcli/commands/config/__init__.py +158 -0
  36. src/htcli/commands/config/display.py +353 -0
  37. src/htcli/commands/config/handlers.py +347 -0
  38. src/htcli/commands/config/prompts.py +357 -0
  39. src/htcli/commands/consensus/__init__.py +61 -0
  40. src/htcli/commands/consensus/handlers.py +100 -0
  41. src/htcli/commands/governance/__init__.py +49 -0
  42. src/htcli/commands/governance/handlers.py +81 -0
  43. src/htcli/commands/node/__init__.py +304 -0
  44. src/htcli/commands/node/display.py +749 -0
  45. src/htcli/commands/node/error_handling.py +470 -0
  46. src/htcli/commands/node/handlers.py +844 -0
  47. src/htcli/commands/node/prompts.py +346 -0
  48. src/htcli/commands/overwatch/__init__.py +219 -0
  49. src/htcli/commands/overwatch/display.py +396 -0
  50. src/htcli/commands/overwatch/error_handling.py +276 -0
  51. src/htcli/commands/overwatch/handlers.py +443 -0
  52. src/htcli/commands/overwatch/prompts.py +359 -0
  53. src/htcli/commands/stake/__init__.py +736 -0
  54. src/htcli/commands/stake/display.py +1103 -0
  55. src/htcli/commands/stake/error_handling.py +425 -0
  56. src/htcli/commands/stake/handlers.py +1902 -0
  57. src/htcli/commands/stake/prompts.py +1080 -0
  58. src/htcli/commands/subnet/__init__.py +639 -0
  59. src/htcli/commands/subnet/display.py +801 -0
  60. src/htcli/commands/subnet/error_handling.py +524 -0
  61. src/htcli/commands/subnet/handlers.py +2855 -0
  62. src/htcli/commands/subnet/prompts.py +1225 -0
  63. src/htcli/commands/validator/__init__.py +192 -0
  64. src/htcli/commands/validator/display.py +54 -0
  65. src/htcli/commands/validator/handlers.py +340 -0
  66. src/htcli/commands/wallet/__init__.py +546 -0
  67. src/htcli/commands/wallet/display.py +806 -0
  68. src/htcli/commands/wallet/error_handling.py +210 -0
  69. src/htcli/commands/wallet/handlers.py +3040 -0
  70. src/htcli/commands/wallet/prompts.py +1518 -0
  71. src/htcli/config.py +184 -0
  72. src/htcli/dependencies.py +186 -0
  73. src/htcli/errors/__init__.py +63 -0
  74. src/htcli/errors/base.py +141 -0
  75. src/htcli/errors/display.py +20 -0
  76. src/htcli/errors/handlers.py +710 -0
  77. src/htcli/main.py +343 -0
  78. src/htcli/models/__init__.py +21 -0
  79. src/htcli/models/enums/enum_types.py +35 -0
  80. src/htcli/models/errors.py +103 -0
  81. src/htcli/models/requests/__init__.py +197 -0
  82. src/htcli/models/requests/config.py +70 -0
  83. src/htcli/models/requests/consensus.py +19 -0
  84. src/htcli/models/requests/governance.py +38 -0
  85. src/htcli/models/requests/identity.py +51 -0
  86. src/htcli/models/requests/key.py +22 -0
  87. src/htcli/models/requests/node.py +91 -0
  88. src/htcli/models/requests/overwatch.py +64 -0
  89. src/htcli/models/requests/staking.py +580 -0
  90. src/htcli/models/requests/subnet.py +195 -0
  91. src/htcli/models/requests/validator.py +139 -0
  92. src/htcli/models/requests/wallet.py +118 -0
  93. src/htcli/models/responses/__init__.py +147 -0
  94. src/htcli/models/responses/base.py +18 -0
  95. src/htcli/models/responses/chain.py +39 -0
  96. src/htcli/models/responses/config.py +58 -0
  97. src/htcli/models/responses/identity.py +102 -0
  98. src/htcli/models/responses/overwatch.py +51 -0
  99. src/htcli/models/responses/staking.py +502 -0
  100. src/htcli/models/responses/subnet.py +856 -0
  101. src/htcli/models/responses/wallet.py +185 -0
  102. src/htcli/ui/__init__.py +87 -0
  103. src/htcli/ui/colors.py +309 -0
  104. src/htcli/ui/components/__init__.py +60 -0
  105. src/htcli/ui/components/panels.py +174 -0
  106. src/htcli/ui/components/progress.py +166 -0
  107. src/htcli/ui/components/spinners.py +92 -0
  108. src/htcli/ui/components/tables.py +809 -0
  109. src/htcli/ui/components/trees.py +721 -0
  110. src/htcli/ui/display.py +336 -0
  111. src/htcli/ui/prompts.py +870 -0
  112. src/htcli/utils/__init__.py +76 -0
  113. src/htcli/utils/blockchain/__init__.py +75 -0
  114. src/htcli/utils/blockchain/formatting.py +368 -0
  115. src/htcli/utils/blockchain/patches.py +286 -0
  116. src/htcli/utils/blockchain/peer_id.py +186 -0
  117. src/htcli/utils/blockchain/staking.py +448 -0
  118. src/htcli/utils/blockchain/type_registry.py +1373 -0
  119. src/htcli/utils/blockchain/validation.py +179 -0
  120. src/htcli/utils/cache.py +613 -0
  121. src/htcli/utils/constants.py +38 -0
  122. src/htcli/utils/legacy/__init__.py +12 -0
  123. src/htcli/utils/legacy/colors.py +311 -0
  124. src/htcli/utils/legacy/crypto.py +1176 -0
  125. src/htcli/utils/legacy/formatting.py +452 -0
  126. src/htcli/utils/legacy/interactive.py +306 -0
  127. src/htcli/utils/legacy/subnet_manifest.py +265 -0
  128. src/htcli/utils/legacy/validation.py +488 -0
  129. src/htcli/utils/logging.py +183 -0
  130. src/htcli/utils/network/__init__.py +20 -0
  131. src/htcli/utils/network/subnet.py +344 -0
  132. src/htcli/utils/prompts.py +27 -0
  133. src/htcli/utils/scale_codec.py +155 -0
  134. src/htcli/utils/validation/__init__.py +57 -0
  135. src/htcli/utils/validation/prompt_validators.py +267 -0
  136. src/htcli/utils/wallet/__init__.py +65 -0
  137. src/htcli/utils/wallet/auth.py +151 -0
  138. src/htcli/utils/wallet/core.py +1069 -0
  139. src/htcli/utils/wallet/crypto.py +1615 -0
  140. src/htcli/utils/wallet/migration.py +159 -0
@@ -0,0 +1,311 @@
1
+ """
2
+ Standardized color scheme for htcli application.
3
+
4
+ This module provides eye-friendly colors based on medical research and terminal compatibility.
5
+ Colors are designed to reduce eye strain and work well across different terminal environments.
6
+ """
7
+
8
+ from enum import Enum
9
+
10
+
11
+ class ColorScheme(Enum):
12
+ """Available color schemes for different terminal environments."""
13
+
14
+ DEFAULT = "default"
15
+ DARK = "dark"
16
+ LIGHT = "light"
17
+ HIGH_CONTRAST = "high_contrast"
18
+ SOFT = "soft"
19
+
20
+
21
+ class Colors:
22
+ """
23
+ Standardized color palette for htcli.
24
+
25
+ - Avoid pure white (#FFFFFF) - too bright and causes eye strain
26
+ - Avoid pure black (#000000) - too harsh contrast
27
+ - Avoid deep greens - can cause eye fatigue
28
+ - Use softer, muted colors with lower saturation
29
+ - Ensure good contrast ratios without being harsh
30
+ - Work well in both light and dark terminals
31
+ - Use colors that reduce blue light exposure
32
+ """
33
+
34
+ # Primary colors - Soft, eye-friendly alternatives
35
+ PRIMARY = "bright_blue" # Soft blue - good for primary elements
36
+ SECONDARY = "cyan" # Gentle cyan - good for secondary info
37
+ SUCCESS = "bright_green" # Softer green - less harsh than deep green
38
+ WARNING = "yellow" # Gentle yellow - warnings
39
+ ERROR = "bright_red" # Softer red - less harsh than deep red
40
+ INFO = "blue" # Soft blue - informational
41
+
42
+ # Text colors - Easy on the eyes, avoiding pure white
43
+ TEXT_PRIMARY = "bright_white" # Softer white for primary text
44
+ TEXT_SECONDARY = "bright_black" # Soft gray for secondary text
45
+ TEXT_MUTED = "dim" # Very soft gray for muted text
46
+
47
+ # Background colors - Subtle and non-intrusive
48
+ BG_PRIMARY = "black" # Standard terminal background
49
+ BG_SECONDARY = "bright_black" # Slightly lighter background
50
+ BG_HIGHLIGHT = "blue" # Subtle highlight background
51
+
52
+ # Border colors - Clean and professional, avoiding harsh whites
53
+ BORDER_PRIMARY = "bright_white" # Softer white borders
54
+ BORDER_SECONDARY = "bright_black" # Subtle borders
55
+
56
+ # Status colors - Clear but not harsh
57
+ STATUS_ONLINE = "bright_green" # Softer green for online/active
58
+ STATUS_OFFLINE = "bright_red" # Softer red for offline/inactive
59
+ STATUS_PENDING = "yellow" # Gentle yellow for pending/waiting
60
+
61
+ # Balance colors - Financial clarity with eye-friendly alternatives
62
+ BALANCE_POSITIVE = "bright_green" # Softer green for positive balances
63
+ BALANCE_NEGATIVE = "bright_red" # Softer red for negative balances
64
+ BALANCE_ZERO = "bright_black" # Soft gray for zero balances
65
+
66
+ # Wallet colors - Clear identification with softer tones
67
+ WALLET_COLDKEY = "cyan" # Cyan for coldkey identification
68
+ WALLET_HOTKEY = "blue" # Blue for hotkey identification
69
+ WALLET_ADDRESS = "bright_green" # Softer green for address display
70
+
71
+ # Table colors - Professional appearance with reduced eye strain
72
+ TABLE_HEADER = "bright_white" # Softer white for headers
73
+ TABLE_ROW = "bright_black" # Soft gray for row text
74
+ TABLE_BORDER = "bright_white" # Softer white borders
75
+ TABLE_HIGHLIGHT = "blue" # Subtle blue for highlighted rows
76
+
77
+ # Interactive elements - Gentle colors for user interaction
78
+ PROMPT = "cyan" # Cyan for user prompts
79
+ INPUT = "bright_white" # Softer white for user input
80
+ BUTTON = "blue" # Blue for interactive buttons
81
+ LINK = "cyan" # Cyan for clickable links
82
+
83
+ # Special purpose colors - Important but not harsh
84
+ SECURITY = "bright_red" # Softer red for security items
85
+ ENCRYPTION = "bright_green" # Softer green for encryption status
86
+ MNEMONIC = "yellow" # Yellow for recovery phrases (important!)
87
+ PASSWORD = "bright_red" # Softer red for password fields
88
+
89
+ # Alternative color schemes for different preferences
90
+ ALTERNATIVE_SUCCESS = "cyan" # Cyan alternative for success states
91
+ ALTERNATIVE_BALANCE = "blue" # Blue alternative for balances
92
+ ALTERNATIVE_WALLET = "magenta" # Magenta alternative for wallet types
93
+
94
+ # Soft color scheme - Even more eye-friendly
95
+ SOFT_SUCCESS = "cyan" # Cyan instead of green for success
96
+ SOFT_BALANCE = "blue" # Blue instead of green for balances
97
+ SOFT_WALLET = "magenta" # Magenta for wallet types
98
+ SOFT_TEXT = "bright_black" # Very soft text color
99
+ SOFT_BORDER = "bright_black" # Very soft borders
100
+
101
+ # Accessibility colors - High contrast option
102
+ ACCESSIBILITY_HIGH_CONTRAST = {
103
+ "text": "bright_white",
104
+ "background": "black",
105
+ "border": "bright_white",
106
+ "error": "bright_red",
107
+ "success": "bright_green",
108
+ "warning": "bright_yellow",
109
+ }
110
+
111
+
112
+ def get_color(color_name: str, scheme: ColorScheme = ColorScheme.DEFAULT) -> str:
113
+ """
114
+ Get a standardized color based on the current color scheme.
115
+
116
+ Args:
117
+ color_name: Name of the color to retrieve
118
+ scheme: Color scheme to use
119
+
120
+ Returns:
121
+ Rich-compatible color string
122
+ """
123
+ if scheme == ColorScheme.HIGH_CONTRAST:
124
+ return Colors.ACCESSIBILITY_HIGH_CONTRAST.get(color_name, "white")
125
+
126
+ # Get the color attribute from Colors class
127
+ color_attr = getattr(Colors, color_name.upper(), None)
128
+ if color_attr:
129
+ return color_attr.value
130
+
131
+ # Fallback to safe defaults
132
+ return "bright_white"
133
+
134
+
135
+ def get_current_color_scheme() -> ColorScheme:
136
+ """
137
+ Get the current color scheme from configuration.
138
+
139
+ Returns:
140
+ Current ColorScheme enum value
141
+ """
142
+ try:
143
+ from src.htcli.config import load_config
144
+
145
+ config = load_config()
146
+ scheme_name = config.output.color_scheme.lower()
147
+
148
+ # Map config values to ColorScheme enum
149
+ scheme_mapping = {
150
+ "default": ColorScheme.DEFAULT,
151
+ "dark": ColorScheme.DARK,
152
+ "light": ColorScheme.LIGHT,
153
+ "high_contrast": ColorScheme.HIGH_CONTRAST,
154
+ "high-contrast": ColorScheme.HIGH_CONTRAST,
155
+ "soft": ColorScheme.SOFT,
156
+ }
157
+
158
+ return scheme_mapping.get(scheme_name, ColorScheme.DEFAULT)
159
+ except Exception:
160
+ # Fallback to default if config loading fails
161
+ return ColorScheme.DEFAULT
162
+
163
+
164
+ def get_table_style(scheme: ColorScheme = ColorScheme.DEFAULT) -> dict:
165
+ """
166
+ Get standardized table styling.
167
+
168
+ Args:
169
+ scheme: Color scheme to use
170
+
171
+ Returns:
172
+ Dictionary with table styling parameters
173
+ """
174
+ if scheme == ColorScheme.HIGH_CONTRAST:
175
+ return {
176
+ "header_style": "bold bright_white",
177
+ "border_style": "bright_white",
178
+ "row_styles": ["bright_white", "bright_black"],
179
+ }
180
+ elif scheme == ColorScheme.SOFT:
181
+ return {
182
+ "header_style": f"bold {Colors.SOFT_TEXT}",
183
+ "border_style": Colors.SOFT_BORDER,
184
+ "row_styles": [Colors.SOFT_TEXT, Colors.SOFT_TEXT],
185
+ }
186
+
187
+ return {
188
+ "header_style": f"bold {Colors.TABLE_HEADER}",
189
+ "border_style": Colors.TABLE_BORDER,
190
+ "row_styles": [Colors.TABLE_ROW, Colors.TEXT_PRIMARY],
191
+ }
192
+
193
+
194
+ def get_status_color(status: str, scheme: ColorScheme = ColorScheme.DEFAULT) -> str:
195
+ """
196
+ Get appropriate color for status indicators.
197
+
198
+ Args:
199
+ status: Status string (online, offline, pending, etc.)
200
+ scheme: Color scheme to use
201
+
202
+ Returns:
203
+ Rich-compatible color string
204
+ """
205
+ status_colors = {
206
+ "online": Colors.STATUS_ONLINE,
207
+ "offline": Colors.STATUS_OFFLINE,
208
+ "pending": Colors.STATUS_PENDING,
209
+ "active": Colors.STATUS_ONLINE,
210
+ "inactive": Colors.STATUS_OFFLINE,
211
+ "success": Colors.SUCCESS,
212
+ "error": Colors.ERROR,
213
+ "warning": Colors.WARNING,
214
+ "info": Colors.INFO,
215
+ }
216
+
217
+ return status_colors.get(status.lower(), Colors.TEXT_PRIMARY)
218
+
219
+
220
+ def get_balance_color(balance: float, scheme: ColorScheme = ColorScheme.DEFAULT) -> str:
221
+ """
222
+ Get appropriate color for balance display.
223
+
224
+ Args:
225
+ balance: Balance amount
226
+ scheme: Color scheme to use
227
+
228
+ Returns:
229
+ Rich-compatible color string
230
+ """
231
+ if scheme == ColorScheme.SOFT:
232
+ if balance > 0:
233
+ return Colors.SOFT_BALANCE
234
+ elif balance < 0:
235
+ return Colors.ERROR
236
+ else:
237
+ return Colors.SOFT_TEXT
238
+ else:
239
+ if balance > 0:
240
+ return Colors.BALANCE_POSITIVE
241
+ elif balance < 0:
242
+ return Colors.BALANCE_NEGATIVE
243
+ else:
244
+ return Colors.BALANCE_ZERO
245
+
246
+
247
+ def get_wallet_color(
248
+ wallet_type: str, scheme: ColorScheme = ColorScheme.DEFAULT
249
+ ) -> str:
250
+ """
251
+ Get appropriate color for wallet type display.
252
+
253
+ Args:
254
+ wallet_type: Type of wallet (coldkey, hotkey, etc.)
255
+ scheme: Color scheme to use
256
+
257
+ Returns:
258
+ Rich-compatible color string
259
+ """
260
+ if scheme == ColorScheme.SOFT:
261
+ wallet_colors = {
262
+ "coldkey": Colors.SOFT_WALLET,
263
+ "hotkey": Colors.SOFT_WALLET,
264
+ "address": Colors.SOFT_BALANCE,
265
+ "external": Colors.SOFT_TEXT,
266
+ }
267
+ else:
268
+ wallet_colors = {
269
+ "coldkey": Colors.WALLET_COLDKEY,
270
+ "hotkey": Colors.WALLET_HOTKEY,
271
+ "address": Colors.WALLET_ADDRESS,
272
+ "external": Colors.TEXT_SECONDARY,
273
+ }
274
+
275
+ return wallet_colors.get(wallet_type.lower(), Colors.TEXT_PRIMARY)
276
+
277
+
278
+ # Convenience functions for common use cases
279
+ def success_color() -> str:
280
+ """Get success color."""
281
+ return Colors.SUCCESS
282
+
283
+
284
+ def error_color() -> str:
285
+ """Get error color."""
286
+ return Colors.ERROR
287
+
288
+
289
+ def warning_color() -> str:
290
+ """Get warning color."""
291
+ return Colors.WARNING
292
+
293
+
294
+ def info_color() -> str:
295
+ """Get info color."""
296
+ return Colors.INFO
297
+
298
+
299
+ def primary_color() -> str:
300
+ """Get primary color."""
301
+ return Colors.PRIMARY
302
+
303
+
304
+ def text_color() -> str:
305
+ """Get primary text color."""
306
+ return Colors.TEXT_PRIMARY
307
+
308
+
309
+ def muted_color() -> str:
310
+ """Get muted text color."""
311
+ return Colors.TEXT_MUTED