Esempio n. 1
0
 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)
Esempio n. 2
0
    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)