-
Notifications
You must be signed in to change notification settings - Fork 441
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
Matchmaker Client #18
Conversation
/// Create a new client with the given signer and chain | ||
pub fn new(signer: S, chain: Chain) -> Self { | ||
let url = match chain { | ||
Chain::Mainnet => "https://relay.flashbots.net:443", |
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.
Might be a good idea to add a constants file for the relay urls and other urls that are common amongst MEV strategies even though the relay url is passed into the flashbots executor as a parameter
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.
just a small suggestion but it works well!
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.
Thanks! Will pull out into a constants file once these start appearing in the codebase more often
attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables)) | ||
))] | ||
|
||
//! Client library for Flashbots MEV-share Matchmaker, fulfilling the |
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.
good!
// mock service that returns the request headers | ||
let svc = FlashbotsSigner { | ||
signer: fb_signer.clone(), | ||
inner: service_fn(|_req: Request<Body>| async { |
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.
Nice!
/// Matchmaker client to interact with MEV-share | ||
pub struct Client<S> { | ||
/// Underlying HTTP client | ||
pub http_client: HttpClient<FlashbotsSigner<S, HttpBackend>>, | ||
} |
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.
This is 👍 given you use jsonrpsee, you could also have done it this way: https://github.com/onbjerg/ethers-flashbots/blob/master/src/relay.rs#L83-L101, just using reqwest
, but maybe you had other reasons not to?
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.
yep! Writing the tower middleware felt a bit cleaner since it allowed us to take advantage of jsonrpsee instead of copying in snippets of json-rpc code, but both work
* executor * lints
Co-authored-by: Georgios Konstantopoulos <[email protected]>
Co-authored-by: Georgios Konstantopoulos <[email protected]>
An client implementation of MEV-share's matchmaker. We implement flashbots-style authentication as a tower middleware