2025-11-10 11:56:41 +00:00
|
|
|
// Copyright 2025 DataHaven
|
|
|
|
|
// This file is part of DataHaven.
|
|
|
|
|
|
|
|
|
|
// DataHaven 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.
|
|
|
|
|
|
|
|
|
|
// DataHaven 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 DataHaven. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
2025-04-14 11:40:24 +00:00
|
|
|
use crate::eth::EthCompatRuntimeApiCollection;
|
|
|
|
|
use codec::Codec;
|
|
|
|
|
// Substrate
|
2025-05-08 13:14:30 +00:00
|
|
|
use datahaven_runtime_common::{AccountId, Nonce};
|
2025-04-14 11:40:24 +00:00
|
|
|
use sc_executor::WasmExecutor;
|
|
|
|
|
use sp_runtime::traits::{Block as BlockT, MaybeDisplay};
|
|
|
|
|
|
|
|
|
|
/// Full backend.
|
|
|
|
|
pub type FullBackend<B> = sc_service::TFullBackend<B>;
|
|
|
|
|
/// Full client.
|
|
|
|
|
pub type FullClient<B, RA, HF> = sc_service::TFullClient<B, RA, WasmExecutor<HF>>;
|
|
|
|
|
|
|
|
|
|
/// A set of APIs that every runtime must implement.
|
|
|
|
|
pub trait _BaseRuntimeApiCollection<Block: BlockT>:
|
|
|
|
|
sp_api::ApiExt<Block>
|
|
|
|
|
+ sp_api::Metadata<Block>
|
|
|
|
|
+ sp_block_builder::BlockBuilder<Block>
|
|
|
|
|
+ sp_offchain::OffchainWorkerApi<Block>
|
|
|
|
|
+ sp_session::SessionKeys<Block>
|
|
|
|
|
+ sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block>
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl<Block, Api> _BaseRuntimeApiCollection<Block> for Api
|
|
|
|
|
where
|
|
|
|
|
Block: BlockT,
|
|
|
|
|
Api: sp_api::ApiExt<Block>
|
|
|
|
|
+ sp_api::Metadata<Block>
|
|
|
|
|
+ sp_block_builder::BlockBuilder<Block>
|
|
|
|
|
+ sp_offchain::OffchainWorkerApi<Block>
|
|
|
|
|
+ sp_session::SessionKeys<Block>
|
|
|
|
|
+ sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block>,
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// A set of APIs that template runtime must implement.
|
|
|
|
|
pub trait _RuntimeApiCollection<Block: BlockT, Balance: Codec + MaybeDisplay>:
|
|
|
|
|
_BaseRuntimeApiCollection<Block>
|
|
|
|
|
+ EthCompatRuntimeApiCollection<Block>
|
|
|
|
|
+ sp_consensus_babe::BabeApi<Block>
|
|
|
|
|
+ sp_consensus_grandpa::GrandpaApi<Block>
|
|
|
|
|
+ frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Nonce>
|
|
|
|
|
+ pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance>
|
|
|
|
|
+ fp_rpc::ConvertTransactionRuntimeApi<Block>
|
|
|
|
|
+ fp_rpc::EthereumRuntimeRPCApi<Block>
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl<Block, Balance, Api> _RuntimeApiCollection<Block, Balance> for Api
|
|
|
|
|
where
|
|
|
|
|
Block: BlockT,
|
|
|
|
|
Balance: Codec + MaybeDisplay,
|
|
|
|
|
Api: _BaseRuntimeApiCollection<Block>
|
|
|
|
|
+ EthCompatRuntimeApiCollection<Block>
|
|
|
|
|
+ sp_consensus_babe::BabeApi<Block>
|
|
|
|
|
+ sp_consensus_grandpa::GrandpaApi<Block>
|
|
|
|
|
+ frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Nonce>
|
|
|
|
|
+ pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance>
|
|
|
|
|
+ fp_rpc::ConvertTransactionRuntimeApi<Block>
|
|
|
|
|
+ fp_rpc::EthereumRuntimeRPCApi<Block>,
|
|
|
|
|
{
|
|
|
|
|
}
|