2019-07-31 15:02:41 +00:00
|
|
|
from common import *
|
|
|
|
from apps.common.paths import HARDENED
|
|
|
|
|
|
|
|
from trezor.crypto.curve import secp256k1
|
|
|
|
|
2019-08-26 16:47:49 +00:00
|
|
|
if not utils.BITCOIN_ONLY:
|
2020-09-23 10:31:07 +00:00
|
|
|
from apps.binance.helpers import address_from_public_key
|
2019-08-26 16:47:49 +00:00
|
|
|
|
|
|
|
|
|
|
|
@unittest.skipUnless(not utils.BITCOIN_ONLY, "altcoin")
|
2019-07-31 15:02:41 +00:00
|
|
|
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()
|