naeural-client 2.7.3__py3-none-any.whl → 2.7.4__py3-none-any.whl

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.
naeural_client/_ver.py CHANGED
@@ -1,4 +1,4 @@
1
- __VER__ = "2.7.3"
1
+ __VER__ = "2.7.4"
2
2
 
3
3
  if __name__ == "__main__":
4
4
  with open("pyproject.toml", "rt") as fd:
naeural_client/bc/base.py CHANGED
@@ -1406,10 +1406,27 @@ class BaseBlockEngine:
1406
1406
  True if `address` meets the basic criteria for an EVM address, False otherwise.
1407
1407
  """
1408
1408
  return BaseBlockEngine.is_valid_evm_address(address)
1409
-
1409
+
1410
1410
 
1411
1411
  @staticmethod
1412
- def web3_is_node_licensed(address : str, network=None) -> bool:
1412
+ def get_evm_network() -> str:
1413
+ """
1414
+ Get the current network
1415
+
1416
+ Returns
1417
+ -------
1418
+ str
1419
+ the network name.
1420
+
1421
+ """
1422
+ return os.environ.get(dAuth.DAUTH_NET_ENV_KEY, dAuth.DAUTH_SDK_NET_DEFAULT)
1423
+
1424
+ @property
1425
+ def evm_network(self):
1426
+ return self.get_evm_network()
1427
+
1428
+
1429
+ def web3_is_node_licensed(self, address : str, network=None, debug=False) -> bool:
1413
1430
  """
1414
1431
  Check if the address is allowed to send commands to the node
1415
1432
 
@@ -1419,11 +1436,12 @@ class BaseBlockEngine:
1419
1436
  the address to check.
1420
1437
  """
1421
1438
  if network is None:
1422
- network = os.environ.get(dAuth.DAUTH_NET_ENV_KEY, dAuth.DAUTH_SDK_NET_DEFAULT)
1439
+ network = self.evm_network
1423
1440
 
1424
1441
  assert network.lower() in ['mainnet', 'testnet'], f"Invalid network {network}"
1425
1442
 
1426
1443
  assert BaseBlockEngine.is_valid_eth_address(address), "Invalid Ethereum address"
1444
+
1427
1445
 
1428
1446
  if network.lower() == 'mainnet':
1429
1447
  contract_address = dAuth.DAUTH_MAINNET_ND_ADDR
@@ -1431,6 +1449,9 @@ class BaseBlockEngine:
1431
1449
  else:
1432
1450
  contract_address = dAuth.DAUTH_TESTNET_ND_ADDR
1433
1451
  rpc_url = dAuth.DAUTH_TESTNET_RPC
1452
+
1453
+ if debug:
1454
+ self.P(f"Checking if {address} ({network}) is allowed via {rpc_url}...")
1434
1455
 
1435
1456
  w3 = Web3(Web3.HTTPProvider(rpc_url))
1436
1457
 
@@ -1442,7 +1463,7 @@ class BaseBlockEngine:
1442
1463
  return result
1443
1464
 
1444
1465
 
1445
- def web3_get_oracles(self, network=None) -> list:
1466
+ def web3_get_oracles(self, network=None, debug=False) -> list:
1446
1467
  """
1447
1468
  Get the list of oracles from the contract
1448
1469
 
@@ -1458,7 +1479,7 @@ class BaseBlockEngine:
1458
1479
 
1459
1480
  """
1460
1481
  if network is None:
1461
- network = os.environ.get(dAuth.DAUTH_NET_ENV_KEY, dAuth.DAUTH_SDK_NET_DEFAULT)
1482
+ network = BaseBlockEngine.get_evm_network()
1462
1483
 
1463
1484
  assert network.lower() in ['mainnet', 'testnet'], f"Invalid network {network}"
1464
1485
 
@@ -1468,6 +1489,9 @@ class BaseBlockEngine:
1468
1489
  else:
1469
1490
  contract_address = dAuth.DAUTH_TESTNET_ND_ADDR
1470
1491
  rpc_url = dAuth.DAUTH_TESTNET_RPC
1492
+
1493
+ if debug:
1494
+ self.P(f"Getting oracles for {network} via {rpc_url}...")
1471
1495
 
1472
1496
  w3 = Web3(Web3.HTTPProvider(rpc_url))
1473
1497
 
@@ -1532,7 +1556,7 @@ class BaseBlockEngine:
1532
1556
 
1533
1557
  # Network handling
1534
1558
  if network is None:
1535
- network = os.environ.get(dAuth.DAUTH_NET_ENV_KEY, dAuth.DAUTH_SDK_NET_DEFAULT)
1559
+ network = self.evm_network
1536
1560
 
1537
1561
  # URL handling
1538
1562
  if not isinstance(url, str) or len(url) < MIN_LEN:
@@ -1553,9 +1577,9 @@ class BaseBlockEngine:
1553
1577
  self.P("Found dAuth URL in environment: '{}'".format(url), color='g')
1554
1578
  else:
1555
1579
  self.P("Using default dAuth URL: '{}'".format(url), color='g')
1556
-
1580
+ eth_short = self.eth_address[:6] + '...' + self.eth_address[-4:]
1557
1581
  while not done:
1558
- self.P(f"Trying dAuth `{url}` information... (try {tries})")
1582
+ self.P(f"<{eth_short}> ({network}) dAuth with `{url}`... (try {tries + 1} / {max_tries})")
1559
1583
  try:
1560
1584
  to_send = {
1561
1585
  **kwargs,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: naeural_client
3
- Version: 2.7.3
3
+ Version: 2.7.4
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
@@ -1,5 +1,5 @@
1
1
  naeural_client/__init__.py,sha256=YimqgDbjLuywsf8zCWE0EaUXH4MBUrqLxt0TDV558hQ,632
2
- naeural_client/_ver.py,sha256=nDVrulMfL35a57x2FvSgElM6f3wFtjsC43Smx4Z-Jlk,330
2
+ naeural_client/_ver.py,sha256=pQIIzt3yp7bR6azKXxODJfGwEGqxGT47g23SuGyMGrk,330
3
3
  naeural_client/base_decentra_object.py,sha256=C4iwZTkhKNBS4VHlJs5DfElRYLo4Q9l1V1DNVSk1fyQ,4412
4
4
  naeural_client/plugins_manager_mixin.py,sha256=X1JdGLDz0gN1rPnTN_5mJXR8JmqoBFQISJXmPR9yvCo,11106
5
5
  naeural_client/base/__init__.py,sha256=hACh83_cIv7-PwYMM3bQm2IBmNqiHw-3PAfDfAEKz9A,259
@@ -14,7 +14,7 @@ naeural_client/base/webapp_pipeline.py,sha256=ZNGqZ36DY076XVDfGu2Q61kCt3kxIJ4Mi4
14
14
  naeural_client/base/payload/__init__.py,sha256=y8fBI8tG2ObNfaXFWjyWZXwu878FRYj_I8GIbHT4GKE,29
15
15
  naeural_client/base/payload/payload.py,sha256=x-au7l67Z_vfn_4R2C_pjZCaFuUVXHngJiGOfIAYVdE,2690
16
16
  naeural_client/bc/__init__.py,sha256=FQj23D1PrY06NUOARiKQi4cdj0-VxnoYgYDEht8lpr8,158
17
- naeural_client/bc/base.py,sha256=H2ke33T_Iflf_viGvi7ceyJ5S_I_aJLk9UZoTckTzpk,45988
17
+ naeural_client/bc/base.py,sha256=sTdJs_qcg7SlanxizZ2IfPilUR_z7hsBhcFO1fl-Jw0,46457
18
18
  naeural_client/bc/chain.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
19
  naeural_client/bc/ec.py,sha256=-HPfKpYAqy_eZpiJf3gWR2L4ZDDP7fZY2uwdNYYmS80,23868
20
20
  naeural_client/certs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -84,8 +84,8 @@ naeural_client/utils/comm_utils.py,sha256=4cS9llRr_pK_3rNgDcRMCQwYPO0kcNU7AdWy_L
84
84
  naeural_client/utils/config.py,sha256=GzduH5_ZFN39RBdpICDKhx2ZqXen5fF-JJ0RoEcF2wQ,7401
85
85
  naeural_client/utils/dotenv.py,sha256=_AgSo35n7EnQv5yDyu7C7i0kHragLJoCGydHjvOkrYY,2008
86
86
  naeural_client/utils/oracle_sync/oracle_tester.py,sha256=GmZwu2JM9_UB2K-4rKB3o0RgWLqM-7Im6HwBnQLXmHI,25312
87
- naeural_client-2.7.3.dist-info/METADATA,sha256=eFUx-ggIYpO0_8WcUqUVJG9IWyS1ULDRh1OBbKpMvnM,12353
88
- naeural_client-2.7.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
89
- naeural_client-2.7.3.dist-info/entry_points.txt,sha256=CTua17GUrRa4aXeafezGC9TiWKGKQzwTjQmB2jyj22g,91
90
- naeural_client-2.7.3.dist-info/licenses/LICENSE,sha256=cvOsJVslde4oIaTCadabXnPqZmzcBO2f2zwXZRmJEbE,11311
91
- naeural_client-2.7.3.dist-info/RECORD,,
87
+ naeural_client-2.7.4.dist-info/METADATA,sha256=RA9h9UzRdeIGU5pdlf5lrQF4jssDLhkWBlhb5IOz950,12353
88
+ naeural_client-2.7.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
89
+ naeural_client-2.7.4.dist-info/entry_points.txt,sha256=CTua17GUrRa4aXeafezGC9TiWKGKQzwTjQmB2jyj22g,91
90
+ naeural_client-2.7.4.dist-info/licenses/LICENSE,sha256=cvOsJVslde4oIaTCadabXnPqZmzcBO2f2zwXZRmJEbE,11311
91
+ naeural_client-2.7.4.dist-info/RECORD,,