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 /// **This parameter will become required for the [Create a new transaction endpoint](https://developers.fireblocks.com/reference/createtransaction) on March 1, 2026.** This parameter allows you to add a unique ID of your own to help prevent duplicate transactions. No specific format is required for this parameter. After you submit a transaction with an external ID, Fireblocks will automatically reject all future transactions with the same ID. Using an external ID primarily helps in situations where, even though a submitted transaction responds with an error due to an internet outage, the transaction was still sent to and processed on the blockchain. Use the [Get a specific transaction by external transaction ID](https://developers.fireblocks.com/reference/gettransactionbyexternalid) to validate whether these transactions have been processed.
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; used for `TRANSFER`, `MINT`, or `BURN` operations. See [the list of supported assets and their IDs](https://developers.fireblocks.com/reference/listassets).
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 paid 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 more 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.** Notes: - To replace a transaction,
80 /// create another transaction using the stuck transaction's hash and
81 /// specify a higher fee. - To drop a transaction, create another
82 /// transaction using the stuck transaction's hash and change the `amount`
83 /// field to 0.
84 #[serde(rename = "replaceTxByHash", skip_serializing_if = "Option::is_none")]
85 pub replace_tx_by_hash: Option<String>,
86 #[serde(rename = "extraParameters", skip_serializing_if = "Option::is_none")]
87 pub extra_parameters: Option<models::ExtraParameters>,
88 /// The ID for AML providers to associate the owner of funds with
89 /// transactions.
90 #[serde(rename = "customerRefId", skip_serializing_if = "Option::is_none")]
91 pub customer_ref_id: Option<String>,
92 #[serde(rename = "travelRuleMessage", skip_serializing_if = "Option::is_none")]
93 pub travel_rule_message: Option<models::TravelRuleCreateTransactionRequest>,
94 /// This feature is no longer supported.
95 #[serde(rename = "autoStaking", skip_serializing_if = "Option::is_none")]
96 pub auto_staking: Option<bool>,
97 #[serde(rename = "networkStaking", skip_serializing_if = "Option::is_none")]
98 pub network_staking: Option<models::TransactionRequestNetworkStaking>,
99 #[serde(rename = "cpuStaking", skip_serializing_if = "Option::is_none")]
100 pub cpu_staking: Option<models::TransactionRequestNetworkStaking>,
101 /// - Override the default gasless configuration by sending true\\false
102 #[serde(rename = "useGasless", skip_serializing_if = "Option::is_none")]
103 pub use_gasless: Option<bool>,
104}
105
106impl TransactionRequest {
107 pub fn new() -> TransactionRequest {
108 TransactionRequest {
109 operation: None,
110 note: None,
111 external_tx_id: None,
112 asset_id: None,
113 source: None,
114 destination: None,
115 destinations: None,
116 amount: None,
117 treat_as_gross_amount: None,
118 force_sweep: None,
119 fee_level: None,
120 fee: None,
121 priority_fee: None,
122 fail_on_low_fee: None,
123 max_fee: None,
124 gas_limit: None,
125 gas_price: None,
126 network_fee: None,
127 replace_tx_by_hash: None,
128 extra_parameters: None,
129 customer_ref_id: None,
130 travel_rule_message: None,
131 auto_staking: None,
132 network_staking: None,
133 cpu_staking: None,
134 use_gasless: None,
135 }
136 }
137}
138/// For UTXO or EVM-based blockchains only. Defines the blockchain fee level
139/// which will be payed for the transaction. Alternatively, specific fee
140/// estimation parameters exist below.
141#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
142pub enum FeeLevel {
143 #[serde(rename = "LOW")]
144 Low,
145 #[serde(rename = "MEDIUM")]
146 Medium,
147 #[serde(rename = "HIGH")]
148 High,
149}
150
151impl Default for FeeLevel {
152 fn default() -> FeeLevel {
153 Self::Low
154 }
155}