Example #1
0
    def test_new_account(self):
        with pytest.raises(ValueError):
            Account()

        account = Account.generate()
        assert account and account.address
        assert account.zil_key.address == account.address

        address = "b50c2404e699fd985f71b2c3f032059f13d6543b"
        account = Account(address=address)
        assert account and account.address
        assert account.checksum_address == zilkey.to_checksum_address(address)
        assert account.zil_key is None

        pub_key = "0x03949D29723DA4B2628224D3EC8E74C518ACA98C6630B00527F86B8349E982CB57"
        private_key = "05C3CF3387F31202CD0798B7AA882327A1BD365331F90954A58C18F61BD08FFC"
        address = "95B27EC211F86748DD985E1424B4058E94AA5814"

        account = Account(address=address, private_key=private_key)
        assert account and account.address
        assert account.checksum_address == zilkey.to_checksum_address(address)
        assert account.zil_key is not None

        account = Account(address=address, public_key=pub_key)
        assert account and account.address
        assert account.checksum_address == zilkey.to_checksum_address(address)
        assert account.zil_key is not None

        account = Account(address=address,
                          public_key=pub_key,
                          private_key=private_key)
        assert account and account.address
        assert account.checksum_address == zilkey.to_checksum_address(address)
        assert account.zil_key is not None
Example #2
0
    def test_new_account(self):
        with pytest.raises(ValueError):
            Account()

        account = Account.generate()
        assert account and account.address
        assert account.zil_key.address == account.address

        address = "b50c2404e699fd985f71b2c3f032059f13d6543b"
        account = Account(address=address)
        assert account and account.address
        assert account.checksum_address == zilkey.to_checksum_address(address)
        assert account.zil_key is None

        pub_key = "0x03949D29723DA4B2628224D3EC8E74C518ACA98C6630B00527F86B8349E982CB57"
        private_key = "05C3CF3387F31202CD0798B7AA882327A1BD365331F90954A58C18F61BD08FFC"
        address = "95B27EC211F86748DD985E1424B4058E94AA5814"

        account = Account(address=address, private_key=private_key)
        assert account and account.address
        assert account.checksum_address == zilkey.to_checksum_address(address)
        assert account.zil_key is not None

        account = Account(address=address, public_key=pub_key)
        assert account and account.address
        assert account.checksum_address == zilkey.to_checksum_address(address)
        assert account.zil_key is not None

        account = Account(address=address,
                          public_key=pub_key,
                          private_key=private_key)
        assert account and account.address
        assert account.checksum_address == zilkey.to_checksum_address(address)
        assert account.zil_key is not None

        addr = "1d19918a737306218b5cbb3241fcdcbd998c3a72"
        bech32_addr = "zil1r5verznnwvrzrz6uhveyrlxuhkvccwnju4aehf"
        account1 = Account(address=addr)
        account2 = Account(address=bech32_addr)
        assert account1 == account2
        assert account1.bech32_address == bech32_addr
        assert account2.address == addr
Example #3
0
def generate_wallet():
    account = Account.generate()
    #print(account.bech32_address)
    return account.bech32_address, account.public_key, account.private_key