1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-23 14:58:09 +00:00

fix(core/ripple): use standard layouts for sign_tx

[no changelog]
This commit is contained in:
Martin Milata 2023-04-03 17:38:31 +02:00
parent 69bc442c90
commit c21cf87c53
3 changed files with 7 additions and 10 deletions

View File

@ -2,7 +2,7 @@ from typing import TYPE_CHECKING
from trezor.enums import ButtonRequestType from trezor.enums import ButtonRequestType
from trezor.strings import format_amount from trezor.strings import format_amount
from trezor.ui.layouts import confirm_metadata from trezor.ui.layouts import confirm_metadata, confirm_total
from .helpers import DECIMALS from .helpers import DECIMALS
@ -10,14 +10,11 @@ if TYPE_CHECKING:
from trezor.wire import Context from trezor.wire import Context
async def require_confirm_fee(ctx: Context, fee: int) -> None: async def require_confirm_total(ctx: Context, total: int, fee: int) -> None:
await confirm_metadata( await confirm_total(
ctx, ctx,
"confirm_fee", format_amount(total, DECIMALS) + " XRP",
"Confirm fee",
"Transaction fee:\n{}",
format_amount(fee, DECIMALS) + " XRP", format_amount(fee, DECIMALS) + " XRP",
ButtonRequestType.ConfirmOutput,
) )
@ -35,4 +32,4 @@ async def require_confirm_destination_tag(ctx: Context, tag: int) -> None:
async def require_confirm_tx(ctx: Context, to: str, value: int) -> None: async def require_confirm_tx(ctx: Context, to: str, value: int) -> None:
from trezor.ui.layouts import confirm_output from trezor.ui.layouts import confirm_output
await confirm_output(ctx, to, format_amount(value, DECIMALS) + " XRP", hold=True) await confirm_output(ctx, to, format_amount(value, DECIMALS) + " XRP")

View File

@ -47,8 +47,8 @@ async def sign_tx(
if payment.destination_tag is not None: if payment.destination_tag is not None:
await layout.require_confirm_destination_tag(ctx, payment.destination_tag) await layout.require_confirm_destination_tag(ctx, payment.destination_tag)
await layout.require_confirm_fee(ctx, msg.fee)
await layout.require_confirm_tx(ctx, payment.destination, payment.amount) await layout.require_confirm_tx(ctx, payment.destination, payment.amount)
await layout.require_confirm_total(ctx, payment.amount + msg.fee, msg.fee)
# Signs and encodes signature into DER format # Signs and encodes signature into DER format
first_half_of_sha512 = sha512(to_sign).digest()[:32] first_half_of_sha512 = sha512(to_sign).digest()[:32]

View File

@ -1674,7 +1674,7 @@
"TT_ripple-test_get_address.py::test_ripple_get_address": "80a6e289138a604cf351a29511cf6f85e2243591317894703152787e1351a1a3", "TT_ripple-test_get_address.py::test_ripple_get_address": "80a6e289138a604cf351a29511cf6f85e2243591317894703152787e1351a1a3",
"TT_ripple-test_get_address.py::test_ripple_get_address_other": "80a6e289138a604cf351a29511cf6f85e2243591317894703152787e1351a1a3", "TT_ripple-test_get_address.py::test_ripple_get_address_other": "80a6e289138a604cf351a29511cf6f85e2243591317894703152787e1351a1a3",
"TT_ripple-test_sign_tx.py::test_ripple_sign_invalid_fee": "80a6e289138a604cf351a29511cf6f85e2243591317894703152787e1351a1a3", "TT_ripple-test_sign_tx.py::test_ripple_sign_invalid_fee": "80a6e289138a604cf351a29511cf6f85e2243591317894703152787e1351a1a3",
"TT_ripple-test_sign_tx.py::test_ripple_sign_simple_tx": "eb1677859fe11ba49e9bfee5111e81dcbddd7c63dfb1aea6370dfdfb0a5c88fa", "TT_ripple-test_sign_tx.py::test_ripple_sign_simple_tx": "ec3cbfd6ab3c1574c78a3864baf66c1497972986dda525c93debdbea49dab442",
"TT_stellar-test_stellar.py::test_get_address[parameters0-result0]": "cc398b30b3da458cfa14085c647c3e3efa66d85222d8dd7216b8902329d7f036", "TT_stellar-test_stellar.py::test_get_address[parameters0-result0]": "cc398b30b3da458cfa14085c647c3e3efa66d85222d8dd7216b8902329d7f036",
"TT_stellar-test_stellar.py::test_get_address[parameters1-result1]": "6df40614002c6de060e415a0a6b144baf6c79b13e8d79866633426e04fda395b", "TT_stellar-test_stellar.py::test_get_address[parameters1-result1]": "6df40614002c6de060e415a0a6b144baf6c79b13e8d79866633426e04fda395b",
"TT_stellar-test_stellar.py::test_get_address[parameters2-result2]": "90b9af1272540b7742bedb5db34444b2efba9b1e32746e4ddf7cee3a1a413dc0", "TT_stellar-test_stellar.py::test_get_address[parameters2-result2]": "90b9af1272540b7742bedb5db34444b2efba9b1e32746e4ddf7cee3a1a413dc0",