commit 9d9ed134c3099d80a55f8f45578dd9ba1fe42256
parent 567a788588075f1ccb08a70c9e1ed27c53ef69f0
Author: lash <dev@holbrook.no>
Date: Thu, 3 Nov 2022 09:02:38 +0000
Add block height to eth-balance call
Diffstat:
3 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/chainlib/eth/cli/config.py b/chainlib/eth/cli/config.py
@@ -32,7 +32,6 @@ def process_config(config, arg, args, flags):
raise ValueError('unknown rpc dialect {}'.format(config.get('RPC_DIALECT')))
if arg.match('wallet', flags):
- if getattr(args, 'z'):
- config.add(True, '_Z')
+ config.add(getattr(args, 'z'), '_Z')
return config
diff --git a/chainlib/eth/runnable/balance.py b/chainlib/eth/runnable/balance.py
@@ -37,6 +37,7 @@ from chainlib.eth.gas import (
balance,
)
from chainlib.eth.settings import process_settings
+from chainlib.eth.jsonrpc import to_blockheight_param
logg = logging.getLogger()
@@ -75,7 +76,8 @@ def main():
r = None
decimals = 18
- o = balance(settings.get('RECIPIENT'), id_generator=settings.get('RPC_ID_GENERATOR'))
+ height = to_blockheight_param(config.get('_HEIGHT'))
+ o = balance(settings.get('RECIPIENT'), id_generator=settings.get('RPC_ID_GENERATOR'), height=height)
r = settings.get('CONN').do(o)
hx = strip_0x(r)
diff --git a/chainlib/eth/settings.py b/chainlib/eth/settings.py
@@ -85,9 +85,12 @@ def process_settings_wallet(settings, config):
settings.set('WALLET', wallet)
- if config.get('_Z'):
- settings.set('RECIPIENT', None)
- return settings
+ try:
+ if config.get('_Z'):
+ settings.set('RECIPIENT', None)
+ return settings
+ except KeyError:
+ pass
recipient_in = None
try: