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

Adds eth_chainId method call #293

Merged
merged 2 commits into from
Dec 4, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/api/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,11 @@ impl<T: Transport> Eth<T> {
CallFuture::new(self.transport.execute("eth_getCompilers", vec![]))
}

/// Get chain id
pub fn chain_id(&self) -> CallFuture<U256, T::Out> {
CallFuture::new(self.transport.execute("eth_chainId", vec![]))
}

/// Get storage entry
pub fn storage(&self, address: Address, idx: U256, block: Option<BlockNumber>) -> CallFuture<H256, T::Out> {
let address = helpers::serialize(&address);
Expand Down Expand Up @@ -526,6 +531,11 @@ mod tests {
Value::Array(vec![]) => vec![]
);

rpc_test! (
Eth:chain_id => "eth_chainId";
Value::String("0x123".into()) => 0x123
);

rpc_test! (
Eth:storage, Address::from_low_u64_be(0x123), 0x456, None
=>
Expand Down