diff --git a/multiversx_sdk_cli/accounts.py b/multiversx_sdk_cli/accounts.py index 26037d3c..ca53d2a8 100644 --- a/multiversx_sdk_cli/accounts.py +++ b/multiversx_sdk_cli/accounts.py @@ -69,12 +69,12 @@ def __init__(self, def sign_transaction(self, transaction: ITransaction) -> str: assert self.signer is not None - return self.signer.sign(transaction).hex() + return self.signer.sign(transaction.serialize_for_signing()).hex() def sign_message(self, data: bytes) -> str: assert self.signer is not None message = MessageV1(data) - signature = self.signer.sign(message) + signature = self.signer.sign(message.serialize_for_signing()) logger.debug(f"Account.sign_message(): raw_data_to_sign = {data.hex()}, message_data_to_sign = {message.serialize_for_signing().hex()}, signature = {signature.hex()}") return signature.hex() diff --git a/multiversx_sdk_cli/delegation/staking_provider.py b/multiversx_sdk_cli/delegation/staking_provider.py index 61d43d87..1bae35a1 100644 --- a/multiversx_sdk_cli/delegation/staking_provider.py +++ b/multiversx_sdk_cli/delegation/staking_provider.py @@ -2,7 +2,7 @@ from pathlib import Path from typing import Any -from multiversx_sdk_core import Address, ArbitraryMessage +from multiversx_sdk_core import Address from multiversx_sdk_wallet.validator_pem import ValidatorPEM from multiversx_sdk_wallet.validator_signer import ValidatorSigner @@ -52,9 +52,7 @@ def prepare_args_for_add_nodes(args: Any): pem_file = ValidatorPEM.from_file(validator_pem) validator_signer = ValidatorSigner(pem_file.secret_key) - message = ArbitraryMessage(bytes.fromhex(account.address.hex())) - - signed_message = validator_signer.sign(message).hex() + signed_message = validator_signer.sign(account.address.pubkey).hex() add_nodes_data += f"@{pem_file.secret_key.generate_public_key().hex()}@{signed_message}" diff --git a/multiversx_sdk_cli/sign_verify.py b/multiversx_sdk_cli/sign_verify.py index 6e893620..1e79eef2 100644 --- a/multiversx_sdk_cli/sign_verify.py +++ b/multiversx_sdk_cli/sign_verify.py @@ -23,7 +23,7 @@ def verify_signature(self) -> bool: verifier = UserVerifier.from_address(Address.from_bech32(self.address)) verifiable_message = MessageV1.from_string(self.message) verifiable_message.signature = bytes.fromhex(self.signature) - is_signed = verifier.verify(verifiable_message) + is_signed = verifier.verify(verifiable_message.serialize_for_signing(), verifiable_message.signature) return is_signed def to_dictionary(self) -> Dict[str, str]: diff --git a/multiversx_sdk_cli/validators/core.py b/multiversx_sdk_cli/validators/core.py index bc327ad6..e4c3b0b7 100644 --- a/multiversx_sdk_cli/validators/core.py +++ b/multiversx_sdk_cli/validators/core.py @@ -2,7 +2,7 @@ from pathlib import Path from typing import Any, List, Tuple, Union -from multiversx_sdk_core import Address, ArbitraryMessage +from multiversx_sdk_core import Address from multiversx_sdk_wallet.validator_pem import ValidatorPEM from multiversx_sdk_wallet.validator_signer import ValidatorSigner @@ -60,9 +60,7 @@ def prepare_transaction_data_for_stake(node_operator_address: Address, validator pem_file = ValidatorPEM.from_file(validator_pem) validator_signer = ValidatorSigner(pem_file.secret_key) - message = ArbitraryMessage(bytes.fromhex(node_operator_address.hex())) - - signed_message = validator_signer.sign(message).hex() + signed_message = validator_signer.sign(node_operator_address.pubkey).hex() call_arguments.append(f"0x{pem_file.secret_key.generate_public_key().hex()}") call_arguments.append(f"0x{signed_message}") diff --git a/pyproject.toml b/pyproject.toml index e24bb482..178bf3b2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,7 +28,7 @@ dependencies = [ "requests-cache", "rich==13.3.4", "multiversx-sdk-network-providers>=0.11.0", - "multiversx-sdk-wallet>=0.7.0, <0.8.0", + "multiversx-sdk-wallet>=0.8.0", "multiversx-sdk-core>=0.5.0" ] diff --git a/requirements.txt b/requirements.txt index 1038a8ac..cb9ddb4a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,4 +11,4 @@ rich==13.3.4 multiversx-sdk-core==0.6.0 multiversx-sdk-network-providers>=0.11.0 -multiversx-sdk-wallet>=0.7.0, < 0.8.0 +multiversx-sdk-wallet>=0.8.0