mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-07-07 15:18:08 +00:00
feat(cardano): display tx id for plutus txs
This commit is contained in:
parent
f0e230642b
commit
962f689e8a
@ -445,6 +445,7 @@ async def confirm_transaction(
|
|||||||
ttl: int | None,
|
ttl: int | None,
|
||||||
validity_interval_start: int | None,
|
validity_interval_start: int | None,
|
||||||
is_network_id_verifiable: bool,
|
is_network_id_verifiable: bool,
|
||||||
|
tx_hash: bytes | None,
|
||||||
) -> None:
|
) -> None:
|
||||||
props: list[PropertyType] = [
|
props: list[PropertyType] = [
|
||||||
("Transaction fee:", format_coin_amount(fee)),
|
("Transaction fee:", format_coin_amount(fee)),
|
||||||
@ -456,6 +457,9 @@ async def confirm_transaction(
|
|||||||
props.append((f"Valid since: {format_optional_int(validity_interval_start)}", None))
|
props.append((f"Valid since: {format_optional_int(validity_interval_start)}", None))
|
||||||
props.append((f"TTL: {format_optional_int(ttl)}", None))
|
props.append((f"TTL: {format_optional_int(ttl)}", None))
|
||||||
|
|
||||||
|
if tx_hash:
|
||||||
|
props.append(("Transaction ID:", tx_hash))
|
||||||
|
|
||||||
await confirm_properties(
|
await confirm_properties(
|
||||||
ctx,
|
ctx,
|
||||||
"confirm_total",
|
"confirm_total",
|
||||||
|
@ -189,10 +189,10 @@ async def sign_tx(
|
|||||||
with tx_dict:
|
with tx_dict:
|
||||||
await _process_transaction(ctx, msg, keychain, tx_dict, account_path_checker)
|
await _process_transaction(ctx, msg, keychain, tx_dict, account_path_checker)
|
||||||
|
|
||||||
await _confirm_transaction(ctx, msg, is_network_id_verifiable)
|
tx_hash = hash_fn.digest()
|
||||||
|
await _confirm_transaction(ctx, msg, is_network_id_verifiable, tx_hash)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
tx_hash = hash_fn.digest()
|
|
||||||
response_after_witness_requests = await _process_witness_requests(
|
response_after_witness_requests = await _process_witness_requests(
|
||||||
ctx,
|
ctx,
|
||||||
keychain,
|
keychain,
|
||||||
@ -362,11 +362,11 @@ async def _confirm_transaction(
|
|||||||
ctx: wire.Context,
|
ctx: wire.Context,
|
||||||
msg: CardanoSignTxInit,
|
msg: CardanoSignTxInit,
|
||||||
is_network_id_verifiable: bool,
|
is_network_id_verifiable: bool,
|
||||||
|
tx_hash: bytes,
|
||||||
) -> None:
|
) -> None:
|
||||||
if msg.signing_mode in (
|
if msg.signing_mode in (
|
||||||
CardanoTxSigningMode.ORDINARY_TRANSACTION,
|
CardanoTxSigningMode.ORDINARY_TRANSACTION,
|
||||||
CardanoTxSigningMode.MULTISIG_TRANSACTION,
|
CardanoTxSigningMode.MULTISIG_TRANSACTION,
|
||||||
CardanoTxSigningMode.PLUTUS_TRANSACTION,
|
|
||||||
):
|
):
|
||||||
await confirm_transaction(
|
await confirm_transaction(
|
||||||
ctx,
|
ctx,
|
||||||
@ -375,6 +375,20 @@ async def _confirm_transaction(
|
|||||||
msg.ttl,
|
msg.ttl,
|
||||||
msg.validity_interval_start,
|
msg.validity_interval_start,
|
||||||
is_network_id_verifiable,
|
is_network_id_verifiable,
|
||||||
|
tx_hash=None,
|
||||||
|
)
|
||||||
|
elif msg.signing_mode == CardanoTxSigningMode.PLUTUS_TRANSACTION:
|
||||||
|
# we display tx hash so that experienced users can compare it to the tx hash computed by
|
||||||
|
# a trusted device (in case the tx contains many items which are tedious to check one by
|
||||||
|
# one on the Trezor screen)
|
||||||
|
await confirm_transaction(
|
||||||
|
ctx,
|
||||||
|
msg.fee,
|
||||||
|
msg.protocol_magic,
|
||||||
|
msg.ttl,
|
||||||
|
msg.validity_interval_start,
|
||||||
|
is_network_id_verifiable,
|
||||||
|
tx_hash,
|
||||||
)
|
)
|
||||||
elif msg.signing_mode == CardanoTxSigningMode.POOL_REGISTRATION_AS_OWNER:
|
elif msg.signing_mode == CardanoTxSigningMode.POOL_REGISTRATION_AS_OWNER:
|
||||||
await confirm_stake_pool_registration_final(
|
await confirm_stake_pool_registration_final(
|
||||||
|
Loading…
Reference in New Issue
Block a user