コード例 #1
0
    def add_account(self, *args):
        # Registration
        Account.enable_unaudited_hdwallet_features() 
        acct, mnemonic = Account.create_with_mnemonic()
        # Get private key
        private_class = Account.from_mnemonic(mnemonic) 
        private_dict = private_class.__dict__ 
        private_key = str(private_dict['_key_obj'])

        CteaPerceApp.mnemonic = mnemonic   
        CteaPerceApp.public = acct.address
        CteaPerceApp.private_key = private_key
コード例 #2
0
def test_unknown_language():
    with pytest.raises(ValidationError, match="Invalid language choice.*"):
        Account.create_with_mnemonic(language="pig latin")
コード例 #3
0
def test_bad_account_path2():
    with pytest.raises(ValidationError, match="Path.*is not valid.*"):
        Account.create_with_mnemonic(account_path='m/not/an/account/path')
コード例 #4
0
def test_incorrect_num_words():
    with pytest.raises(ValidationError,
                       match="Invalid choice for number of words.*"):
        Account.create_with_mnemonic(num_words=11)
コード例 #5
0
def test_bad_passphrase():
    a1, mnemonic = Account.create_with_mnemonic(passphrase="My passphrase")
    a2 = Account.from_mnemonic(mnemonic, passphrase="Not my passphrase")
    assert a1.address != a2.address
コード例 #6
0
def test_account_restore():
    a1, mnemonic = Account.create_with_mnemonic(num_words=24,
                                                passphrase="TESTING")
    a2 = Account.from_mnemonic(mnemonic, passphrase="TESTING")
    assert a1.address == a2.address
コード例 #7
0
def createWithMnemonic():
    acct, mnemonic = Account.create_with_mnemonic()
    return acct, mnemonic