From d06242afbe9d9b9b25c85666795b5978baf1a1c1 Mon Sep 17 00:00:00 2001 From: maciejnems Date: Wed, 15 Feb 2023 13:43:14 +0100 Subject: [PATCH] fix build --- e2e-tests/src/test/fee.rs | 59 ++++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 28 deletions(-) diff --git a/e2e-tests/src/test/fee.rs b/e2e-tests/src/test/fee.rs index 8710367933..50acac7a51 100644 --- a/e2e-tests/src/test/fee.rs +++ b/e2e-tests/src/test/fee.rs @@ -1,15 +1,18 @@ -// use aleph_client::{ -// api::transaction_payment::events::TransactionFeePaid, -// pallets::{balances::BalanceUserApi, fee::TransactionPaymentApi, system::SystemSudoApi}, -// utility::BlocksApi, -// AccountId, RootConnection, SignedConnection, TxStatus, -// }; -// use log::info; -// use primitives::Balance; +use aleph_client::{ + api::transaction_payment::events::TransactionFeePaid, + pallets::{balances::BalanceUserApi, fee::TransactionPaymentApi}, + utility::BlocksApi, + AccountId, SignedConnection, TxStatus, +}; +use log::info; +use primitives::Balance; + +// use aleph_client::{RootConnection, pallets::system::SystemSudoApi}; // use sp_runtime::{FixedPointNumber, FixedU128}; // use crate::{config::setup_test, transfer::setup_for_transfer}; +// This test is disabled, as for now we no longer have access to fill_block runtime call // #[tokio::test] // pub async fn fee_calculation() -> anyhow::Result<()> { // let config = setup_test(); @@ -99,27 +102,27 @@ // } // } -// pub async fn current_fees( -// connection: &SignedConnection, -// to: AccountId, -// tip: Option, -// transfer_value: Balance, -// ) -> (Balance, u128) { -// let actual_multiplier = connection.get_next_fee_multiplier(None).await; - -// let tx_info = match tip { -// None => connection.transfer(to, transfer_value, TxStatus::Finalized), -// Some(tip) => connection.transfer_with_tip(to, transfer_value, tip, TxStatus::Finalized), -// } -// .await -// .unwrap(); +pub async fn current_fees( + connection: &SignedConnection, + to: AccountId, + tip: Option, + transfer_value: Balance, +) -> (Balance, u128) { + let actual_multiplier = connection.get_next_fee_multiplier(None).await; -// let events = connection.get_tx_events(tx_info).await.unwrap(); -// let event = events.find_first::().unwrap().unwrap(); + let tx_info = match tip { + None => connection.transfer(to, transfer_value, TxStatus::Finalized), + Some(tip) => connection.transfer_with_tip(to, transfer_value, tip, TxStatus::Finalized), + } + .await + .unwrap(); -// let fee = event.actual_fee; + let events = connection.get_tx_events(tx_info).await.unwrap(); + let event = events.find_first::().unwrap().unwrap(); -// info!("fee payed: {}", fee); + let fee = event.actual_fee; -// (fee, actual_multiplier) -// } + info!("fee payed: {}", fee); + + (fee, actual_multiplier) +}