Instantiate the address returned by Seed

This commit is contained in:
Michał Sałaban 2018-06-04 12:53:45 +02:00
parent d12f2f66c0
commit b14770ea5a
2 changed files with 6 additions and 2 deletions

View file

@ -35,10 +35,10 @@
# + simplified interface, changed exceptions (assertions -> explicit raise)
# + optimization
from monero import address
from monero import wordlists
from monero import ed25519
from monero import base58
from monero.address import address
from binascii import hexlify, unhexlify
from os import urandom
from sha3 import keccak_256
@ -161,7 +161,7 @@ class Seed(object):
h = keccak_256()
h.update(unhexlify(data))
checksum = h.hexdigest()
return base58.encode(data + checksum[0:8])
return address(base58.encode(data + checksum[0:8]))
def generate_hex(n_bytes=32):

View file

@ -2,6 +2,7 @@
# -*- coding: utf-8 -*-
import unittest
from monero.address import Address
from monero.seed import Seed
from monero.wordlists import list_wordlists
@ -75,9 +76,11 @@ class SeedTestCase(unittest.TestCase):
self.assertEqual(
seed.public_address(),
'44cWztNFdAqNnycvZbUoj44vsbAEmKnx9aNgkjHdjtMsBrSeKiY8J4s2raH7EMawA2Fwo9utaRTV7Aw8EcTMNMxhH4YtKdH')
self.assertIsInstance(seed.public_address(), Address)
self.assertEqual(
seed.public_address(net='stagenet'),
'54pZ5jHDGmwNnycvZbUoj44vsbAEmKnx9aNgkjHdjtMsBrSeKiY8J4s2raH7EMawA2Fwo9utaRTV7Aw8EcTMNMxhH6cuARW')
self.assertIsInstance(seed.public_address(net='stagenet'), Address)
seed = Seed("dwelt idols lopped blender haggled rabbits piloted value swagger taunts toolbox upgrade swagger")
self.assertTrue(seed.is_mymonero())
@ -93,6 +96,7 @@ class SeedTestCase(unittest.TestCase):
self.assertEqual(
seed.public_address(),
'47dwi1w9it69yZyTBBRD52ctQqw3B2FZx79bCEgVUKGHH2m7MjmaXrjeQfchMMkarG6AF9a36JvBWCyRaqEcUixpKLQRxdj')
self.assertIsInstance(seed.public_address(), Address)
def test_languages(self):
for wordlist in list_wordlists():