Skip to content

Perform args validation on command#485

Merged
popenta merged 3 commits into
feat/nextfrom
args-validation
Feb 27, 2025
Merged

Perform args validation on command#485
popenta merged 3 commits into
feat/nextfrom
args-validation

Conversation

@popenta
Copy link
Copy Markdown
Collaborator

@popenta popenta commented Feb 20, 2025

No description provided.

@popenta popenta self-assigned this Feb 20, 2025
@popenta popenta marked this pull request as draft February 20, 2025 14:49
Base automatically changed from switch-to-sdk-native-auth-client to feat/next February 25, 2025 12:48
@popenta popenta marked this pull request as ready for review February 25, 2025 12:49
Comment thread multiversx_sdk_cli/args_validation.py Outdated
raise InvalidArgumentsError("One of --relayer-pem, --relayer-keyfile, or --relayer-ledger must be provided")


def ensure_broadcast_args(args: Any):
Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Collaborator Author

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.

Comment thread multiversx_sdk_cli/args_validation.py Outdated
from multiversx_sdk_cli.errors import InvalidArgumentsError


def ensure_required_transaction_args_are_provided(args: Any):
Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Collaborator Author

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")
Copy link
Copy Markdown
Contributor

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?

Copy link
Copy Markdown
Collaborator Author

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.

Comment thread multiversx_sdk_cli/cli_shared.py Outdated

if chain_id:
return chain_id
else:
Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed, done

@popenta popenta merged commit 9a06b1e into feat/next Feb 27, 2025
@popenta popenta deleted the args-validation branch February 27, 2025 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants