fix(account): add default param, get_nonce

- add a default `block_num` parameter 'latest' to get_account_nonce
 - add get_nonce as an alias of get_account_nonce
pull/35/head
MaxMustermann2 2 years ago
parent 6d6c417fe5
commit 218fee615b
No known key found for this signature in database
GPG Key ID: 4F4AB9DB6FF24C94
  1. 8
      pyhmy/account.py

@ -125,7 +125,7 @@ def get_balance_by_block(address, block_num, endpoint=_default_endpoint, timeout
except TypeError as e: except TypeError as e:
raise InvalidRPCReplyError(method, endpoint) from e raise InvalidRPCReplyError(method, endpoint) from e
def get_account_nonce(address, block_num, endpoint=_default_endpoint, timeout=_default_timeout) -> int: def get_account_nonce(address, block_num='latest', endpoint=_default_endpoint, timeout=_default_timeout) -> int:
""" """
Get the account nonce Get the account nonce
@ -165,6 +165,12 @@ def get_account_nonce(address, block_num, endpoint=_default_endpoint, timeout=_d
except TypeError as e: except TypeError as e:
raise InvalidRPCReplyError(method, endpoint) from e raise InvalidRPCReplyError(method, endpoint) from e
def get_nonce(address, block_num='latest', endpoint=_default_endpoint, timeout=_default_timeout) -> int:
"""
See get_account_nonce
"""
return get_account_nonce(address, block_num, endpoint, timeout)
def get_transaction_count(address, block_num, endpoint=_default_endpoint, timeout=_default_timeout) -> int: def get_transaction_count(address, block_num, endpoint=_default_endpoint, timeout=_default_timeout) -> int:
""" """
Get the number of transactions the given address has sent for the given block number Get the number of transactions the given address has sent for the given block number

Loading…
Cancel
Save