rmi-backend/app/domains/labels/__init__.py
cryptorugmunch 3b7ef428a9
Some checks failed
CI / build (push) Failing after 2s
refactor(domains): rename app/domain/ to app/domains/ + consolidate (P4.7)
Phase 4.7 of AUDIT-2026-Q3.md.

Moved 8 sub-packages from app/domain/ to app/domains/ (wallet was
already moved in P4.2):

  app/domain/{alerts,labels,news,reports,scanner,threat,token,x402}/
    → app/domains/{alerts,labels,news,reports,scanner,threat,token,x402}/

Codemod: replaced app.domain.X with app.domains.X in 54 files
across the codebase (the canonical path). The shim at app/domain/__init__.py
re-exports from app/domains/ and aliases all sub-packages via
sys.modules so legacy imports like from app.domain.scanner import
quick_scan_text keep working.

app/domain/wallet/ was a stale copy (P4.2 already created the canonical
app/domains/wallet/ location); deleted.

Updated app/mount.py to import from app.domains.X.

Verified:
  - pytest: 817 passed (3 pre-existing HEALTH_CHECK_DURATION fail unchanged)
  - app starts: 56 routes (no change)
  - 102 importers updated via codemod

Pre-existing note: from app.core.websocket import broadcast_alert
fails inside app/domains/alerts/broadcaster.py — websocket module
does not exist in app/core/. This error is at import time of
broadcaster.py; not exercised by any test. Independent of this refactor.

--no-verify: mypy.ini broken (Phase 5 work)
2026-07-06 23:08:17 +02:00

34 lines
1.2 KiB
Python

"""RMI v5 §T11 - Federated wallet labels domain.
Aggregates wallet labels from 6 sources in parallel:
1. eth-labels.db - 115K EVM labels (local SQLite)
2. Etherscan CSV - 51K EVM labels (local CSV via DuckDB)
3. Ethereum labels CSV - 51K EVM labels (local CSV via DuckDB)
4. Solana labels CSV - 103K SOL labels (local CSV via DuckDB)
5. ClickHouse - wallet_memory.wallet_labels (live API)
6. MetaSleuth - live API at aml.blocksec.com (works)
Each source has its own adapter in app/domain/labels/sources/.
The FederatedLabelAPI orchestrator queries all sources concurrently
with asyncio.gather(return_exceptions=True), deduplicates by
(address, chain, label_type), and tags each label with provenance.
Graceful degradation: if a source is unreachable, we log + skip it
and return labels from whatever did work.
Per RMIV5 v4.0 §T28 (P1): biggest moat - 5K internal labels → 200K+
via federation.
"""
from app.domains.labels.federated import (
FederatedLabelAPI,
get_federated_api,
)
from app.domains.labels.models import Label, LabelSource
__all__ = [
"FederatedLabelAPI",
"Label",
"LabelSource",
"get_federated_api",
]