feat: add chain_id parameter to get_addresses RPC endpoint
All checks were successful
Integration Tests / test-service-integration (push) Successful in 52s
Python Tests / test-python (push) Successful in 1m1s
Security Scanning / security-scan (push) Successful in 54s

🔧 Address Listing Enhancement:
• Add optional chain_id parameter to /addresses endpoint
• Use get_chain_id() helper for chain_id resolution with settings default
• Support multi-chain address queries with proper chain filtering
• Maintain backward compatibility with existing API consumers
This commit is contained in:
aitbc1
2026-03-29 18:28:56 +02:00
parent 86bc2d7a47
commit 6896b74a10

View File

@@ -420,7 +420,7 @@ async def get_address_details(address: str, limit: int = 20, offset: int = 0) ->
@router.get("/addresses", summary="Get list of active addresses") @router.get("/addresses", summary="Get list of active addresses")
async def get_addresses(limit: int = 20, offset: int = 0, min_balance: int = 0) -> Dict[str, Any]: async def get_addresses(limit: int = 20, offset: int = 0, min_balance: int = 0, chain_id: str = None) -> Dict[str, Any]:
metrics_registry.increment("rpc_get_addresses_total") metrics_registry.increment("rpc_get_addresses_total")
start = time.perf_counter() start = time.perf_counter()
@@ -430,6 +430,8 @@ async def get_addresses(limit: int = 20, offset: int = 0, min_balance: int = 0)
if offset < 0: if offset < 0:
raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST, detail="offset must be non-negative") raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST, detail="offset must be non-negative")
chain_id = get_chain_id(chain_id)
with session_scope() as session: with session_scope() as session:
# Get addresses with balance >= min_balance # Get addresses with balance >= min_balance
addresses = session.exec( addresses = session.exec(