naeural-client 3.0.9__py3-none-any.whl → 3.1.1__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__ = "3.0.9"
1
+ __VER__ = "3.1.1"
2
2
 
3
3
  if __name__ == "__main__":
4
4
  with open("pyproject.toml", "rt") as fd:
@@ -3000,6 +3000,7 @@ class GenericSession(BaseDecentrAIObject):
3000
3000
 
3001
3001
  eth: bool, optional
3002
3002
  If True, will use the nodes eth addresses instead of internal. Defaults to False.
3003
+ It will also display extra info about node wallets (ETH and $R1 balances)
3003
3004
 
3004
3005
  all_info: bool, optional
3005
3006
  If True, will return all the information. Defaults to False.
@@ -3032,10 +3033,17 @@ class GenericSession(BaseDecentrAIObject):
3032
3033
  if all_info:
3033
3034
  mapping = OrderedDict({
3034
3035
  # we assign dummy integer values to the computed columns
3035
- # and we will fillter them
3036
+ # and we will filter them
3036
3037
  'ETH Address': 1,
3037
3038
  **mapping
3038
3039
  })
3040
+ if eth or all_info:
3041
+ mapping = OrderedDict({
3042
+ **mapping,
3043
+ 'ETH' : 2,
3044
+ '$R1' : 3,
3045
+ })
3046
+ # end if eth or all_info
3039
3047
  res = OrderedDict()
3040
3048
  for k in mapping:
3041
3049
  res[k] = []
@@ -3074,6 +3082,7 @@ class GenericSession(BaseDecentrAIObject):
3074
3082
  continue
3075
3083
  for key, column in reverse_mapping.items():
3076
3084
  if isinstance(key, int):
3085
+ # if the key is an integer, then it is a computed column
3077
3086
  continue
3078
3087
  val = node_info.get(key, None)
3079
3088
  if key == PAYLOAD_DATA.NETMON_LAST_REMOTE_TIME:
@@ -3088,16 +3097,26 @@ class GenericSession(BaseDecentrAIObject):
3088
3097
  # again self.get_node_alias(best_super) might not work if using the hb data
3089
3098
  best_super_alias = node_info.get(PAYLOAD_DATA.NETMON_EEID, None)
3090
3099
  val = self.bc_engine._add_prefix(val)
3100
+ add_balance = False
3091
3101
  if all_info:
3092
3102
  val_eth = self.bc_engine.node_address_to_eth_address(val)
3093
3103
  res['ETH Address'].append(val_eth)
3104
+ eth_addr = val_eth
3105
+ add_balance = True
3094
3106
  elif eth:
3095
3107
  val = self.bc_engine.node_address_to_eth_address(val)
3108
+ eth_addr = val
3109
+ add_balance = True
3110
+ if add_balance:
3111
+ eth_balance = self.bc_engine.web3_get_balance_eth(val)
3112
+ r1_balance = self.bc_engine.web3_get_balance_r1(val)
3113
+ res['ETH'].append(round(eth_balance,4))
3114
+ res['$R1'].append(round(r1_balance,4))
3096
3115
  elif key == PAYLOAD_DATA.NETMON_WHITELIST:
3097
3116
  val = client_is_allowed
3098
3117
  elif key in [PAYLOAD_DATA.NETMON_STATUS_KEY, PAYLOAD_DATA.NETMON_NODE_VERSION]:
3099
3118
  val = val.split(' ')[0]
3100
- res[column].append(val)
3119
+ res[column].append(val)
3101
3120
  # end for
3102
3121
  # end if
3103
3122
  pd.options.display.float_format = '{:.1f}'.format
naeural_client/bc/base.py CHANGED
@@ -815,7 +815,7 @@ class BaseBlockEngine(_EVMMixin):
815
815
 
816
816
  """
817
817
  if from_file and os.path.isfile(source):
818
- self.P("Reading SK from '{}'".format(source), verbosity=1)
818
+ self.P("Reading SK from '{}'".format(source), verbosity=2)
819
819
  with open(source, 'rt') as fh:
820
820
  data = fh.read()
821
821
  else: