from dataclasses import dataclass from uuid import uuid4 @dataclass(frozen=True) class PaymentIntent: intent_id: str wallet: str destination: str total_debit_sat: int def new_intent(wallet: str, destination: str, total: int) -> PaymentIntent: if type(total) is not int or total <= 0: raise ValueError("invalid total debit") return PaymentIntent(str(uuid4()), wallet, destination, total)