Gioca: the round, the player's funds and their bet; the bet is two steps (a confirmation screen that sends nothing, then an explicit confirm) with a fresh idempotency key per screen, and the server re-checks everything. Portafoglio: spendable apart from in-confirmation, deposit address with a QR of the player's own address, copy button, simulated test deposits. Movimenti: the player's own ledger, paged, stacked as cards on a phone. GET /app/stato/ feeds the page and its polling. Every view takes the user from the session only. Checked end to end in a real browser (Playwright): status moves from pending to confirmed without a reload, a double click is one bet. Mutation checks: cross-account leak, non-idempotent POST and unrestricted test-deposit amounts are all caught. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
24 lines
1.3 KiB
Python
24 lines
1.3 KiB
Python
"""The words for a ledger error: the code is stable, the text is Italian (ADR-60)."""
|
|
|
|
from .format import plm_text
|
|
|
|
|
|
def ledger_error_text(code: str, params: dict) -> str:
|
|
texts = {
|
|
"no_round_open": "Non c'è un round aperto in questo momento. Riprova fra poco.",
|
|
"round_closing": "Le puntate di questo round sono chiuse. Attendi il prossimo round.",
|
|
"already_betting": "Hai già una puntata in questo round.",
|
|
"bets_suspended": "Le nuove puntate sono sospese. Riprova più tardi.",
|
|
"missing_request_id": "La richiesta non è valida. Ricarica la pagina e riprova.",
|
|
"idempotency_conflict": "Questa richiesta è già stata usata per un'altra operazione. Ricarica la pagina e riprova.",
|
|
"invalid_amount": "L'importo non è valido.",
|
|
}
|
|
if code == "insufficient_balance":
|
|
return f"Saldo insufficiente: servono {plm_text(params.get('required_sats', 0))} spendibili."
|
|
if code == "balance_pending_confirmation":
|
|
return (f"Il saldo che vedi include {plm_text(params.get('pending_sats', 0))} ancora in conferma: "
|
|
"potrai puntare quando saranno confermati.")
|
|
if code == "round_full":
|
|
return "Questo round ha raggiunto il limite di giocatori o di montepremi. Attendi il prossimo."
|
|
return texts.get(code, "Non è stato possibile completare l'operazione. Riprova.")
|