mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-08-04 12:56:25 +00:00
fixup! feat(core): add Zcash shielded transactions
This commit is contained in:
parent
0ff2c781bb
commit
7292bdc0e1
@ -21,15 +21,20 @@ from .messages import ZcashSignatureType as SigType
|
|||||||
from .tools import expect
|
from .tools import expect
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from typing import Generator
|
from typing import Generator, List
|
||||||
from .client import TrezorClient
|
from .client import TrezorClient
|
||||||
|
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@expect(messages.ZcashViewingKey, field="key")
|
@expect(messages.ZcashViewingKey, field="key", ret_type=str)
|
||||||
def get_viewing_key(client: "TrezorClient", z_address_n: list[int], coin_name: str = "Zcash", full: bool = True) -> str:
|
def get_viewing_key(
|
||||||
|
client: "TrezorClient",
|
||||||
|
z_address_n: List[int],
|
||||||
|
coin_name: str = "Zcash",
|
||||||
|
full: bool = True
|
||||||
|
) -> str:
|
||||||
"""Returns Zcash Unified Full Viewing Key."""
|
"""Returns Zcash Unified Full Viewing Key."""
|
||||||
return client.call(
|
return client.call(
|
||||||
messages.ZcashGetViewingKey(
|
messages.ZcashGetViewingKey(
|
||||||
@ -40,15 +45,15 @@ def get_viewing_key(client: "TrezorClient", z_address_n: list[int], coin_name: s
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@expect(messages.ZcashAddress, field="address")
|
@expect(messages.ZcashAddress, field="address", ret_type=str)
|
||||||
def get_address(
|
def get_address(
|
||||||
client: "TrezorClient",
|
client: "TrezorClient",
|
||||||
t_address_n: list[int] | None = None,
|
t_address_n: List[int] | None = None,
|
||||||
z_address_n: list[int] | None = None,
|
z_address_n: List[int] | None = None,
|
||||||
diversifier_index: int = 0,
|
diversifier_index: int = 0,
|
||||||
show_display: bool = False,
|
show_display: bool = False,
|
||||||
coin_name: str = "Zcash",
|
coin_name: str = "Zcash",
|
||||||
):
|
) -> str:
|
||||||
"""
|
"""
|
||||||
Returns a Zcash address.
|
Returns a Zcash address.
|
||||||
"""
|
"""
|
||||||
@ -68,8 +73,8 @@ EMPTY_ANCHOR = bytes.fromhex("ae2935f1dfd8a24aed7c70df7de3a668eb7a49b1319880dde2
|
|||||||
|
|
||||||
def sign_tx(
|
def sign_tx(
|
||||||
client: "TrezorClient",
|
client: "TrezorClient",
|
||||||
inputs: list[messages.TxInput | messages.ZcashOrchardInput],
|
inputs: List[messages.TxInput | messages.ZcashOrchardInput],
|
||||||
outputs: list[messages.TxOutput | messages.ZcashOrchardOutput],
|
outputs: List[messages.TxOutput | messages.ZcashOrchardOutput],
|
||||||
coin_name: str = "Zcash",
|
coin_name: str = "Zcash",
|
||||||
version_group_id: int = 0x26A7270A, # protocol spec §7.1.2
|
version_group_id: int = 0x26A7270A, # protocol spec §7.1.2
|
||||||
branch_id: int = 0xC2D6D0B4, # https://zips.z.cash/zip-0252
|
branch_id: int = 0xC2D6D0B4, # https://zips.z.cash/zip-0252
|
||||||
|
Loading…
Reference in New Issue
Block a user