-
Notifications
You must be signed in to change notification settings - Fork 236
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
fix(provider
): make Caller
EthCall
specific
#1620
Conversation
fn call( | ||
&self, | ||
method: Cow<'static, str>, | ||
params: Params, | ||
) -> TransportResult<ProviderCall<T, serde_json::Value, Resp>> { | ||
params: EthCallParams<'_, N>, | ||
) -> TransportResult<ProviderCall<T, EthCallParams<'static, N>, Resp>> { |
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.
would be nice to have either enum for method or just separate call
/estimate_gas
methods on trait so that custom implementations don't have to match on strings
pub struct EthCallParams<'req, N: Network> { | ||
data: &'req N::TransactionRequest, | ||
data: Cow<'req, N::TransactionRequest>, | ||
block: Option<BlockId>, | ||
overrides: Option<&'req StateOverride>, | ||
overrides: Option<Cow<'req, StateOverride>>, | ||
} |
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.
curious what's usecase for Cow and builder methods here? I'd expect that this wouldn always be constructed through EthCall
builders and both users and custom Caller
implementations wouldn't need to constructor/change this type manually?
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.
approach lgtm, this is already pretty useful as is, just left a couple comments
Resp: RpcReturn, | ||
{ | ||
/// Method that needs to be implemented to convert to a `ProviderCall`. | ||
/// | ||
/// This method handles serialization of the params and sends the request to relevant data | ||
/// source and returns a `ProviderCall`. | ||
/// This method sends the request to relevant data source and returns a `ProviderCall`. | ||
fn call( |
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.
@yash-atreya could we make Caller::call
always output Bytes
and estimate_gas
would output u64? Resp
generic might be tricky to deal with in custom implementations
Motivation
Closes #1471
Solution
data
andoverrides
fields inEthCallParams
to beCow
.EthCallParams
as arg inCaller.call(&self, method, params: EthCallParams<'_, N>)
.ProviderCall
should be used overEthCallParams
PR Checklist