ripple: add destination tag

pull/25/head
Tomas Susanka 6 years ago
parent 330003c993
commit bbef658c32

@ -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)

@ -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)

@ -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)

Loading…
Cancel
Save