-
Notifications
You must be signed in to change notification settings - Fork 486
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add rpc v2 types and api (#1427)
- Loading branch information
Showing
33 changed files
with
3,710 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,13 @@ | ||
[package] | ||
name = "fc-rpc-v2" | ||
version = "2.0.0-dev" | ||
license = "GPL-3.0-or-later WITH Classpath-exception-2.0" | ||
description = "Ethereum RPC (web3) compatibility layer for Substrate." | ||
authors = { workspace = true } | ||
edition = { workspace = true } | ||
repository = { workspace = true } | ||
|
||
[package.metadata.docs.rs] | ||
targets = ["x86_64-unknown-linux-gnu"] | ||
|
||
[dependencies] |
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,15 @@ | ||
[package] | ||
name = "fc-rpc-v2-api" | ||
version = "0.1.0" | ||
license = "GPL-3.0-or-later WITH Classpath-exception-2.0" | ||
description = "Ethereum RPC (web3) interfaces." | ||
authors = { workspace = true } | ||
edition = { workspace = true } | ||
repository = { workspace = true } | ||
|
||
[dependencies] | ||
ethereum-types = { workspace = true } | ||
jsonrpsee = { workspace = true, features = ["client-core", "server-core", "macros"] } | ||
|
||
# Frontier | ||
fc-rpc-v2-types = { workspace = true } |
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,47 @@ | ||
// This file is part of Frontier. | ||
|
||
// Copyright (C) Parity Technologies (UK) Ltd. | ||
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 | ||
|
||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
|
||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
|
||
// You should have received a copy of the GNU General Public License | ||
// along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
use ethereum_types::H256; | ||
use jsonrpsee::{core::RpcResult, proc_macros::rpc}; | ||
|
||
use crate::types::{block_id::BlockNumberOrTagOrHash, bytes::Bytes}; | ||
|
||
/// Debug RPC interface. | ||
#[rpc(client, server, namespace = "debug")] | ||
#[async_trait] | ||
pub trait DebugApi { | ||
/// Returns an RLP-encoded header. | ||
#[method(name = "getRawHeader")] | ||
async fn raw_header(&self, block: BlockNumberOrTagOrHash) -> RpcResult<Option<Bytes>>; | ||
|
||
/// Returns an RLP-encoded block. | ||
#[method(name = "getRawBlock")] | ||
async fn raw_block(&self, block: BlockNumberOrTagOrHash) -> RpcResult<Option<Bytes>>; | ||
|
||
/// Returns the EIP-2718 binary-encoded transaction. | ||
#[method(name = "getRawTransaction")] | ||
async fn raw_transaction(&self, transaction_hash: H256) -> RpcResult<Option<Bytes>>; | ||
|
||
/// Returns an array of EIP-2718 binary-encoded receipts. | ||
#[method(name = "getRawReceipts")] | ||
async fn raw_receipts(&self, block: BlockNumberOrTagOrHash) -> RpcResult<Vec<Bytes>>; | ||
|
||
/// Returns an array of recent bad blocks that the client has seen on the network. | ||
#[method(name = "getBadBlocks")] | ||
async fn bad_blocks(&self) -> RpcResult<Vec<()>>; | ||
} |
Oops, something went wrong.