|
1 | 1 | # -*- coding: utf-8 -*- |
2 | 2 | # ------------------------------------------------------------------------------ |
3 | 3 | # |
4 | | -# Copyright 2023 Valory AG |
| 4 | +# Copyright 2023-2025 Valory AG |
5 | 5 | # |
6 | 6 | # Licensed under the Apache License, Version 2.0 (the "License"); |
7 | 7 | # you may not use this file except in compliance with the License. |
|
29 | 29 | from aea_ledger_ethereum.ethereum import ( |
30 | 30 | SignedTransactionTranslator as BaseSignedTransactionTranslator, |
31 | 31 | ) |
32 | | -from aea_ledger_ethereum.ethereum import ( |
33 | | - TESTNET_NAME, |
34 | | - set_wrapper_for_web3py_session_cache, |
35 | | -) |
| 32 | +from aea_ledger_ethereum.ethereum import TESTNET_NAME |
36 | 33 | from aea_ledger_ethereum_hwi.account import HWIAccount |
37 | 34 | from eth_account.messages import encode_defunct |
38 | 35 | from eth_account.signers.local import LocalAccount |
@@ -152,14 +149,14 @@ def sign_message(self, message: bytes, is_deprecated_mode: bool = False) -> str: |
152 | 149 | if is_deprecated_mode and len(message) == 32: |
153 | 150 | with warnings.catch_warnings(): |
154 | 151 | warnings.simplefilter("ignore") |
155 | | - signature_dict = cast(HWIAccount, self.entity).signHash(message) |
156 | | - signed_msg = signature_dict["signature"].hex() |
| 152 | + signature_dict = cast(HWIAccount, self.entity).unsafe_sign_hash(message) |
| 153 | + signed_msg = signature_dict["signature"].to_0x_hex() |
157 | 154 | else: |
158 | 155 | signable_message = encode_defunct(primitive=message) |
159 | 156 | signature = cast(HWIAccount, self.entity).sign_message( |
160 | 157 | signable_message=signable_message |
161 | 158 | ) |
162 | | - signed_msg = signature["signature"].hex() |
| 159 | + signed_msg = signature["signature"].to_0x_hex() |
163 | 160 | return signed_msg |
164 | 161 |
|
165 | 162 | def sign_transaction(self, transaction: JSONLike, **kwargs: Any) -> JSONLike: |
@@ -230,6 +227,3 @@ class EthereumHWIFaucetApi(EthereumFaucetApi): |
230 | 227 |
|
231 | 228 | identifier = _ETHEREUM_HWI |
232 | 229 | testnet_name = TESTNET_NAME |
233 | | - |
234 | | - |
235 | | -set_wrapper_for_web3py_session_cache() |
0 commit comments