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

Use official chain list #14

Merged
merged 5 commits into from
Apr 6, 2024
Merged

Use official chain list #14

merged 5 commits into from
Apr 6, 2024

Conversation

ligustah
Copy link
Collaborator

@ligustah ligustah commented Apr 5, 2024

Using the official chain list we can easily create RPC clients for any of the chains. Can update in future to allow overwriting URLs for specific chains (e.g. using our internal proxy in our deployment instead of the public url)

Copy link
Collaborator Author

ligustah commented Apr 5, 2024

@ligustah ligustah force-pushed the rich-rule-evaluation-results branch from dc6b11f to 7db9571 Compare April 5, 2024 10:05
@ligustah ligustah requested a review from erikreppel April 5, 2024 10:06
@ligustah ligustah marked this pull request as ready for review April 5, 2024 10:06
@ligustah ligustah mentioned this pull request Apr 5, 2024
justfile Show resolved Hide resolved
pub parent: Option<Parent>,
}

async fn connect(url: &String) -> eyre::Result<Box<dyn Provider<Ethereum>>> {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: it might be better to do connect<T>(url: &String) -> eyre::Result<T> where T: Provider<E>, E: Ethereum
just so downstream doesnt have to use a boxed type for everything

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The on_builtin works with both http and ws urls, so the actual return type depends on the URL that is passed in. Don't think that can be typed without the box.

Copy link
Contributor

Choose a reason for hiding this comment

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

you just use a generic for the network type (similar to how you use E: Ethereum in the first comment)

}

impl Chain {
pub async fn get_rpc(&self, need_pub_sub: bool) -> eyre::Result<Box<dyn Provider<Ethereum>>> {
Copy link
Contributor

Choose a reason for hiding this comment

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

same as above

}

impl Chain {
pub async fn get_rpc(&self, need_pub_sub: bool) -> eyre::Result<Box<dyn Provider<Ethereum>>> {
Copy link
Contributor

Choose a reason for hiding this comment

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

We should cache here otherwise we'll create a WS connection each time this function is called

Copy link
Collaborator Author

ligustah commented Apr 6, 2024

Merge activity

  • Apr 6, 7:28 PM EDT: @ligustah started a stack merge that includes this pull request via Graphite.
  • Apr 6, 7:31 PM EDT: Graphite rebased this pull request as part of a merge.
  • Apr 6, 7:32 PM EDT: @ligustah merged this pull request with Graphite.

@ligustah ligustah changed the base branch from rich-rule-evaluation-results to main April 6, 2024 23:29
@ligustah ligustah merged commit cd5423f into main Apr 6, 2024
3 checks passed
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.

2 participants