naeural-client 2.6.24__tar.gz → 2.6.26__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. {naeural_client-2.6.24 → naeural_client-2.6.26}/PKG-INFO +7 -1
  2. {naeural_client-2.6.24 → naeural_client-2.6.26}/README.md +6 -0
  3. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/_ver.py +1 -1
  4. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/base/generic_session.py +19 -2
  5. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/bc/base.py +64 -0
  6. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/cli/cli_commands.py +16 -2
  7. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/cli/nodes.py +8 -2
  8. naeural_client-2.6.26/naeural_client/cli/oracles.py +165 -0
  9. naeural_client-2.6.26/naeural_client/utils/oracle_sync/multiple_requests.py +585 -0
  10. {naeural_client-2.6.24 → naeural_client-2.6.26}/nepctl.MD +37 -1
  11. {naeural_client-2.6.24 → naeural_client-2.6.26}/pyproject.toml +1 -1
  12. {naeural_client-2.6.24 → naeural_client-2.6.26}/xperimental/check_local_keys/check1.py +1 -1
  13. naeural_client-2.6.26/xperimental/sign/simple_payload_checker.py +17 -0
  14. {naeural_client-2.6.24 → naeural_client-2.6.26}/.devcontainer/Dockerfile +0 -0
  15. {naeural_client-2.6.24 → naeural_client-2.6.26}/.devcontainer/devcontainer.json +0 -0
  16. {naeural_client-2.6.24 → naeural_client-2.6.26}/.gitattributes +0 -0
  17. {naeural_client-2.6.24 → naeural_client-2.6.26}/.github/workflows/python-publish.yml +0 -0
  18. {naeural_client-2.6.24 → naeural_client-2.6.26}/.gitignore +0 -0
  19. {naeural_client-2.6.24 → naeural_client-2.6.26}/.vscode/launch.json +0 -0
  20. {naeural_client-2.6.24 → naeural_client-2.6.26}/LICENSE +0 -0
  21. {naeural_client-2.6.24 → naeural_client-2.6.26}/TODOs.md +0 -0
  22. {naeural_client-2.6.24 → naeural_client-2.6.26}/__init__.py +0 -0
  23. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/__init__.py +0 -0
  24. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/base/__init__.py +0 -0
  25. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/base/distributed_custom_code_presets.py +0 -0
  26. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/base/instance.py +0 -0
  27. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/base/payload/__init__.py +0 -0
  28. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/base/payload/payload.py +0 -0
  29. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/base/pipeline.py +0 -0
  30. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/base/plugin_template.py +0 -0
  31. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/base/responses.py +0 -0
  32. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/base/transaction.py +0 -0
  33. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/base/webapp_pipeline.py +0 -0
  34. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/base_decentra_object.py +0 -0
  35. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/bc/__init__.py +0 -0
  36. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/bc/chain.py +0 -0
  37. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/bc/ec.py +0 -0
  38. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/certs/__init__.py +0 -0
  39. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/certs/r9092118.ala.eu-central-1.emqxsl.com.crt +0 -0
  40. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/cli/README.md +0 -0
  41. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/cli/cli.py +0 -0
  42. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/code_cheker/__init__.py +0 -0
  43. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/code_cheker/base.py +0 -0
  44. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/code_cheker/checker.py +0 -0
  45. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/comm/__init__.py +0 -0
  46. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/comm/amqp_wrapper.py +0 -0
  47. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/comm/mqtt_wrapper.py +0 -0
  48. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/const/README.md +0 -0
  49. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/const/__init__.py +0 -0
  50. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/const/apps.py +0 -0
  51. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/const/base.py +0 -0
  52. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/const/comms.py +0 -0
  53. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/const/environment.py +0 -0
  54. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/const/formatter.py +0 -0
  55. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/const/heartbeat.py +0 -0
  56. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/const/misc.py +0 -0
  57. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/const/payload.py +0 -0
  58. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/default/__init__.py +0 -0
  59. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/default/instance/__init__.py +0 -0
  60. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/default/instance/chain_dist_custom_job_01_plugin.py +0 -0
  61. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/default/instance/custom_webapi_01_plugin.py +0 -0
  62. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/default/instance/net_mon_01_plugin.py +0 -0
  63. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/default/instance/telegram_basic_bot_01_plugin.py +0 -0
  64. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/default/instance/telegram_conversational_bot_01_plugin.py +0 -0
  65. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/default/instance/view_scene_01_plugin.py +0 -0
  66. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/default/session/mqtt_session.py +0 -0
  67. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/io_formatter/__init__.py +0 -0
  68. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/io_formatter/base/__init__.py +0 -0
  69. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/io_formatter/base/base_formatter.py +0 -0
  70. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/io_formatter/default/__init__.py +0 -0
  71. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/io_formatter/default/a_dummy.py +0 -0
  72. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/io_formatter/default/aixp1.py +0 -0
  73. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/io_formatter/default/default.py +0 -0
  74. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/io_formatter/io_formatter_manager.py +0 -0
  75. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/logging/__init__.py +0 -0
  76. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/logging/base_logger.py +0 -0
  77. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/logging/logger_mixins/__init__.py +0 -0
  78. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/logging/logger_mixins/class_instance_mixin.py +0 -0
  79. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/logging/logger_mixins/computer_vision_mixin.py +0 -0
  80. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/logging/logger_mixins/datetime_mixin.py +0 -0
  81. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/logging/logger_mixins/download_mixin.py +0 -0
  82. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/logging/logger_mixins/general_serialization_mixin.py +0 -0
  83. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/logging/logger_mixins/json_serialization_mixin.py +0 -0
  84. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/logging/logger_mixins/pickle_serialization_mixin.py +0 -0
  85. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/logging/logger_mixins/process_mixin.py +0 -0
  86. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/logging/logger_mixins/resource_size_mixin.py +0 -0
  87. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/logging/logger_mixins/timers_mixin.py +0 -0
  88. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/logging/logger_mixins/upload_mixin.py +0 -0
  89. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/logging/logger_mixins/utils_mixin.py +0 -0
  90. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/logging/small_logger.py +0 -0
  91. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/logging/tzlocal/__init__.py +0 -0
  92. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/logging/tzlocal/unix.py +0 -0
  93. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/logging/tzlocal/utils.py +0 -0
  94. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/logging/tzlocal/win32.py +0 -0
  95. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/logging/tzlocal/windows_tz.py +0 -0
  96. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/plugins_manager_mixin.py +0 -0
  97. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/utils/__init__.py +0 -0
  98. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/utils/comm_utils.py +0 -0
  99. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/utils/config.py +0 -0
  100. {naeural_client-2.6.24 → naeural_client-2.6.26}/naeural_client/utils/dotenv.py +0 -0
  101. {naeural_client-2.6.24 → naeural_client-2.6.26}/requirements.txt +0 -0
  102. {naeural_client-2.6.24 → naeural_client-2.6.26}/tutorials/.example_env +0 -0
  103. {naeural_client-2.6.24 → naeural_client-2.6.26}/tutorials/8. custom_code_fastapi_assets/index.html +0 -0
  104. {naeural_client-2.6.24 → naeural_client-2.6.26}/tutorials/9. code_sandbox_from_scratch_assets/index.html +0 -0
  105. {naeural_client-2.6.24 → naeural_client-2.6.26}/tutorials/_example_pk_sdk.pem +0 -0
  106. {naeural_client-2.6.24 → naeural_client-2.6.26}/tutorials/ex01_part1_connect.py +0 -0
  107. {naeural_client-2.6.24 → naeural_client-2.6.26}/tutorials/ex01_part2_filter.py +0 -0
  108. {naeural_client-2.6.24 → naeural_client-2.6.26}/tutorials/ex01_part3_adv_filter.py +0 -0
  109. {naeural_client-2.6.24 → naeural_client-2.6.26}/tutorials/ex02_first_deploy.py +0 -0
  110. {naeural_client-2.6.24 → naeural_client-2.6.26}/tutorials/ex03_custom_code_on_one_remote__example_1.py +0 -0
  111. {naeural_client-2.6.24 → naeural_client-2.6.26}/tutorials/ex04_custom_code_on_one_remote__example_2.py +0 -0
  112. {naeural_client-2.6.24 → naeural_client-2.6.26}/tutorials/ex05_custom_code_on_one_remote__example_3.py +0 -0
  113. {naeural_client-2.6.24 → naeural_client-2.6.26}/tutorials/ex06_custom_code_on_multiple_remotes__example_1.py +0 -0
  114. {naeural_client-2.6.24 → naeural_client-2.6.26}/tutorials/ex07_custom_code_on_multiple_remotes__example_2.py +0 -0
  115. {naeural_client-2.6.24 → naeural_client-2.6.26}/tutorials/ex08_custom_webapi.py +0 -0
  116. {naeural_client-2.6.24 → naeural_client-2.6.26}/tutorials/ex09_code_sandbox_from_scratch.py +0 -0
  117. {naeural_client-2.6.24 → naeural_client-2.6.26}/tutorials/ex10_telegram_echo_bot.py +0 -0
  118. {naeural_client-2.6.24 → naeural_client-2.6.26}/tutorials/ex11_telegram_blackjack_bot.py +0 -0
  119. {naeural_client-2.6.24 → naeural_client-2.6.26}/tutorials/ex12_telegram_smart_bot.py +0 -0
  120. {naeural_client-2.6.24 → naeural_client-2.6.26}/tutorials/ex13_launch_repo_based_webapp.py +0 -0
  121. {naeural_client-2.6.24 → naeural_client-2.6.26}/tutorials/video_presentation/1. hello_world.ipynb +0 -0
  122. {naeural_client-2.6.24 → naeural_client-2.6.26}/winrun.bat +0 -0
  123. {naeural_client-2.6.24 → naeural_client-2.6.26}/xperimental/.example_env +0 -0
  124. {naeural_client-2.6.24 → naeural_client-2.6.26}/xperimental/_archive/test.py +0 -0
  125. {naeural_client-2.6.24 → naeural_client-2.6.26}/xperimental/_tutorials/3. simple_real_time_custom_code.py +0 -0
  126. {naeural_client-2.6.24 → naeural_client-2.6.26}/xperimental/_tutorials/4. real_time_custom_code_2.py +0 -0
  127. {naeural_client-2.6.24 → naeural_client-2.6.26}/xperimental/_tutorials/8. chatbot.py +0 -0
  128. {naeural_client-2.6.24 → naeural_client-2.6.26}/xperimental/auth/t1.py +0 -0
  129. {naeural_client-2.6.24 → naeural_client-2.6.26}/xperimental/decentralized/chain_dist_example.py +0 -0
  130. {naeural_client-2.6.24 → naeural_client-2.6.26}/xperimental/decentralized/chain_dist_example_initiator.py +0 -0
  131. {naeural_client-2.6.24 → naeural_client-2.6.26}/xperimental/decentralized/chain_dist_example_worker.py +0 -0
  132. {naeural_client-2.6.24 → naeural_client-2.6.26}/xperimental/enc_dec/enc_dec_test.py +0 -0
  133. {naeural_client-2.6.24 → naeural_client-2.6.26}/xperimental/enc_dec/payload_tester.py +0 -0
  134. {naeural_client-2.6.24 → naeural_client-2.6.26}/xperimental/eth/eth_sign.py +0 -0
  135. {naeural_client-2.6.24 → naeural_client-2.6.26}/xperimental/eth/info.md +0 -0
  136. {naeural_client-2.6.24 → naeural_client-2.6.26}/xperimental/eth/sign.py +0 -0
  137. {naeural_client-2.6.24 → naeural_client-2.6.26}/xperimental/multi-enc-dec/multi_test1.py +0 -0
  138. {naeural_client-2.6.24 → naeural_client-2.6.26}/xperimental/multi-enc-dec/multi_test2.py +0 -0
  139. {naeural_client-2.6.24 → naeural_client-2.6.26}/xperimental/names/gen1.py +0 -0
  140. {naeural_client-2.6.24 → naeural_client-2.6.26}/xperimental/names/gen2.py +0 -0
  141. {naeural_client-2.6.24 → naeural_client-2.6.26}/xperimental/names/gen3.py +0 -0
  142. {naeural_client-2.6.24 → naeural_client-2.6.26}/xperimental/sign/test_sign1.py +0 -0
  143. {naeural_client-2.6.24 → naeural_client-2.6.26}/xperimental/utils/get_documentation.py +0 -0
  144. {naeural_client-2.6.24 → naeural_client-2.6.26}/xperimental/various/README.md +0 -0
  145. {naeural_client-2.6.24 → naeural_client-2.6.26}/xperimental/various/attach_example.py +0 -0
  146. {naeural_client-2.6.24 → naeural_client-2.6.26}/xperimental/various/ex1.py +0 -0
  147. {naeural_client-2.6.24 → naeural_client-2.6.26}/xperimental/various/hello.py +0 -0
  148. {naeural_client-2.6.24 → naeural_client-2.6.26}/xperimental/various/remote_exec.py +0 -0
  149. {naeural_client-2.6.24 → naeural_client-2.6.26}/xperimental/various/save_images.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: naeural_client
3
- Version: 2.6.24
3
+ Version: 2.6.26
4
4
  Summary: `naeural_client` is the Python SDK required for client app development for the Naeural Edge Protocol Edge Protocol framework
5
5
  Project-URL: Homepage, https://github.com/NaeuralEdgeProtocol/naeural_client
6
6
  Project-URL: Bug Tracker, https://github.com/NaeuralEdgeProtocol/naeural_client/issues
@@ -38,6 +38,12 @@ Key functionalities of the Ratio1 SDK include:
38
38
 
39
39
  Unlike the Ratio1 Core Packages, which are intended solely for protocol and ecosystem enhancements and are not meant for standalone installation, the Ratio1 SDK is designed for both client-side development and sending workloads to Ratio1 Edge Nodes, making it an indispensable tool for developers within the ecosystem.
40
40
 
41
+ ## The `nepctl` CLI Tool
42
+
43
+ Our SDK has a CLI tool called `nepctl` that allows you to interact with the Ratio1 network. You can use it to query nodes, configure the client, and manage nodes directly from the terminal. The `nepctl` tool is a powerful utility that simplifies network interactions and provides a seamless experience for developers.
44
+
45
+ For more information on the `nepctl` CLI tool, please refer to the [nepctl](nepctl.md) documentation.
46
+
41
47
  ## Dependencies
42
48
 
43
49
  The Ratio1 SDK relies on several key packages to function effectively. These dependencies are automatically managed when installing the SDK via pip:
@@ -15,6 +15,12 @@ Key functionalities of the Ratio1 SDK include:
15
15
 
16
16
  Unlike the Ratio1 Core Packages, which are intended solely for protocol and ecosystem enhancements and are not meant for standalone installation, the Ratio1 SDK is designed for both client-side development and sending workloads to Ratio1 Edge Nodes, making it an indispensable tool for developers within the ecosystem.
17
17
 
18
+ ## The `nepctl` CLI Tool
19
+
20
+ Our SDK has a CLI tool called `nepctl` that allows you to interact with the Ratio1 network. You can use it to query nodes, configure the client, and manage nodes directly from the terminal. The `nepctl` tool is a powerful utility that simplifies network interactions and provides a seamless experience for developers.
21
+
22
+ For more information on the `nepctl` CLI tool, please refer to the [nepctl](nepctl.md) documentation.
23
+
18
24
  ## Dependencies
19
25
 
20
26
  The Ratio1 SDK relies on several key packages to function effectively. These dependencies are automatically managed when installing the SDK via pip:
@@ -1,4 +1,4 @@
1
- __VER__ = "2.6.24"
1
+ __VER__ = "2.6.26"
2
2
 
3
3
  if __name__ == "__main__":
4
4
  with open("pyproject.toml", "rt") as fd:
@@ -2664,6 +2664,7 @@ class GenericSession(BaseDecentrAIObject):
2664
2664
  df_only=False,
2665
2665
  debug=False,
2666
2666
  eth=False,
2667
+ all_info=False,
2667
2668
  ):
2668
2669
  """
2669
2670
  This function will return a Pandas dataframe known nodes in the network based on
@@ -2698,6 +2699,9 @@ class GenericSession(BaseDecentrAIObject):
2698
2699
  eth: bool, optional
2699
2700
  If True, will use the nodes eth addresses instead of internal. Defaults to False.
2700
2701
 
2702
+ all_info: bool, optional
2703
+ If True, will return all the information. Defaults to False.
2704
+
2701
2705
  Returns
2702
2706
  -------
2703
2707
 
@@ -2723,11 +2727,19 @@ class GenericSession(BaseDecentrAIObject):
2723
2727
  'Oracle' : PAYLOAD_DATA.NETMON_IS_SUPERVISOR,
2724
2728
  'Peered' : PAYLOAD_DATA.NETMON_WHITELIST,
2725
2729
  })
2726
- reverse_mapping = {v: k for k, v in mapping.items()}
2730
+ if all_info:
2731
+ mapping = OrderedDict({
2732
+ # we assign dummy integer values to the computed columns
2733
+ # and we will fillter them
2734
+ 'ETH Address': 1,
2735
+ **mapping
2736
+ })
2727
2737
  res = OrderedDict()
2728
2738
  for k in mapping:
2729
2739
  res[k] = []
2730
2740
 
2741
+ reverse_mapping = {v: k for k, v in mapping.items()}
2742
+
2731
2743
  result, elapsed = self.__wait_for_supervisors_net_mon_data(
2732
2744
  supervisor=supervisor,
2733
2745
  timeout=timeout,
@@ -2759,6 +2771,8 @@ class GenericSession(BaseDecentrAIObject):
2759
2771
  if supervisors_only and not is_supervisor:
2760
2772
  continue
2761
2773
  for key, column in reverse_mapping.items():
2774
+ if isinstance(key, int):
2775
+ continue
2762
2776
  val = node_info.get(key, None)
2763
2777
  if key == PAYLOAD_DATA.NETMON_LAST_REMOTE_TIME:
2764
2778
  # val hols a string '2024-12-23 23:50:16.462155' and must be converted to a datetime
@@ -2772,7 +2786,10 @@ class GenericSession(BaseDecentrAIObject):
2772
2786
  # again self.get_node_name(best_super) might not work if using the hb data
2773
2787
  best_super_alias = node_info.get(PAYLOAD_DATA.NETMON_EEID, None)
2774
2788
  val = self.bc_engine._add_prefix(val)
2775
- if eth:
2789
+ if all_info:
2790
+ val_eth = self.bc_engine.node_address_to_eth_address(val)
2791
+ res['ETH Address'].append(val_eth)
2792
+ elif eth:
2776
2793
  val = self.bc_engine.node_address_to_eth_address(val)
2777
2794
  elif key == PAYLOAD_DATA.NETMON_WHITELIST:
2778
2795
  val = client_is_allowed
@@ -621,6 +621,7 @@ class BaseBlockEngine:
621
621
  address = self._remove_prefix(address)
622
622
  address = BCct.ADDR_PREFIX + address
623
623
  return address
624
+
624
625
 
625
626
 
626
627
  def _pk_to_address(self, public_key):
@@ -915,6 +916,23 @@ class BaseBlockEngine:
915
916
  the address without the prefix.
916
917
  """
917
918
  return self._remove_prefix(address)
919
+
920
+
921
+ def maybe_add_prefix(self, address):
922
+ """
923
+ Adds the prefix to the address
924
+
925
+ Parameters
926
+ ----------
927
+ address : str
928
+ the text address.
929
+
930
+ Returns
931
+ -------
932
+ address : str
933
+ the address with the prefix.
934
+ """
935
+ return self._add_prefix(address)
918
936
 
919
937
 
920
938
  def dict_digest(self, dct_data, return_str=True):
@@ -1235,6 +1253,52 @@ class BaseBlockEngine:
1235
1253
  def eth_account(self):
1236
1254
  return self.__eth_account
1237
1255
 
1256
+ @staticmethod
1257
+ def is_valid_evm_address(address: str) -> bool:
1258
+ """
1259
+ Check if the input string is a valid Ethereum (EVM) address using basic heuristics.
1260
+
1261
+ Parameters
1262
+ ----------
1263
+ address : str
1264
+ The address string to verify.
1265
+
1266
+ Returns
1267
+ -------
1268
+ bool
1269
+ True if `address` meets the basic criteria for an EVM address, False otherwise.
1270
+ """
1271
+ # Basic checks:
1272
+ # A) Must start with '0x'
1273
+ # B) Must be exactly 42 characters in total
1274
+ # C) All remaining characters must be valid hexadecimal digits
1275
+ if not address.startswith("0x"):
1276
+ return False
1277
+ if len(address) != 42:
1278
+ return False
1279
+
1280
+ hex_part = address[2:]
1281
+ # Ensure all characters in the hex part are valid hex digits
1282
+ return all(c in "0123456789abcdefABCDEF" for c in hex_part)
1283
+
1284
+ @staticmethod
1285
+ def is_valid_eth_address(address: str) -> bool:
1286
+ """
1287
+ Check if the input string is a valid Ethereum (EVM) address using basic heuristics.
1288
+
1289
+ Parameters
1290
+ ----------
1291
+ address : str
1292
+ The address string to verify.
1293
+
1294
+ Returns
1295
+ -------
1296
+ bool
1297
+ True if `address` meets the basic criteria for an EVM address, False otherwise.
1298
+ """
1299
+ return BaseBlockEngine.is_valid_evm_address(address)
1300
+
1301
+
1238
1302
  ### end Ethereum
1239
1303
 
1240
1304
 
@@ -1,7 +1,8 @@
1
1
  from naeural_client.cli.nodes import (
2
2
  get_nodes, get_supervisors,
3
- restart_node, shutdown_node
3
+ restart_node, shutdown_node,
4
4
  )
5
+ from naeural_client.cli.oracles import get_availability
5
6
  from naeural_client.utils.config import show_config, reset_config, show_address
6
7
 
7
8
 
@@ -17,12 +18,25 @@ CLI_COMMANDS = {
17
18
  "--online" : "Get only online nodes as seen by a active supervisor (flag)", # DONE
18
19
  "--peered": "Get only peered nodes - ie nodes that can be used by current client address (flag)", # DONE
19
20
  "--supervisor" : "Use a specific supervisor node",
20
- "--eth": "Use a specific node (flag)",
21
+ "--eth" : "Use a specific node (flag)",
22
+ "--wide" : "Display all available information (flag)",
21
23
  }
22
24
  },
23
25
  "supervisors": {
24
26
  "func": get_supervisors, # DONE
25
27
  },
28
+ "avail": {
29
+ "func": get_availability,
30
+ "params": {
31
+ ### use "(flag)" at the end of the description to indicate a boolean flag
32
+ ### otherwise it will be treated as a str parameter
33
+ "node": "The ETH address of the node to be checked via the oracle network.",
34
+ "--start": "The start epoch number to check the availability from",
35
+ "--end": "The end epoch number to check the availability to",
36
+ "--json": "Enable full JSON oracle network output (flag)",
37
+ "--rounds": "The number of rounds to check the availability for testing purposes (default=1)",
38
+ }
39
+ }
26
40
  },
27
41
  "config": {
28
42
  "show": {
@@ -11,6 +11,7 @@ def _get_netstats(
11
11
  supervisors_only=False,
12
12
  return_session=False,
13
13
  eth=False,
14
+ all_info=False
14
15
  ):
15
16
  t1 = time()
16
17
  from naeural_client import Session
@@ -19,6 +20,7 @@ def _get_netstats(
19
20
  online_only=online_only, allowed_only=allowed_only, supervisor=supervisor,
20
21
  supervisors_only=supervisors_only,
21
22
  eth=eth,
23
+ all_info=all_info,
22
24
  )
23
25
  df = dct_info[SESSION_CT.NETSTATS_REPORT]
24
26
  supervisor = dct_info[SESSION_CT.NETSTATS_REPORTER]
@@ -31,6 +33,7 @@ def _get_netstats(
31
33
  return df, supervisor, super_alias, nr_supers, elapsed
32
34
 
33
35
 
36
+
34
37
  def get_nodes(args):
35
38
  """
36
39
  This function is used to get the information about the nodes and it will perform the following:
@@ -40,7 +43,8 @@ def get_nodes(args):
40
43
  3. Wait for the second net mon message via Session and show progress.
41
44
  4. Get the active nodes union via Session and display the nodes marking those peered vs non-peered.
42
45
  """
43
- supervisor_addr = args.supervisor
46
+ supervisor_addr = args.supervisor
47
+ wide = args.wide
44
48
  if args.verbose:
45
49
  log_with_color(f"Getting nodes from supervisor <{supervisor_addr}>...", color='b')
46
50
 
@@ -50,6 +54,7 @@ def get_nodes(args):
50
54
  allowed_only=args.peered,
51
55
  supervisor=supervisor_addr,
52
56
  eth=args.eth,
57
+ all_info=wide,
53
58
  )
54
59
  df, supervisor, super_alias, nr_supers, elapsed = res
55
60
  if args.online:
@@ -150,4 +155,5 @@ def shutdown_node(args):
150
155
  node = args.node
151
156
  log_with_color(f"Attempting to shutdown node <{node}>", color='b')
152
157
  _send_command_to_node(args, COMMANDS.SHUTDOWN)
153
- return
158
+ return
159
+
@@ -0,0 +1,165 @@
1
+ """
2
+
3
+
4
+ NOTE: if any of oracles return data["result"]["oracle"]["manager"]["valid"] != True then
5
+ - ommit that oracle from the list of oracles shown
6
+ - display red warning containing the issue and the "certainty"
7
+
8
+ >nepctl get avail 0x693369781001bAC65F653856d0C00fA62129F407 --start 4 --end 6 --rounds 8
9
+
10
+ Availability of node <0x693369781001bAC65F653856d0C00fA62129F407> from epoch 4 to epoch 6 on 8 rounds:
11
+ Oracle #1:
12
+ Address: 0xai_AleLPKqUHV-iPc-76-rUvDkRWW4dFMIGKW1xFVcy65nH
13
+ ETH Addr: 0xE486F0d594e9F26931fC10c29E6409AEBb7b5144
14
+ Alias: nen-aid01
15
+ Responses: 3
16
+ Epochs: [ 4, 5, 6]
17
+ Avails: [ 3, 254, 127]
18
+ Cartainty: [0.99, 0.99, 0.99]
19
+ Oracle #2:
20
+ Address: 0xai_Amfnbt3N-qg2-qGtywZIPQBTVlAnoADVRmSAsdDhlQ-6
21
+ ETH Addr: 0x129a21A78EBBA79aE78B8f11d5B57102950c1Fc0
22
+ Alias: nen-2
23
+ Responses: 2
24
+ Epochs: [ 4, 5, 6]
25
+ Avails: [ 3, 254, 127]
26
+ Cartainty: [0.99, 0.99, 0.99]
27
+ Oracle #3: [RED due to not data["result"]["oracle"]["manager"]["valid"]]
28
+ WARNING: Oracle returned invalid data due to uncertainity
29
+ Address: 0xai_A-Bn9grkqH1GUMTZUqHNzpX5DA6PqducH9_JKAlBx6YL
30
+ ETH Addr: 0x93B04EF1152D81A0847C2272860a8a5C70280E14
31
+ Alias: nen-aid02
32
+ Responses: 3
33
+ Epochs: [ 4, 5, 6]
34
+ Avails: [ 3, 0, 127]
35
+ Cartainty: [0.99, 0.41, 0.99]
36
+
37
+
38
+ >nepctl get avail 0x693369781001bAC65F653856d0C00fA62129F407 --start 4 --end 6 --rounds 8
39
+
40
+ Availability of node <0x693369781001bAC65F653856d0C00fA62129F407> from epoch 4 to epoch 6 on 8 rounds:
41
+ Oracle #1:
42
+ Address: 0xai_AleLPKqUHV-iPc-76-rUvDkRWW4dFMIGKW1xFVcy65nH
43
+ ETH Addr: 0xE486F0d594e9F26931fC10c29E6409AEBb7b5144
44
+ Alias: nen-aid01
45
+ Responses: 3
46
+ Avails: [3, 254, 127]
47
+ Oracle #2:
48
+ Address: 0xai_Amfnbt3N-qg2-qGtywZIPQBTVlAnoADVRmSAsdDhlQ-6
49
+ ETH Addr: 0x129a21A78EBBA79aE78B8f11d5B57102950c1Fc0
50
+ Alias: nen-2
51
+ Responses: 3
52
+ Avails: [3, 254, 127]
53
+ Oracle #3:
54
+ Address: 0xai_A-Bn9grkqH1GUMTZUqHNzpX5DA6PqducH9_JKAlBx6YL
55
+ ETH Addr: 0x93B04EF1152D81A0847C2272860a8a5C70280E14
56
+ Alias: nen-aid02
57
+ Responses: 3
58
+ Avails: [3, 254, 127]
59
+
60
+
61
+
62
+ >nepctl get avail 0x693369781001bAC65F653856d0C00fA62129F407 --start 4 --end 6 --rounds 8
63
+ [if same oracle returns different avail dump the two confligting json with RED and stop command]
64
+
65
+ >nepctl get avail 0x693369781001bAC65F653856d0C00fA62129F407 --start 4 --end 6 --full
66
+ [just dump json]
67
+
68
+
69
+ >nepctl get avail 0x693369781001bAC65F653856d0C00fA62129F407 --start 4 --end 6
70
+ Availability of node <0x693369781001bAC65F653856d0C00fA62129F407> from epoch 4 to epoch 6:
71
+ Oracle address: 0xE486F0d594e9F26931fC10c29E6409AEBb7b5144
72
+ Oracle alias: nen-aid01
73
+ Oracle report:
74
+ - Epoch #4: 127 ( 50%)
75
+ - Epoch #5: 254 (100%)
76
+ - Epoch #6: 3 ( 1%)
77
+
78
+ >nepctl get avail 0x693369781001bAC65F653856d0C00fA62129F407 # assuming current epoch is 10
79
+ Availability of node <0x693369781001bAC65F653856d0C00fA62129F407> from epoch 1 to epoch 9:
80
+ Oracle address: 0xE486F0d594e9F26931fC10c29E6409AEBb7b5144
81
+ Oracle alias: nen-aid01
82
+ Oracle report:
83
+ - Epoch #1: 127 ( 50%)
84
+ - Epoch #2: 127 ( 50%)
85
+ - Epoch #3: 127 ( 50%)
86
+ - Epoch #4: 127 ( 50%)
87
+ - Epoch #5: 254 (100%)
88
+ - Epoch #6: 3 ( 1%)
89
+ - Epoch #7: 64 ( 25%)
90
+ - Epoch #8: 33 ( 13%)
91
+ - Epoch #9: 254 (100%)
92
+
93
+
94
+ TODO: (future)
95
+ - check ETH signature of the oracle data
96
+
97
+ """
98
+ import requests
99
+
100
+ from naeural_client.utils.config import log_with_color
101
+ from naeural_client import Logger
102
+ from naeural_client.bc import DefaultBlockEngine
103
+ from naeural_client.utils.oracle_sync.multiple_requests import oracle_tester_init, handle_command_results
104
+
105
+ """
106
+ TODOs:
107
+ - test NEPCTL command in CLI too
108
+ - check ETH signature of the oracle data
109
+ """
110
+
111
+
112
+ def _check_response(data):
113
+ res = True
114
+ log = Logger("NEPCTL", base_folder=".", app_folder="_local_cache", silent=True)
115
+ bc = DefaultBlockEngine(name='test', log=log)
116
+ print(bc.address)
117
+ return res
118
+
119
+ def get_availability(args):
120
+ """
121
+ This function is used to get the availability of the node.
122
+
123
+ Parameters
124
+ ----------
125
+ args : argparse.Namespace
126
+ Arguments passed to the function.
127
+ """
128
+
129
+ node = args.node
130
+ start = args.start or 1
131
+ end = args.end
132
+ full = args.json
133
+ rounds = args.rounds or 1
134
+ if str(rounds).isnumeric() and int(rounds) > 0:
135
+ rounds = int(rounds)
136
+ else:
137
+ log_with_color("`rounds` must be a positive integer. Setting rounds to 1.", color='r')
138
+ rounds = 1
139
+ # endif rounds
140
+
141
+ if isinstance(rounds, int) and rounds > 10:
142
+ log_with_color("Rounds exceed the maximum limit of 10. Setting rounds to 10.", color='r')
143
+ rounds = min(rounds, 10)
144
+
145
+ if full:
146
+ if rounds > 1:
147
+ log_with_color("Cannot generate full JSON oracle network output in 'rounds' mode.", color='r')
148
+ full = False
149
+ # endif full
150
+
151
+ tester = oracle_tester_init()
152
+ log_with_color("Checking {}availability of node <{}> from {} to {}.".format(
153
+ "(DEBUG MODE) " if rounds > 1 else "", node, start,
154
+ end if end else "last epoch"
155
+ ), color='b'
156
+ )
157
+ res = tester.execute_command(
158
+ node_eth_addr=node,
159
+ start=start,
160
+ end=end,
161
+ rounds=rounds,
162
+ debug=full
163
+ )
164
+ handle_command_results(res)
165
+ return