from __future__ import annotations


def expected_confirmation(wallet_address: str) -> str:
    suffix = (wallet_address or "")[-4:]
    if len(suffix) < 4:
        raise ValueError("wallet_address muss mindestens 4 Zeichen enthalten")
    return f"CLOSE ALL {suffix}"


def validate_panic_confirmation(confirmation: str | None, wallet_address: str) -> bool:
    if not confirmation:
        return False
    return confirmation.strip() == expected_confirmation(wallet_address)
