referrerpolicy=no-referrer-when-downgrade

pallet_transaction_payment_rpc_runtime_api/
lib.rs

1// This file is part of Substrate.
2
3// Copyright (C) Parity Technologies (UK) Ltd.
4// SPDX-License-Identifier: Apache-2.0
5
6// Licensed under the Apache License, Version 2.0 (the "License");
7// you may not use this file except in compliance with the License.
8// You may obtain a copy of the License at
9//
10// 	http://www.apache.org/licenses/LICENSE-2.0
11//
12// Unless required by applicable law or agreed to in writing, software
13// distributed under the License is distributed on an "AS IS" BASIS,
14// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15// See the License for the specific language governing permissions and
16// limitations under the License.
17
18//! Runtime API definition for transaction payment pallet.
19
20#![cfg_attr(not(feature = "std"), no_std)]
21
22use codec::Codec;
23use sp_runtime::traits::MaybeDisplay;
24
25pub use pallet_transaction_payment::{FeeDetails, InclusionFee, RuntimeDispatchInfo};
26
27sp_api::decl_runtime_apis! {
28	#[api_version(4)]
29	pub trait TransactionPaymentApi<Balance> where
30		Balance: Codec + MaybeDisplay,
31	{
32		fn query_info(uxt: Block::Extrinsic, len: u32) -> RuntimeDispatchInfo<Balance>;
33		fn query_fee_details(uxt: Block::Extrinsic, len: u32) -> FeeDetails<Balance>;
34		fn query_weight_to_fee(weight: sp_weights::Weight) -> Balance;
35		fn query_length_to_fee(length: u32) -> Balance;
36	}
37
38	#[api_version(3)]
39	pub trait TransactionPaymentCallApi<Balance, Call>
40	where
41		Balance: Codec + MaybeDisplay,
42		Call: Codec,
43	{
44		/// Query information of a dispatch class, weight, and fee of a given encoded `Call`.
45		fn query_call_info(call: Call, len: u32) -> RuntimeDispatchInfo<Balance>;
46
47		/// Query fee details of a given encoded `Call`.
48		fn query_call_fee_details(call: Call, len: u32) -> FeeDetails<Balance>;
49
50		/// Query the output of the current `WeightToFee` given some input.
51		fn query_weight_to_fee(weight: sp_weights::Weight) -> Balance;
52
53		/// Query the output of the current `LengthToFee` given some input.
54		fn query_length_to_fee(length: u32) -> Balance;
55	}
56}