From 25676bd43a8c6776fad31ee75a82dc7e0a2aeb72 Mon Sep 17 00:00:00 2001 From: moisses89 <7888669+moisses89@users.noreply.github.com> Date: Wed, 17 Jan 2024 10:55:10 +0100 Subject: [PATCH] Return bytes instead HexStr --- safe_cli/operators/hw_wallets/hw_wallet.py | 3 +-- safe_cli/operators/hw_wallets/ledger_wallet.py | 7 ++++--- safe_cli/operators/hw_wallets/trezor_wallet.py | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/safe_cli/operators/hw_wallets/hw_wallet.py b/safe_cli/operators/hw_wallets/hw_wallet.py index ac176174..337b429c 100644 --- a/safe_cli/operators/hw_wallets/hw_wallet.py +++ b/safe_cli/operators/hw_wallets/hw_wallet.py @@ -1,7 +1,6 @@ import re from abc import ABC, abstractmethod -from eth_typing import HexStr from web3.types import TxParams from .constants import BIP32_ETH_PATTERN, BIP32_LEGACY_LEDGER_PATTERN @@ -50,7 +49,7 @@ def sign_typed_hash(self, domain_hash: bytes, message_hash: bytes) -> bytes: @abstractmethod def get_signed_raw_transaction( self, tx_parameters: TxParams, chain_id: int - ) -> HexStr: + ) -> bytes: """ :param chain_id: diff --git a/safe_cli/operators/hw_wallets/ledger_wallet.py b/safe_cli/operators/hw_wallets/ledger_wallet.py index 4ed99a40..9b02ae4d 100644 --- a/safe_cli/operators/hw_wallets/ledger_wallet.py +++ b/safe_cli/operators/hw_wallets/ledger_wallet.py @@ -1,6 +1,7 @@ from typing import Optional -from eth_typing import ChecksumAddress, HexStr +from eth_typing import ChecksumAddress +from hexbytes import HexBytes from ledgerblue.Dongle import Dongle from ledgereth import create_transaction, sign_typed_data_draft from ledgereth.accounts import get_account_by_path @@ -54,7 +55,7 @@ def sign_typed_hash(self, domain_hash: bytes, message_hash: bytes) -> bytes: @raise_ledger_exception_as_hw_wallet_exception def get_signed_raw_transaction( self, tx_parameters: TxParams, chain_id: int - ) -> HexStr: + ) -> bytes: """ :param chain_id: @@ -73,4 +74,4 @@ def get_signed_raw_transaction( sender_path=self.derivation_path, dongle=self.dongle, ) - return signed_transaction.raw_transaction() + return HexBytes(signed_transaction.raw_transaction()) diff --git a/safe_cli/operators/hw_wallets/trezor_wallet.py b/safe_cli/operators/hw_wallets/trezor_wallet.py index b09de6d6..ba41b752 100644 --- a/safe_cli/operators/hw_wallets/trezor_wallet.py +++ b/safe_cli/operators/hw_wallets/trezor_wallet.py @@ -1,7 +1,7 @@ from functools import lru_cache import rlp -from eth_typing import ChecksumAddress, HexStr +from eth_typing import ChecksumAddress from hexbytes import HexBytes from trezorlib import tools from trezorlib.client import TrezorClient, get_default_client @@ -61,7 +61,7 @@ def sign_typed_hash(self, domain_hash: bytes, message_hash: bytes) -> bytes: @raise_trezor_exception_as_hw_wallet_exception def get_signed_raw_transaction( self, tx_parameters: TxParams, chain_id: int - ) -> HexStr: + ) -> bytes: """ :param chain_id: @@ -131,4 +131,4 @@ def get_signed_raw_transaction( ] ).hex() - return HexStr(encoded_transaction) + return HexBytes(encoded_transaction)