mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 22:11:02 +00:00
Estimate message fee api (#600)
* estimate_message_delivery_and_dispatch_fee runtime API * auto-determine message fees in relay * remove fee argument from relay calls * Fix import of weight contant Co-authored-by: Hernando Castano <castano.ha@gmail.com>
This commit is contained in:
committed by
Bastian Köcher
parent
0624fd0d94
commit
9fbb922766
@@ -36,6 +36,9 @@ pub mod kovan;
|
||||
pub mod millau_messages;
|
||||
pub mod rialto_poa;
|
||||
|
||||
use crate::millau_messages::{ToMillauMessagePayload, WithMillauMessageBridge};
|
||||
|
||||
use bridge_runtime_common::messages::{source::estimate_message_dispatch_and_delivery_fee, MessageBridge};
|
||||
use codec::Decode;
|
||||
use pallet_grandpa::{fg_primitives, AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList};
|
||||
use sp_api::impl_runtime_apis;
|
||||
@@ -695,7 +698,17 @@ impl_runtime_apis! {
|
||||
}
|
||||
}
|
||||
|
||||
impl bp_millau::ToMillauOutboundLaneApi<Block> for Runtime {
|
||||
impl bp_millau::ToMillauOutboundLaneApi<Block, Balance, ToMillauMessagePayload> for Runtime {
|
||||
fn estimate_message_delivery_and_dispatch_fee(
|
||||
_lane_id: bp_message_lane::LaneId,
|
||||
payload: ToMillauMessagePayload,
|
||||
) -> Option<Balance> {
|
||||
estimate_message_dispatch_and_delivery_fee::<WithMillauMessageBridge>(
|
||||
&payload,
|
||||
WithMillauMessageBridge::RELAYER_FEE_PERCENT,
|
||||
).ok()
|
||||
}
|
||||
|
||||
fn messages_dispatch_weight(
|
||||
lane: bp_message_lane::LaneId,
|
||||
begin: bp_message_lane::MessageNonce,
|
||||
|
||||
Reference in New Issue
Block a user