From 274824cc9a68fed9581fa6515212a7bc18039388 Mon Sep 17 00:00:00 2001 From: badrogger Date: Sun, 29 Dec 2019 15:25:40 +0200 Subject: [PATCH] Hotfix consistent sign and send --- skale/wallets/common.py | 2 +- skale/wallets/ledger_wallet.py | 8 ++++---- skale/wallets/sgx_wallet.py | 4 ++-- skale/wallets/web3_wallet.py | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/skale/wallets/common.py b/skale/wallets/common.py index 8b0ce12d..f260c7d0 100644 --- a/skale/wallets/common.py +++ b/skale/wallets/common.py @@ -26,7 +26,7 @@ def sign(self, tx): pass @abstractmethod - def sign_and_send(self, tx_dict): + def sign_and_send(self, tx_dict) -> str: pass @property diff --git a/skale/wallets/ledger_wallet.py b/skale/wallets/ledger_wallet.py index 117b40fd..9c294dab 100644 --- a/skale/wallets/ledger_wallet.py +++ b/skale/wallets/ledger_wallet.py @@ -135,9 +135,9 @@ def sign(self, tx_dict): exchange_result = self.exchange_sign_payload_by_chunks(payload) return LedgerWallet.parse_sign_result(tx, exchange_result) - def sign_and_send(self, tx): + def sign_and_send(self, tx) -> str: signed_tx = self.sign(tx) - return self._web3.eth.sendRawTransaction(signed_tx.rawTransaction) + return self._web3.eth.sendRawTransaction(signed_tx.rawTransaction).hex() @classmethod def parse_derive_result(cls, exchange_result): @@ -164,7 +164,7 @@ def get_address_with_public_key(self): return LedgerWallet.parse_derive_result(exchange_result) -def hardware_sign_and_send(web3, method, gas_amount, wallet): +def hardware_sign_and_send(web3, method, gas_amount, wallet) -> str: address_from = wallet['address'] eth_nonce = get_eth_nonce(web3, address_from) tx_dict = method.buildTransaction({ @@ -172,7 +172,7 @@ def hardware_sign_and_send(web3, method, gas_amount, wallet): 'nonce': eth_nonce }) signed_txn = wallet.sign(tx_dict) - tx = web3.eth.sendRawTransaction(signed_txn.rawTransaction) + tx = web3.eth.sendRawTransaction(signed_txn.rawTransaction).hex() logger.info( f'{method.__class__.__name__} - transaction_hash: {web3.toHex(tx)}' ) diff --git a/skale/wallets/sgx_wallet.py b/skale/wallets/sgx_wallet.py index 0df2c22a..c4b1699b 100644 --- a/skale/wallets/sgx_wallet.py +++ b/skale/wallets/sgx_wallet.py @@ -37,9 +37,9 @@ def sign(self, tx_dict): tx_dict['nonce'] = get_eth_nonce(self._web3, self._address) return self.sgx_client.sign(tx_dict, self.key_name) - def sign_and_send(self, tx): + def sign_and_send(self, tx) -> str: signed_tx = self.sgx_client.sign(tx, self.key_name) - return self._web3.eth.sendRawTransaction(signed_tx.rawTransaction) + return self._web3.eth.sendRawTransaction(signed_tx.rawTransaction).hex() @property def address(self): diff --git a/skale/wallets/web3_wallet.py b/skale/wallets/web3_wallet.py index 0b16f6aa..5d128897 100644 --- a/skale/wallets/web3_wallet.py +++ b/skale/wallets/web3_wallet.py @@ -66,9 +66,9 @@ def sign(self, tx_dict): private_key=self._private_key ) - def sign_and_send(self, tx_dict): + def sign_and_send(self, tx_dict) -> str: signed_tx = self.sign(tx_dict) - return self._web3.eth.sendRawTransaction(signed_tx.rawTransaction) + return self._web3.eth.sendRawTransaction(signed_tx.rawTransaction).hex() @property def address(self):