def test_generate(self): """Test whether random Mnemonic generation works.""" k = MnemonicKey.generate() assert len(k.mnemonic.split()) == 24 assert k.mnemonic != MnemonicKey.generate().mnemonic assert is_acc_address(k.acc_address) assert is_val_address(k.val_address)
def test_new_wallet_send(self, terra, wallet, fee): """A new wallet should be able to make transactions.""" new_wallet = terra.wallet(MnemonicKey.generate()) send = MsgSend( from_address=new_wallet.address, to_address=wallet.address, amount=Coins(uluna=1), ) tx = new_wallet.create_and_sign_tx(send, fee=fee) with pytest.raises(TxError): new_wallet.broadcast(tx) tx = wallet.create_and_sign_tx( MsgSend( from_address=wallet.address, to_address=new_wallet.address, amount=Coins(uluna=10000000), ), fee=fee, ) wallet.broadcast(tx) tx = new_wallet.create_and_sign_tx(send, fee=fee) res = new_wallet.broadcast(tx) assert isinstance(res, TxBroadcastResult)
def test_from_mnemonic(self, mnemonics): """Test whether creating a MnemonicKey with a known mnemonic generates the correct values.""" # GIVEN a 24-character mnemonic # THEN give back a correctly-populated MnemonicKey for mnemonic in mnemonics: k = MnemonicKey(mnemonic["mnemonic"]) compare(k, mnemonic)
def a3(): return MnemonicKey( "corn peasant blue sight spy three stove confirm night brother vote dish reduce sick observe outside vacant arena laugh devote exotic wasp supply rally" )
def a2(): return MnemonicKey( "service frozen keen unveil luggage initial surge name conduct mesh soup escape weather gas clown brand holiday result protect chat plug false pitch little" )
def a1(): return MnemonicKey( "swamp increase solar renew twelve easily possible pig ostrich harvest more indicate lion denial kind target small dumb mercy under proud arrive gentle field" )
def master_key2(): return MnemonicKey( "spatial fantasy weekend romance entire million celery final moon solid route theory way hockey north trigger advice balcony melody fabric alter bullet twice push" )
def master_key(): return MnemonicKey( "island relax shop such yellow opinion find know caught erode blue dolphin behind coach tattoo light focus snake common size analyst imitate employ walnut" )
def wallet(mnemonics, terra): """Wallet #1, which should have some testnet funds.""" m = mnemonics[0]["mnemonic"] return terra.wallet(MnemonicKey(m))