def test_import_account(self):
     wm = WalletManager()
     wm.open_wallet("./test.json")
     wm.import_account(
         "label2",
         "Yl1e9ugbVADd8a2SbAQ56UfUvr3e9hD2eNXAM9xNjhnefB+YuNXDFvUrIRaYth+L",
         "1", "AazEvfQPcQ2GEFFPLF1ZLwQ7K5jDn81hve",
         base64.b64decode("pwLIUKAf2bAbTseH/WYrfQ=="))
     wm.save()
Esempio n. 2
0
 def test_create_account_from_prikey(self):
     wm = WalletManager()
     path = os.path.join(os.getcwd(), 'test.json')
     wm.open_wallet(path)
     private_key = '75de8489fcb2dcaf2ef3cd607feffde18789de7da129b5e97c81e001793cb7cf'
     account = wm.create_account_from_prikey("myaccount", "1", private_key)
     wm.save()
     self.assertEqual(account.address, 'AazEvfQPcQ2GEFFPLF1ZLwQ7K5jDn81hve')
     os.remove(path)
 def test_create_account_from_prikey(self):
     wm = WalletManager()
     wm.open_wallet("/Users/zhaoxavi/test.txt")
     account = wm.create_account_from_prikey(
         "myaccount", "1",
         util.hex_to_bytes(
             "75de8489fcb2dcaf2ef3cd607feffde18789de7da129b5e97c81e001793cb7cf"
         ))
     wm.save()
     print(account)
Esempio n. 4
0
 def test_import_account(self):
     wm = WalletManager()
     path = os.path.join(os.getcwd(), 'test.json')
     wm.open_wallet(path)
     wm.open_wallet("./test.json")
     wm.import_account(
         "label2",
         "Yl1e9ugbVADd8a2SbAQ56UfUvr3e9hD2eNXAM9xNjhnefB+YuNXDFvUrIRaYth+L",
         "1", "AazEvfQPcQ2GEFFPLF1ZLwQ7K5jDn81hve",
         "pwLIUKAf2bAbTseH/WYrfQ==")
     wm.save()
     os.remove(path)
 def test_import_account(self):
     wm = WalletManager()
     path = os.path.join(os.getcwd(), 'test.json')
     wm.open_wallet(path)
     label = 'label'
     encrypted_pri_key = 'Yl1e9ugbVADd8a2SbAQ56UfUvr3e9hD2eNXAM9xNjhnefB+YuNXDFvUrIRaYth+L'
     password = '******'
     b58_address = 'AazEvfQPcQ2GEFFPLF1ZLwQ7K5jDn81hve'
     b64_salt = 'pwLIUKAf2bAbTseH/WYrfQ=='
     account = wm.import_account(label, encrypted_pri_key, password,
                                 b58_address, b64_salt)
     self.assertTrue(isinstance(account, AccountData))
     wm.save()
     os.remove(path)
 def test_create_account_from_private_key(self):
     wm = WalletManager()
     wm.create_wallet_file(path)
     try:
         wm.open_wallet(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()
Esempio n. 7
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()
Esempio n. 8
0
    def test_import_account(self):
        private_key = '75de8489fcb2dcaf2ef3cd607feffde18789de7da129b5e97c81e001793cb7cf'
        account = Account(private_key, SignatureScheme.SHA256withECDSA)
        salt = "pwLIUKAf2bAbTseH/WYrfQ=="
        pwd = "1"
        enc_private_key = account.export_gcm_encrypted_private_key(
            pwd, salt, 16384)
        print('enc_private_key is ', enc_private_key)

        wm = WalletManager()
        path = os.path.join(os.getcwd(), 'test.json')
        wm.open_wallet(path)
        wm.open_wallet("./test.json")
        encrypted_pri_key = "Yl1e9ugbVADd8a2SbAQ56UfUvr3e9hD2eNXAM9xNjhnefB+YuNXDFvUrIRaYth+L"
        #import_account(label: str, encrypted_pri_key: str, pwd: str, base58_addr: str, base64_salt: str)
        addr = "AazEvfQPcQ2GEFFPLF1ZLwQ7K5jDn81hve"
        wm.import_account("label2", encrypted_pri_key, pwd, addr, salt)
        wm.save()
        os.remove(path)
 def test_create_random_account(self):
     wm = WalletManager()
     wm.open_wallet("./test.json")
     acc = wm.create_random_account("mywallet", "1")
     wm.save()
     print(acc)