コード例 #1
0
def test_generate_nonce():
    """Test generate nonce."""
    nonce = FetchAIApi.generate_tx_nonce(
        seller="some_seller_addr", client="some_buyer_addr"
    )
    assert len(nonce) > 0 and int(
        nonce, 16
    ), "The len(nonce) must not be 0 and must be hex"
コード例 #2
0
def test_transfer():
    """Test transfer of wealth."""
    fetchai_api = FetchAIApi(**FETCHAI_TESTNET_CONFIG)
    fc1 = FetchAICrypto(private_key_path=FETCHAI_PRIVATE_KEY_PATH)
    fc2 = FetchAICrypto()
    amount = 40000
    fee = 30000
    tx_nonce = fetchai_api.generate_tx_nonce(fc2.address, fc1.address)
    tx_digest = fetchai_api.transfer(fc1,
                                     fc2.address,
                                     amount,
                                     fee,
                                     tx_nonce,
                                     chain_id=3)
    assert tx_digest is not None, "Failed to submit transfer!"