Skip to content

Commit

Permalink
fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
maciejnems committed Feb 15, 2023
1 parent 41b821d commit d06242a
Showing 1 changed file with 31 additions and 28 deletions.
59 changes: 31 additions & 28 deletions e2e-tests/src/test/fee.rs
Original file line number Diff line number Diff line change
@@ -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();
Expand Down Expand Up @@ -99,27 +102,27 @@
// }
// }

// pub async fn current_fees(
// connection: &SignedConnection,
// to: AccountId,
// tip: Option<Balance>,
// 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<Balance>,
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::<TransactionFeePaid>().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::<TransactionFeePaid>().unwrap().unwrap();

// info!("fee payed: {}", fee);
let fee = event.actual_fee;

// (fee, actual_multiplier)
// }
info!("fee payed: {}", fee);

(fee, actual_multiplier)
}

0 comments on commit d06242a

Please sign in to comment.