-
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
Refactored delegation transactions #486
Conversation
multiversx_sdk_cli/cli_delegation.py
Outdated
if value < MINIMUM_AMOUNT_TO_DELEGATE: | ||
errors.BadUserInput(f"Value must be greater than {MINIMUM_AMOUNT_TO_DELEGATE} (1 EGLD)") |
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.
Check can be dropped 💭 (time-dependent).
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.
deleted
multiversx_sdk_cli/cli_delegation.py
Outdated
if value < MINIMUM_AMOUNT_TO_DELEGATE: | ||
errors.BadUserInput(f"Value must be greater than {MINIMUM_AMOUNT_TO_DELEGATE} (1 EGLD)") |
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.
As above 💭
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.
deleted
|
||
DELEGATION_MANAGER_SC_ADDRESS_HEX = "000000000000000000010000000000000000000000000000000000000004ffff" |
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.
I think the constant is defined somewhere else, as well (when used for creating staking providers).
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 is not defined anywhere else.
|
||
return tx | ||
|
||
def prepare_transaction_for_automatic_activation(self, owner: IAccount, args: Any) -> Transaction: | ||
delegation_contract = Address.new_from_bech32(args.delegation_contract) | ||
def prepare_transaction_for_automatic_activation( |
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.
Heads-up: in Barnard, this might change (we'll see at that point):
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.
|
||
return tx | ||
|
||
# will be replaced in the future once it's implemented in sdk-py |
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.
👍
multiversx_sdk_cli/cli_delegation.py
Outdated
|
||
|
||
def add_new_nodes(args: Any): | ||
ensure_arguments_are_provided_and_prepared(args) | ||
validate_transaction_args(args) |
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.
can you extract this into a method because they are used in every method
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
sender, nonce = prepare_sender(args) | ||
guardian, guardian_address = prepare_guardian(args) | ||
relayer, relayer_address = prepare_relayer(args) | ||
|
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.
Also can you extract this into a method maybe something like InitializeDelegationOperations
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
@@ -369,66 +390,233 @@ def ensure_arguments_are_provided_and_prepared(args: Any): | |||
cli_shared.prepare_nonce_in_args(args) | |||
|
|||
|
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.
can you set the nonce on the sender and then use it from there?
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.
Yes, done
No description provided.