fireblocks_sdk/models/
unsigned_message.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 UnsignedMessage {
16    #[serde(rename = "preHash", skip_serializing_if = "Option::is_none")]
17    pub pre_hash: Option<models::PreHash>,
18    /// Content to sign on. - EIP-191: Requires a 32 byte-long string for ECDSA
19    /// (hash of the actual message to sign) or any length for EdDSA, as
20    /// prehashing is not required. - EIP-712: Requires an object specifying the
21    /// structured data format, including `types`, `domain`, `primaryType`, and
22    /// `message`.
23    #[serde(rename = "content")]
24    pub content: String,
25    /// BIP44 address index
26    #[serde(rename = "bip44addressIndex", skip_serializing_if = "Option::is_none")]
27    pub bip44address_index: Option<i32>,
28    /// BIP44 change index
29    #[serde(rename = "bip44change", skip_serializing_if = "Option::is_none")]
30    pub bip44change: Option<f64>,
31    /// BIP44 full derivation path
32    #[serde(rename = "derivationPath", skip_serializing_if = "Option::is_none")]
33    pub derivation_path: Option<Vec<f64>>,
34    /// Typed Message Signing - message type.  - EIP191 & EIP712: for ETH and
35    /// all EVM based assets typed message signing - TIP191: For Tron (TRX)
36    /// typed message signing - BTC_MESSAGE: For Bitcoin (BTC) typed message
37    /// signing
38    #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
39    pub r#type: Option<Type>,
40}
41
42impl UnsignedMessage {
43    pub fn new(content: String) -> UnsignedMessage {
44        UnsignedMessage {
45            pre_hash: None,
46            content,
47            bip44address_index: None,
48            bip44change: None,
49            derivation_path: None,
50            r#type: None,
51        }
52    }
53}
54/// Typed Message Signing - message type.  - EIP191 & EIP712: for ETH and all
55/// EVM based assets typed message signing - TIP191: For Tron (TRX) typed
56/// message signing - BTC_MESSAGE: For Bitcoin (BTC) typed message signing
57#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
58pub enum Type {
59    #[serde(rename = "EIP191")]
60    Eip191,
61    #[serde(rename = "EIP712")]
62    Eip712,
63    #[serde(rename = "TIP191")]
64    Tip191,
65    #[serde(rename = "BTC_MESSAGE")]
66    BtcMessage,
67}
68
69impl Default for Type {
70    fn default() -> Type {
71        Self::Eip191
72    }
73}