2018-06-21 14:28:34 +00:00
|
|
|
# This file is part of the Trezor project.
|
2017-01-03 18:40:05 +00:00
|
|
|
#
|
2019-05-29 16:44:09 +00:00
|
|
|
# Copyright (C) 2012-2019 SatoshiLabs and contributors
|
2017-01-03 18:40:05 +00:00
|
|
|
#
|
|
|
|
# This library is free software: you can redistribute it and/or modify
|
2018-06-21 14:28:34 +00:00
|
|
|
# it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
# as published by the Free Software Foundation.
|
2017-01-03 18:40:05 +00:00
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
#
|
2018-06-21 14:28:34 +00:00
|
|
|
# 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>.
|
|
|
|
|
2018-08-13 16:21:24 +00:00
|
|
|
import pytest
|
2016-08-16 15:22:30 +00:00
|
|
|
|
2018-08-10 12:04:58 +00:00
|
|
|
from trezorlib import ethereum
|
2018-08-13 16:21:24 +00:00
|
|
|
from trezorlib.tools import H_
|
|
|
|
|
2019-09-11 12:43:32 +00:00
|
|
|
from ..common import MNEMONIC12
|
2018-06-14 12:57:20 +00:00
|
|
|
|
2017-06-23 19:31:42 +00:00
|
|
|
|
2019-08-22 16:47:01 +00:00
|
|
|
@pytest.mark.altcoin
|
2018-05-21 16:30:00 +00:00
|
|
|
@pytest.mark.ethereum
|
2019-09-11 12:29:39 +00:00
|
|
|
class TestMsgEthereumGetaddress:
|
2019-08-27 14:58:59 +00:00
|
|
|
@pytest.mark.setup_client(mnemonic=MNEMONIC12)
|
|
|
|
def test_ethereum_getaddress(self, client):
|
2018-08-13 16:21:24 +00:00
|
|
|
assert (
|
2019-08-27 14:58:59 +00:00
|
|
|
ethereum.get_address(client, [H_(44), H_(60)])
|
2019-01-25 15:07:15 +00:00
|
|
|
== "0xE025dfbE2C53638E547C6487DED34Add7b8Aafc1"
|
2018-08-13 16:21:24 +00:00
|
|
|
)
|
|
|
|
assert (
|
2019-08-27 14:58:59 +00:00
|
|
|
ethereum.get_address(client, [H_(44), H_(60), 1])
|
2019-01-25 15:07:15 +00:00
|
|
|
== "0xeD46C856D0c79661cF7d40FFE0C0C5077c00E898"
|
2018-08-13 16:21:24 +00:00
|
|
|
)
|
|
|
|
assert (
|
2019-08-27 14:58:59 +00:00
|
|
|
ethereum.get_address(client, [H_(44), H_(60), 0, H_(1)])
|
2019-01-25 15:07:15 +00:00
|
|
|
== "0x6682Fa7F3eC58581b1e576268b5463B4b5c93839"
|
2018-08-13 16:21:24 +00:00
|
|
|
)
|
|
|
|
assert (
|
2019-08-27 14:58:59 +00:00
|
|
|
ethereum.get_address(client, [H_(44), H_(60), H_(9), 0])
|
2019-01-25 15:07:15 +00:00
|
|
|
== "0xFb3BE0F9717fF5fCF3C58EB49a9Ed67F1BD89D4E"
|
2018-08-13 16:21:24 +00:00
|
|
|
)
|
|
|
|
assert (
|
2019-08-27 14:58:59 +00:00
|
|
|
ethereum.get_address(client, [H_(44), H_(60), 0, 9999999])
|
2019-01-25 15:07:15 +00:00
|
|
|
== "0x6b909b50d88c9A8E02453A87b3662E3e7a5E0CF1"
|
2018-08-13 16:21:24 +00:00
|
|
|
)
|
2019-01-11 12:19:42 +00:00
|
|
|
assert (
|
2019-08-27 14:58:59 +00:00
|
|
|
ethereum.get_address(client, [H_(44), H_(6060), 0, 9999999])
|
2019-01-25 15:07:15 +00:00
|
|
|
== "0x98b8e926bd224764De2A0E4f4CBe1521474050AF"
|
2019-01-11 12:19:42 +00:00
|
|
|
)
|
2019-08-25 14:36:14 +00:00
|
|
|
# Wanchain SLIP44 id
|
|
|
|
assert (
|
2019-08-27 14:58:59 +00:00
|
|
|
ethereum.get_address(client, [H_(44), H_(5718350), H_(0)])
|
2019-08-25 14:36:14 +00:00
|
|
|
== "0x4d643B1b556E14A27143a38bcE61230FFf5AFca8"
|
|
|
|
)
|