Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@methods.add
def server_exit(**params):
engine = get_icon_service_engine()
engine.close()
shutdown()
@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)
@methods.add
def ping():
return 'pong'
@methods.add
def ping():
return 'pong'
@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()
@methods.add
def icx_getTotalSupply(**params):
engine = get_icon_service_engine()
value: int = engine.query(method='icx_getTotalSupply', params=params)
return hex(value)
@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
@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)
@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()
@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