Пример #1
0
    def blockbyheight(self, conf):
        """Query block with given height

        :param conf: blockbyheight command configuration
        :return: result of query
        """
        icon_client = IconClient(conf['uri'])

        response = icon_client.send(
            IconJsonrpc.getBlockByHeight(conf['height']))

        if "error" in response:
            print('Got an error response')
            print(json.dumps(response, indent=4))
        else:
            print(f"block info : {json.dumps(response, indent=4)}")

        return response
Пример #2
0
 def test_getBlockByHeight(self):
     request = IconJsonrpc.getBlockByHeight("2")
     self.check_jsonschema_validation(request=request)
     request = IconJsonrpc.getBlockByHeight("0x2")
     self.check_jsonschema_validation(request=request)