diff --git a/src/apps/ripple/layout.py b/src/apps/ripple/layout.py index 085578978..35aae084c 100644 --- a/src/apps/ripple/layout.py +++ b/src/apps/ripple/layout.py @@ -16,6 +16,13 @@ async def require_confirm_fee(ctx, fee): await require_confirm(ctx, text, ButtonRequestType.ConfirmOutput) +async def require_confirm_destination_tag(ctx, tag): + text = Text("Confirm tag", ui.ICON_SEND, icon_color=ui.GREEN) + text.normal("Destination tag:") + text.bold(str(tag)) + await require_confirm(ctx, text, ButtonRequestType.ConfirmOutput) + + async def require_confirm_tx(ctx, to, value): text = Text("Confirm sending", ui.ICON_SEND, icon_color=ui.GREEN) diff --git a/src/apps/ripple/serialize.py b/src/apps/ripple/serialize.py index 7b4481afb..d98a93cc8 100644 --- a/src/apps/ripple/serialize.py +++ b/src/apps/ripple/serialize.py @@ -31,6 +31,7 @@ FIELDS_MAP = { "flags": {"type": FIELD_TYPE_INT32, "key": 2}, "txnSignature": {"type": FIELD_TYPE_VL, "key": 4}, "lastLedgerSequence": {"type": FIELD_TYPE_INT32, "key": 27}, + "destinationTag": {"type": FIELD_TYPE_INT32, "key": 14}, } TRANSACTION_TYPES = {"Payment": 0} @@ -42,6 +43,7 @@ def serialize(msg: RippleSignTx, source_address: str, pubkey=None, signature=Non write(w, FIELDS_MAP["type"], TRANSACTION_TYPES["Payment"]) write(w, FIELDS_MAP["flags"], msg.flags) write(w, FIELDS_MAP["sequence"], msg.sequence) + write(w, FIELDS_MAP["destinationTag"], msg.payment.destination_tag) write(w, FIELDS_MAP["lastLedgerSequence"], msg.last_ledger_sequence) write(w, FIELDS_MAP["amount"], msg.payment.amount) write(w, FIELDS_MAP["fee"], msg.fee) diff --git a/src/apps/ripple/sign_tx.py b/src/apps/ripple/sign_tx.py index b3d0be7c6..4174dc077 100644 --- a/src/apps/ripple/sign_tx.py +++ b/src/apps/ripple/sign_tx.py @@ -23,6 +23,8 @@ async def sign_tx(ctx, msg: RippleSignTx, keychain): to_sign = get_network_prefix() + tx check_fee(msg.fee) + if msg.payment.destination_tag is not None: + await layout.require_confirm_destination_tag(ctx, msg.payment.destination_tag) await layout.require_confirm_fee(ctx, msg.fee) await layout.require_confirm_tx(ctx, msg.payment.destination, msg.payment.amount)