-
Notifications
You must be signed in to change notification settings - Fork 38
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(providers
): wrapped provider
#171
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also need impl Provider
return type statement and Contract
example
/// Creates and returns an implementation of the [`Provider`] trait. | ||
async fn get_provider(url: &str) -> TransportResult<impl Provider> { | ||
ProviderBuilder::new().on_builtin(url).await | ||
} | ||
|
||
/// Simple free function to get the latest block number. | ||
async fn get_block_number<P: Provider>(provider: &P) -> TransportResult<u64> { | ||
provider.get_block_number().await | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can get remove these standalone functions?
these look a bit weird and you wouldn't write it like this
Motivation
Ref alloy-rs/alloy#1859
Solution
Demonstrate how to pass a provider in a free function and wrap it in a custom type
Merge after
alloy 0.1
bumpPR Checklist