-
-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
25 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from eth_account import Account as EthAccount | ||
|
||
try: | ||
# Web3 v7 | ||
from web3.middleware import ExtraDataToPOAMiddleware # type: ignore | ||
except ImportError: | ||
from web3.middleware import geth_poa_middleware as ExtraDataToPOAMiddleware # type: ignore | ||
|
||
|
||
def sign_hash(msghash, private_key): | ||
try: | ||
# Web3 v7 | ||
return EthAccount.unsafe_sign_hash(msghash, private_key) # type: ignore | ||
except AttributeError: | ||
# Web3 v6 | ||
return EthAccount.signHash(msghash, private_key) # type: ignore | ||
|
||
|
||
__all__ = [ | ||
"ExtraDataToPOAMiddleware", | ||
"sign_hash", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters