|
|
|
@ -2,7 +2,12 @@ from ustruct import unpack
|
|
|
|
|
|
|
|
|
|
from trezor.utils import format_amount
|
|
|
|
|
|
|
|
|
|
currencies = {1: "OMNI", 2: "tOMNI", 3: "MAID", 31: "USDT"}
|
|
|
|
|
currencies = {
|
|
|
|
|
1: ("OMNI", True),
|
|
|
|
|
2: ("tOMNI", True),
|
|
|
|
|
3: ("MAID", False),
|
|
|
|
|
31: ("USDT", True),
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def is_valid(data: bytes) -> bool:
|
|
|
|
@ -15,9 +20,10 @@ def parse(data: bytes) -> bool:
|
|
|
|
|
tx_version, tx_type = unpack(">HH", data[4:8])
|
|
|
|
|
if tx_version == 0 and tx_type == 0 and len(data) == 20: # OMNI simple send
|
|
|
|
|
currency, amount = unpack(">IQ", data[8:20])
|
|
|
|
|
suffix, divisible = currencies.get(currency, ("UNKN", False))
|
|
|
|
|
return "Simple send of %s %s" % (
|
|
|
|
|
format_amount(amount, 8),
|
|
|
|
|
currencies.get(currency, "UNKN"),
|
|
|
|
|
format_amount(amount, 8 if divisible else 0),
|
|
|
|
|
suffix,
|
|
|
|
|
)
|
|
|
|
|
else:
|
|
|
|
|
# unknown OMNI transaction
|
|
|
|
|