1# This file is part of the Trezor project. 2# 3# Copyright (C) 2012-2022 SatoshiLabs and contributors 4# 5# This library is free software: you can redistribute it and/or modify 6# it under the terms of the GNU Lesser General Public License version 3 7# as published by the Free Software Foundation. 8# 9# This library is distributed in the hope that it will be useful, 10# but WITHOUT ANY WARRANTY; without even the implied warranty of 11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12# GNU Lesser General Public License for more details. 13# 14# You should have received a copy of the License along with this library. 15# If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>. 16 17from typing import TYPE_CHECKING 18 19from . import messages 20from .tools import expect 21 22if TYPE_CHECKING: 23 from .client import TrezorClient 24 from .tools import Address 25 from .protobuf import MessageType 26 27 28# MAINNET = 0 29# TESTNET = 1 30# STAGENET = 2 31# FAKECHAIN = 3 32 33 34@expect(messages.MoneroAddress, field="address", ret_type=bytes) 35def get_address( 36 client: "TrezorClient", 37 n: "Address", 38 show_display: bool = False, 39 network_type: int = 0, 40) -> "MessageType": 41 return client.call( 42 messages.MoneroGetAddress( 43 address_n=n, show_display=show_display, network_type=network_type 44 ) 45 ) 46 47 48@expect(messages.MoneroWatchKey) 49def get_watch_key( 50 client: "TrezorClient", n: "Address", network_type: int = 0 51) -> "MessageType": 52 return client.call( 53 messages.MoneroGetWatchKey(address_n=n, network_type=network_type) 54 ) 55