use plutus_ledger_api::{csl::lib as csl, v2::transaction::TransactionHash};
use std::collections::BTreeMap;
use std::future::Future;
use thiserror::Error;
pub trait Submitter {
fn evaluate_transaction(
&self,
tx_builder: &csl::TransactionBuilder,
plutus_scripts: &[csl::PlutusScript],
redeemers: &[csl::Redeemer],
) -> impl Future<
Output = Result<BTreeMap<(csl::RedeemerTag, csl::BigNum), csl::ExUnits>, SubmitterError>,
>;
fn submit_transaction(
&self,
tx: &csl::FixedTransaction,
) -> impl Future<Output = Result<TransactionHash, SubmitterError>>;
fn await_tx_confirm(
&self,
tx_hash: &TransactionHash,
) -> impl Future<Output = Result<(), SubmitterError>>;
}
#[derive(Error, Debug)]
#[error(transparent)]
pub struct SubmitterError(pub anyhow::Error);