-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Implement web3_clientVersion (#223)
* feat: Implement web3_clientVersion * lint fix --------- Co-authored-by: Dustin Brickwood <[email protected]>
- Loading branch information
1 parent
134805d
commit 7f68fc4
Showing
13 changed files
with
99 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { expect } from "chai"; | ||
import { getTestProvider } from "../helpers/utils"; | ||
|
||
const provider = getTestProvider(); | ||
|
||
describe("web3_clientVersion", function () { | ||
it("Should return zkSync/v2.0", async function () { | ||
// Arrange | ||
const expectedClientVersion = "zkSync/v2.0"; | ||
|
||
// Act | ||
const response: string = await provider.send("web3_clientVersion", []); | ||
|
||
// Assert | ||
expect(response).to.equal(expectedClientVersion); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
use jsonrpc_derive::rpc; | ||
|
||
use crate::namespaces::Result; | ||
|
||
#[rpc] | ||
pub trait Web3NamespaceT { | ||
#[rpc(name = "web3_clientVersion", returns = "String")] | ||
fn web3_client_version(&self) -> Result<String>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ mod hardhat; | |
mod in_memory; | ||
mod in_memory_ext; | ||
mod net; | ||
mod web3; | ||
mod zks; | ||
|
||
pub use in_memory::*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
use crate::{ | ||
fork::ForkSource, | ||
namespaces::{Result, Web3NamespaceT}, | ||
node::InMemoryNode, | ||
}; | ||
|
||
impl<S: ForkSource + std::fmt::Debug + Clone + Send + Sync + 'static> Web3NamespaceT | ||
for InMemoryNode<S> | ||
{ | ||
fn web3_client_version(&self) -> Result<String> { | ||
Ok("zkSync/v2.0".to_string()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters