refactor: consolidate blockchain explorer into single app and update backup ignore patterns
- Remove standalone explorer-web app (README, HTML, package files) - Add /web endpoint to blockchain-explorer for web interface access - Update .gitignore to exclude application backup archives (*.tar.gz, *.zip) - Add backup documentation files to .gitignore (BACKUP_INDEX.md, README.md) - Consolidate explorer functionality into main blockchain-explorer application
This commit is contained in:
36
cli/tests/api/test_blockchain_commands.py
Normal file
36
cli/tests/api/test_blockchain_commands.py
Normal file
@@ -0,0 +1,36 @@
|
||||
import subprocess
|
||||
import re
|
||||
|
||||
def run_cmd(cmd):
|
||||
print(f"Running: {' '.join(cmd)}")
|
||||
result = subprocess.run(
|
||||
cmd,
|
||||
capture_output=True,
|
||||
text=True
|
||||
)
|
||||
|
||||
# Strip ANSI escape sequences
|
||||
ansi_escape = re.compile(r'\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])')
|
||||
clean_stdout = ansi_escape.sub('', result.stdout).strip()
|
||||
|
||||
print(f"Exit code: {result.returncode}")
|
||||
print(f"Output:\n{clean_stdout}")
|
||||
if result.stderr:
|
||||
print(f"Stderr:\n{result.stderr}")
|
||||
print("-" * 40)
|
||||
|
||||
print("=== BLOCKCHAIN API TESTS ===")
|
||||
|
||||
base_cmd = ["/home/oib/windsurf/aitbc/cli/venv/bin/aitbc", "--url", "http://10.1.223.93:8000/v1", "--api-key", "client_dev_key_1", "--output", "json"]
|
||||
|
||||
print("\n--- genesis ---")
|
||||
run_cmd(base_cmd + ["blockchain", "genesis", "--chain-id", "ait-devnet"])
|
||||
|
||||
print("\n--- mempool ---")
|
||||
run_cmd(base_cmd + ["blockchain", "mempool", "--chain-id", "ait-healthchain"])
|
||||
|
||||
print("\n--- head ---")
|
||||
run_cmd(base_cmd + ["blockchain", "head", "--chain-id", "ait-testnet"])
|
||||
|
||||
print("\n--- send ---")
|
||||
run_cmd(base_cmd + ["blockchain", "send", "--chain-id", "ait-devnet", "--from", "alice", "--to", "bob", "--data", "test", "--nonce", "1"])
|
||||
42
cli/tests/api/test_blockchain_commands_full.py
Normal file
42
cli/tests/api/test_blockchain_commands_full.py
Normal file
@@ -0,0 +1,42 @@
|
||||
import subprocess
|
||||
import os
|
||||
|
||||
def run_cmd(cmd):
|
||||
print(f"Running: {' '.join(cmd)}")
|
||||
env = os.environ.copy()
|
||||
env["AITBC_NO_RICH"] = "1"
|
||||
|
||||
result = subprocess.run(
|
||||
cmd,
|
||||
capture_output=True,
|
||||
text=True,
|
||||
env=env
|
||||
)
|
||||
|
||||
print(f"Exit code: {result.returncode}")
|
||||
print(f"Output:\n{result.stdout.strip()}")
|
||||
if result.stderr:
|
||||
print(f"Stderr:\n{result.stderr.strip()}")
|
||||
print("-" * 40)
|
||||
|
||||
print("=== NEW BLOCKCHAIN API TESTS (WITH DYNAMIC NODE RESOLUTION) ===")
|
||||
|
||||
base_cmd = ["/home/oib/windsurf/aitbc/cli/venv/bin/aitbc", "--url", "http://10.1.223.93:8000/v1", "--api-key", "client_dev_key_1", "--output", "json"]
|
||||
|
||||
print("\n--- faucet (minting devnet funds to alice) ---")
|
||||
run_cmd(base_cmd + ["blockchain", "faucet", "--address", "alice", "--amount", "5000000000"])
|
||||
|
||||
print("\n--- balance (checking alice's balance) ---")
|
||||
run_cmd(base_cmd + ["blockchain", "balance", "--address", "alice"])
|
||||
|
||||
print("\n--- genesis ---")
|
||||
run_cmd(base_cmd + ["blockchain", "genesis", "--chain-id", "ait-devnet"])
|
||||
|
||||
print("\n--- transactions ---")
|
||||
run_cmd(base_cmd + ["blockchain", "transactions", "--chain-id", "ait-healthchain"])
|
||||
|
||||
print("\n--- head ---")
|
||||
run_cmd(base_cmd + ["blockchain", "head", "--chain-id", "ait-testnet"])
|
||||
|
||||
print("\n--- send (alice sending devnet funds to bob) ---")
|
||||
run_cmd(base_cmd + ["blockchain", "send", "--chain-id", "ait-devnet", "--from", "alice", "--to", "bob", "--data", "test", "--nonce", "1"])
|
||||
46
cli/tests/api/test_blockchain_commands_full_table.py
Normal file
46
cli/tests/api/test_blockchain_commands_full_table.py
Normal file
@@ -0,0 +1,46 @@
|
||||
import subprocess
|
||||
import os
|
||||
import re
|
||||
|
||||
def run_cmd(cmd):
|
||||
print(f"Running: {' '.join(cmd)}")
|
||||
env = os.environ.copy()
|
||||
|
||||
result = subprocess.run(
|
||||
cmd,
|
||||
capture_output=True,
|
||||
text=True,
|
||||
env=env
|
||||
)
|
||||
|
||||
# Strip ANSI escape sequences
|
||||
ansi_escape = re.compile(r'\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])')
|
||||
clean_stdout = ansi_escape.sub('', result.stdout).strip()
|
||||
|
||||
print(f"Exit code: {result.returncode}")
|
||||
print(f"Output:\n{clean_stdout}")
|
||||
if result.stderr:
|
||||
print(f"Stderr:\n{result.stderr.strip()}")
|
||||
print("-" * 40)
|
||||
|
||||
print("=== NEW BLOCKCHAIN API TESTS (TABLE OUTPUT) ===")
|
||||
|
||||
base_cmd = ["/home/oib/windsurf/aitbc/cli/venv/bin/aitbc", "--url", "http://10.1.223.93:8000/v1", "--api-key", "client_dev_key_1", "--output", "table"]
|
||||
|
||||
print("\n--- faucet (minting devnet funds to alice) ---")
|
||||
run_cmd(base_cmd + ["blockchain", "faucet", "--address", "alice", "--amount", "5000000000"])
|
||||
|
||||
print("\n--- balance (checking alice's balance) ---")
|
||||
run_cmd(base_cmd + ["blockchain", "balance", "--address", "alice"])
|
||||
|
||||
print("\n--- genesis ---")
|
||||
run_cmd(base_cmd + ["blockchain", "genesis", "--chain-id", "ait-devnet"])
|
||||
|
||||
print("\n--- transactions ---")
|
||||
run_cmd(base_cmd + ["blockchain", "transactions", "--chain-id", "ait-devnet"])
|
||||
|
||||
print("\n--- head ---")
|
||||
run_cmd(base_cmd + ["blockchain", "head", "--chain-id", "ait-testnet"])
|
||||
|
||||
print("\n--- send (alice sending devnet funds to bob) ---")
|
||||
run_cmd(base_cmd + ["blockchain", "send", "--chain-id", "ait-devnet", "--from", "alice", "--to", "bob", "--data", "test", "--nonce", "1"])
|
||||
36
cli/tests/api/test_blockchain_commands_no_rich.py
Normal file
36
cli/tests/api/test_blockchain_commands_no_rich.py
Normal file
@@ -0,0 +1,36 @@
|
||||
import subprocess
|
||||
import os
|
||||
|
||||
def run_cmd(cmd):
|
||||
print(f"Running: {' '.join(cmd)}")
|
||||
env = os.environ.copy()
|
||||
env["AITBC_NO_RICH"] = "1"
|
||||
|
||||
result = subprocess.run(
|
||||
cmd,
|
||||
capture_output=True,
|
||||
text=True,
|
||||
env=env
|
||||
)
|
||||
|
||||
print(f"Exit code: {result.returncode}")
|
||||
print(f"Output:\n{result.stdout.strip()}")
|
||||
if result.stderr:
|
||||
print(f"Stderr:\n{result.stderr.strip()}")
|
||||
print("-" * 40)
|
||||
|
||||
print("=== BLOCKCHAIN API TESTS ===")
|
||||
|
||||
base_cmd = ["/home/oib/windsurf/aitbc/cli/venv/bin/aitbc", "--url", "http://10.1.223.93:8000/v1", "--api-key", "client_dev_key_1", "--output", "json"]
|
||||
|
||||
print("\n--- genesis ---")
|
||||
run_cmd(base_cmd + ["blockchain", "genesis", "--chain-id", "ait-devnet"])
|
||||
|
||||
print("\n--- mempool ---")
|
||||
run_cmd(base_cmd + ["blockchain", "mempool", "--chain-id", "ait-healthchain"])
|
||||
|
||||
print("\n--- head ---")
|
||||
run_cmd(base_cmd + ["blockchain", "head", "--chain-id", "ait-testnet"])
|
||||
|
||||
print("\n--- send ---")
|
||||
run_cmd(base_cmd + ["blockchain", "send", "--chain-id", "ait-devnet", "--from", "alice", "--to", "bob", "--data", "test", "--nonce", "1"])
|
||||
37
cli/tests/api/test_real_scenarios.py
Normal file
37
cli/tests/api/test_real_scenarios.py
Normal file
@@ -0,0 +1,37 @@
|
||||
import subprocess
|
||||
import re
|
||||
|
||||
def run_cmd(cmd):
|
||||
print(f"Running: {' '.join(cmd)}")
|
||||
result = subprocess.run(
|
||||
cmd,
|
||||
capture_output=True,
|
||||
text=True
|
||||
)
|
||||
|
||||
# Strip ANSI escape sequences
|
||||
ansi_escape = re.compile(r'\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])')
|
||||
clean_stdout = ansi_escape.sub('', result.stdout).strip()
|
||||
|
||||
print(f"Exit code: {result.returncode}")
|
||||
print(f"Output:\n{clean_stdout}")
|
||||
if result.stderr:
|
||||
print(f"Stderr:\n{result.stderr}")
|
||||
print("-" * 40)
|
||||
|
||||
print("=== LIVE DATA TESTING ON LOCALHOST ===")
|
||||
|
||||
# Local config to point to both nodes
|
||||
subprocess.run(["rm", "-f", "/home/oib/.aitbc/multichain_config.yaml"])
|
||||
subprocess.run(["/home/oib/windsurf/aitbc/cli/venv/bin/aitbc", "node", "add", "aitbc-primary", "http://10.1.223.93:8082"])
|
||||
subprocess.run(["/home/oib/windsurf/aitbc/cli/venv/bin/aitbc", "node", "add", "aitbc1-primary", "http://10.1.223.40:8082"])
|
||||
|
||||
print("\n--- Testing from Localhost to aitbc (10.1.223.93) ---")
|
||||
base_cmd = ["/home/oib/windsurf/aitbc/cli/venv/bin/aitbc", "--url", "http://10.1.223.93:8000/v1", "--api-key", "client_dev_key_1", "--output", "json"]
|
||||
run_cmd(base_cmd + ["blockchain", "info"])
|
||||
run_cmd(base_cmd + ["chain", "list"])
|
||||
|
||||
print("\n--- Testing from Localhost to aitbc1 (10.1.223.40) ---")
|
||||
base_cmd1 = ["/home/oib/windsurf/aitbc/cli/venv/bin/aitbc", "--url", "http://10.1.223.40:8000/v1", "--api-key", "client_dev_key_1", "--output", "json"]
|
||||
run_cmd(base_cmd1 + ["blockchain", "info"])
|
||||
run_cmd(base_cmd1 + ["chain", "list"])
|
||||
34
cli/tests/api/test_real_scenarios_table.py
Normal file
34
cli/tests/api/test_real_scenarios_table.py
Normal file
@@ -0,0 +1,34 @@
|
||||
import subprocess
|
||||
import re
|
||||
|
||||
def run_cmd(cmd):
|
||||
print(f"Running: {' '.join(cmd)}")
|
||||
result = subprocess.run(
|
||||
cmd,
|
||||
capture_output=True,
|
||||
text=True
|
||||
)
|
||||
|
||||
# Strip ANSI escape sequences
|
||||
ansi_escape = re.compile(r'\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])')
|
||||
clean_stdout = ansi_escape.sub('', result.stdout).strip()
|
||||
|
||||
print(f"Exit code: {result.returncode}")
|
||||
print(f"Output:\n{clean_stdout}")
|
||||
if result.stderr:
|
||||
print(f"Stderr:\n{result.stderr}")
|
||||
print("-" * 40)
|
||||
|
||||
print("=== LIVE DATA TESTING ON LOCALHOST ===")
|
||||
|
||||
print("\n--- Testing from Localhost to aitbc (10.1.223.93) ---")
|
||||
base_cmd = ["/home/oib/windsurf/aitbc/cli/venv/bin/aitbc", "--url", "http://10.1.223.93:8000/v1", "--api-key", "client_dev_key_1", "--output", "table"]
|
||||
run_cmd(base_cmd + ["blockchain", "info"])
|
||||
run_cmd(base_cmd + ["chain", "list"])
|
||||
run_cmd(base_cmd + ["node", "chains"])
|
||||
|
||||
print("\n--- Testing from Localhost to aitbc1 (10.1.223.40) ---")
|
||||
base_cmd1 = ["/home/oib/windsurf/aitbc/cli/venv/bin/aitbc", "--url", "http://10.1.223.40:8000/v1", "--api-key", "client_dev_key_1", "--output", "table"]
|
||||
run_cmd(base_cmd1 + ["blockchain", "info"])
|
||||
run_cmd(base_cmd1 + ["chain", "list"])
|
||||
run_cmd(base_cmd1 + ["node", "chains"])
|
||||
Reference in New Issue
Block a user