1// This file is part of Substrate.
23// Copyright (C) Parity Technologies (UK) Ltd.
4// SPDX-License-Identifier: Apache-2.0
56// 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.
1718//! Runtime API definition for transaction payment pallet.
1920#![cfg_attr(not(feature = "std"), no_std)]
2122use codec::Codec;
23use sp_runtime::traits::MaybeDisplay;
2425pub use pallet_transaction_payment::{FeeDetails, InclusionFee, RuntimeDispatchInfo};
2627sp_api::decl_runtime_apis! {
28#[api_version(4)]
29pub trait TransactionPaymentApi<Balance> where
30Balance: Codec + MaybeDisplay,
31 {
32fn query_info(uxt: Block::Extrinsic, len: u32) -> RuntimeDispatchInfo<Balance>;
33fn query_fee_details(uxt: Block::Extrinsic, len: u32) -> FeeDetails<Balance>;
34fn query_weight_to_fee(weight: sp_weights::Weight) -> Balance;
35fn query_length_to_fee(length: u32) -> Balance;
36 }
3738#[api_version(3)]
39pub trait TransactionPaymentCallApi<Balance, Call>
40where
41Balance: Codec + MaybeDisplay,
42 Call: Codec,
43 {
44/// Query information of a dispatch class, weight, and fee of a given encoded `Call`.
45fn query_call_info(call: Call, len: u32) -> RuntimeDispatchInfo<Balance>;
4647/// Query fee details of a given encoded `Call`.
48fn query_call_fee_details(call: Call, len: u32) -> FeeDetails<Balance>;
4950/// Query the output of the current `WeightToFee` given some input.
51fn query_weight_to_fee(weight: sp_weights::Weight) -> Balance;
5253/// Query the output of the current `LengthToFee` given some input.
54fn query_length_to_fee(length: u32) -> Balance;
55 }
56}