eigen_client_fireblocks/
transaction.rs

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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
use serde::{Deserialize, Serialize};

use crate::contract_call::{
    DestinationTransferPeerPath, ExtraParameters, TransactionOperation, TransferPeerPath,
};

#[derive(Debug, Serialize, Deserialize, Clone)]
#[serde(rename_all = "camelCase")]
pub struct TransactionRequest {
    #[serde(rename = "assetId")]
    pub asset_id: String,
    pub operation: TransactionOperation,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub external_tx_id: Option<String>,
    pub source: TransferPeerPath,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub destination: Option<DestinationTransferPeerPath>,
    pub amount: String,
    pub extra_parameters: Option<ExtraParameters>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub gas_price: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub gas_limit: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    replace_tx_by_hash: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub note: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(rename = "maxFee")]
    pub max_fee: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(rename = "priorityFee")]
    priority_fee: Option<String>,
}

impl TransactionRequest {
    #[allow(clippy::too_many_arguments)]
    pub fn new(
        operation: TransactionOperation,
        external_tx_id: Option<String>,
        asset_id: String,
        source: TransferPeerPath,
        destination: Option<DestinationTransferPeerPath>,
        amount: String,
        extra_parameters: Option<ExtraParameters>,
        replace_tx_by_hash: Option<String>,
        gas_price: Option<String>,
        gas_limit: Option<String>,
        note: Option<String>,
        max_fee: Option<String>,
        priority_fee: Option<String>,
    ) -> Self {
        Self {
            operation,
            external_tx_id,
            asset_id,
            source,
            destination,
            amount,
            extra_parameters,
            replace_tx_by_hash,
            gas_price,
            gas_limit,
            note,
            max_fee,
            priority_fee,
        }
    }
}

#[derive(Debug, Serialize, Deserialize)]
pub struct TransactionResponse {
    id: String,
    status: String,
}