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_std::vec::Vec;
27
28#[derive(Eq, PartialEq, Clone, Encode, Decode, Debug, TypeInfo)]
29pub struct TxPoolResponseLegacy {
30    pub ready: Vec<LegacyTransaction>,
31    pub future: Vec<LegacyTransaction>,
32}
33
34#[derive(Eq, PartialEq, Clone, Encode, Decode, Debug, TypeInfo)]
35pub struct TxPoolResponse {
36    pub ready: Vec<Transaction>,
37    pub future: Vec<Transaction>,
38}
39
40sp_api::decl_runtime_apis! {
41    #[api_version(2)]
42    pub trait TxPoolRuntimeApi {
43        #[changed_in(2)]
44        fn extrinsic_filter(
45            xt_ready: Vec<<Block as BlockT>::Extrinsic>,
46            xt_future: Vec<<Block as BlockT>::Extrinsic>,
47        ) -> TxPoolResponseLegacy;
48        fn extrinsic_filter(
49            xt_ready: Vec<<Block as BlockT>::Extrinsic>,
50            xt_future: Vec<<Block as BlockT>::Extrinsic>,
51        ) -> TxPoolResponse;
52    }
53}