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(provider): provider examples #3

Merged
merged 13 commits into from
Mar 25, 2024
Merged

feat(provider): provider examples #3

merged 13 commits into from
Mar 25, 2024

Conversation

yash-atreya
Copy link
Member

@yash-atreya yash-atreya commented Mar 14, 2024

  • http
  • ws
  • ipc
  • builder

@yash-atreya yash-atreya marked this pull request as ready for review March 14, 2024 20:44
@zerosnacks zerosnacks changed the title provider examples feat(provider): provider examples Mar 15, 2024
@zerosnacks
Copy link
Member

Pulled in the latest upstream changes and made a few slight stylistic changes

examples/providers/examples/builder.rs Outdated Show resolved Hide resolved
examples/providers/examples/ws.rs Outdated Show resolved Hide resolved
Comment on lines 24 to 27
let provider_with_signer = ProviderBuilder::<_, Ethereum>::new()
.signer(EthereumSigner::from(signer))
.network::<Ethereum>()
.provider(RootProvider::new(rpc_client));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideal UX here is alloy_network::Ethereum::builder().signer(signer).connect(anvil.endpoint()). We should strive to get to that, incl the gas / nonce filling layer being on by default with the option to turn it off with .manual() or something. cc @onbjerg @DaniPopes

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now ::<_, Ethereum> and .network are not necessary anymore: alloy-rs/alloy#304

examples/providers/examples/ws.rs Outdated Show resolved Hide resolved
examples/providers/examples/ws_with_auth.rs Outdated Show resolved Hide resolved
examples/providers/examples/builder.rs Outdated Show resolved Hide resolved
Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm,

needs alloy update and one nit

let rpc_client = RpcClient::new(Http::<Client>::new(anvil.endpoint().parse().unwrap()), false);
let provider_with_signer = ProviderBuilder::<_, Ethereum>::new()
.signer(EthereumSigner::from(signer))
.network::<Ethereum>()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this shouldn't be necessary anymore

examples/providers/Cargo.toml Outdated Show resolved Hide resolved
@yash-atreya yash-atreya merged commit 78d6035 into main Mar 25, 2024
2 checks passed
@zerosnacks zerosnacks deleted the provider_examples branch March 27, 2024 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants