예제 #1
0
def test_send_tx_sync_mode_wrong_sequence_fail(requests_mock):
    requests_mock.register_uri(
        "POST",
        "{}/txs".format(TEST_RPC),
        json={
            "height":
            "0",
            "txhash":
            "611F45A21BB7937E451CDE78D124218603644635CC40A97D2BC1E854CED8D6E6",
            "code":
            4,
            "raw_log":
            "unauthorized: signature verification failed; verify correct account sequence and chain-id",
        },
        status_code=200,
    )
    assert client.send_tx_sync_mode(
        TEST_WRONG_SEQUENCE_MSG
    ) == TransactionSyncMode(
        tx_hash=HexBytes(
            bytes.fromhex(
                "611F45A21BB7937E451CDE78D124218603644635CC40A97D2BC1E854CED8D6E6"
            )),
        code=4,
        error_log=
        "unauthorized: signature verification failed; verify correct account sequence and chain-id",
    )
예제 #2
0
def test_send_tx_sync_mode_return_only_code(requests_mock):
    requests_mock.register_uri(
        "POST",
        "{}/txs".format(TEST_RPC),
        json={
            "height": "0",
            "txhash": "611F45A21BB7937E451CDE78D124218603644635CC40A97D2BC1E854CED8D6E6",
            "code": 19,
        },
        status_code=200,
    )
    assert client.send_tx_sync_mode(TEST_WRONG_SEQUENCE_MSG) == TransactionSyncMode(
        tx_hash=HexBytes(bytes.fromhex("611F45A21BB7937E451CDE78D124218603644635CC40A97D2BC1E854CED8D6E6")),
        code=19,
        error_log=None,
    )
예제 #3
0
def test_send_tx_sync_mode_success(requests_mock):
    requests_mock.register_uri(
        "POST",
        "{}/txs".format(TEST_RPC),
        json={
            "height": "0",
            "txhash": "E204AAD58ACA8F00942B1BB66D9F745F5E2C21E04C5DF6A0CB73DF02B6B51121",
            "raw_log": "[]",
        },
        status_code=200,
    )

    assert client.send_tx_sync_mode(TEST_MSG) == TransactionSyncMode(
        tx_hash=HexBytes(bytes.fromhex("E204AAD58ACA8F00942B1BB66D9F745F5E2C21E04C5DF6A0CB73DF02B6B51121")),
        code=0,
        error_log=None,
    )