Revert "Revert "override conversion rate in estimate-message-fee RPC (#1189)" (#1275)" (#1333)

This reverts commit ffd25db46c5855bcef6710b53d5ca3325ce54e56.
This commit is contained in:
Svyatoslav Nikolsky
2022-03-02 09:35:42 +03:00
committed by Bastian Köcher
parent bc1dcb7548
commit 0ef401ae53
14 changed files with 85 additions and 21 deletions
@@ -21,6 +21,7 @@ use crate::{
use bp_runtime::BalanceOf;
use codec::{Decode, Encode};
use relay_substrate_client::Chain;
use sp_runtime::FixedU128;
use structopt::StructOpt;
use strum::VariantNames;
@@ -72,8 +73,13 @@ pub(crate) async fn estimate_message_delivery_and_dispatch_fee<Fee: Decode, C: C
lane: bp_messages::LaneId,
payload: P,
) -> anyhow::Result<Fee> {
let conversion_rate_override: Option<FixedU128> = None;
let encoded_response = client
.state_call(estimate_fee_method.into(), (lane, payload).encode().into(), None)
.state_call(
estimate_fee_method.into(),
(lane, payload, conversion_rate_override).encode().into(),
None,
)
.await?;
let decoded_response: Option<Fee> = Decode::decode(&mut &encoded_response.0[..])
.map_err(relay_substrate_client::Error::ResponseParseFailed)?;