How to use the jsonrpcserver.aio.methods 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 bcb / jsonrpcserver / tests / test_async_request.py View on Github external
async def test_request(self):
        req = AsyncRequest({"jsonrpc": "2.0", "method": "foo", "id": 1})
        response = await req.call(methods)
        self.assertEqual("bar", response["result"])
github singnet / alpha-daemon / snetd_alpha / daemon.py View on Github external
def __missing__(self, key):
        methods.add(self.d.create_passthrough(key), key)
        return self[key]
github trinity-project / trinity / gateway / discarded / jsonrpc.py View on Github external
@methods.add
async def ShowNodeList(params):
    from gateway import gateway_singleton
    return gateway_singleton.handle_jsonrpc_request('ShowNodeList', params)
github icon-project / t-bears / tbears / server / jsonrpc_server.py View on Github external
    @methods.add
    async def icx_getScoreApi(**request_params):
        Logger.debug(f'json_rpc_server icx_getScoreApi!', TBEARS_LOG_TAG)

        method = 'icx_getScoreApi'
        request = {'method': method, 'params': request_params}
        response = await get_icon_inner_task().query(request)
        return response_to_json_query(response)
github trinity-project / trinity / gateway / network / jsonrpc.py View on Github external
@methods.add
async def GetRouterInfo(params):
    from gateway import gateway_singleton
    return gateway_singleton.handle_wallet_request('GetRouterInfo', params)
github singnet / alpha-daemon / snetd_alpha / daemon.py View on Github external
def __init__(self):
        self.app = web.Application()
        self.chain = BlockchainClient(self.app)
        methods._items = HandlerCreator(self)

        if config.BLOCKCHAIN_ENABLED:
            self.app.on_startup.append(self.setup_db)
            self.app.on_startup.append(self.process_completions)
            self.app.on_startup.append(self.create_event_task)
            self.app.on_cleanup.append(self.cancel_event_task)
            self.app.on_cleanup.append(self.cleanup_db)

        cors = aiohttp_cors.setup(self.app)
        resource = cors.add(self.app.router.add_resource("/"))
        cors.add(
            resource.add_route("POST", self.handle), {
                "*": aiohttp_cors.ResourceOptions(
                    allow_credentials=False,
                    allow_headers=("X-Requested-With", "Content-Type"),
                    max_age=3600