Skip to content

Commit

Permalink
added new methods
Browse files Browse the repository at this point in the history
  • Loading branch information
tonypony220 committed Dec 31, 2023
1 parent dd86bed commit 2086f69
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
7 changes: 7 additions & 0 deletions crates/rpc/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ use crate::BeerusRpc;
#[rpc(server, namespace = "starknet")]
pub trait BeerusRpc {
// ------------------- Starknet Provider Endpoints -------------------
#[method(name = "specVersion")]
async fn spec_version(&self) -> Result<String, BeerusRpcError>;

#[method(name = "getBlockWithTxHashes")]
async fn get_block_with_tx_hashes(
&self,
Expand Down Expand Up @@ -169,6 +172,10 @@ pub trait BeerusRpc {
#[async_trait]
impl BeerusRpcServer for BeerusRpc {
// ------------------- Starknet Provider Endpoints -------------------
async fn spec_version(&self) -> Result<String, BeerusRpcError> {
self.beerus.starknet_client.spec_version().await.map_err(BeerusRpcError::from)
}

async fn get_block_with_tx_hashes(
&self,
block_id: BlockId,
Expand Down
13 changes: 13 additions & 0 deletions examples/rpc/starknet_specChain.hurl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
POST http://0.0.0.0:3030
Content-Type: application/json
{
"jsonrpc": "2.0",
"method": "starknet_specVersion",
"params": [],
"id": 1
}

HTTP 200
[Asserts]
jsonpath "$.error" not exists
jsonpath "$.result" isString

0 comments on commit 2086f69

Please sign in to comment.