Add WeightToFee and LengthToFee impls to transaction-payment Runtime API (#13110)

* Add WeightToFee and LengthToFee impls to RPC

* Remove RPC additions

* Update frame/transaction-payment/rpc/runtime-api/src/lib.rs

Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>

* Add comments to length_to_fee and weight_to_fee

Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
This commit is contained in:
Stephen Shelton
2023-01-26 07:39:20 -07:00
committed by GitHub
parent 64b55cb170
commit 702963fea4
4 changed files with 39 additions and 4 deletions
@@ -25,7 +25,7 @@ use sp_runtime::traits::MaybeDisplay;
pub use pallet_transaction_payment::{FeeDetails, InclusionFee, RuntimeDispatchInfo};
sp_api::decl_runtime_apis! {
#[api_version(2)]
#[api_version(3)]
pub trait TransactionPaymentApi<Balance> where
Balance: Codec + MaybeDisplay,
{
@@ -33,9 +33,11 @@ sp_api::decl_runtime_apis! {
fn query_info(uxt: Block::Extrinsic, len: u32) -> RuntimeDispatchInfo<Balance, sp_weights::OldWeight>;
fn query_info(uxt: Block::Extrinsic, len: u32) -> RuntimeDispatchInfo<Balance>;
fn query_fee_details(uxt: Block::Extrinsic, len: u32) -> FeeDetails<Balance>;
fn query_weight_to_fee(weight: sp_weights::Weight) -> Balance;
fn query_length_to_fee(length: u32) -> Balance;
}
#[api_version(2)]
#[api_version(3)]
pub trait TransactionPaymentCallApi<Balance, Call>
where
Balance: Codec + MaybeDisplay,
@@ -46,5 +48,11 @@ sp_api::decl_runtime_apis! {
/// Query fee details of a given encoded `Call`.
fn query_call_fee_details(call: Call, len: u32) -> FeeDetails<Balance>;
/// Query the output of the current `WeightToFee` given some input.
fn query_weight_to_fee(weight: sp_weights::Weight) -> Balance;
/// Query the output of the current `LengthToFee` given some input.
fn query_length_to_fee(length: u32) -> Balance;
}
}