コード例 #1
0
ファイル: tester.py プロジェクト: pipermerriam/web3.py
        'eth_uninstallFilter': apply_formatter_at_index(to_integer_if_hex, 0),
        'eth_getFilterChanges': apply_formatter_at_index(to_integer_if_hex, 0),
        'eth_getFilterLogs': apply_formatter_at_index(to_integer_if_hex, 0),
    },
    result_formatters={
        # Eth
        'eth_newFilter': apply_formatter_if(is_integer, hex),
        'eth_protocolVersion': apply_formatter_if(is_integer, str),
        'eth_getTransactionByHash': apply_formatters_to_dict(TRANSACTION_FORMATTERS),
        # Net
        'net_version': apply_formatter_if(is_integer, str),
    },
)


return_none_result = static_result(None)


ethtestrpc_exception_middleware = construct_exception_handler_middleware(
    method_handlers={
        'eth_getBlockByHash': (ValueError, static_result(None)),
        'eth_getBlockByNumber': (ValueError, static_result(None)),
    },
)


def ethereum_tester_personal_remapper_middleware(make_request, web3):
    def middleware(method, params):
        if method == 'personal_sendTransaction':
            return make_request('personal_signAndSendTransaction', params)
        else:
コード例 #2
0
    },
    result_formatters={
        # Eth
        'eth_newFilter':
        apply_formatter_if(is_integer, hex),
        'eth_protocolVersion':
        apply_formatter_if(is_integer, str),
        'eth_getTransactionByHash':
        apply_formatters_to_dict(TRANSACTION_FORMATTERS),
        # Net
        'net_version':
        apply_formatter_if(is_integer, str),
    },
)

return_none_result = static_result(None)

ethtestrpc_exception_middleware = construct_exception_handler_middleware(
    method_handlers={
        'eth_getBlockByHash': (ValueError, static_result(None)),
        'eth_getBlockByNumber': (ValueError, static_result(None)),
    }, )


def ethereum_tester_personal_remapper_middleware(make_request, web3):
    def middleware(method, params):
        if method == 'personal_sendTransaction':
            return make_request('personal_signAndSendTransaction', params)
        else:
            return make_request(method, params)