fireblocks_sdk/models/
transaction_request.rs

1// Fireblocks API
2//
3// Fireblocks provides a suite of applications to manage digital asset operations and a complete development platform to build your business on the blockchain.  - Visit our website for more information: [Fireblocks Website](https://fireblocks.com) - Visit our developer docs: [Fireblocks DevPortal](https://developers.fireblocks.com)
4//
5// The version of the OpenAPI document: 1.8.0
6// Contact: developers@fireblocks.com
7// Generated by: https://openapi-generator.tech
8
9use {
10    crate::models,
11    serde::{Deserialize, Serialize},
12};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct TransactionRequest {
16    #[serde(rename = "operation", skip_serializing_if = "Option::is_none")]
17    pub operation: Option<models::TransactionOperation>,
18    /// Custom note, not sent to the blockchain, to describe the transaction at
19    /// your Fireblocks workspace.
20    #[serde(rename = "note", skip_serializing_if = "Option::is_none")]
21    pub note: Option<String>,
22    /// An optional but highly recommended parameter. Fireblocks will reject future transactions with same ID.  You should set this to a unique ID representing the transaction, to avoid submitting the same transaction twice. This helps with cases where submitting the transaction responds with an error code due to Internet interruptions, but the transaction was actually sent and processed. To validate whether a transaction has been processed, [Find a specific transaction by external transaction ID](https://developers.fireblocks.com/reference/gettransactionbyexternalid). There is no specific format required for this parameter.
23    #[serde(rename = "externalTxId", skip_serializing_if = "Option::is_none")]
24    pub external_tx_id: Option<String>,
25    /// The ID of the asset to transfer, for `TRANSFER`, `MINT` or `BURN` operations. [See the list of supported assets and their IDs on Fireblocks.](https://developers.fireblocks.com/reference/getsupportedassets-1)
26    #[serde(rename = "assetId", skip_serializing_if = "Option::is_none")]
27    pub asset_id: Option<String>,
28    #[serde(rename = "source", skip_serializing_if = "Option::is_none")]
29    pub source: Option<models::SourceTransferPeerPath>,
30    #[serde(rename = "destination", skip_serializing_if = "Option::is_none")]
31    pub destination: Option<models::DestinationTransferPeerPath>,
32    /// For UTXO based blockchains, you can send a single transaction to
33    /// multiple destinations.
34    #[serde(rename = "destinations", skip_serializing_if = "Option::is_none")]
35    pub destinations: Option<Vec<models::TransactionRequestDestination>>,
36    #[serde(rename = "amount", skip_serializing_if = "Option::is_none")]
37    pub amount: Option<models::TransactionRequestAmount>,
38    /// \"When set to `true`, the fee will be deducted from the requested
39    /// amount.\"  **Note**: This parameter can only be considered if a
40    /// transaction’s asset is a base asset, such as ETH or MATIC. If the asset
41    /// can’t be used for transaction fees, like USDC, this parameter is ignored
42    /// and the fee is deducted from the relevant base asset wallet in the
43    /// source account.
44    #[serde(rename = "treatAsGrossAmount", skip_serializing_if = "Option::is_none")]
45    pub treat_as_gross_amount: Option<bool>,
46    /// For Polkadot, TON, Kusama and Westend transactions only. When set to
47    /// true, Fireblocks will empty the asset wallet.     **Note:** If set to
48    /// true when the source account is exactly 1 DOT, the transaction will
49    /// fail. Any amount more or less than 1 DOT succeeds. This is a Polkadot
50    /// blockchain limitation.
51    #[serde(rename = "forceSweep", skip_serializing_if = "Option::is_none")]
52    pub force_sweep: Option<bool>,
53    /// For UTXO or EVM-based blockchains only. Defines the blockchain fee level
54    /// which will be payed for the transaction. Alternatively, specific fee
55    /// estimation parameters exist below.
56    #[serde(rename = "feeLevel", skip_serializing_if = "Option::is_none")]
57    pub fee_level: Option<FeeLevel>,
58    #[serde(rename = "fee", skip_serializing_if = "Option::is_none")]
59    pub fee: Option<models::TransactionRequestFee>,
60    #[serde(rename = "priorityFee", skip_serializing_if = "Option::is_none")]
61    pub priority_fee: Option<models::TransactionRequestPriorityFee>,
62    /// When set to `true`, in case the current `MEDIUM` fee level is higher
63    /// than the one specified in the transaction, the transaction will fail to
64    /// avoid getting stuck with no confirmations.
65    #[serde(rename = "failOnLowFee", skip_serializing_if = "Option::is_none")]
66    pub fail_on_low_fee: Option<bool>,
67    /// The maximum fee (gas price or fee per byte) that should be payed for the
68    /// transaction.  In case the current value of the requested `feeLevel` is
69    /// higher than this requested maximum fee.  Represented by a numeric string
70    /// for accurate precision.
71    #[serde(rename = "maxFee", skip_serializing_if = "Option::is_none")]
72    pub max_fee: Option<String>,
73    #[serde(rename = "gasLimit", skip_serializing_if = "Option::is_none")]
74    pub gas_limit: Option<models::TransactionRequestGasLimit>,
75    #[serde(rename = "gasPrice", skip_serializing_if = "Option::is_none")]
76    pub gas_price: Option<models::TransactionRequestGasPrice>,
77    #[serde(rename = "networkFee", skip_serializing_if = "Option::is_none")]
78    pub network_fee: Option<models::TransactionRequestNetworkFee>,
79    /// For EVM-based blockchains only. In case a transaction is stuck, specify
80    /// the hash of the stuck transaction to replace it by this transaction with
81    /// a higher fee, or to replace it with this transaction with a zero fee and
82    /// drop it from the blockchain.
83    #[serde(rename = "replaceTxByHash", skip_serializing_if = "Option::is_none")]
84    pub replace_tx_by_hash: Option<String>,
85    #[serde(rename = "extraParameters", skip_serializing_if = "Option::is_none")]
86    pub extra_parameters: Option<models::ExtraParameters>,
87    /// The ID for AML providers to associate the owner of funds with
88    /// transactions.
89    #[serde(rename = "customerRefId", skip_serializing_if = "Option::is_none")]
90    pub customer_ref_id: Option<String>,
91    #[serde(rename = "travelRuleMessage", skip_serializing_if = "Option::is_none")]
92    pub travel_rule_message: Option<models::TravelRuleCreateTransactionRequest>,
93    /// This feature is no longer supported.
94    #[serde(rename = "autoStaking", skip_serializing_if = "Option::is_none")]
95    pub auto_staking: Option<bool>,
96    #[serde(rename = "networkStaking", skip_serializing_if = "Option::is_none")]
97    pub network_staking: Option<models::TransactionRequestNetworkStaking>,
98    #[serde(rename = "cpuStaking", skip_serializing_if = "Option::is_none")]
99    pub cpu_staking: Option<models::TransactionRequestNetworkStaking>,
100    /// - Override the default gasless configuration by sending true\\false
101    #[serde(rename = "useGasless", skip_serializing_if = "Option::is_none")]
102    pub use_gasless: Option<bool>,
103}
104
105impl TransactionRequest {
106    pub fn new() -> TransactionRequest {
107        TransactionRequest {
108            operation: None,
109            note: None,
110            external_tx_id: None,
111            asset_id: None,
112            source: None,
113            destination: None,
114            destinations: None,
115            amount: None,
116            treat_as_gross_amount: None,
117            force_sweep: None,
118            fee_level: None,
119            fee: None,
120            priority_fee: None,
121            fail_on_low_fee: None,
122            max_fee: None,
123            gas_limit: None,
124            gas_price: None,
125            network_fee: None,
126            replace_tx_by_hash: None,
127            extra_parameters: None,
128            customer_ref_id: None,
129            travel_rule_message: None,
130            auto_staking: None,
131            network_staking: None,
132            cpu_staking: None,
133            use_gasless: None,
134        }
135    }
136}
137/// For UTXO or EVM-based blockchains only. Defines the blockchain fee level
138/// which will be payed for the transaction. Alternatively, specific fee
139/// estimation parameters exist below.
140#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
141pub enum FeeLevel {
142    #[serde(rename = "LOW")]
143    Low,
144    #[serde(rename = "MEDIUM")]
145    Medium,
146    #[serde(rename = "HIGH")]
147    High,
148}
149
150impl Default for FeeLevel {
151    fn default() -> FeeLevel {
152        Self::Low
153    }
154}