-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: import members to brownie_patch package (#158)
- Loading branch information
1 parent
7d6ae0a
commit b9eb0b0
Showing
2 changed files
with
12 additions
and
6 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
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 |
---|---|---|
@@ -1,14 +1,20 @@ | ||
|
||
from contextlib import suppress | ||
|
||
from dank_mids.helpers import setup_dank_w3_from_sync | ||
from dank_mids.brownie_patch.types import DankContractCall, DankContractMethod, DankContractTx, DankOverloadedMethod | ||
|
||
__all__ = ["DankContractCall", "DankContractMethod", "DankContractTx", "DankOverloadedMethod"] | ||
|
||
# If using dank_mids wih brownie, and brownie is connected when this file executes, you will get a 'dank_w3' async web3 instance with Dank Middleware here. | ||
try: | ||
with suppress(ImportError) | ||
from brownie import network, web3 | ||
|
||
if network.is_connected(): | ||
from dank_mids.brownie_patch.contract import Contract, patch_contract | ||
from web3.eth import AsyncEth as _AsyncEth | ||
|
||
dank_web3 = setup_dank_w3_from_sync(web3) | ||
dank_eth: _AsyncEth = dank_web3.eth | ||
except ImportError: | ||
pass | ||
|
||
__all__ += ["Contract", "patch_contract", "dank_web3", "dank_eth"] |