async def get_unbound_offset(request, address): #756e626f756e6454696d654f6666736574 = unboundTimeOffset result, err = await get_rpc_ont(request, 'getstorage', [ '0100000000000000000000000000000000000000', '756e626f756e6454696d654f6666736574' + Tool.address_to_scripthash(address) ]) if err or not result: return 0 return int(big_or_little(result), 16)
async def get_nep5_asset_balance(request, address, asset): result = await get_rpc(request, 'invokefunction', [ asset, "balanceOf", [{ "type": "Hash160", "value": big_or_little(Tool.address_to_scripthash(address)) }] ]) if result and "HALT, BREAK" == result["state"]: hex_str = result['stack'][0]['value'] if hex_str: return Tool.hex_to_num_str(hex_str) return '0' return '0'