Skip to content

docs(provider): add usage examples to provider README #2313

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

Merged
merged 3 commits into from
May 13, 2025

Conversation

VolodymyrBg
Copy link
Contributor

Motivation

The provider README.md file contained a TODO placeholder in the usage section without any actual examples. This made it difficult for new users to understand how to use the alloy-provider crate effectively. Clear documentation with usage examples is essential for developer adoption and understanding of the library's capabilities.

Solution

Added comprehensive usage examples to the provider README.md file, replacing the "TODO :)" with actual code samples. The examples demonstrate:

  • Basic provider initialization and querying blockchain information
  • Creating a provider with wallet support for transaction signing
  • Advanced provider configuration with chain specification and call batching
  • Local development setup with Anvil

These examples cover the most common use cases and provide a good starting point for users of the alloy-provider crate.

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

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.

@yash-atreya should we do this, given that we already have this in the book?

use alloy_primitives::Address;

#[tokio::main]
async fn main() -> anyhow::Result<()> {
Copy link
Member

Choose a reason for hiding this comment

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

this should juse just Box<dyn Error> here

@jenpaff
Copy link
Contributor

jenpaff commented Apr 19, 2025

@yash-atreya should we do this, given that we already have this in the book?

I don't think it makes sense, I would just link to the book instead

Copy link
Contributor

@jenpaff jenpaff left a comment

Choose a reason for hiding this comment

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

We're currently in the process of updating the alloy book https://alloy.rs/ , we should link to the examples in the book.

@github-project-automation github-project-automation bot moved this to In Progress in Alloy Apr 19, 2025
@VolodymyrBg
Copy link
Contributor Author

We're currently in the process of updating the alloy book https://alloy.rs/ , we should link to the examples in the book.

Like this? or in the book repository?

@mattsse mattsse merged commit 42c8971 into alloy-rs:main May 13, 2025
@github-project-automation github-project-automation bot moved this from In Progress to Done in Alloy May 13, 2025
jgomez360 pushed a commit to jgomez360/alloy that referenced this pull request Jun 15, 2025
* docs(provider): add usage examples to provider README

* Update README.md

* Update README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants