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

Remove reliance on web3 instance for name_to_address_middleware #3021

Closed
Tracked by #2854
fselmo opened this issue Jul 5, 2023 · 0 comments · Fixed by #3169
Closed
Tracked by #2854

Remove reliance on web3 instance for name_to_address_middleware #3021

fselmo opened this issue Jul 5, 2023 · 0 comments · Fixed by #3169
Labels
Breaking Change v7 breaking changes considered for v7

Comments

@fselmo
Copy link
Collaborator

fselmo commented Jul 5, 2023

When we have a v7 branch going, the sync ENS name-to-address middleware can be re-written as:

def name_to_address_middleware(
    make_request: Callable[[RPCEndpoint, Any], Any],
    w3: "Web3",
) -> Middleware:
    normalizers = [
        abi_ens_resolver(w3),
    ]
    middleware = construct_formatting_middleware(
        request_formatters=abi_request_formatters(normalizers, RPC_ABIS)
    )
    return middleware(make_request, w3)

Removing the need to pass in a web3 instance to default_middlewares() in manager.py. It can then be passed in just as the other default middlewares, as the method reference name_to_address_middleware, rather than the method instance name_to_address_middleware(w3).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Breaking Change v7 breaking changes considered for v7
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant