Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add type annotations to zksync module #63

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ transfer = wallet.deposit(
In order to run test you need to run local-setup on your machine. For running tests, use:
```console
make wait
make prepare-tests
make prepare-environment
make run-tests
```

Expand Down
9 changes: 6 additions & 3 deletions zksync2/module/module_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,20 @@
from zksync2.module.middleware import build_zksync_middleware

from typing import Union
from web3._utils.module import attach_modules
from eth_typing import URI
from web3 import Web3


class ZkWeb3(Web3):
zksync: ZkSync


class ZkSyncBuilder:
@classmethod
def build(cls, url: Union[URI, str]) -> Web3:
def build(cls, url: Union[URI, str]) -> ZkWeb3:
web3_module = Web3()
zksync_provider = ZkSyncProvider(url)
zksync_middleware = build_zksync_middleware(zksync_provider)
web3_module.middleware_onion.add(zksync_middleware)
attach_modules(web3_module, {"zksync": (ZkSync,)})
web3_module.zksync = ZkSync(web3_module)
return web3_module
Loading