feat: add chain_id parameter to get_addresses RPC endpoint
🔧 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:
@@ -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(
|
||||||
|
|||||||
Reference in New Issue
Block a user