zaru-core 0.1.0

A secure payment model engine with transaction state machine and cryptographic verification
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use async_trait::async_trait;

use crate::amount::Amount;
use crate::settlement::types::SettlementStatus;
use crate::transaction::{Transaction, TxId, Verified};

#[async_trait]
pub trait SettlementLayer {
    type Error;

    async fn submit(&self, tx: Transaction<Verified>) -> Result<TxId, Self::Error>;

    async fn status(&self, tx_id: &TxId) -> Result<SettlementStatus, Self::Error>;

    async fn await_finality(&self, tx_id: &TxId) -> Result<SettlementStatus, Self::Error>;

    async fn estimate_fee(&self, tx: &Transaction<Verified>) -> Result<Amount, Self::Error>;
}