How to use the jsonrpcserver.methods.add function in jsonrpcserver

To help you get started, we’ve selected a few jsonrpcserver examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github icon-project / icon-service / tools / jsonrpc_server.py View on Github external
    @methods.add
    def server_exit(**params):
        engine = get_icon_service_engine()
        engine.close()
        shutdown()
github icon-project / t-bears / tbears / tbears / server / jsonrpc_server.py View on Github external
    @methods.add
    def icx_getBalance(**params):
        engine = get_icon_service_engine()

        # params['address'] = Address.from_string(params['address'])
        params = _type_converter.convert(params, recursive=False)
        value = engine.query(method='icx_getBalance', params=params)

        return hex(value)
github icon-project / icon-service / tools / jsonrpc_server.py View on Github external
    @methods.add
    def icx_sendTransaction(**kwargs):
        """ icx_sendTransaction jsonrpc handler.
        We assume that only one tx in a block.

        :param kwargs: jsonrpc params field.
        """
        engine = get_icon_service_engine()

        params = _type_converter.convert(kwargs, recursive=False)

        tx = {
            'method': 'icx_sendTransaction',
            'params': params
        }

        block_height: int = get_block_height()
github icon-project / t-bears / tbears / tbears / server / jsonrpc_server.py View on Github external
    @methods.add
    def icx_getTotalSupply(**params):
        engine = get_icon_service_engine()

        value: int = engine.query(method='icx_getTotalSupply', params=params)
        return hex(value)
github icon-project / icon-service / tools / jsonrpc_server.py View on Github external
    @methods.add
    def icx_call(**params):
        engine = get_icon_service_engine()
        params = _type_converter.convert(params, recursive=False)
        value = engine.query(method='icx_call', params=params)

        if isinstance(value, int):
            value = hex(value)

        return value
github icon-project / icon-service / tools / jsonrpc_server.py View on Github external
    @methods.add
    def icx_getBalance(**params):
        engine = get_icon_service_engine()

        # params['address'] = Address.from_string(params['address'])
        params = _type_converter.convert(params, recursive=False)
        value = engine.query(method='icx_getBalance', params=params)

        return hex(value)
github icon-project / t-bears / tbears / tbears / server / jsonrpc_server.py View on Github external
    @methods.add
    def icx_sendTransaction(**kwargs):
        """ icx_sendTransaction jsonrpc handler.
        We assume that only one tx in a block.

        :param kwargs: jsonrpc params field.
        """
        engine = get_icon_service_engine()

        params = _type_converter.convert(kwargs, recursive=False)

        tx = {
            'method': 'icx_sendTransaction',
            'params': params
        }

        block_height: int = get_block_height()
github icon-project / t-bears / tbears / tbears / server / jsonrpc_server.py View on Github external
    @methods.add
    def icx_call(**params):
        engine = get_icon_service_engine()
        params = _type_converter.convert(params, recursive=False)
        value = engine.query(method='icx_call', params=params)

        if isinstance(value, int):
            value = hex(value)

        return value