moonbeam_rpc_primitives_txpool/
lib.rs

1// Copyright 2019-2025 PureStake Inc.
2// This file is part of Moonbeam.
3
4// Moonbeam is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8
9// Moonbeam is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12// GNU General Public License for more details.
13
14// You should have received a copy of the GNU General Public License
15// along with Moonbeam.  If not, see <http://www.gnu.org/licenses/>.
16
17#![cfg_attr(not(feature = "std"), no_std)]
18// These clippy lints are disabled because the macro-generated code triggers them.
19#![allow(clippy::unnecessary_mut_passed)]
20#![allow(clippy::too_many_arguments)]
21
22pub use ethereum::{TransactionV0 as LegacyTransaction, TransactionV3 as Transaction};
23use parity_scale_codec::{Decode, Encode};
24use sp_runtime::scale_info::TypeInfo;
25use sp_runtime::traits::Block as BlockT;
26use sp_runtime::RuntimeDebug;
27use sp_std::vec::Vec;
28
29#[derive(Eq, PartialEq, Clone, Encode, Decode, RuntimeDebug, TypeInfo)]
30pub struct TxPoolResponseLegacy {
31	pub ready: Vec<LegacyTransaction>,
32	pub future: Vec<LegacyTransaction>,
33}
34
35#[derive(Eq, PartialEq, Clone, Encode, Decode, RuntimeDebug, TypeInfo)]
36pub struct TxPoolResponse {
37	pub ready: Vec<Transaction>,
38	pub future: Vec<Transaction>,
39}
40
41sp_api::decl_runtime_apis! {
42	#[api_version(2)]
43	pub trait TxPoolRuntimeApi {
44		#[changed_in(2)]
45		fn extrinsic_filter(
46			xt_ready: Vec<<Block as BlockT>::Extrinsic>,
47			xt_future: Vec<<Block as BlockT>::Extrinsic>,
48		) -> TxPoolResponseLegacy;
49		fn extrinsic_filter(
50			xt_ready: Vec<<Block as BlockT>::Extrinsic>,
51			xt_future: Vec<<Block as BlockT>::Extrinsic>,
52		) -> TxPoolResponse;
53	}
54}