示例#1
0
 def test_create_account_from_private_key(self):
     wm = WalletManager()
     wm.create_wallet_file(self.path)
     try:
         wm.open_wallet(self.path)
         private_key = '75de8489fcb2dcaf2ef3cd607feffde18789de7da129b5e97c81e001793cb7cf'
         label = 'hello_account'
         account = wm.create_account_from_private_key(
             password, private_key, label)
         b58_address = 'AazEvfQPcQ2GEFFPLF1ZLwQ7K5jDn81hve'
         wm.save()
         self.assertEqual(b58_address, account.b58_address)
     finally:
         wm.del_wallet_file()
示例#2
0
 def test_import_account(self):
     wm = WalletManager(wallet_path=self.path)
     self.assertEqual(self.path, wm.wallet_path)
     wm.create_wallet_file()
     try:
         wm.open_wallet()
         label = 'label'
         b64_salt = 'MGEzY2Y0MWYyODhhOTQ3MA=='
         encrypted_pri_key = 'E6Yb/UmgAggwqHrj/OVYjVVacVhXiehRctKrxzVE/bi+tZId0AEN2wLoKsahpNq2'
         b58_address = 'AazEvfQPcQ2GEFFPLF1ZLwQ7K5jDn81hve'
         account = wm.import_account(label, encrypted_pri_key, password,
                                     b58_address, b64_salt)
         acct = wm.get_account_by_b58_address(b58_address, password)
         self.assertTrue(isinstance(account, AccountData))
         self.assertTrue(isinstance(acct, Account))
         wm.save()
     finally:
         wm.del_wallet_file()