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

Implement Web3 namespace RPC handler #983

Closed
Tracked by #37
mattsse opened this issue Jan 23, 2023 · 3 comments · Fixed by #990
Closed
Tracked by #37

Implement Web3 namespace RPC handler #983

mattsse opened this issue Jan 23, 2023 · 3 comments · Fixed by #990
Assignees
Labels
A-rpc Related to the RPC implementation C-enhancement New feature or request D-good-first-issue Nice and easy! A great choice to get started

Comments

@mattsse
Copy link
Collaborator

mattsse commented Jan 23, 2023

Describe the feature

Add missing Web3Api type and implementation of

/// Web3 rpc interface.
#[cfg_attr(not(feature = "client"), rpc(server))]
#[cfg_attr(feature = "client", rpc(server, client))]
pub trait Web3Api {
/// Returns current client version.
#[method(name = "web3_clientVersion")]
fn client_version(&self) -> Result<String>;
/// Returns sha3 of the given data.
#[method(name = "web3_sha3")]
fn sha3(&self, input: Bytes) -> Result<H256>;
}

client_version should be included in NetworkInfo I think

Similar to:

/// `admin` API implementation.
///
/// This type provides the functionality for handling `admin` related requests.
pub struct AdminApi {
/// An interface to interact with the network
network: NetworkHandle,
}
impl AdminApi {
/// Creates a new instance of `AdminApi`.
pub fn new(network: NetworkHandle) -> AdminApi {
AdminApi { network }
}
}
#[async_trait]
impl AdminApiServer for AdminApi {

Additional context

No response

@mattsse mattsse added C-enhancement New feature or request D-good-first-issue Nice and easy! A great choice to get started A-rpc Related to the RPC implementation labels Jan 23, 2023
@leruaa
Copy link
Contributor

leruaa commented Jan 23, 2023

I would like to take this on

@leruaa
Copy link
Contributor

leruaa commented Jan 23, 2023

@mattsse What do you think is the best to build client_version? I was thinking to use clap::crate_version!(), and transmit it to NetworkHandle via NetworkConfig.

@mattsse
Copy link
Collaborator Author

mattsse commented Jan 23, 2023

hmm I guess this is just the Client name in NetworkStatus, we can just use that for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rpc Related to the RPC implementation C-enhancement New feature or request D-good-first-issue Nice and easy! A great choice to get started
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants