-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathCreateUmaInvoiceInput.py
More file actions
42 lines (31 loc) · 1.62 KB
/
CreateUmaInvoiceInput.py
File metadata and controls
42 lines (31 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# Copyright ©, 2022-present, Lightspark Group, Inc. - All Rights Reserved
from dataclasses import dataclass
from typing import Any, Mapping, Optional
@dataclass
class CreateUmaInvoiceInput:
node_id: str
"""The node from which to create the invoice."""
amount_msats: int
"""The amount for which the invoice should be created, in millisatoshis."""
metadata_hash: str
"""The SHA256 hash of the UMA metadata payload. This will be present in the h-tag (SHA256 purpose of payment) of the resulting Bolt 11 invoice."""
expiry_secs: Optional[int]
"""The expiry of the invoice in seconds. Default value is 86400 (1 day)."""
receiver_hash: Optional[str]
"""An optional, monthly-rotated, unique hashed identifier corresponding to the receiver of the payment."""
def to_json(self) -> Mapping[str, Any]:
return {
"create_uma_invoice_input_node_id": self.node_id,
"create_uma_invoice_input_amount_msats": self.amount_msats,
"create_uma_invoice_input_metadata_hash": self.metadata_hash,
"create_uma_invoice_input_expiry_secs": self.expiry_secs,
"create_uma_invoice_input_receiver_hash": self.receiver_hash,
}
def from_json(obj: Mapping[str, Any]) -> CreateUmaInvoiceInput:
return CreateUmaInvoiceInput(
node_id=obj["create_uma_invoice_input_node_id"],
amount_msats=obj["create_uma_invoice_input_amount_msats"],
metadata_hash=obj["create_uma_invoice_input_metadata_hash"],
expiry_secs=obj["create_uma_invoice_input_expiry_secs"],
receiver_hash=obj["create_uma_invoice_input_receiver_hash"],
)