|
1 | 1 | from typing import Any |
2 | 2 |
|
3 | 3 | from multiversx_sdk import ProxyNetworkProvider |
4 | | -from prettytable import PrettyTable |
| 4 | +from rich.console import Console |
| 5 | +from rich.table import Table |
5 | 6 |
|
6 | 7 | from multiversx_sdk_cli import cli_shared |
7 | 8 | from multiversx_sdk_cli.config import get_config_for_network_providers |
@@ -179,27 +180,33 @@ def get_version(args: Any): |
179 | 180 | config = get_config_for_network_providers() |
180 | 181 | proxy = ProxyNetworkProvider(url=args.proxy, config=config) |
181 | 182 | if args.all: |
182 | | - t = PrettyTable( |
183 | | - [ |
184 | | - "Shard ID", |
185 | | - "Contract address (bech32)", |
186 | | - "Contract address (hex)", |
187 | | - "Version", |
188 | | - ] |
189 | | - ) |
| 183 | + table = Table(title="DNS Version") |
| 184 | + table.add_column("Shard ID") |
| 185 | + table.add_column("Contract address (bech32)") |
| 186 | + table.add_column("Contract address (hex)") |
| 187 | + table.add_column("Version") |
| 188 | + |
190 | 189 | for shard_id in range(0, 256): |
191 | 190 | address = compute_dns_address_for_shard_id(shard_id) |
192 | 191 | v = version(shard_id, proxy) |
193 | | - t.add_row([shard_id, address.to_bech32(), address.to_hex(), v]) # type: ignore |
194 | | - print(t) |
| 192 | + table.add_row(str(shard_id), address.to_bech32(), address.to_hex(), v) |
| 193 | + |
| 194 | + console = Console() |
| 195 | + console.print(table) |
195 | 196 | else: |
196 | 197 | shard_id = int(args.shard_id) |
197 | 198 | print(version(shard_id, proxy)) |
198 | 199 |
|
199 | 200 |
|
200 | 201 | def print_dns_addresses_table(args: Any): |
201 | | - t = PrettyTable(["Shard ID", "Contract address (bech32)", "Contract address (hex)"]) |
| 202 | + table = Table(title="DNS Addresses") |
| 203 | + table.add_column("Shard ID") |
| 204 | + table.add_column("Contract address (bech32)") |
| 205 | + table.add_column("Contract address (hex)") |
| 206 | + |
202 | 207 | for shard_id in range(0, 256): |
203 | 208 | address = compute_dns_address_for_shard_id(shard_id) |
204 | | - t.add_row([shard_id, address.to_bech32(), address.to_hex()]) # type: ignore |
205 | | - print(t) |
| 209 | + table.add_row(str(shard_id), address.to_bech32(), address.to_hex()) |
| 210 | + |
| 211 | + console = Console() |
| 212 | + console.print(table) |
0 commit comments