2018-11-04 14:21:08 +00:00
|
|
|
# This file is part of the Trezor project.
|
|
|
|
#
|
2019-05-29 16:44:09 +00:00
|
|
|
# Copyright (C) 2012-2019 SatoshiLabs and contributors
|
2018-11-04 14:21:08 +00:00
|
|
|
#
|
|
|
|
# This library is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
# as published by the Free Software Foundation.
|
|
|
|
#
|
|
|
|
# This library is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU Lesser General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the License along with this library.
|
|
|
|
# If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
|
|
|
|
|
|
|
|
import pytest
|
|
|
|
|
|
|
|
from trezorlib import monero
|
2024-11-15 16:31:22 +00:00
|
|
|
from trezorlib.debuglink import SessionDebugWrapper as Session
|
2018-11-04 14:21:08 +00:00
|
|
|
from trezorlib.tools import parse_path
|
|
|
|
|
2021-11-10 20:24:45 +00:00
|
|
|
from ...common import MNEMONIC12
|
2023-09-22 09:49:40 +00:00
|
|
|
from ...input_flows import InputFlowShowAddressQRCode
|
2018-11-04 14:21:08 +00:00
|
|
|
|
2023-09-22 09:49:40 +00:00
|
|
|
TEST_VECTORS = [
|
|
|
|
(
|
|
|
|
"m/44h/128h/0h",
|
|
|
|
b"4Ahp23WfMrMFK3wYL2hLWQFGt87ZTeRkufS6JoQZu6MEFDokAQeGWmu9MA3GFq1yVLSJQbKJqVAn9F9DLYGpRzRAEXqAXKM",
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"m/44h/128h/1h",
|
|
|
|
b"44iAazhoAkv5a5RqLNVyh82a1n3ceNggmN4Ho7bUBJ14WkEVR8uFTe9f7v5rNnJ2kEbVXxfXiRzsD5Jtc6NvBi4D6WNHPie",
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"m/44h/128h/2h",
|
|
|
|
b"47ejhmbZ4wHUhXaqA4b7PN667oPMkokf4ZkNdWrMSPy9TNaLVr7vLqVUQHh2MnmaAEiyrvLsX8xUf99q3j1iAeMV8YvSFcH",
|
|
|
|
),
|
|
|
|
]
|
2018-11-04 14:21:08 +00:00
|
|
|
|
2023-09-22 09:49:40 +00:00
|
|
|
pytestmark = [
|
|
|
|
pytest.mark.altcoin,
|
|
|
|
pytest.mark.monero,
|
2024-09-02 11:01:16 +00:00
|
|
|
pytest.mark.models("core"),
|
2023-09-22 09:49:40 +00:00
|
|
|
pytest.mark.setup_client(mnemonic=MNEMONIC12),
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.parametrize("path, expected_address", TEST_VECTORS)
|
2024-11-15 16:31:22 +00:00
|
|
|
def test_monero_getaddress(session: Session, path: str, expected_address: bytes):
|
|
|
|
address = monero.get_address(session, parse_path(path), show_display=True)
|
2023-09-22 09:49:40 +00:00
|
|
|
assert address == expected_address
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.parametrize("path, expected_address", TEST_VECTORS)
|
|
|
|
def test_monero_getaddress_chunkify_details(
|
2024-11-15 16:31:22 +00:00
|
|
|
session: Session, path: str, expected_address: bytes
|
2023-09-22 09:49:40 +00:00
|
|
|
):
|
2024-11-15 16:31:22 +00:00
|
|
|
with session.client as client:
|
2023-09-22 09:49:40 +00:00
|
|
|
IF = InputFlowShowAddressQRCode(client)
|
|
|
|
client.set_input_flow(IF.get())
|
|
|
|
address = monero.get_address(
|
2024-11-15 16:31:22 +00:00
|
|
|
session, parse_path(path), show_display=True, chunkify=True
|
2023-09-14 10:22:18 +00:00
|
|
|
)
|
2023-09-22 09:49:40 +00:00
|
|
|
assert address == expected_address
|