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

            
22
pub use ethereum::{TransactionV0 as LegacyTransaction, TransactionV2 as Transaction};
23
use parity_scale_codec::{Decode, Encode};
24
use sp_runtime::scale_info::TypeInfo;
25
use sp_runtime::traits::Block as BlockT;
26
use sp_runtime::RuntimeDebug;
27
use sp_std::vec::Vec;
28

            
29
#[derive(Eq, PartialEq, Clone, Encode, Decode, RuntimeDebug, TypeInfo)]
30
pub struct TxPoolResponseLegacy {
31
	pub ready: Vec<LegacyTransaction>,
32
	pub future: Vec<LegacyTransaction>,
33
}
34

            
35
#[derive(Eq, PartialEq, Clone, Encode, Decode, RuntimeDebug, TypeInfo)]
36
pub struct TxPoolResponse {
37
	pub ready: Vec<Transaction>,
38
	pub future: Vec<Transaction>,
39
}
40

            
41
20
sp_api::decl_runtime_apis! {
42
20
	#[api_version(2)]
43
20
	pub trait TxPoolRuntimeApi {
44
20
		#[changed_in(2)]
45
20
		fn extrinsic_filter(
46
20
			xt_ready: Vec<<Block as BlockT>::Extrinsic>,
47
20
			xt_future: Vec<<Block as BlockT>::Extrinsic>,
48
20
		) -> TxPoolResponseLegacy;
49
20
		fn extrinsic_filter(
50
20
			xt_ready: Vec<<Block as BlockT>::Extrinsic>,
51
20
			xt_future: Vec<<Block as BlockT>::Extrinsic>,
52
20
		) -> TxPoolResponse;
53
20
	}
54
20
}