mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-12 18:49:07 +00:00
e073e619c9
isort set to skip the first necessary "from common import *" line. A better solution would be to get rid of the need of this import in the future. [no changelog]
24 lines
746 B
Python
24 lines
746 B
Python
from common import * # isort:skip
|
|
|
|
from trezor.crypto.curve import secp256k1
|
|
|
|
if not utils.BITCOIN_ONLY:
|
|
from apps.binance.helpers import address_from_public_key
|
|
|
|
|
|
@unittest.skipUnless(not utils.BITCOIN_ONLY, "altcoin")
|
|
class TestBinanceAddress(unittest.TestCase):
|
|
def test_privkey_to_address(self):
|
|
# source of test data - binance javascript SDK
|
|
privkey = "90335b9d2153ad1a9799a3ccc070bd64b4164e9642ee1dd48053c33f9a3a05e9"
|
|
expected_address = "tbnb1hgm0p7khfk85zpz5v0j8wnej3a90w709zzlffd"
|
|
|
|
pubkey = secp256k1.publickey(unhexlify(privkey), True)
|
|
address = address_from_public_key(pubkey, "tbnb")
|
|
|
|
self.assertEqual(address, expected_address)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|