Skip to content

Commit 24a6820

Browse files
Merge pull request #354 from emiliolalvarez/cert-issuer-fix-web3-support
Cert issuer fix web3 support
2 parents 4057bb2 + f228007 commit 24a6820

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

cert_issuer/blockchain_handlers/ethereum/connectors.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import requests
55
import web3
66
from web3 import Web3, HTTPProvider
7+
from hexbytes import HexBytes
78

89
try:
910
from urllib2 import urlopen, HTTPError
@@ -167,7 +168,7 @@ def __init__(self, ethereum_url):
167168

168169
def broadcast_tx(self, tx):
169170
logging.info('Broadcasting transaction with EthereumRPCProvider')
170-
response = self.w3.eth.sendRawTransaction(tx).hex()
171+
response = self.w3.eth.send_raw_transaction(HexBytes(tx)).hex()
171172
return response
172173

173174
def get_balance(self, address):
@@ -184,7 +185,7 @@ def get_address_nonce(self, address):
184185
Necessary for the transaction creation.
185186
"""
186187
logging.info('Fetching nonce with EthereumRPCProvider')
187-
response = self.w3.eth.getTransactionCount(address, "pending")
188+
response = self.w3.eth.get_transaction_count(address, "pending")
188189
return response
189190

190191

cert_issuer/blockchain_handlers/ethereum/signer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def sign_transaction(self, wif, transaction_to_sign):
3030
if isinstance(transaction_to_sign, dict):
3131
try:
3232
transaction_to_sign['chainId'] = self.netcode
33-
raw_tx = web3.Account.sign_transaction(transaction_to_sign, wif)['rawTransaction']
33+
raw_tx = web3.Account.sign_transaction(transaction_to_sign, wif).raw_transaction
3434
raw_tx_hex = to_hex(raw_tx)
3535
return raw_tx_hex
3636
except Exception as msg:

0 commit comments

Comments
 (0)