From 6896b74a10f3ba8d756fcc05e7190448aee22caf Mon Sep 17 00:00:00 2001 From: aitbc1 Date: Sun, 29 Mar 2026 18:28:56 +0200 Subject: [PATCH] feat: add chain_id parameter to get_addresses RPC endpoint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🔧 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 --- apps/blockchain-node/src/aitbc_chain/rpc/router.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/blockchain-node/src/aitbc_chain/rpc/router.py b/apps/blockchain-node/src/aitbc_chain/rpc/router.py index 496c7963..1d5cab7e 100755 --- a/apps/blockchain-node/src/aitbc_chain/rpc/router.py +++ b/apps/blockchain-node/src/aitbc_chain/rpc/router.py @@ -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") -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") 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: 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: # Get addresses with balance >= min_balance addresses = session.exec(