Skip to content

Commit

Permalink
Adds eth_chainId method call (#293)
Browse files Browse the repository at this point in the history
  • Loading branch information
tuler authored and tomusdrw committed Dec 4, 2019
1 parent dd544d5 commit 91180b7
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/api/eth.rs
Expand Up @@ -166,6 +166,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 @@ -541,6 +546,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

0 comments on commit 91180b7

Please sign in to comment.