-
Notifications
You must be signed in to change notification settings - Fork 2
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
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
dc6b11f
to
7db9571
Compare
pub parent: Option<Parent>, | ||
} | ||
|
||
async fn connect(url: &String) -> eyre::Result<Box<dyn Provider<Ethereum>>> { |
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.
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
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.
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.
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.
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>>> { |
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.
same as above
} | ||
|
||
impl Chain { | ||
pub async fn get_rpc(&self, need_pub_sub: bool) -> eyre::Result<Box<dyn Provider<Ethereum>>> { |
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.
We should cache here otherwise we'll create a WS connection each time this function is called
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)