Skip to main content

fireblocks_sdk/models/
transaction_response.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 TransactionResponse {
16    /// Fireblocks Transaction ID
17    pub id: String,
18    /// Unique external transaction identifier provided by the user. Used to
19    /// help prevent duplicate transactions.
20    #[serde(rename = "externalTxId", skip_serializing_if = "Option::is_none")]
21    pub external_tx_id: Option<String>,
22    pub status: models::TransactionStatus,
23    #[serde(rename = "subStatus", skip_serializing_if = "Option::is_none")]
24    pub sub_status: Option<models::TransactionSubStatus>,
25    /// The hash of the transaction on the blockchain.  * This parameter exists
26    /// if at least one of the following conditions is met:       1. The
27    /// transaction’s source type is `UNKNOWN`, `WHITELISTED_ADDRESS`,
28    /// `NETWORK_CONNECTION`, `ONE_TIME_ADDRESS`, `FIAT_ACCOUNT` or
29    /// `GAS_STATION`.       2. The transaction’s source type is `VAULT` and the
30    /// status is either: `CONFIRMING`, `COMPLETED`, or was in any of these
31    /// statuses prior to changing to `FAILED` or `REJECTED`. In some instances,
32    /// transactions in status `BROADCASTING` will include the txHash as well.
33    /// 3. The transaction’s source type is `EXCHANGE_ACCOUNT` and the
34    /// transaction’s destination type is `VAULT`, and the status is either:
35    /// `CONFIRMING`, `COMPLETED`, or was in any of these status prior to
36    /// changing to `FAILED`.   * In addition, the following conditions must be
37    /// met:      1. The asset is a crypto asset (not fiat).      2. The
38    /// transaction operation is not `RAW` or `TYPED_MESSAGE`.
39    #[serde(rename = "txHash", skip_serializing_if = "Option::is_none")]
40    pub tx_hash: Option<String>,
41    #[serde(rename = "operation", skip_serializing_if = "Option::is_none")]
42    pub operation: Option<models::GetTransactionOperation>,
43    /// Custom note, not sent to the blockchain, that describes the transaction
44    /// at your Fireblocks workspace.
45    #[serde(rename = "note", skip_serializing_if = "Option::is_none")]
46    pub note: Option<String>,
47    /// A JSON used to store additional blockchain-specific data.  **Example:**
48    /// In HBAR, this property will have the txHash in addition to the txID.
49    #[serde(rename = "blockchainInfo", skip_serializing_if = "Option::is_none")]
50    pub blockchain_info: Option<serde_json::Value>,
51    /// The ID of the asset for `TRANSFER`, `MINT`, `BURN`, `ENABLE_ASSET`,`STAKE` ,`UNSTAKE` or `WITHDRAW` operations. See the [list of supported assets and their IDs on Fireblocks](https://developers.fireblocks.com/reference/getsupportedassets).
52    #[serde(rename = "assetId", skip_serializing_if = "Option::is_none")]
53    pub asset_id: Option<String>,
54    /// Type classification of the asset
55    #[serde(rename = "assetType", skip_serializing_if = "Option::is_none")]
56    pub asset_type: Option<String>,
57    #[serde(rename = "source", skip_serializing_if = "Option::is_none")]
58    pub source: Option<models::SourceTransferPeerPathResponse>,
59    /// For account based assets only, the source address of the transaction.
60    /// **Note:** If the status is `CONFIRMING`, `COMPLETED`, or has been
61    /// `CONFIRMING`; then moved forward to `FAILED` or `REJECTED`, then this
62    /// parameter will contain the source address. In any other case, this
63    /// parameter will be empty.
64    #[serde(rename = "sourceAddress", skip_serializing_if = "Option::is_none")]
65    pub source_address: Option<String>,
66    /// Source address tag for Tag/Memo supporting assets, or Bank Transfer
67    /// Description for the fiat provider BLINC (by BCB Group).
68    #[serde(rename = "tag", skip_serializing_if = "Option::is_none")]
69    pub tag: Option<String>,
70    #[serde(rename = "destination", skip_serializing_if = "Option::is_none")]
71    pub destination: Option<models::DestinationTransferPeerPathResponse>,
72    /// The transaction’s destinations. **Note:** In case the transaction is
73    /// sent to a single destination, the `destination` parameter is used
74    /// instead of this.
75    #[serde(rename = "destinations", skip_serializing_if = "Option::is_none")]
76    pub destinations: Option<Vec<models::TransactionResponseDestination>>,
77    /// Address where the asset were transferred. Notes:   - For [Multi destination transactions](https://support.fireblocks.io/hc/en-us/articles/360018447980-Multi-destination-transactions), this parameter will be empty. In this case, you should refer to the destinations field.   - If the status is `CONFIRMING`, `COMPLETED`, or has been `CONFIRMING`; then moved forward to `FAILED` or `REJECTED`, then this parameter will contain the destination address. In any other case, this parameter will be empty.
78    #[serde(rename = "destinationAddress", skip_serializing_if = "Option::is_none")]
79    pub destination_address: Option<String>,
80    /// Description of the destination address.
81    #[serde(
82        rename = "destinationAddressDescription",
83        skip_serializing_if = "Option::is_none"
84    )]
85    pub destination_address_description: Option<String>,
86    /// Destination address tag for Tag/Memo supporting assets, or Bank Transfer
87    /// Description for the fiat provider BLINC (by BCB Group).
88    #[serde(rename = "destinationTag", skip_serializing_if = "Option::is_none")]
89    pub destination_tag: Option<String>,
90    #[serde(
91        rename = "contractCallDecodedData",
92        skip_serializing_if = "Option::is_none"
93    )]
94    pub contract_call_decoded_data: Option<models::TransactionResponseContractCallDecodedData>,
95    #[serde(rename = "amountInfo", skip_serializing_if = "Option::is_none")]
96    pub amount_info: Option<models::AmountInfo>,
97    /// For transactions initiated via this Fireblocks workspace, when set to
98    /// `true`, the fee is deducted from the requested amount.  **Note:** This
99    /// parameter can only be considered if a transaction's asset is a base
100    /// asset, such as ETH or MATIC. If the asset can't be used for transaction
101    /// fees, like USDC, this parameter is ignored and the fee is deducted from
102    /// the relevant base asset wallet in the source account.
103    #[serde(rename = "treatAsGrossAmount", skip_serializing_if = "Option::is_none")]
104    pub treat_as_gross_amount: Option<bool>,
105    #[serde(rename = "feeInfo", skip_serializing_if = "Option::is_none")]
106    pub fee_info: Option<models::FeeInfo>,
107    /// The asset which was withdrawn to pay the transaction fee, for example
108    /// ETH for EVM-based blockchains, BTC for Tether Omni.
109    #[serde(rename = "feeCurrency", skip_serializing_if = "Option::is_none")]
110    pub fee_currency: Option<String>,
111    /// In case a single transaction resulted with multiple transfers, for
112    /// example a result of a contract call, then this parameter specifies each
113    /// transfer that took place on the blockchain.
114    #[serde(rename = "networkRecords", skip_serializing_if = "Option::is_none")]
115    pub network_records: Option<Vec<models::NetworkRecord>>,
116    /// The transaction’s creation date and time, in unix timestamp.
117    #[serde(rename = "createdAt", skip_serializing_if = "Option::is_none")]
118    pub created_at: Option<f64>,
119    /// The transaction’s last update date and time, in unix timestamp.
120    #[serde(rename = "lastUpdated", skip_serializing_if = "Option::is_none")]
121    pub last_updated: Option<f64>,
122    /// User ID of the initiator of the transaction.
123    #[serde(rename = "createdBy", skip_serializing_if = "Option::is_none")]
124    pub created_by: Option<String>,
125    /// User ID’s of the signers of the transaction.
126    #[serde(rename = "signedBy", skip_serializing_if = "Option::is_none")]
127    pub signed_by: Option<Vec<String>>,
128    /// User ID of the user that rejected the transaction (in case it was
129    /// rejected).
130    #[serde(rename = "rejectedBy", skip_serializing_if = "Option::is_none")]
131    pub rejected_by: Option<String>,
132    #[serde(rename = "authorizationInfo", skip_serializing_if = "Option::is_none")]
133    pub authorization_info: Option<models::AuthorizationInfo>,
134    /// If the transaction originated from an exchange, this is the ID of this
135    /// transaction at the exchange.
136    #[serde(rename = "exchangeTxId", skip_serializing_if = "Option::is_none")]
137    pub exchange_tx_id: Option<String>,
138    /// The ID for AML providers to associate the owner of funds with
139    /// transactions.
140    #[serde(rename = "customerRefId", skip_serializing_if = "Option::is_none")]
141    pub customer_ref_id: Option<String>,
142    #[serde(rename = "amlScreeningResult", skip_serializing_if = "Option::is_none")]
143    pub aml_screening_result: Option<models::AmlScreeningResult>,
144    #[serde(rename = "complianceResult", skip_serializing_if = "Option::is_none")]
145    pub compliance_result: Option<models::ComplianceResult>,
146    /// Indicates the transaction was not broadcast by Fireblocks
147    #[serde(
148        rename = "notBroadcastByFireblocks",
149        skip_serializing_if = "Option::is_none"
150    )]
151    pub not_broadcast_by_fireblocks: Option<bool>,
152    /// dApp URL for Web3 transactions
153    #[serde(rename = "dappUrl", skip_serializing_if = "Option::is_none")]
154    pub dapp_url: Option<String>,
155    /// Gas limit for EVM-based blockchain transactions
156    #[serde(rename = "gasLimit", skip_serializing_if = "Option::is_none")]
157    pub gas_limit: Option<String>,
158    /// Blockchain-specific index or identifier for the transaction
159    #[serde(rename = "blockchainIndex", skip_serializing_if = "Option::is_none")]
160    pub blockchain_index: Option<String>,
161    /// Solana rent payment amount
162    #[serde(rename = "paidRent", skip_serializing_if = "Option::is_none")]
163    pub paid_rent: Option<String>,
164    #[serde(rename = "extraParameters", skip_serializing_if = "Option::is_none")]
165    pub extra_parameters: Option<models::ExtraParameters>,
166    /// An array of signed messages
167    #[serde(rename = "signedMessages", skip_serializing_if = "Option::is_none")]
168    pub signed_messages: Option<Vec<models::SignedMessage>>,
169    /// The number of confirmations of the transaction. The number will increase
170    /// until the transaction will be considered completed according to the
171    /// confirmation policy.
172    #[serde(rename = "numOfConfirmations", skip_serializing_if = "Option::is_none")]
173    pub num_of_confirmations: Option<f64>,
174    #[serde(rename = "blockInfo", skip_serializing_if = "Option::is_none")]
175    pub block_info: Option<models::BlockInfo>,
176    /// For UTXO based assets this is the vOut, for Ethereum based, this is the
177    /// index of the event of the contract call.  **Note:** This field is not
178    /// returned if a transaction uses the `destinations` object with more than
179    /// one value.
180    #[serde(rename = "index", skip_serializing_if = "Option::is_none")]
181    pub index: Option<f64>,
182    #[serde(rename = "rewardInfo", skip_serializing_if = "Option::is_none")]
183    pub reward_info: Option<models::RewardInfo>,
184    #[serde(rename = "feePayerInfo", skip_serializing_if = "Option::is_none")]
185    pub fee_payer_info: Option<models::FeePayerInfo>,
186    #[serde(rename = "systemMessages", skip_serializing_if = "Option::is_none")]
187    pub system_messages: Option<models::SystemMessageInfo>,
188    #[serde(rename = "addressType", skip_serializing_if = "Option::is_none")]
189    pub address_type: Option<AddressType>,
190    /// The amount requested by the user. Deprecated - please use the
191    /// `amountInfo` field for accuracy.
192    #[serde(rename = "requestedAmount", skip_serializing_if = "Option::is_none")]
193    pub requested_amount: Option<f64>,
194    /// If the transfer is a withdrawal from an exchange, the actual amount that
195    /// was requested to be transferred. Otherwise, the requested amount.
196    /// Deprecated - please use the `amountInfo` field for accuracy.
197    #[serde(rename = "amount", skip_serializing_if = "Option::is_none")]
198    pub amount: Option<f64>,
199    /// The net amount of the transaction, after fee deduction. Deprecated -
200    /// please use the `amountInfo` field for accuracy.
201    #[serde(rename = "netAmount", skip_serializing_if = "Option::is_none")]
202    pub net_amount: Option<f64>,
203    /// The USD value of the requested amount. Deprecated - please use the
204    /// `amountInfo` field for accuracy.
205    #[serde(
206        rename = "amountUSD",
207        default,
208        with = "::serde_with::rust::double_option",
209        skip_serializing_if = "Option::is_none"
210    )]
211    pub amount_usd: Option<Option<f64>>,
212    /// The total fee deducted by the exchange from the actual requested amount
213    /// (`serviceFee` = `amount` - `netAmount`). Deprecated - please use the
214    /// `feeInfo` field for accuracy.
215    #[serde(rename = "serviceFee", skip_serializing_if = "Option::is_none")]
216    pub service_fee: Option<f64>,
217    /// Deprecated - please use the `feeInfo` field for accuracy.
218    #[serde(rename = "fee", skip_serializing_if = "Option::is_none")]
219    pub fee: Option<f64>,
220    /// The fee paid to the network. Deprecated - please use the `feeInfo` field
221    /// for accuracy.
222    #[serde(rename = "networkFee", skip_serializing_if = "Option::is_none")]
223    pub network_fee: Option<f64>,
224    /// The transaction's revert reason. This field will be returned when
225    /// `subStatus` =  'SMART_CONTRACT_EXECUTION_FAILED'.
226    #[serde(rename = "errorDescription", skip_serializing_if = "Option::is_none")]
227    pub error_description: Option<String>,
228    /// If the transaction is a Replace-By-Fee (RBF) transaction, this is the
229    /// hash of the transaction that was replaced.
230    #[serde(rename = "replacedTxByHash", skip_serializing_if = "Option::is_none")]
231    pub replaced_tx_by_hash: Option<String>,
232    /// Blockchain nonce for the transaction
233    #[serde(rename = "nonce", skip_serializing_if = "Option::is_none")]
234    pub nonce: Option<String>,
235}
236
237impl TransactionResponse {
238    pub fn new() -> TransactionResponse {
239        TransactionResponse {
240            id: String::new(),
241            external_tx_id: None,
242            status: models::TransactionStatus::Submitted,
243            sub_status: None,
244            tx_hash: None,
245            operation: None,
246            note: None,
247            blockchain_info: None,
248            asset_id: None,
249            asset_type: None,
250            source: None,
251            source_address: None,
252            tag: None,
253            destination: None,
254            destinations: None,
255            destination_address: None,
256            destination_address_description: None,
257            destination_tag: None,
258            contract_call_decoded_data: None,
259            amount_info: None,
260            treat_as_gross_amount: None,
261            fee_info: None,
262            fee_currency: None,
263            network_records: None,
264            created_at: None,
265            last_updated: None,
266            created_by: None,
267            signed_by: None,
268            rejected_by: None,
269            authorization_info: None,
270            exchange_tx_id: None,
271            customer_ref_id: None,
272            aml_screening_result: None,
273            compliance_result: None,
274            not_broadcast_by_fireblocks: None,
275            dapp_url: None,
276            gas_limit: None,
277            blockchain_index: None,
278            paid_rent: None,
279            extra_parameters: None,
280            signed_messages: None,
281            num_of_confirmations: None,
282            block_info: None,
283            index: None,
284            reward_info: None,
285            fee_payer_info: None,
286            system_messages: None,
287            address_type: None,
288            requested_amount: None,
289            amount: None,
290            net_amount: None,
291            amount_usd: None,
292            service_fee: None,
293            fee: None,
294            network_fee: None,
295            error_description: None,
296            replaced_tx_by_hash: None,
297            nonce: None,
298        }
299    }
300}
301///
302#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
303pub enum AddressType {
304    #[serde(rename = "")]
305    Empty,
306    #[serde(rename = "WHITELISTED")]
307    Whitelisted,
308    #[serde(rename = "ONE_TIME")]
309    OneTime,
310}
311
312impl Default for AddressType {
313    fn default() -> AddressType {
314        Self::Empty
315    }
316}