chore: remove configuration files and enhance blockchain explorer with advanced search, analytics, and export features
- Delete .aitbc.yaml.example CLI configuration template - Delete .lycheeignore link checker exclusion rules - Delete .nvmrc Node.js version specification - Add advanced search panel with filters for address, amount range, transaction type, time range, and validator - Add analytics dashboard with transaction volume, active addresses, and block time metrics - Add Chart.js integration
This commit is contained in:
31
dev/scripts/patch_cli_blockchain_node_dynamic.py
Normal file
31
dev/scripts/patch_cli_blockchain_node_dynamic.py
Normal file
@@ -0,0 +1,31 @@
|
||||
import re
|
||||
|
||||
with open("/home/oib/windsurf/aitbc/cli/aitbc_cli/commands/blockchain.py", "r") as f:
|
||||
content = f.read()
|
||||
|
||||
# Instead of blindly hardcoding 10.1.223.93, we can actually fetch the first node from multichain config or use an option --node.
|
||||
# Let's add a helper inside the file.
|
||||
helper_code = """
|
||||
def _get_node_endpoint(ctx):
|
||||
try:
|
||||
from ..core.config import load_multichain_config
|
||||
config = load_multichain_config()
|
||||
if not config.nodes:
|
||||
return "http://127.0.0.1:8082"
|
||||
# Return the first node's endpoint
|
||||
return list(config.nodes.values())[0].endpoint
|
||||
except:
|
||||
return "http://127.0.0.1:8082"
|
||||
"""
|
||||
|
||||
# Replace the hardcoded urls with _get_node_endpoint(ctx)
|
||||
content = content.replace('f"http://10.1.223.93:8082/rpc/blocks/0?chain_id={chain_id}"', 'f"{_get_node_endpoint(ctx)}/rpc/blocks/0?chain_id={chain_id}"')
|
||||
content = content.replace('f"http://10.1.223.93:8082/rpc/mempool?chain_id={chain_id}"', 'f"{_get_node_endpoint(ctx)}/rpc/mempool?chain_id={chain_id}"')
|
||||
content = content.replace('f"http://10.1.223.93:8082/rpc/head?chain_id={chain_id}"', 'f"{_get_node_endpoint(ctx)}/rpc/head?chain_id={chain_id}"')
|
||||
content = content.replace('f"http://10.1.223.93:8082/rpc/sendTx"', 'f"{_get_node_endpoint(ctx)}/rpc/sendTx"')
|
||||
|
||||
# Prepend the helper
|
||||
content = content.replace('import httpx', 'import httpx\n' + helper_code, 1)
|
||||
|
||||
with open("/home/oib/windsurf/aitbc/cli/aitbc_cli/commands/blockchain.py", "w") as f:
|
||||
f.write(content)
|
||||
Reference in New Issue
Block a user