1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use ethers::types::{H256, TransactionReceipt};
use serde::Serialize;

// minimal types since they are pretty case specific


/// enum for success and failure
#[derive(Debug, Serialize, Clone)]
pub enum TxStatus {
    /// Transaction was successful and executed
    Successful(TransactionReceipt),
    /// Transaction failed in one way or another
    Failed(TxErrors),
}

/// enum for the 3 different types of failures
#[derive(Debug, Serialize, Clone)]
pub enum TxErrors {
    /// Transaction went through, but reciept is None
    NoReceipt(H256),
    /// Transaction reverted
    Reverted(TransactionReceipt),
    /// Transaction failed to send or mine
    Failed(String),
}