-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Perform args validation on command #485
Conversation
raise InvalidArgumentsError("One of --relayer-pem, --relayer-keyfile, or --relayer-ledger must be provided") | ||
|
||
|
||
def ensure_broadcast_args(args: Any): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is more like "validate_broadcast_args", since neither is required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
renamed to validate_broadcast_args
.
from multiversx_sdk_cli.errors import InvalidArgumentsError | ||
|
||
|
||
def ensure_required_transaction_args_are_provided(args: Any): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Maybe we can use "validate" or "check" instead of "ensure"? Since the word "ensure" makes us think about required arguments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
"""Ensure that gas_limit is provided.""" | ||
if hasattr(args, "gas_limit") and not args.gas_limit: | ||
if hasattr(args, "estimate_gas") and not args.estimate_gas: | ||
raise InvalidArgumentsError("If --gas-limit not provided, --estimate-gas must be provided") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But we will drop --estimate-gas
in the near future, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's been already dropped in a future PR.
multiversx_sdk_cli/cli_shared.py
Outdated
|
||
if chain_id: | ||
return chain_id | ||
else: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
else
statement can be dropped, and remaining lines unindent-ed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed, done
No description provided.