refactor: move /api/chains endpoint to top of file and update explorer default IP
- Move /api/chains endpoint definition before BLOCKCHAIN_RPC_URLS configuration - Remove duplicate async version of list_chains endpoint - Change blockchain explorer version from 2.0.0 to 0.1.0 - Update default explorer IP from 10.1.223.93 to 10.1.223.1 - Remove warning messages from enterprise integration import errors
This commit is contained in:
@@ -17,7 +17,18 @@ from fastapi.staticfiles import StaticFiles
|
|||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field
|
||||||
import uvicorn
|
import uvicorn
|
||||||
|
|
||||||
app = FastAPI(title="AITBC Blockchain Explorer", version="2.0.0")
|
app = FastAPI(title="AITBC Blockchain Explorer", version="0.1.0")
|
||||||
|
|
||||||
|
@app.get("/api/chains")
|
||||||
|
def list_chains():
|
||||||
|
"""List all supported chains"""
|
||||||
|
return {
|
||||||
|
"chains": [
|
||||||
|
{"id": "ait-devnet", "name": "AIT Development Network", "status": "active"},
|
||||||
|
{"id": "ait-testnet", "name": "AIT Test Network", "status": "inactive"},
|
||||||
|
{"id": "ait-mainnet", "name": "AIT Main Network", "status": "coming_soon"}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
# Configuration - Multi-chain support
|
# Configuration - Multi-chain support
|
||||||
BLOCKCHAIN_RPC_URLS = {
|
BLOCKCHAIN_RPC_URLS = {
|
||||||
@@ -1253,16 +1264,6 @@ async def get_latest_blocks(limit: int = 10, chain_id: str = DEFAULT_CHAIN) -> L
|
|||||||
except Exception:
|
except Exception:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
@app.get("/api/chains")
|
|
||||||
async def list_chains():
|
|
||||||
"""List all supported chains"""
|
|
||||||
return {
|
|
||||||
"chains": [
|
|
||||||
{"id": "ait-devnet", "name": "AIT Development Network", "status": "active"},
|
|
||||||
{"id": "ait-testnet", "name": "AIT Test Network", "status": "inactive"},
|
|
||||||
{"id": "ait-mainnet", "name": "AIT Main Network", "status": "coming_soon"}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@app.get("/health")
|
@app.get("/health")
|
||||||
|
|||||||
@@ -18,27 +18,22 @@ try:
|
|||||||
from enterprise_api_gateway import EnterpriseAPIGateway
|
from enterprise_api_gateway import EnterpriseAPIGateway
|
||||||
ENTERPRISE_SERVICES_AVAILABLE = True
|
ENTERPRISE_SERVICES_AVAILABLE = True
|
||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
print(f"Warning: Enterprise API Gateway not available: {e}")
|
pass
|
||||||
EnterpriseAPIGateway = None
|
|
||||||
ENTERPRISE_SERVICES_AVAILABLE = False
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from enterprise_integration import EnterpriseIntegrationFramework
|
from enterprise_integration import EnterpriseIntegrationFramework
|
||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
print(f"Warning: Enterprise Integration not available: {e}")
|
pass
|
||||||
EnterpriseIntegrationFramework = None
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from enterprise_security import EnterpriseSecurityManager
|
from enterprise_security import EnterpriseSecurityManager
|
||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
print(f"Warning: Enterprise Security not available: {e}")
|
pass
|
||||||
EnterpriseSecurityManager = None
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from tenant_management import TenantManagementService
|
from tenant_management import TenantManagementService
|
||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
print(f"Warning: Tenant Management not available: {e}")
|
pass
|
||||||
TenantManagementService = None
|
|
||||||
|
|
||||||
@click.group()
|
@click.group()
|
||||||
def enterprise_integration_group():
|
def enterprise_integration_group():
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ def _get_explorer_endpoint(ctx):
|
|||||||
try:
|
try:
|
||||||
config = ctx.obj['config']
|
config = ctx.obj['config']
|
||||||
# Default to port 8016 for blockchain explorer
|
# Default to port 8016 for blockchain explorer
|
||||||
return getattr(config, 'explorer_url', 'http://10.1.223.93:8016')
|
return getattr(config, 'explorer_url', 'http://10.1.223.1:8016')
|
||||||
except:
|
except:
|
||||||
return "http://10.1.223.93:8016"
|
return "http://10.1.223.1:8016"
|
||||||
|
|
||||||
|
|
||||||
def _curl_request(url: str, params: dict = None):
|
def _curl_request(url: str, params: dict = None):
|
||||||
|
|||||||
Reference in New Issue
Block a user