How to use the jsonrpcserver.aio.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 bcb / jsonrpcserver / tests / test_async_request.py View on Github external
if inspect.iscoroutinefunction(f):
            future = f(*args, **kwargs)
        else:
            coroutine = asyncio.coroutine(f)
            future = coroutine(*args, **kwargs)
        asyncio.get_event_loop().run_until_complete(future)

    return wrapper


class MyMethods:
    async def foo(self):
        return "bar"


methods.add(MyMethods().foo)


class TestCall(TestCase):
    @async_test
    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 gdassori / spruned / spruned / application / jsonrpc_server.py View on Github external
methods.add(self.estimatesmartfee)
        methods.add(self.getbestblockhash)
        methods.add(self.getblockchaininfo)
        methods.add(self.getblockheader)
        methods.add(self.getblockhash)
        methods.add(self.getblock)
        methods.add(self.getblockcount)
        methods.add(self.getrawtransaction)
        methods.add(self.gettxout)
        methods.add(self.getpeerinfo)
        methods.add(self.sendrawtransaction)
        methods.add(self.stop)
        methods.add(self.getmempoolinfo)
        methods.add(self.getchaintxstats)
        methods.add(self.getmininginfo)
        methods.add(self.getrawmempool)
        methods.add(self.getnetworkinfo)
        methods.add(self.uptime)
        methods.add(self.getnettotals)
        methods.add(self.validateaddress)
        methods.add(self.dev_memorysummary, name="dev-gc-stats")
        methods.add(self.dev_collect, name="dev-gc-collect")
        return await web.TCPSite(runner, host=self.host, port=self.port).start()
github gdassori / spruned / spruned / application / jsonrpc_server.py View on Github external
methods.add(self.getbestblockhash)
        methods.add(self.getblockchaininfo)
        methods.add(self.getblockheader)
        methods.add(self.getblockhash)
        methods.add(self.getblock)
        methods.add(self.getblockcount)
        methods.add(self.getrawtransaction)
        methods.add(self.gettxout)
        methods.add(self.getpeerinfo)
        methods.add(self.sendrawtransaction)
        methods.add(self.stop)
        methods.add(self.getmempoolinfo)
        methods.add(self.getchaintxstats)
        methods.add(self.getmininginfo)
        methods.add(self.getrawmempool)
        methods.add(self.getnetworkinfo)
        methods.add(self.uptime)
        methods.add(self.getnettotals)
        methods.add(self.validateaddress)
        methods.add(self.dev_memorysummary, name="dev-gc-stats")
        methods.add(self.dev_collect, name="dev-gc-collect")
        return await web.TCPSite(runner, host=self.host, port=self.port).start()
github gdassori / spruned / spruned / application / jsonrpc_server.py View on Github external
runner = web.AppRunner(app)
        self.app = app
        await runner.setup()
        methods.add(self.echo)
        methods.add(self.help)
        methods.add(self.estimatefee)
        methods.add(self.estimatesmartfee)
        methods.add(self.getbestblockhash)
        methods.add(self.getblockchaininfo)
        methods.add(self.getblockheader)
        methods.add(self.getblockhash)
        methods.add(self.getblock)
        methods.add(self.getblockcount)
        methods.add(self.getrawtransaction)
        methods.add(self.gettxout)
        methods.add(self.getpeerinfo)
        methods.add(self.sendrawtransaction)
        methods.add(self.stop)
        methods.add(self.getmempoolinfo)
        methods.add(self.getchaintxstats)
        methods.add(self.getmininginfo)
        methods.add(self.getrawmempool)
        methods.add(self.getnetworkinfo)
        methods.add(self.uptime)
        methods.add(self.getnettotals)
        methods.add(self.validateaddress)
        methods.add(self.dev_memorysummary, name="dev-gc-stats")
        methods.add(self.dev_collect, name="dev-gc-collect")
        return await web.TCPSite(runner, host=self.host, port=self.port).start()
github gdassori / spruned / spruned / application / jsonrpc_server.py View on Github external
async def start(self):
        app = web.Application()
        app.router.add_post('/', self._handle)
        runner = web.AppRunner(app)
        self.app = app
        await runner.setup()
        methods.add(self.echo)
        methods.add(self.help)
        methods.add(self.estimatefee)
        methods.add(self.estimatesmartfee)
        methods.add(self.getbestblockhash)
        methods.add(self.getblockchaininfo)
        methods.add(self.getblockheader)
        methods.add(self.getblockhash)
        methods.add(self.getblock)
        methods.add(self.getblockcount)
        methods.add(self.getrawtransaction)
        methods.add(self.gettxout)
        methods.add(self.getpeerinfo)
        methods.add(self.sendrawtransaction)
        methods.add(self.stop)
        methods.add(self.getmempoolinfo)
        methods.add(self.getchaintxstats)
        methods.add(self.getmininginfo)
        methods.add(self.getrawmempool)
        methods.add(self.getnetworkinfo)
        methods.add(self.uptime)
        methods.add(self.getnettotals)
github icon-project / t-bears / tbears / server / jsonrpc_server.py View on Github external
    @methods.add
    async def icx_call(**request_params):
        Logger.debug(f'json_rpc_server icx_call!', TBEARS_LOG_TAG)

        method = 'icx_call'
        request = {'method': method, 'params': request_params}
        response = await get_icon_inner_task().query(request)
        return response_to_json_query(response)
github gdassori / spruned / spruned / application / jsonrpc_server.py View on Github external
async def start(self):
        app = web.Application()
        app.router.add_post('/', self._handle)
        runner = web.AppRunner(app)
        self.app = app
        await runner.setup()
        methods.add(self.echo)
        methods.add(self.help)
        methods.add(self.estimatefee)
        methods.add(self.estimatesmartfee)
        methods.add(self.getbestblockhash)
        methods.add(self.getblockchaininfo)
        methods.add(self.getblockheader)
        methods.add(self.getblockhash)
        methods.add(self.getblock)
        methods.add(self.getblockcount)
        methods.add(self.getrawtransaction)
        methods.add(self.gettxout)
        methods.add(self.getpeerinfo)
        methods.add(self.sendrawtransaction)
        methods.add(self.stop)
        methods.add(self.getmempoolinfo)
        methods.add(self.getchaintxstats)
        methods.add(self.getmininginfo)
        methods.add(self.getrawmempool)
        methods.add(self.getnetworkinfo)
        methods.add(self.uptime)
        methods.add(self.getnettotals)
        methods.add(self.validateaddress)
github gdassori / spruned / spruned / application / jsonrpc_server.py View on Github external
methods.add(self.help)
        methods.add(self.estimatefee)
        methods.add(self.estimatesmartfee)
        methods.add(self.getbestblockhash)
        methods.add(self.getblockchaininfo)
        methods.add(self.getblockheader)
        methods.add(self.getblockhash)
        methods.add(self.getblock)
        methods.add(self.getblockcount)
        methods.add(self.getrawtransaction)
        methods.add(self.gettxout)
        methods.add(self.getpeerinfo)
        methods.add(self.sendrawtransaction)
        methods.add(self.stop)
        methods.add(self.getmempoolinfo)
        methods.add(self.getchaintxstats)
        methods.add(self.getmininginfo)
        methods.add(self.getrawmempool)
        methods.add(self.getnetworkinfo)
        methods.add(self.uptime)
        methods.add(self.getnettotals)
        methods.add(self.validateaddress)
        methods.add(self.dev_memorysummary, name="dev-gc-stats")
        methods.add(self.dev_collect, name="dev-gc-collect")
        return await web.TCPSite(runner, host=self.host, port=self.port).start()