def test_submit_p2p_with_unknown_address():
    client = testnet.create_client()
    account = testnet.gen_account(client)
    da = DiemAccount(account, [], client)
    with pytest.raises(ValueError):
        da.submit_p2p(gen_txn(), (b"", b""),
                      by_address=LocalAccount().account_address)
Пример #2
0
async def test_no_child_accounts():
    client = create_client()
    faucet = Faucet(client)
    account = await faucet.gen_account()
    da = DiemAccount(account, [], client)
    assert da.hrp == account.hrp
    assert da.account_identifier() == account.account_identifier()

    payee = await faucet.gen_account()
    signed_txn = await da.submit_p2p(gen_txn(payee=payee.account_identifier()), (b"", b""))
    assert signed_txn.raw_txn.sender == account.account_address
def test_no_child_accounts():
    client = testnet.create_client()
    account = testnet.gen_account(client)
    da = DiemAccount(account, [], client)
    assert da.hrp == account.hrp
    assert da.account_identifier(None) == account.account_identifier(None)

    signed_txn_hex = da.submit_p2p(gen_txn(), (b"", b""))
    signed_txn = diem_types.SignedTransaction.bcs_deserialize(
        bytes.fromhex(signed_txn_hex))
    assert signed_txn.raw_txn.sender == account.account_address
Пример #4
0
async def test_submit_p2p_with_unknown_address():
    client = create_client()
    faucet = Faucet(client)
    account = await faucet.gen_account()
    da = DiemAccount(account, [], client)
    with pytest.raises(ValueError):
        payee = LocalAccount().account_identifier()
        await da.submit_p2p(gen_txn(payee=payee), (b"", b""), by_address=LocalAccount().account_address)
Пример #5
0
async def test_ensure_account_balance_is_always_enough():
    client = create_client()
    faucet = Faucet(client)
    account = LocalAccount.generate()
    await faucet.mint(account.auth_key.hex(), 1, XUS)
    da = DiemAccount(account, [], client)
    account_data = await client.must_get_account(account.account_address)
    amount = utils.balance(account_data, XUS) + 1
    payee = await faucet.gen_account()
    txn = await da.submit_p2p(gen_txn(payee=payee.account_identifier(), amount=amount), (b"", b""))
    await client.wait_for_transaction(txn)