mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-07-13 10:08:08 +00:00

Changes many fields to required -- as far as we were able to figure out, signing would fail if these fields aren't provided anyway, so this should not pose a compatibility problem. Co-authored-by: matejcik <ja@matejcik.cz>
27 lines
892 B
Python
27 lines
892 B
Python
from typing import TYPE_CHECKING
|
|
|
|
from trezor import wire
|
|
from trezor.enums import CardanoNativeScriptHashDisplayFormat
|
|
from trezor.messages import CardanoNativeScriptHash
|
|
|
|
from . import native_script, seed
|
|
from .layout import show_native_script, show_script_hash
|
|
|
|
if TYPE_CHECKING:
|
|
from trezor.messages import CardanoGetNativeScriptHash
|
|
|
|
|
|
@seed.with_keychain
|
|
async def get_native_script_hash(
|
|
ctx: wire.Context, msg: CardanoGetNativeScriptHash, keychain: seed.Keychain
|
|
) -> CardanoNativeScriptHash:
|
|
native_script.validate_native_script(msg.script)
|
|
|
|
script_hash = native_script.get_native_script_hash(keychain, msg.script)
|
|
|
|
if msg.display_format != CardanoNativeScriptHashDisplayFormat.HIDE:
|
|
await show_native_script(ctx, msg.script)
|
|
await show_script_hash(ctx, script_hash, msg.display_format)
|
|
|
|
return CardanoNativeScriptHash(script_hash=script_hash)
|